query
stringlengths 7
6.41k
| document
stringlengths 12
28.8k
| metadata
dict | negatives
listlengths 30
30
| negative_scores
listlengths 30
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Swktch on / off marking on the current file or directory. | def toggle_mark
main.toggle_mark current_item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark!\n\t\t\t\t@marked = true\n\t\t\tend",
"def edl_mark \n send_cmd(\"edl_mark\")\n end",
"def flags; changeset.flags(@path); end",
"def toggle\n if on?\n off\n else\n on\n end\n end",
"def switch_flag\n\t\t@flag = !@flag\n\tend",
"def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end",
"def mark; end",
"def toggle_state\n puts \"******* toggle_state *******\"\n end",
"def markSyncOperations\n #N Without this, the sync operations won't be marked\n @sourceContent.markSyncOperationsForDestination(@destinationContent)\n #N Without these puts statements, the user won't receive feedback about what sync operations (i.e. copies and deletes) are marked for execution\n puts \" ================================================ \"\n puts \"After marking for sync --\"\n puts \"\"\n puts \"Local:\"\n #N Without this, the user won't see what local files and directories are marked for copying (i.e. upload)\n @sourceContent.showIndented()\n puts \"\"\n puts \"Remote:\"\n #N Without this, the user won't see what remote files and directories are marked for deleting\n @destinationContent.showIndented()\n end",
"def toggle!\n\t\tif self.can_mark_complete?\n\t\t\tself.mark_complete!\n\t\telsif self.can_re_open?\n\t\t\tself.re_open!\n\t\tend\n\tend",
"def turn_on!\n @turned_off = false\n end",
"def switch_light_off\n puts \"*** switch_light_off\"\n true\nend",
"def mark!(force = false)\n if force or changing?\n mark.blank? ? self.mark = Mark.new(:changed_at => Time.now) : self.mark.changed_at = Time.now\n self.mark.save\n end\n end",
"def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end",
"def turn_on()\n 'Turn on the #{model}<br>' \\\n 'If the thermocycler is off, toggle the power switch in the back of the instrument'\n end",
"def off?; !self.on?; end",
"def toggle\n toggle_icon_display\n restart_finder\n icons_showing?\n end",
"def force_current\n @current = true\n end",
"def faint\n self.fainted = true\n end",
"def toggle_on(outlet = 1)\n toggle(outlet, true)\n end",
"def flag\n @flagged != @flagged = true unless @revealed\n end",
"def reset_marks(path, lines_added=[], lines_changed=[])\n [ [:added, lines_added],\n [:changed, lines_changed],\n ].each do |k, lines|\n mark = \"#{ENV[\"TM_BUNDLE_SUPPORT\"]}/#{k}.pdf\"\n mate = ENV[\"TM_MATE\"]\n cmd = mate ? [mate] : %w[ echo mate ] # if invoked from outside textmate (without TM_MATE set) just print what it would run, instead\n cmd << \"--clear-mark=#{mark}\"\n cmd.concat [\"--set-mark=#{mark}\", *lines.map{|n| \"--line=#{n}\" }] unless lines.empty?\n cmd << path\n system *cmd\n end\nend",
"def undo\n fan.off\n end",
"def toggle\n set_switch(!self.switch) if @switch\n end",
"def unmark!\n @session.chanserv.mark(self.name, :off)\n end",
"def movetalk()\n merge(movetalk: 'true')\n end",
"def toggle_selection_mode\n if @mode == 'SEL'\n unselect_all\n @mode = nil\n message 'Selection mode is single. '\n else\n @mode = 'SEL'\n message 'Typing a hint selects the file. Typing again will clear . '\n end\nend",
"def markToDelete\n #N Without this we won't remember that this file is to be deleted\n @toBeDeleted = true\n end",
"def visit\n @mark = true\n end",
"def onCmdFlat(sender, sel, ptr)\n bctrl :flat, :buy, :short, :flip\n @watcher.cmdGoFlat\n end"
]
| [
"0.57452375",
"0.56885517",
"0.5654512",
"0.5560023",
"0.55504096",
"0.5456111",
"0.54291165",
"0.540916",
"0.53911823",
"0.5383848",
"0.5345398",
"0.53184044",
"0.5282469",
"0.5273503",
"0.5237769",
"0.5228008",
"0.5194415",
"0.51476866",
"0.5141669",
"0.51280946",
"0.51065254",
"0.50951695",
"0.50823975",
"0.5052993",
"0.5013568",
"0.5012529",
"0.49913675",
"0.49851868",
"0.49847314",
"0.49842674"
]
| 0.5859266 | 0 |
Accept user input, and directly execute it as a Ruby method call to the controller. ==== Parameters +preset_command+ A command that would be displayed at the command line before user input. +default_argument+ A default argument for the command. | def process_command_line(preset_command: nil, default_argument: nil)
prompt = preset_command ? ":#{preset_command} " : ':'
command_line.set_prompt prompt
cmd, *args = command_line.get_command(prompt: prompt, default: default_argument).split(' ')
if cmd && !cmd.empty? && respond_to?(cmd)
ret = self.public_send cmd, *args
clear_command_line
ret
end
rescue Interrupt
clear_command_line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(raw_input)\n clean_input, verbosity = sanitize_input raw_input\n\n if clean_input.length > 0\n command = find_command(clean_input) || @modes.current_mode.dynamic_command(clean_input) || @modes.global_mode.command_not_found\n user_args = extract_user_args command, clean_input\n command_ctx = build_context(command, user_args, verbosity)\n args = resolve_args(command, command_ctx)\n\n command.method.call(*args)\n end\n end",
"def default(*options, &block)\n if options.size == 1 && options.first.is_a?(Symbol) && !block_given?\n command :__default => options.first\n else\n command :__default, *options, &block\n end\n end",
"def run_built_in(command)\n _, command, *args = command.strip.split(/\\s+/)\n case command\n when 'user' then user_command(args)\n when 'reset' then reset_command(args)\n when 'version' then version_command(args)\n when 'help' then help_command(args)\n else '-> usage: v user|reset|version|help'\n end\n end",
"def command_processor(user_input)\r\n case user_input.downcase\r\n when \"help\"\r\n list_available_commands\r\n when \"create\"\r\n ui_create_event\r\n when \"view-day\"\r\n ui_view_by_day\r\n when \"view-month\"\r\n ui_view_by_month\r\n when \"delete\"\r\n ui_delete_event\r\n when \"modify\"\r\n ui_modify_event\r\n else\r\n puts \"#{user_input} is not a command. type 'help' to see a list of commands\"\r\n end\r\nend",
"def run(songs) # I thought we were supposed to call this bit 'runner'?\n puts \"Welcome to my Jukebox!\\n\\n Please enter a command:\\n\\n Help, List, Play, or Exit\\n\\n\"\n help\n command = gets.strip.to_s\n case command # I originally used if-else\n when \"help\"\n help\n when \"list\"\n list(songs)\n when \"play\"\n play(songs) # runs play songs method\n when \"exit\" # or use unless\n exit_jukebox\n # else\n # puts \"Erroneous Command\"\n # exit_jukebox\n end\nend",
"def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend",
"def deliver(default = nil)\n # Design decision: the pre-prompt behavior\n # gets evaluated *once*, not every time the\n # user gets prompted. This prevents multiple\n # evaluations when bad options are provided.\n _eval_pre if @pre\n\n valid_option_chosen = false\n until valid_option_chosen\n response = messenger.prompt(@prompt_text, default)\n if validate(response)\n valid_option_chosen = true\n @answer = evaluate_behaviors(response)\n _eval_post if @post\n else\n messenger.error(@last_error_message)\n end\n end\n end",
"def method_missing(command_name, input = nil, &block)\n action = nil\n options_def = ''\n\n unless block.nil?\n action = block\n options_def = input\n\n if !options_def.nil? && !options_def.instance_of?(String)\n raise 'Invalid options'\n end\n end\n\n if input.instance_of? Consoler::Application\n action = input\n options_def = ''\n end\n\n if action.nil?\n raise 'Invalid subapp/block'\n end\n\n command = command_name.to_s\n\n _add_command(command, options_def, action)\n\n nil\n end",
"def run!\n if self.class.commands.include?(@command)\n run_command\n elsif @command.nil?\n puts \"Command required\"\n puts @parser\n exit 1\n else\n abort \"Unknown command: #{@command}. Use one of #{self.class.commands.join(', ')}\"\n end\n end",
"def process_command\n # Make sure we are running from the correct directory\n puts \"Running from .. \" + Dir.pwd if $DEBUG\n\n # determing which action and forward accordingly\n method = \"cmd_\" + @arguments.shift\n if !respond_to? method\n puts \"do not have `#{method}' in my reportoire ..\"\n output_usage\n end\n send(method, *@arguments)\n rescue ArgumentError\n output_usage\n end",
"def launch!\n\t\tintroduction\n\n\t\tresult = nil\n\t\tuntil result == :quit\n\t\t\tprint \"> Choose one of these options: List, Sort, Find or Add.\\n\\n\"\n\t\t\tuser_response = gets.chomp\n\t\t\tresult = do_action(user_response)\n\t\tend\n\t\tconclusion\n\tend",
"def prompt(text, args, options = {}, &block)\n key = options[:key]\n default = options[:default] || ''\n if key\n arg = args[key]\n if arg && yield(arg)\n print \"#{text}: #{arg}\\n\"\n STDOUT.flush\n return\n end\n end\n while true\n print \"#{text} [#{default}]: \"\n STDOUT.flush\n value = STDIN.gets.chomp!\n value = default if value.blank?\n break if yield value\n end\n end",
"def default_command(command)\n @@default_command = command.to_sym\n end",
"def run(*args)\n print_help_and_exit if args.first == \"-?\"\n directive = args.first || \"default\"\n command = command_for(directive)\n \n if command.is_a?(Array)\n exec_multiple_directives directive, command\n else\n exec_directive directive, command\n end\n end",
"def exec_command_or_do(command, from, &block)\n return if self.exec_command(command, from)\n\n unless block.nil?\n @log.info \"Executing default action\"\n block.call(command, from)\n end\n end",
"def run\n \n if parsed_options?\n \n process_command\n end\n \n end",
"def original_run_command=(_arg0); end",
"def run_cmd(input); end",
"def test_method\n prompt('test method')\nend",
"def run(input, options = {})\n command = Command.new(options: options)\n yield(command) if block_given?\n command.run(input)\n end",
"def provide_user_option \r\n @user_choice = user_input \"\\nWhat would you like to do?\\nPress 1 to pick a file and play normally\\nPress 2 to play file in reverse\\nPress 3 if you'd like to exit\\n\"\r\nend",
"def read_user_input(message, default = \"\", show_input = true)\n print interpolate_message(message, default)\n show_input ? gets : silent_command { gets }\n ($_.chomp.empty?) ? default.chomp : $_.chomp\n end",
"def call(input = nil)\n default_settings = self.default_settings\n\n runner =\n if default_settings\n self.runner.new(self, default_settings)\n else\n self.runner.new(self)\n end\n\n if around\n around.call(runner, input)\n else\n runner.call(input)\n end\n end",
"def menu\n\n puts \"~~~~~~~~Best Calculator EVER!~~~~~~~~\"\n puts \"Choose Function\"\n print \"(b)asic, (a)dvanced or (q)uit: \"\n option_1 = gets.chomp.downcase\n\n if option_1 == \"b\"\n basic_calc\n elsif option_1 == \"a\"\n advanced_calc\n else \n \"q\"\n \n end\nend",
"def process_command(user, command, args, params = nil)\n command = command.to_sym\n if actions.include?(command)\n @current_user = user\n @params = paramify(args)\n puts \"-> #{self.class}.#{command}\"\n self.instance_exec &actions[command.to_sym]\n else\n raise \"Class #{self.class} does not have an action named #{command}\"\n end\n end",
"def run_action_requiring_special_handling(command: nil, parameter_map: nil, action_return_type: nil)\n action_return = nil\n closure_argument_value = nil # only used if the action uses it\n\n case command.method_name\n when \"sh\"\n error_callback = proc { |string_value| closure_argument_value = string_value } if parameter_map[:error_callback]\n command_param = parameter_map[:command]\n log_param = parameter_map[:log]\n action_return = Fastlane::FastFile.sh(command_param, log: log_param, error_callback: error_callback)\n end\n\n command_return = ActionCommandReturn.new(\n return_value: action_return,\n return_value_type: action_return_type,\n closure_argument_value: closure_argument_value\n )\n\n return command_return\n end",
"def process(input)\n full_input = input\n args = input.split(\" \")\n\n case args[0]\n when \"quit\"\n bye()\n when \"help\"\n displayHelp()\n when \"modules\"\n printModules()\n when \"use\"\n options = get_options(args[1])\n if options == false \n puts \"Wrong module\"\n elsif args[1] == \"http_module\"\n http_fuzz()\n else\n setup_module(args[1], options)\n end\n else\n puts \"Wrong options\"\n displayHelp()\n end\n\nend",
"def prompt(caller = nil)\n case caller\n when \"list\"\n puts \"please select by number\"\n # when \"select\"\n # puts \"\"\n else\n COMMANDS.each_with_index{|command, index| puts index.to_s + \".\" + command}\n end\n @command = gets.chomp\n execute(@command)\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 input(applied_action_as_symbol_or_string = :inspect)\r\n gets.send(applied_action_as_symbol_or_string)\r\nend"
]
| [
"0.5753752",
"0.5311514",
"0.52760154",
"0.5255442",
"0.5209559",
"0.52045923",
"0.5193481",
"0.5190856",
"0.512851",
"0.5098161",
"0.5068501",
"0.50610435",
"0.505512",
"0.5027248",
"0.50228804",
"0.49825186",
"0.49575496",
"0.4947826",
"0.49460825",
"0.49459407",
"0.49411976",
"0.49376097",
"0.4926475",
"0.49211422",
"0.49207547",
"0.49181768",
"0.49088308",
"0.49052078",
"0.48635128",
"0.48542598"
]
| 0.80562204 | 0 |
convert angle into radian | def to_rad(angle)
angle * Math::PI / 180
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def rad2rad(rad)\r\n remt(rad, PI2)\r\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend",
"def deg2rad\n self * (Math::PI/180)\n end",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def sec_to_rad(x)\n x*Math::PI/(180*3600)\n end",
"def angle\n rad / Math::PI * 180\n end",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def g2r(n)\n\tn*(Math::PI/180)\nend",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end",
"def to_rad(n_decimals = nil)\n include Math unless defined?(Math)\n radians = self * PI / 180.0\n return radians if n_decimals.nil?\n radians.round(n_decimals)\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def conv_degree_to_radian(aNum)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n return (aNum * Degree_to_radian_mult)\r\nend",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def radians\n self * 180 / Math::PI\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end"
]
| [
"0.8188487",
"0.81217587",
"0.80756223",
"0.79066086",
"0.7888177",
"0.7733667",
"0.7690215",
"0.7642279",
"0.7455517",
"0.7417873",
"0.7374782",
"0.73061264",
"0.72938514",
"0.72599244",
"0.70856446",
"0.70856446",
"0.70626193",
"0.7046213",
"0.7024125",
"0.70218194",
"0.70045155",
"0.69863516",
"0.69357276",
"0.69357276",
"0.69244105",
"0.6911483",
"0.6907112",
"0.68460685",
"0.6820203",
"0.6765304"
]
| 0.842279 | 0 |
GET /rows/1 GET /rows/1.xml | def show
@row = Row.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @row }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def show\n @datashows = Datashow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @datashows }\n end\n end",
"def rows\n render 'rows.html'\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end",
"def fetch_row\n @screen = session.active_screen\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end",
"def show\n @task_row = TaskRow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task_row }\n end\n end",
"def row\n get_row\n respond_to_action(:row)\n end",
"def index\n @rows = Row.all\n end",
"def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end",
"def index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end",
"def rows\n @rows\n end",
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clientes }\n end\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"def index\n @users = User.all\n render :xml => @users\n end",
"def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lieus }\n end\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @rowempls = Rowempl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rowempls }\n end\n end",
"def rows()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rows::RowsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend"
]
| [
"0.6468013",
"0.58220077",
"0.5796088",
"0.57727957",
"0.5766898",
"0.5766898",
"0.5700217",
"0.5696157",
"0.5677216",
"0.5623952",
"0.56088895",
"0.5596446",
"0.5593269",
"0.5592369",
"0.55885434",
"0.55766624",
"0.5574343",
"0.5570168",
"0.5565081",
"0.5565081",
"0.556031",
"0.5538186",
"0.5533417",
"0.55328786",
"0.55150986",
"0.54954654",
"0.5494462",
"0.549156",
"0.548688",
"0.5483611"
]
| 0.62354 | 1 |
Serves predictions for the buyers | def predictions
raise "Err"
buyer_suggestions = PropertyBuyer.suggest_buyers(params[:str]).select([:id, :name, :image_url]).limit(20)
render json: buyer_suggestions, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict\n\t\t@bio = Bio.where(:user_id => current_user.id).last \n\n\t\t# Game_date and @players transformed to JSON and send to API in order to fetch player predictions\n\t\t@game_date = params[:game_date]\n\t\t@players = params[:players] \n\n\t\t# API Returns player predictions\n\t\t\t#first look in database, and if predictions already exist, pull from here\n\t\t\t#else get request to API, and API returns predictions\n\n\t\t# Temp fake data is returned instead // modify this to store into database instead of this weird Array/Url string voodoo\n\t\t@array = Array.new\n\t\t8.times do\n\t\t @array.push Faker::Name.name\n\t\tend\n\n\t\trender(\"sports/predict/\", :notice => \"Successfully fetched player predictions from API.\")\n\t\t\n\tend",
"def predict_all\r\n @recommendations = Professional.all.map do |professional|\r\n Recommender.new(professional).recommend\r\n end\r\n true\r\n end",
"def predictions\n @predictions ||= Prediction.predict_for(self)\n end",
"def test_predict\n data = Disco.load_movielens\n recommender = Disco::Recommender.new(factors: 20)\n recommender.fit(data)\n assert_kind_of Array, recommender.predict(data.first(5))\n end",
"def index\n @predictions = Prediction.all\n end",
"def get_test_set_data\n\t\treturn @predictions\n\tend",
"def predict()\n self.extend(Prediction)\n end",
"def fit_predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end",
"def predict(predictive_users, movie_id, user_id)\n score = 0.0\n total = 0.0\n tally = 0.0\n predictive_users.each do |user|\n score = rating(user, movie_id).to_i #Takes the average score of users in the predictive \n #array and sets that to the prediction. \n if score != 0\n total += score\n tally += 1\n end\n end\n \n base_prediction = (total / tally).to_f\n prediction = prediction_modifiers(base_prediction, movie_id, user_id)\n return prediction\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n liked_by_set = Recommendations::Helpers::RedisKeyMapper.liked_by_set_for(klass, item_id)\n similarity_sum = 0.0\n\n # Get sum of similarities of each item in set\n similarity_sum = similarity_total_for(user_id, liked_by_set)\n\n liked_by_count = Recommendations.redis.pipelined do\n Recommendations.redis.scard(liked_by_set)\n end\n prediction = similarity_sum / (liked_count).to_f\n prediction.finite ? prediction : 0.0\n end",
"def predict_rating(user,film)\r\n f_amount=SVD_param.find_by_name(@f_amoun_str).value.to_i\r\n\r\n mu=SVD_param.find_by_name(@global_predictor_str).value\r\n user_prd=user.base_predictor\r\n film_prd=film.base_predictor\r\n\r\n baseline=mu+user_prd+film_prd\r\n\r\n user_f_vect=create_user_factor_vector(user.id)\r\n film_f_vect=create_film_factor_vector(film.id)\r\n\r\n prediction=baseline + multiply_vectors(\r\n film_f_vect,\r\n user_f_vect\r\n )\r\n return prediction\r\n end",
"def payment_predictions\n @results = Project.payment_prediction_results(@account, params, @start_date, @end_date)\n @totals = Project.payment_prediction_totals(@account, params, @start_date, @end_date)\n end",
"def index\n @prediction = Prediction.all\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n gemd_by_set = Recommendable::Helpers::RedisKeyMapper.gemd_by_set_for(klass, item_id)\n disgemd_by_set = Recommendable::Helpers::RedisKeyMapper.disgemd_by_set_for(klass, item_id)\n similarity_sum = 0.0\n\n similarity_sum += Recommendable.redis.smembers(gemd_by_set).inject(0) do |memo, id|\n memo += Recommendable.redis.zscore(similarity_set, id).to_f\n end\n\n similarity_sum += Recommendable.redis.smembers(disgemd_by_set).inject(0) do |memo, id|\n memo -= Recommendable.redis.zscore(similarity_set, id).to_f\n end\n\n gemd_by_count = Recommendable.redis.scard(gemd_by_set)\n disgemd_by_count = Recommendable.redis.scard(disgemd_by_set)\n prediction = similarity_sum / (gemd_by_count + disgemd_by_count).to_f\n prediction.finite? ? prediction : 0.0\n end",
"def predict(object)\n liked_by, disliked_by = object.send :create_recommendable_sets\n rated_by = Recommendable.redis.scard(liked_by) + Recommendable.redis.scard(disliked_by)\n similarity_sum = 0.0\n prediction = 0.0\n \n Recommendable.redis.smembers(liked_by).inject(similarity_sum) {|sum, r| sum += Recommendable.redis.zscore(similarity_set, r).to_f }\n Recommendable.redis.smembers(disliked_by).inject(similarity_sum) {|sum, r| sum -= Recommendable.redis.zscore(similarity_set, r).to_f }\n \n prediction = similarity_sum / rated_by.to_f\n \n object.send :destroy_recommendable_sets\n \n return prediction\n end",
"def predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end",
"def predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n Recommendable.set_shard_key user_id\n liked_by_set = Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(klass, item_id)\n disliked_by_set = Recommendable::Helpers::RedisKeyMapper.disliked_by_set_for(klass, item_id)\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n similarity_sum = 0.0\n\n similarity_sum += Recommendable.redis.eval(similarity_total_for_lua, keys: [liked_by_set, similarity_set]).to_f\n similarity_sum -= Recommendable.redis.eval(similarity_total_for_lua, keys: [disliked_by_set, similarity_set]).to_f\n\n liked_by_count, disliked_by_count = Recommendable.redis.pipelined do\n Recommendable.redis.scard(liked_by_set)\n Recommendable.redis.scard(disliked_by_set)\n end\n prediction = similarity_sum / (liked_by_count + disliked_by_count).to_f\n prediction.finite? ? prediction : 0.0\n end",
"def predict!(current_diff)\n prediction_strategies.flat_map { |strategy| strategy.call(current_diff, map) }\n end",
"def prediction_data(user_id, movie_id)\n if user_id != @user_marker\n @best_match.clear\n most_similar(user_id) #will return the top 20 best matched viewers.\n @user_marker = user_id\n end\n\n matched_movies = viewers(movie_id) #list of all users who saw the movie\n if matched_movies == 0\n prediction = 1\n return prediction\n end\n predictive_users = (@best_match & matched_movies) #sets our predictive data to be the subset \n # of best_match that has also seen this movie\n \n my_prediction = MoviePredictor.new(@user_hash, @movie_hash)\n \n if predictive_users.empty? \n return my_prediction.rating_average(movie_id)\n end\n \n return my_prediction.predict(predictive_users, movie_id, user_id)\n end",
"def run_test\n for i in 0..@count-1\n @predictions << Prediction.new(@test_set[i].user_id,@test_set[i].movie_id, @test_set[i].rating,@database.predict(@test_set[i].user_id, @test_set[i].movie_id))\n end\n end",
"def initialize \n\t\t@predictions = []\n\tend",
"def predict(user, movie)\n\n popularity = @popularityMap[movie].to_i\n \n feature = [popularity]\n linearRegressionModel = user_predictMap[user]\n \n predictRating = linearRegressionModel.predict(feature)\n\n #if there is no enough data to make the predict, then we will take the average rating\n # of the given user\n if predictRating.nan?\n return @avgRatingMap[user].to_i\n end\n if predictRating >= 1 && predictRating<= 5\n if predictRating*10%10 >= 5\n return predictRating.ceil\n else \n return predictRating.floor\n end\n else \n if predictRating > 5\n return 5\n else\n return 1\n end\n end\n end",
"def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'emotion_prediction_id'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :headers => {'Content-Type' => 'application/json'},\n :body_object => training\n )\n\n assemble_json_body(result)\n end",
"def predict(comment)\n input = @prediction.trainedmodels.predict.request_schema.new\n input.input = {}\n input.input.csv_instance = comment\n\n result = @client.execute(\n :api_method => @prediction.trainedmodels.predict,\n :parameters => {'id' => 'emotion_prediction_id'},\n :headers => {'Content-Type' => 'application/json'},\n :body_object => input\n )\n\n assemble_json_body(result)\n end",
"def show_prediction_by_postcode\n params = location_params\n @cur_date = {:date => Time.now.strftime(\"%d-%m-%Y\")}\n postcode = Postcode.find_by(postcode: params[:post_code])\n @location = postcode.locations.first\n @predictions = DataHelper.predict(@location, params[:period])\n end",
"def predict(observation, method)\n Combine.send(method, @models.map{|t| t.predict(observation, method) })\n end",
"def index\n @predict_charts = PredictChart.all\n end",
"def predict(u,m)\n viewer_list = []\n viewers(m).each do |id|\n viewer_list << @user_list[id]\n end\n @user_list[u].predict(m, viewer_list)\n end",
"def set_prediction\n @prediction = Prediction.find(params[:id])\n end"
]
| [
"0.66308594",
"0.65091336",
"0.6460537",
"0.6067307",
"0.6058793",
"0.6032062",
"0.5990188",
"0.5979455",
"0.5977669",
"0.59733355",
"0.5946819",
"0.59376407",
"0.58779806",
"0.57795596",
"0.5755886",
"0.5754334",
"0.5754334",
"0.57266814",
"0.57213825",
"0.5720535",
"0.5718992",
"0.5717544",
"0.5697935",
"0.56967646",
"0.56867",
"0.5681048",
"0.5674605",
"0.5674286",
"0.56714034",
"0.5650267"
]
| 0.6594821 | 1 |
buyer tracking history curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4OCwiZXhwIjoxNTAzNTEwNzUyfQ.7zo4a8g4MTSTURpU5kfzGbMLVyYN_9dDTKIBvKLSvPo" ' | def tracking_history
buyer = user_valid_for_viewing?('Buyer')
if !buyer.nil?
events = Events::Track.where(buyer_id: buyer.id).order("created_at desc")
results = events.map do |event|
{
udprn: event.udprn,
hash_str: event.hash_str,
type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],
created_at: event.created_at,
tracking_id: event.id
}
end
render json: results, status: 200
else
render json: { message: 'Authorization failed' }, status: 401
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_wechat_access_token\n res = RestClient.get \"https://foodtrust.cn/wx/get-access-token?badge=#{ENV['RDS_AGENT']}\"\n #ap res.code; res.cookies; ap res.headers; ap res.body\n return JSON.parse(res.body)['access_token']\nend",
"def get_json_bitbucket_action header\n header['x-event-key'][0]\n end",
"def get_withdrawal_history\n # body = {\n # cmd: \"get_withdrawal_history\"\n # }\n\n end",
"def signed_get_request url\n token=jwt_get_signature url\n HTTParty.get('http://localhost:5000'+url,\n headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\"\n }\n )\n end",
"def send_return_history_request(attrs={})\n request = ReturnHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n response = get(request.to_xml.to_s)\n return response if request.raw_xml==true || request.raw_xml==1\n ReturnHistoryResponse.format(response)\n end",
"def get_signedheaders(timestamp,path,body:\"\",method:\"POST\")\n\n timestamp = Time.now.to_i.to_s\n # body = JSON.generate(body)\n text = timestamp + method + path + body\n sign = OpenSSL::HMAC::hexdigest(OpenSSL::Digest::SHA256.new, SECRET, text)\n\n headers = {\n 'ACCESS-KEY' => KEY,\n 'ACCESS-TIMESTAMP' => timestamp,\n 'ACCESS-SIGN' => sign,\n 'Content-Type' => 'application/json'\n }\n\n # p response = HTTParty.post(url, body:body, headers:headers)\n end",
"def request_history(timestamp=1.day.ago)\n @ws.send({request: \"history\", timestamp: timestamp}.to_json)\n end",
"def history(params = {})\n params.select! { |key, _value| @api.history_config[:allowed_params].include? key }\n\n response = self.class.get(@api.history_config[:url],\n :query => { :auth_token => @token }.merge(params),\n :headers => @api.headers\n )\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n response.body\n end",
"def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend",
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def digest\n @request.header('Authorization')\n end",
"def profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end",
"def key_for_request\n \"#{@referrer}-#{@openx_url.to_s.gsub(/o=[0-9]+&callback=OX_[0-9]+/,'')}v4\"\n end",
"def send_cancellation_history_request(attrs={})\n request = CancellationHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n response = get(request.to_xml.to_s)\n return response if request.raw_xml==true || request.raw_xml==1\n CancellationHistoryResponse.format(response)\n end",
"def author() headers['author'] end",
"def history_usd\n rest.get stats_path(:historyUSD) do |response|\n response_handler response\n end\n end",
"def history(params)\n Client.current.get(\"#{resource_url}/candles\", params)\n end",
"def token\n request.headers['Authorization']\n end",
"def get_token\n request.headers[\"Authorization\"]\n end",
"def vcd_session(vcd, username, password)\n vcd_session_link = RestClient::Resource.new(vcd + '/api/sessions', username, password )\n vcd_session_response = vcd_session_link.post({'Accept' => 'application/*+xml;version=5.5'})\n myvar = 'x_vcloud_authorization'\n @mysession = vcd_session_response.headers[myvar.to_sym]\nend",
"def token\n request.headers[\"Authorization\"]\n end",
"def request_get(token)\n url = \"https://api.spotify.com/v1/browse/new-releases?limit=2\"\n\n options = {\n headers: {\n \"Content-Type\": 'application/json',\n \"Accept\": 'application/json',\n \"Authorization\": \"Bearer #{token}\"\n }\n }\n\n return my_request = HTTParty.get(url, options)\nend",
"def auth_header # gets the authorization header from the request\n # { Authorization: 'Bearer <token>' }\n request.headers['Authorization']\n end",
"def jwt_get_signature url\n\n payload=JWT.encode({ #Payload\n key: \"master\",\n method: \"GET\",\n path: url,\n },\n \"badgemaster\", #Secret\n \"HS256\", #Algoritmo\n {typ: \"JWT\", alg:\"HS256\"} #Headers\n )\n\n end",
"def getHeader\n #updateToken\n {'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' + @token}\n end",
"def fetch_history\n service_response = Economy::Transaction::FetchHistory.new(params).perform\n render_api_response(service_response)\n end",
"def headers\n hash = {}\n hash['Content-Type'] = 'application/json'\n hash['Authorization'] = \"ShacipKey #{api_key}\" unless api_key.nil?\n hash\n end",
"def headers\n {:content_type => :json, :accept => :json, :authorization => \"TAuth realm=\\\"https://odg.t-online.de\\\",tauth_token=\\\"#{token}\\\"\"}\n end",
"def order_tracking_url\n hash[\"OrderTrackingUrl\"]\n end",
"def test_request_signature_get\n uri = URI 'http://localhost/foo/bar?baz=quux%2Fxyzzy#plugh'\n req = Net::HTTP::Get.new uri\n req['Date'] = '2015-09-29'\n req['Cookie'] = 'foo; bar; baz=quux'\n req['Gap-Auth'] = 'mbland'\n\n assert_equal(\n ['GET',\n '',\n '',\n '',\n '2015-09-29',\n '',\n '',\n '',\n '',\n 'foo; bar; baz=quux',\n 'mbland',\n '/foo/bar?baz=quux%2Fxyzzy#plugh',\n ].join(\"\\n\") + \"\\n\",\n auth.string_to_sign(req))\n\n assert_equal(\n 'sha1 ih5Jce9nsltry63rR4ImNz2hdnk=',\n auth.request_signature(req))\n end"
]
| [
"0.5797186",
"0.5700164",
"0.56709397",
"0.5640822",
"0.5569054",
"0.54849124",
"0.5482643",
"0.54783344",
"0.5473061",
"0.5461563",
"0.5458975",
"0.54404914",
"0.5436548",
"0.54051435",
"0.5400448",
"0.5377582",
"0.5368418",
"0.53604376",
"0.5323719",
"0.5309286",
"0.52948594",
"0.52910185",
"0.52814",
"0.52738714",
"0.52722216",
"0.5267783",
"0.52554464",
"0.5250369",
"0.5245103",
"0.52443576"
]
| 0.6094292 | 0 |
Get tracking stats for a buyer curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" " | def tracking_stats
buyer = @current_user
property_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).count
street_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:street_tracking]).count
locality_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:locality_tracking]).count
stats = {
type: (buyer.is_premium? ? 'Premium' : 'Standard'),
locality_tracking_count_limit: Events::Track::BUYER_LOCALITY_PREMIUM_LIMIT[buyer.is_premium.to_s],
street_tracking_count_limit: Events::Track::BUYER_STREET_PREMIUM_LIMIT[buyer.is_premium.to_s],
property_tracking_count_limit: Events::Track::BUYER_PROPERTY_PREMIUM_LIMIT[buyer.is_premium.to_s],
locality_tracking_count: locality_tracking_count,
property_tracking_count: property_tracking_count,
street_tracking_count: street_tracking_count
}
render json: stats, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usage\n @headers['x-ratelimit-usage']\n end",
"def get_member_brief_stats(custid)\n res = $client.get(\"/membersite/member/CareerStats.do?custid=#{custid}\", $headers)\n start = res.body.index('buf = \\'{\"memberSince\"') + 7\n length = res.body.index(\"MemberProfile.driver = extractJSON\") - 3 - start\n data = res.body[start, length]\n JSON.parse data\nend",
"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 pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend",
"def stats\n Client.current.get(\"#{resource_url}/stats\")\n end",
"def raw_stats\n url = URI.parse(stats_url)\n Net::HTTP.start(url.host, url.port) {|http|\n http.request(Net::HTTP::Get.new(url.path))\n }.body\nend",
"def usage_stats\n\t login_filter\n \n\t stats_page = @agent.get(\"/account\")\n\t \n\t stats = stats_page.at('#usage-percent').content.scan(/(\\d+(?:\\.\\d+)?)%\\ used\\ \\((\\d+(?:\\.\\d+)?)([MG])B of (\\d+(?:\\.\\d+)?)GB\\)/).collect{ |d|\n\t { :used => d[1].to_f * ((d[2] == \"G\") ? 1024 : 1),\n\t :total => d[3].to_f * 1024,\n\t :free => (d[3].to_f * 1024 - d[1].to_f * ((d[2] == \"G\") ? 1024 : 1)),\n\t :percent => Percentage.new(d[0].to_f/100)\n\t }\n\t }[0]\n\t \n\t regular_data = stats_page.at('span.bar-graph-legend.bar-graph-normal').next.content.scan(/\\((\\d+(?:\\.\\d+)?)([MG])B/)[0]\n\t stats[:regular_used] = regular_data[0].to_f * ((regular_data[1] == \"G\") ? 1024 : 1) unless regular_data.nil?\n\n\t shared_data = stats_page.at('span.bar-graph-legend.bar-graph-shared').next.content.scan(/\\((\\d+(?:\\.\\d+)?)([MG])B/)[0]\n\t stats[:shared_used] = shared_data[0].to_f * ((shared_data[1] == \"G\") ? 1024 : 1) unless shared_data.nil?\n\n return stats\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def vendor_details\n authenticate_request('Vendor')\n if @current_user\n vendor_details = @current_user.as_json\n yearly_quote_count = Agents::Branches::AssignedAgents::Quote.where(vendor_id: @current_user.id).where(\"created_at > ?\", 1.year.ago).group(:property_id).select(\"count(id)\").to_a.count\n vendor_details[:yearly_quote_count] = yearly_quote_count\n vendor_details[:quote_limit] = Agents::Branches::AssignedAgents::Quote::VENDOR_LIMIT\n vendor_details[:is_premium] = @current_user.buyer.is_premium\n render json: vendor_details, status: 200\n end\n end",
"def visitors(id, date)\n begin\n # json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=today&metrics=ym:s:users&filters=ym:pv:URL=@'ships'&id=33242200&oauth_token=8d3f347e9bfe4be49785fc3922ccc4e1\"))\n json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=#{date.strftime(\"%Y-%m-%d\")}&metrics=ym:s:users&filters=ym:pv:URL=@%27ships/#{id}%27&id=33242200&oauth_token=AQAAAAADvq36AAQsNhxUuZrk40_bsQtY8fXNqrU\"))\n rescue Exception => e\n logger.debug(\"---------------------- #{e}\")\n retry\n end\n\n if (json.present? and json.code == \"200\")\n data_hash = JSON.parse(json.body)\n if data_hash[\"data\"].present?\n visitors = data_hash[\"data\"][0][\"metrics\"][0] \n else\n visitors = nil\n end\n else\n visitors = nil\n end\n\n return visitors\n end",
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def stats\n response[\"stats\"]\n end",
"def raw_info\n yql = \"select * from social.profile where guid='#{uid}'\"\n request = \"https://query.yahooapis.com/v1/yql?q=#{encode_uri_component(yql)}&format=json\"\n @raw_info ||= MultiJson.decode(access_token.get(request).body)\n rescue ::Errno::ETIMEDOUT\n raise ::Timeout::Error\n end",
"def stats\n expose Metadata.stats(@oauth_token)\n end",
"def tracking_history\n buyer = user_valid_for_viewing?('Buyer')\n if !buyer.nil?\n events = Events::Track.where(buyer_id: buyer.id).order(\"created_at desc\")\n results = events.map do |event|\n {\n udprn: event.udprn,\n hash_str: event.hash_str,\n type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],\n created_at: event.created_at,\n tracking_id: event.id\n }\n end\n render json: results, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def users\n response.present? ? response.totals_for_all_results['ga:users'] : 0\n end",
"def stats\n # lookup user + stats via api\n if user_signed_in? and request.headers['HTTP_COOKIE'] and @user = Shelby::API.get_user(params['user_id'])\n @frames = Shelby::API.get_user_stats(params['user_id'], req0uest.headers['HTTP_COOKIE'])\n end\n end",
"def get_payout_stats_v1_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentAuditServiceDeprecatedApi.get_payout_stats_v1 ...'\n end\n # resource path\n local_var_path = '/v1/paymentaudit/payoutStatistics'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'payorId'] = opts[:'payor_id'] if !opts[:'payor_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetPayoutStatistics'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :operation => :\"PaymentAuditServiceDeprecatedApi.get_payout_stats_v1\",\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: PaymentAuditServiceDeprecatedApi#get_payout_stats_v1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_usage_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_usage ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/stats/usage'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HistoricalUsageAggregateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_usage\",\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: HistoricalApi#get_usage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def usage(opts)\n url = '/stats/usage'\n url += '_by_month' if opts.delete(:by_month)\n url += '_by_service' if opts.delete(:by_service)\n client.get_stats(url, opts)\n end",
"def get_blockchain_stats\n stats = HTTParty.get(\"http://webbtc.com/stats.json\")\nend",
"def profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end",
"def stats\n @client.stats\n end",
"def get_payout_stats_v4_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentAuditServiceApi.get_payout_stats_v4 ...'\n end\n # resource path\n local_var_path = '/v4/paymentaudit/payoutStatistics'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'payorId'] = opts[:'payor_id'] if !opts[:'payor_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetPayoutStatistics'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :operation => :\"PaymentAuditServiceApi.get_payout_stats_v4\",\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: PaymentAuditServiceApi#get_payout_stats_v4\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_accounts_receivable_retry_stats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_accounts_receivable_retry_stats ...'\n end\n # resource path\n local_var_path = '/order/accountsReceivableRetryConfig/stats'\n\n # query parameters\n query_params = {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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 = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'AccountsReceivableRetryStatsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_accounts_receivable_retry_stats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def request_stats\n @all = current_user.trip_requests.requests.count\n @completed = current_user.trip_requests.completed.requests.count\n @cancelled = current_user.trip_requests.cancelled.requests.count\n @active = current_user.trip_requests.active.requests.count\n @stats = current_user.trip_requests.requests.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @response = { all: @all, completed: @completed, cancelled: @cancelled, active: @active, requests: @stats }\n json_response(@response)\n end",
"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"
]
| [
"0.629435",
"0.62524647",
"0.6112888",
"0.6063808",
"0.5868",
"0.58195317",
"0.57700455",
"0.5760547",
"0.5760547",
"0.5737094",
"0.5737094",
"0.5677557",
"0.5658288",
"0.564761",
"0.56249946",
"0.5598312",
"0.55890745",
"0.55623746",
"0.5556137",
"0.5533361",
"0.5524257",
"0.5506604",
"0.5503354",
"0.5502482",
"0.548076",
"0.5466214",
"0.5455322",
"0.5438385",
"0.54356223",
"0.5428467"
]
| 0.64779234 | 0 |
Get tracking filters and find details of properties in type of tracking TODO: Net HTTP calls made with hardcoded hostnames to be removed TODO: tracking id should be returned or not? | def tracking_details
buyer = @current_user
type_of_tracking = (params[:type_of_tracking] || "property_tracking").to_sym
if type_of_tracking == :property_tracking
udprns = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).pluck(:udprn)
api = PropertySearchApi.new(filtered_params: {})
body = api.fetch_details_from_udprns(udprns)
render json: {property_details: body}, status: 200
else
if params["hash_str"].present?
body = Oj.load(Net::HTTP.get(URI.parse(URI.encode("http://52.66.124.42/api/v0/properties/search?hash_str=#{params['hash_str']}"))))
render json: {property_details: body}, status: 200
else
body = []
search_hashes = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[type_of_tracking]).pluck(:hash_str).compact
search_hashes.each do |search_hash|
### TODO: Fix this. Use internal methods rather than calling the api
body = Oj.load(Net::HTTP.get(URI.parse(URI.encode("http://api.prophety.co.uk/api/v0/properties/search?hash_str=#{search_hash}")))) + body
end
render json: {search_hashes: search_hashes, property_details: body}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trackers(query, type=nil)\n if type.nil?\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n get('host-attributes/trackers', {'query' => query})\n else\n is_valid_with_error(__method__, [:tracker_type], type)\n get('trackers/search', {'query' => query, 'type' => type})\n end\n end",
"def get_tracking_categories\n response_xml = http_get(\"#{xero_url}/tracking\")\n parse_response(response_xml) \n end",
"def usage_filters\n get('/1/reporting/filters').to_a\n end",
"def list_filters\n {\n track_end_date: 'TrkEndDate gt VALUE',\n track_first_submitted: 'TrkFirstSubmitted gt VALUE',\n app_no: 'AppNo eq VALUE',\n first_name: 'AppFirstName eq VALUE',\n last_name: 'AppLastName eq VALUE',\n email: 'AppEmailAddress eq VALUE'\n }\n end",
"def get_all_tracking_pixels_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TrackingControllerApi.get_all_tracking_pixels ...'\n end\n allowable_values = [\"ASC\", \"DESC\"]\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/tracking/pixels'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].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(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'PageTrackingPixelProjection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrackingControllerApi#get_all_tracking_pixels\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def trackingfield_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TrackingFieldApi.trackingfield_list ...'\n end\n # resource path\n local_var_path = '/tracking_fields'\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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrackingFieldApi#trackingfield_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tracking_stats\n buyer = @current_user\n property_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).count\n street_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:street_tracking]).count\n locality_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:locality_tracking]).count\n stats = {\n type: (buyer.is_premium? ? 'Premium' : 'Standard'),\n locality_tracking_count_limit: Events::Track::BUYER_LOCALITY_PREMIUM_LIMIT[buyer.is_premium.to_s],\n street_tracking_count_limit: Events::Track::BUYER_STREET_PREMIUM_LIMIT[buyer.is_premium.to_s],\n property_tracking_count_limit: Events::Track::BUYER_PROPERTY_PREMIUM_LIMIT[buyer.is_premium.to_s],\n locality_tracking_count: locality_tracking_count,\n property_tracking_count: property_tracking_count,\n street_tracking_count: street_tracking_count\n }\n render json: stats, status: 200\n end",
"def trackers(query, start_at: nil, end_at: nil)\n params = {\n query: query,\n start: start_at,\n end: end_at,\n }.compact\n\n _get(\"/host-attributes/trackers\", params) { |json| json }\n end",
"def test_that_you_may_filter_to_single_track\n getting '/v2/exercises?tracks=fruit'\n\n returns_tracks %w( fruit )\n end",
"def stories(project, api_key, filter='')\n\treq = Net::HTTP::Get.new(\n \"/services/v3/projects/#{project}/stories?filter=#{filter}\",\n {'X-TrackerToken'=>api_key}\n )\n res = Net::HTTP.start(@pt_uri.host, @pt_uri.port) {|http|\n http.request(req)\n }\n\n return res.body\nend",
"def tracking_history\n buyer = user_valid_for_viewing?('Buyer')\n if !buyer.nil?\n events = Events::Track.where(buyer_id: buyer.id).order(\"created_at desc\")\n results = events.map do |event|\n {\n udprn: event.udprn,\n hash_str: event.hash_str,\n type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],\n created_at: event.created_at,\n tracking_id: event.id\n }\n end\n render json: results, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def index\n included = default_to_array(params[:included])\n excluded = default_to_array(params[:excluded])\n records = Record.custom_filter(included, excluded)\n related_hostnames = Hostname\n .filter_related_hostnames(included, excluded)\n .map{ |h| h.address }\n .tally\n\n render json: {\n total_records: records.length,\n records: records.map { |r| { id: r.id, ip_address: r.ip } },\n related_hostnames: related_hostnames.map { |h, c| { hostname: h, count: c } }\n }\n end",
"def initialize_url_filters\n # We use a hash which tells the domains to filter.\n # The hash value tells that if company name contains that string then don't filter\n @url_filter = Hash.new\n @url_filter[\"facebook.com\"] = \"facebook\"\n @url_filter[\"linkedin.com\"] = \"linkedin\"\n @url_filter[\"wikipedia.org\"] = \"wikipedia\"\n @url_filter[\"yahoo.com\"] = \"yahoo\"\n @url_filter[\"zdnet.com\"] = \"zdnet\"\n @url_filter[\"yelp.com\"] = \"yelp\"\n @url_filter[\"yellowpages.com\"] = \"yellowpages\"\n @url_filter[\"thefreelibrary.com\"] = \"thefreelibrary\"\n @url_filter[\"thefreedictionary.com\"] = \"thefreedictionary\"\n @url_filter[\"superpages.com\"] = \"superpages\"\n @url_filter[\"businessweek.com\"] = \"week\"\n @url_filter[\"indiamart.com\"] = \"mart\"\n @url_filter[\"naukri.com\"] = \"naukri\"\n @url_filter[\"monsterindia.com\"] = \"monster\"\n @url_filter[\"answers.com\"] = \"answers\"\n @url_filter[\"sulekha.com\"] = \"sulekha\"\n @url_filter[\"asklaila.com\"] = \"asklaila\"\n @url_filter[\"blogspot.com\"] = \"blogspot\"\n @url_filter[\"manta.com\"] = \"manta\"\n @url_filter[\"zoominfo.com\"] = \"zoom\"\n @url_filter[\"twitter.com\"] = \"twitter\"\n @url_filter[\"hotfrog.com\"] = \"hotfrog\"\n @url_filter[\"amazon.com\"] = \"amazon\"\n end",
"def cost_filters\n get('/1/reporting/cost/filters').to_a\n end",
"def lookup_track_info(orig_url)\n uri = URI.parse(orig_url)\n \n split_url = uri.path.split('/')\n\n puts uri.host\n \n track_info = Hash.new();\n\n #This needs to be better, include only track urls of specific services\n if uri.host == 'open.spotify.com'\n puts 'spotify lookup'\n track_info = spotify_lookup(split_url[2])\n elsif uri.host.ends_with? 'last.fm'\n puts 'lastfm lookup'\n track_info = last_fm_lookup(split_url[2], split_url[4])\n elsif uri.host.ends_with? 'grooveshark.com'\n track_info = grooveshark_lookup('', split_url[2])\n elsif uri.host == 'rd.io'\n print 'rdio lookup'\n else\n # Return an empty track_info hash\n puts 'non-valid url'\n end\n\n return track_info\n end",
"def tracking\n # @@neo = Neography::Rest.new\n self_node = self.get_node\n if self_node\n trackers = []\n begin\n trackers_list = self_node.outgoing(:friends).map{ |n| [n.object_type, n[:object_id]] }\n trackers_list = trackers_list.group_by{|x| x[0]}\n trackers_list.each do |tracker_type|\n tracker_ids = tracker_type[1].map{|u|u[1]}\n trackers << tracker_type[0].safe_constantize.where(id: tracker_ids).try(:to_a)\n end\n rescue Exception\n end\n\n return trackers.flatten\n else\n return []\n end\n end",
"def custom(cfg)\n metrics = []\n @client.query(cfg['query']).each do |result|\n source = if result['metric']['instance'] =~ /^\\d+/\n result['metric']['app']\n else\n result['metric']['instance']\n end\n\n metrics << {\n 'source' => source,\n 'value' => result['value'][1]\n }\n end\n metrics\n end",
"def index\n if params[:track_id]\n @track = Track.find(params[:track_id])\n @events = Event.where(track_id: params[:track_id]).where(event_type: 'track')\n else\n @events = Event.all\n end\n end",
"def common_metrics( request )\n metrics = [ \"External/all\" ]\n metrics << \"External/#{request.host}/all\"\n\n if NewRelic::Agent::Transaction.recording_web_transaction?\n metrics << \"External/allWeb\"\n else\n metrics << \"External/allOther\"\n end\n\n return metrics\n end",
"def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend",
"def atg_tracking_data\n env = params[:env].downcase # uat or uat2\n loc = params[:loc].downcase # US or CA\n\n if env.blank? || loc.blank?\n render plain: ['']\n else\n render plain: AtgTracking.where(\"email like '%atg_#{env}_#{locale}%'\").order(updated_at: :desc).pluck(:email, :address1)\n end\n end",
"def track\n url = Rails.env.development? ? \"http://localhost:8000/stat\" : \"http://stats.universit.as/stat\"\n RestClient.get(url, :params => {\n :ip => request.remote_ip,\n :title => request.referrer\n })\n render :js => ''\n end",
"def tracking_tags\n @config['aftership_tracking_tag']\n end",
"def data_track_list\n $tracer.trace(format_method(__method__))\n return @tag.get(\"data-track\").split(\"|\")\n end",
"def trip_filters\n elems = []\n TimeFilterHelper.time_filters.each do |tf|\n elems << {\n :id => 100 + tf[:id],\n :value => tf[:value]\n }\n end\n TripPurpose.all.each do |tp|\n elems << {\n :id => tp.id,\n :value => tp\n } \n end\n return elems \n end",
"def trackers\n tr = @params['tr']\n if tr\n tr\n else\n []\n end\n end",
"def tracks_get_info params = { :track_id => nil }\n json = send_request 'tracks_get_info', params\n if json['success'] == true\n json['data']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"def tracking_events\n InstallTracking::TrackingEvent.where(['device_token = ? OR old_token = ? OR device_token = ?', self.device_token || \"NONE\", self.device_token || \"NONE\", self.hardware_token || \"NONE\"]);\n end",
"def filter_specs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilterApi.filter_specs ...'\n end\n # resource path\n local_var_path = '/filters/_specs'\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/vnd.feedpushr.filter-spec.v1+json; type=collection'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<FilterSpec>' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilterApi#filter_specs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def filter(event)\n require 'time'\n host = event.get(\"[agent][name]\")\n logpath = event.get(\"[log][file][path]\")\n implant_id = event.get(\"[implant][id]\")\n timefromcs = event.get(\"[c2][timestamp]\") + \" UTC\"\n timestring = Time.parse(timefromcs).strftime(\"%I%M%S\")\n temppath = logpath.split('/cobaltstrike')\n temppath2 = temppath[1].split(/\\/([^\\/]*)$/)\n screenshoturl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike\" + \"#{temppath2[0]}\" + \"/screenshots/screen_\" + \"#{timestring}\" + \"_\" + \"#{implant_id}\" + \".jpg\"\n thumburl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike\" + \"#{temppath2[0]}\" + \"/screenshots/screen_\" + \"#{timestring}\" + \"_\" + \"#{implant_id}\" + \".jpg.thumb.jpg\"\n event.tag(\"_rubyparseok\")\n event.set(\"[screenshot][full]\", screenshoturl)\n event.set(\"[screenshot][thumb]\", thumburl)\n return [event]\nend"
]
| [
"0.597705",
"0.59144413",
"0.5735036",
"0.5617689",
"0.54666567",
"0.5431689",
"0.54226965",
"0.5419066",
"0.53725445",
"0.5345034",
"0.5329371",
"0.5322544",
"0.5312536",
"0.52893865",
"0.5265697",
"0.5249971",
"0.5234865",
"0.5217012",
"0.52111447",
"0.5188541",
"0.51814127",
"0.5128734",
"0.51148283",
"0.5097971",
"0.5093833",
"0.5089233",
"0.5067661",
"0.5062418",
"0.5057262",
"0.5051175"
]
| 0.65677255 | 0 |
Edit tracking details curl XPOST H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" " | def edit_tracking
buyer = @current_user
destroyed = Events::Track.where(id: params[:tracking_id].to_i).last.destroy
render json: { message: 'Destroyed tracking request' }, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tracking_params\n params.permit(:location, :trip_request_id)\n end",
"def post_curl\n `curl -X \"POST\" -H \"Authorization: Basic #{_encode}\" -d grant_type=client_credentials https://accounts.spotify.com/api/token`\n end",
"def tracking_params\n params.require(:tracking).permit(:content, :project_id)\n end",
"def tracking_params\n params.require(:tracking).permit(:nombre, :guia, :estado, :desde, :hasta, :description)\n end",
"def click_tracking_params\n params.require(:click_tracking).permit(:zip, :url, :user_id)\n end",
"def put_authcontrols_exemptmids_token_with_http_info(token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthControlsApi.put_authcontrols_exemptmids_token ...'\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling AuthControlsApi.put_authcontrols_exemptmids_token\"\n end\n # resource path\n local_var_path = '/authcontrols/exemptmids/{token}'.sub('{' + 'token' + '}', CGI.escape(token.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 '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(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"AuthControlsApi.put_authcontrols_exemptmids_token\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthControlsApi#put_authcontrols_exemptmids_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def capture_authorization_by_external_key_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsApi.capture_authorization_by_external_key ...\"\n end\n # resource path\n local_var_path = \"/1.0/kb/payments\"\n\n # query parameters\n query_params = {}\n query_params[:'controlPluginName'] = @api_client.build_collection_param(opts[:'control_plugin_name'], :multi) if !opts[:'control_plugin_name'].nil?\n query_params[:'pluginProperty'] = @api_client.build_collection_param(opts[:'plugin_property'], :multi) if !opts[:'plugin_property'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsApi#capture_authorization_by_external_key\\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 @click_tracking.update(click_tracking_params)\n format.html { redirect_to @click_tracking, notice: 'Click tracking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @click_tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tracker_params\n params.require(:tracker).permit(:token, :description, :enabled)\n end",
"def post(opts = {})\n with_monitoring do\n connection.post(opts[:path]) do |req|\n prefix = opts[:access_token] ? 'Bearer' : 'Basic'\n suffix = opts[:access_token] || opts[:claims_token]\n req.headers = headers.merge('Authorization' => \"#{prefix} #{suffix}\")\n end\n end\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @id_token = args[:id_token] if args.key?(:id_token)\n @phone_verification_info = args[:phone_verification_info] if args.key?(:phone_verification_info)\n @tenant_id = args[:tenant_id] if args.key?(:tenant_id)\n @totp_verification_info = args[:totp_verification_info] if args.key?(:totp_verification_info)\n end",
"def update\n @api_tracking = ApiTracking.find(params[:id])\n\n respond_to do |format|\n if @api_tracking.update_attributes(params[:api_tracking])\n format.html { redirect_to @api_tracking, notice: 'Api tracking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def atest_ID_25845_edit_profile_edit_profile_details\n # Need clarification\n end",
"def cust_details_track_params\n params.require(:cust_details_track).permit(:order_ref_id, :order_date, :ext_ref_id, :custdetails, :vpp, :dealtran, :last_call_back_on, :no_of_attempts, :mobile, :alt_mobile, :products, :current_status)\n end",
"def _build_request resource, request\n admin_token = resource.bootstrap_token\n request.add_field 'X-Auth-Token', admin_token\n request.add_field 'Content-type', 'application/json'\n request.add_field 'user-agent', 'Chef keystone_credentials'\n request\nend",
"def details_access_params\n params.require(:details_access).permit(:user_id, :ip_address, :user_agent)\n end",
"def update(options = {})\n data = PostData.new\n data[:user] = @login\n data[:pass] = @password\n if options[:tid]\n data[:tid] = options[:tid]\n else\n data[:ord_id] = options[:ord_id]\n data[:service_id] = options[:service_id]\n end\n\n ssl_post(STATUS_TEST_URL, data.to_post_data)\n end",
"def modify_identifier(identifier, metadata_hash)\n request_uri = '/id/' + identifier\n uri = URI(ENDPOINT + request_uri)\n request = Net::HTTP::Post.new uri.request_uri\n response = call_api(uri, request, metadata_hash)\nend",
"def update_tag_profile\n # body = {\n # cmd: \"update_tag_profile\"\n # }\n\n end",
"def _build_request resource, request\n admin_token = resource.bootstrap_token\n request.add_field 'X-Auth-Token', admin_token\n request.add_field 'Content-type', 'application/json'\n request.add_field 'user-agent', 'Chef keystone_register'\n request\nend",
"def getTokenEdit( entity_id, language, flatpack_id, edit_page)\n params = Hash.new\n params['entity_id'] = entity_id\n params['language'] = language\n params['flatpack_id'] = flatpack_id\n params['edit_page'] = edit_page\n return doCurl(\"get\",\"/token/edit\",params)\n end",
"def set_TrackingID(value)\n set_input(\"TrackingID\", value)\n end",
"def capture_with_http_info(sbp_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#capture ...\"\n end\n \n # verify the required parameter 'sbp_request' is set\n fail \"Missing the required parameter 'sbp_request' when calling capture\" if sbp_request.nil?\n \n # resource path\n path = \"/v1/transaction/capture\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_request)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SbpResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#capture\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end",
"def policy_activities_actions_issue_quotes_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyActivitiesApi.v1_policy_activities_actions_issue_quotes_post ...'\n end\n # resource path\n local_var_path = '/v1/policy_activities/actions/issue_quotes'\n # query parameters\n query_params = opts[:query_params] || {}\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', 'text/plain', 'application/octet-stream', 'application/json-patch+json', 'text/json', 'application/*+json'])\n # form parameters\n form_params = opts[:form_params] || {}\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])\n # return_type\n return_type = opts[:debug_return_type] || 'Array<CentralEntCoreFrameworkServiceLibraryApiModelIssueQuoteResponse>'\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Bearer']\n new_options = opts.merge(\n :operation => :\"PolicyActivitiesApi.v1_policy_activities_actions_issue_quotes_post\",\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 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: PolicyActivitiesApi#v1_policy_activities_actions_issue_quotes_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n head :unauthorized\n end",
"def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @phone_auth_info = args[:phone_auth_info] if args.key?(:phone_auth_info)\n @refresh_token = args[:refresh_token] if args.key?(:refresh_token)\n @totp_auth_info = args[:totp_auth_info] if args.key?(:totp_auth_info)\n end",
"def add_purchase_details(post, options)\n post[:InternalNote] = options.fetch(:internal_note, '')\n post[:PaymentReason] = options.fetch(:payment_reason, '')\n post[:TokenisationMode] = options.fetch(:tokenisation_mode, 0)\n post[:SettlementDate] = options.fetch(:settlement_date, '')\n post[:Source] = options.fetch(:source, '')\n post[:StoreCard] = options.fetch(:store_card, false)\n post[:SubType] = options.fetch(:sub_type, 'single')\n post[:TestMode] = test?\n post[:Type] = options.fetch(:type, 'cardpresent')\n end",
"def update!(**args)\n @external_identity = args[:external_identity] if args.key?(:external_identity)\n @resolution_status_code = args[:resolution_status_code] if args.key?(:resolution_status_code)\n end",
"def update!(**args)\n @external_identity = args[:external_identity] if args.key?(:external_identity)\n @resolution_status_code = args[:resolution_status_code] if args.key?(:resolution_status_code)\n end"
]
| [
"0.540576",
"0.53994876",
"0.5268931",
"0.52506155",
"0.52359056",
"0.52315164",
"0.5205049",
"0.5192182",
"0.51643455",
"0.51627517",
"0.5141517",
"0.5140408",
"0.5091574",
"0.5076165",
"0.5075412",
"0.5070239",
"0.50637466",
"0.5051737",
"0.50487304",
"0.5031082",
"0.49848428",
"0.49842492",
"0.49827364",
"0.4979794",
"0.4977636",
"0.49708778",
"0.49586725",
"0.49467856",
"0.49377543",
"0.49377543"
]
| 0.5718332 | 0 |
Info about the premium charges monthly curl XGET ' | def info_premium
render json: { value: (PropertyBuyer::PREMIUM_COST*100) }, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def show(charge_token)\n api_response(api_get(\"#{PATH}/#{charge_token}\"))\n end",
"def billing\n request('billing', :get)\n end",
"def charges(company_number, items_per_page = nil, start_index = nil)\n params = {}\n if items_per_page\n params[:items_per_page] = items_per_page\n end\n if start_index\n params[:start_index] = start_index\n end\n client.get(\"company/#{company_number}/charges/\", params)\n end",
"def fetchInstallations(token)\n url = URI(\"https://api.acceptance.hertekconnect.nl/api/v1/installations\")\n\n http = Net::HTTP.new(url.host, url.port);\n http.use_ssl = true\n request = Net::HTTP::Get.new(url)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Authorization\"] = \"Bearer #{token}\"\n\n response = http.request(request)\n puts response.read_body\nend",
"def pricing\n request('pricing', :get)\n end",
"def cost(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:cost),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def monthly_active(options = {})\n request_model = @request_model_factory.monthly_active_request_model(options)\n response = @network_client.perform_request(request_model)\n parse_point_response(response)\n end",
"def billing\n user_agent = request.env['HTTP_USER_AGENT']\n billing_request_body = Billing.request_body(@session)\n parameter = Parameter.first\n\n request = Typhoeus::Request.new(parameter.billing_url, followlocation: true, body: billing_request_body, headers: {Accept: \"text/xml\", :'Content-length' => billing_request_body.bytesize, Authorization: \"Basic base64_encode('NGSER-MR2014:NGSER-MR2014')\", :'User-Agent' => user_agent})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n #response_body\n #@xml = Nokogiri.XML(Billing.response_body).xpath('//methodResponse//params//param//value//struct//member')\n @xml = Nokogiri.XML(result).xpath('//methodResponse//params//param//value//struct//member') rescue nil\n #render text: Billing.response_body.bytesize\n end",
"def get_openexchangerates(currency_code,base_code,key)\n # this is tested as working and so far is seen as the best in the lot \n # this one when free will only do lookups compared to USD, also limits to 1000 lookup per month so only 1 per hour\n # at $12/month Hourly Updates, 10,000 api request/month\n # at $47/month 30-minute Updates, 100,000 api request/month\n # at $97/month 10-minute Updates, unlimited api request/month + currency conversion requests\n # does lookup more than one currency at a time\n #https://openexchangerates.org/api/latest.json?app_id=xxxxxxx\n # see: https://openexchangerates.org/\n # example usage:\n # result = get_openexchangerates(\"THB\",\"JPY\", openexchangerates_key)\n # puts \"rate: \" + result[\"rate\"].to_s ; rate: 2.935490234019467\n #\n # inputs: \n # currency_code: the currency code to lookup example THB\n # base_code: the currency base to use in calculating exchange example USD or THB or BTC\n # key: the api authentication key obtained from https://openexchangerates.org\n #\n # return results:\n # rate: the calculated rate of exchange\n # timestamp: time the rate was taken in seconds_since_epoch_integer format (not sure how accurate as the time is the same for all asset currency)\n # datetime: time in standard human readable format example: 2016-09-15T08:00:14+07:00\n # base: the base code of the currency being calculated example USD\n # example if 1 USD is selling for 34.46 THB then rate will return 34.46 for base USD\n # example#2 if 1 USD is selling for 101.19 KES then rate will return 101.19 for base of USD\n # example#3 with the same values above 1 THB is selling for 2.901 KES so rate will return 2.901 for base of KES \n puts \"get_openexchangerates started\"\n url_start = \"https://openexchangerates.org/api/latest.json?app_id=\"\n url_end = \"\"\n send = url_start + key\n #puts \"sending: #{send}\"\n begin\n #postdata = RestClient.get send , { :Accept => '*/*', 'accept-encoding' => \"gzip, deflate\", :user_agent => \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0\"}\n postdata = RestClient.get send , { :Accept => '*/*', 'accept-encoding' => \"gzip, deflate\"}\n rescue => e\n puts \"fail in get_openexchangerate at RestClient.get error: #{e}\"\n data_out = {}\n data_out[\"service\"] = \"openexchangerates.org\"\n data_out[\"status\"] = \"fail\"\n return data_out\n end\n #puts \"postdata: \" + postdata\n data = JSON.parse(postdata)\n data_out = {}\n data_out[\"status\"] = \"pass\"\n if (base_code == \"USD\")\n #defaults to USD\n data_out[\"currency_code\"] = currency_code\n data_out[\"base\"] = base_code\n data_out[\"datetime\"] = Time.at(data[\"timestamp\"]).to_datetime.to_s\n #date[\"rate\"] = data[\"rates\"][currency_code]\n data_out[\"rate\"] = (data[\"rates\"][currency_code]).to_s\n data_out[\"ask\"] = data_out[\"rate\"]\n data_out[\"bid\"] = data_out[\"rate\"]\n data_out[\"service\"] = \"openexchangerates.org\"\n puts \"data_out: #{data_out}\"\n return data_out\n end\n puts \"here??\"\n usd_base_rate = data[\"rates\"][currency_code]\n base_rate = data[\"rates\"][base_code]\n rate = base_rate / usd_base_rate\n data_out[\"currency_code\"] = currency_code\n #data_out[\"rate\"] = rate.to_s\n #data_out[\"ask\"] = data_out[\"rate\"]\n #data_out[\"bid\"] = data_out[\"rate\"]\n data_out[\"rate\"] = (1.0 / rate.to_f)\n data_out[\"ask\"] = data_out[\"rate\"].to_f\n data_out[\"bid\"] = data_out[\"rate\"].to_f\n data_out[\"base\"] = base_code\n data_out[\"datetime\"] = Time.at(data[\"timestamp\"]).to_datetime.to_s\n data_out[\"service\"] = \"openexchangerates.org\"\n puts \"data_out: #{data_out}\"\n return data_out\nend",
"def get_openexchangerates(currency_code,base_code,key)\n # this is tested as working and so far is seen as the best in the lot \n # this one when free will only do lookups compared to USD, also limits to 1000 lookup per month so only 1 per hour\n # at $12/month Hourly Updates, 10,000 api request/month\n # at $47/month 30-minute Updates, 100,000 api request/month\n # at $97/month 10-minute Updates, unlimited api request/month + currency conversion requests\n # does lookup more than one currency at a time\n #https://openexchangerates.org/api/latest.json?app_id=xxxxxxx\n # see: https://openexchangerates.org/\n # example usage:\n # result = get_openexchangerates(\"THB\",\"JPY\", openexchangerates_key)\n # puts \"rate: \" + result[\"rate\"].to_s ; rate: 2.935490234019467\n #\n # inputs: \n # currency_code: the currency code to lookup example THB\n # base_code: the currency base to use in calculating exchange example USD or THB or BTC\n # key: the api authentication key obtained from https://openexchangerates.org\n #\n # return results:\n # rate: the calculated rate of exchange\n # timestamp: time the rate was taken in seconds_since_epoch_integer format (not sure how accurate as the time is the same for all asset currency)\n # datetime: time in standard human readable format example: 2016-09-15T08:00:14+07:00\n # base: the base code of the currency being calculated example USD\n # example if 1 USD is selling for 34.46 THB then rate will return 34.46 for base USD\n # example#2 if 1 USD is selling for 101.19 KES then rate will return 101.19 for base of USD\n # example#3 with the same values above 1 THB is selling for 2.901 KES so rate will return 2.901 for base of KES \n puts \"get_openexchangerates started\"\n url_start = \"https://openexchangerates.org/api/latest.json?app_id=\"\n url_end = \"\"\n send = url_start + key\n #puts \"sending: #{send}\"\n begin\n #postdata = RestClient.get send , { :Accept => '*/*', 'accept-encoding' => \"gzip, deflate\", :user_agent => \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0\"}\n postdata = RestClient.get send , { :Accept => '*/*', 'accept-encoding' => \"gzip, deflate\"}\n rescue => e\n puts \"fail in get_openexchangerate at RestClient.get error: #{e}\"\n data_out = {}\n data_out[\"service\"] = \"openexchangerates.org\"\n data_out[\"status\"] = \"fail\"\n return data_out\n end\n #puts \"postdata: \" + postdata\n data = JSON.parse(postdata)\n data_out = {}\n data_out[\"status\"] = \"pass\"\n if (base_code == \"USD\")\n #defaults to USD\n data_out[\"currency_code\"] = currency_code\n data_out[\"base\"] = base_code\n data_out[\"datetime\"] = Time.at(data[\"timestamp\"]).to_datetime.to_s\n #date[\"rate\"] = data[\"rates\"][currency_code]\n data_out[\"rate\"] = (data[\"rates\"][currency_code]).to_s\n data_out[\"ask\"] = data_out[\"rate\"]\n data_out[\"bid\"] = data_out[\"rate\"]\n data_out[\"service\"] = \"openexchangerates.org\"\n puts \"data_out: #{data_out}\"\n return data_out\n end\n puts \"here??\"\n usd_base_rate = data[\"rates\"][currency_code]\n base_rate = data[\"rates\"][base_code]\n rate = base_rate / usd_base_rate\n data_out[\"currency_code\"] = currency_code\n #data_out[\"rate\"] = rate.to_s\n #data_out[\"ask\"] = data_out[\"rate\"]\n #data_out[\"bid\"] = data_out[\"rate\"]\n data_out[\"rate\"] = (1.0 / rate.to_f)\n data_out[\"ask\"] = data_out[\"rate\"].to_f\n data_out[\"bid\"] = data_out[\"rate\"].to_f\n data_out[\"base\"] = base_code\n data_out[\"datetime\"] = Time.at(data[\"timestamp\"]).to_datetime.to_s\n data_out[\"service\"] = \"openexchangerates.org\"\n puts \"data_out: #{data_out}\"\n return data_out\nend",
"def request\n result = {}\n req_xml.blank? ? xml = '' : xml = req_xml\n doc = Hpricot.XML(xml)\n (doc/:RequestAuth/:UserPass/:User).inner_html = 'XXXXXXXX'\n (doc/:RequestAuth/:UserPass/:Password).inner_html = 'XXXXXXXX'\n result[:xml] = ErpHelper.xml2html(doc.to_s)\n result[:street] = (doc/:BillTo/:Address/:Street).inner_text\n result[:city] = (doc/:BillTo/:Address/:City).inner_text\n result[:state] = (doc/:BillTo/:Address/:State).inner_text\n result[:zip] = (doc/:BillTo/:Address/:Zip).inner_text\n result[:country] = (doc/:BillTo/:Address/:Country).inner_text\n result[:amount] = (doc/:PayData/:Invoice/:TotalAmt).inner_text\n result[:safe_cc_number] = (doc/:Tender/:Card/:CardNum).inner_text\n result[:expiration_date] = (doc/:Tender/:Card/:ExpDate).inner_text\n result[:expiration_year] = result[:expiration_date][-4,2]\n result[:expiration_month] = result[:expiration_date][-2,2]\n return result\n end",
"def show_page_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @show_crypto = JSON.parse(@response)\n end",
"def getAccountInfo()\n tokens = session['luna_token']\n result = Hash.new\n\n #get contract ids and account id/name\n endpoint_acct = \"/papi/v0/groups/\"\n endpoint_cont = \"/papi/v0/contracts/\"\n result_acct = makeGetRequest(tokens[:baseurl], endpoint_acct, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n result_cont = makeGetRequest(tokens[:baseurl], endpoint_cont, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n\n begin\n jsonObj_acct = JSON.parse(result_acct)\n jsonObj_cont = JSON.parse(result_cont)\n\n account_id = jsonObj_acct[\"accountId\"]\n account_name = jsonObj_acct[\"accountName\"]\n contracts = jsonObj_cont[\"contracts\"]\n\n result[\"account_id\"] = account_id.nil? ? \"Please allow access to PAPI\" : account_id.split(\"_\").last\n result[\"account_name\"] = account_name.nil? ? \"Please allow access to PAPI\" : account_name\n\n if not contracts.nil?\n arr_contracts = Array.new\n contracts[\"items\"].each do |each_contract|\n contract_id = each_contract[\"contractId\"].split(\"_\").last\n arr_contracts.push({\"contractId\" => contract_id})\n end\n result[\"contracts\"] = arr_contracts\n else\n result[\"contracts\"] = \"Please allow access to PAPI\"\n end\n rescue JSON::ParserError => e\n result[\"account_id\"] = \"Please allow access to PAPI\"\n result[\"account_name\"] = \"Please allow access to PAPI\"\n result[\"contracts\"] = \"Please allow access to PAPI\"\n end\n\n #get contract name. only run when there was a contract\n if result[\"contracts\"].class == Array\n endpoint_cont_name = \"/billing-usage/v1/reportSources\"\n result_cont_name = makeGetRequest(tokens[:baseurl], endpoint_cont_name, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n begin\n jsonObj_cont_name = JSON.parse(result_cont_name)\n if jsonObj_cont_name[\"status\"] == \"ok\" and not jsonObj_cont_name[\"contents\"].nil?\n contents = jsonObj_cont_name[\"contents\"]\n contents.each do |each_content|\n result[\"contracts\"].each do |each_contract|\n if each_contract[\"contractId\"] == each_content[\"id\"] then each_contract[\"contractName\"] = each_content[\"name\"] end\n end\n end\n else\n raise JSON::ParserError\n end\n rescue JSON::ParserError => e\n result[\"contracts\"].each do |each_contract|\n each_contract[\"contractName\"] = \"Please allow access to Billing Center API v1\"\n end\n end\n end\n return result\nend",
"def charge_bill_source bill_src_id, bill_id, amount\n url = 'https://%s:@api.omise.co/charges' % [ ENV['OMISE_SECRET_KEY'] ]\n api_uri = URI.parse(url)\n # must convert amout to satang\n data = {'amount' => (amount * 100).to_i.to_s, 'currency' => 'thb', 'source' => bill_src_id.to_s,\n 'description' => 'Charge for bill id ' + bill_id.to_s}\n puts data\n res = Net::HTTP.post_form(api_uri, data)\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n puts res.body\n JSON.parse res.body\n else\n puts res.body\n puts res.error!\n\n nil\n end\n end",
"def get_warranty(serial = \"\", proxy = \"\")\n serial = serial.upcase\n warranty_data = {}\n raw_data = open('https://selfsolve.apple.com/warrantyChecker.do?sn=' + serial.upcase + '&country=USA', :proxy => \"#{proxy}\")\n warranty_data = JSON.parse(raw_data.string[5..-2])\n\n puts \"\\nSerial Number:\\t\\t#{warranty_data['SERIAL_ID']}\\n\"\n puts \"Product Decription:\\t#{warranty_data['PROD_DESCR']}\\n\"\n puts \"Purchase date:\\t\\t#{warranty_data['PURCHASE_DATE'].gsub(\"-\",\".\")}\"\n\n unless warranty_data['COV_END_DATE'].empty?\n puts \"Coverage end:\\t\\t#{warranty_data['COV_END_DATE'].gsub(\"-\",\".\")}\\n\"\n else\n puts \"Coverage end:\\t\\tEXPIRED\\n\"\n end\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def get_current_stock_data(input)\n url = \"https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}\"\n response = RestClient.get(url)\n my_response = JSON.parse(response)\n if my_response[\"Error Message\"] == \"Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY.\" || my_response[\"Note\"] == \"Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day. Please visit https://www.alphavantage.co/premium/ if you would like to target a higher API call frequency.\"\n false\n else\n daily_stock_info = my_response[\"Time Series (Daily)\"][current_date_to_YYYYMMDD]\n end\nend",
"def billing\n user_agent = request.env['HTTP_USER_AGENT']\n #parameter = Parameter.first\n transaction_id = DateTime.now.to_i\n\n request = Typhoeus::Request.new(\"http://37.0.73.3:3778\", followlocation: true, params: {transaction_id: transaction_id, msisdn: @account.msisdn, price: \"50\"})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n return ((result.strip rescue nil) == \"1\" ? true : false)\n end",
"def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend",
"def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend",
"def show\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @show_crypto = JSON.parse(@response)\n end",
"def info_request\n [:name, :symbol, :ask, :change_and_percent_change, :last_trade_date, :days_range,\n :weeks_range_52, :open, :volume, :average_daily_volume, :market_capitalization,\n :pe_ratio, :dividend_per_share, :dividend_yield, :earnings_per_share, :float_shares,\n :ebitda, :change, :close, :previous_close, :change_in_percent, :short_ratio]\n end",
"def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"def funding_info(symbol = \"fUSD\")\n authenticated_post(\"auth/r/funding/#{symbol}\").body\n end",
"def getmininginfo\n @api.request 'getmininginfo'\n end",
"def net_http_get_package_info\n thread = @thread\n timestamp = Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S\\+0000\")\n\n uri = URI(\"#{@sendsafely_url}/#{API}/package/#{@thread}/\")\n\n req = Net::HTTP::Get.new(uri)\n req['Content-Type'] = 'application/json'\n req['ss-api-key'] = @sendsafely_key_id\n req['ss-request-timestamp'] = timestamp\n req['ss-request-signature'] = OpenSSL::HMAC.hexdigest(\"SHA256\", @sendsafely_key_secret, @sendsafely_key_id+\"/#{API}/package/#{thread}\"+timestamp)\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http|\n http.request(req)\n }\n\n puts res.body\n end",
"def test_monthly_duration_products_are_present_in_summary\n activity = account_activities(:one)\n price = billing_prices(:create_one_month)\n activity.update(activity_type: 'create', price: price)\n\n response = <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <results>\n <Result Type=\"0\" Desc=\"OK\" docid=\"309902\" doctype=\"ARVE\" submit=\"Invoices\"/>\n </results>\n XML\n\n stub_request(:post, ENV['directo_invoice_url']).with do |request|\n body = CGI.unescape(request.body)\n body.include? 'month(s)'\n end.to_return(status: 200, body: response)\n\n assert_difference 'Setting.directo_monthly_number_last' do\n DirectoInvoiceForwardLegacyJob.perform_now(monthly: true, dry: false)\n end\n end",
"def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend",
"def get_current_stock_price(input)\n url = \"https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}\"\n response = RestClient.get(url)\n my_response = JSON.parse(response)\n if my_response[\"Error Message\"] == \"Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY.\" || my_response[\"Note\"] == \"Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day. Please visit https://www.alphavantage.co/premium/ if you would like to target a higher API call frequency.\"\n false\n else\n my_response[\"Time Series (Daily)\"][current_date_to_YYYYMMDD][\"1. open\"].to_f\n end\nend"
]
| [
"0.56957513",
"0.56536996",
"0.5617652",
"0.55346733",
"0.54489124",
"0.54278827",
"0.54152215",
"0.5404938",
"0.5353512",
"0.53332824",
"0.53332824",
"0.5309007",
"0.5282927",
"0.52481157",
"0.5220851",
"0.5192615",
"0.5178005",
"0.51483846",
"0.5146838",
"0.51355654",
"0.51355654",
"0.51354325",
"0.51305455",
"0.5122978",
"0.5105721",
"0.50868756",
"0.5085202",
"0.5082112",
"0.50766224",
"0.5070944"
]
| 0.56641144 | 1 |
Create a new Response object for the given Net::SFTP::Request instance, and with the given data. If there is no :code key in the data, the code is assumed to be FX_OK. | def initialize(request, data={}) #:nodoc:
@request, @data = request, data
@code, @message = data[:code] || FX_OK, data[:message]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_with_code(code, subcode)\n OpenStruct.new(name: code_name(code), code: code, subcode: subcode)\n end",
"def initialize(data, status_code)\n @data = data\n @statusCode = status_code\n end",
"def _success(data,code)\n status code\n response.headers['Content-Type'] = 'application/json'\n body(data.to_json)\n end",
"def initialize(code, object = nil, status = nil, aditional_data = nil, data_root = :message)\n aditional_data = {} unless aditional_data\n response = {\n :status => status || \"success\",\n :code => code,\n :message => Response::message(code)\n }.merge(aditional_data)\n\n if object\n @_object = object\n response[:data] = {data_root => @_object}\n end\n\n @object = OpenStruct.new(response)\n end",
"def rest_ok_response(data = nil, opts = {})\n data ||= {}\n if encode_format = opts[:encode_into]\n # This might be a misnomer in taht payload is still a hash which then in RestResponse.new becomes json\n # for case of yaml, the data wil be a string formed by yaml encoding\n data =\n case encode_format\n when :yaml then encode_into_yaml(data)\n else fail Error.new(\"Unexpected encode format (#{encode_format})\")\n end\n end\n\n payload = { status: :ok, data: data }\n payload.merge!(datatype: opts[:datatype]) if opts[:datatype]\n\n # set custom messages in response\n [:info, :warn, :error].each do |msg_type|\n payload.merge!(msg_type => opts[msg_type]) if opts[msg_type]\n end\n\n RestResponse.new(payload)\n end",
"def api_response(*args) # :nodoc:\n code = args.first\n args.shift\n\n err = @@ERROR_CODES[code] || @@ERROR_CODES[:unknown]\n render :json => {\n :error => {\n :code => err[0],\n :message => err[1],\n },\n :content => args.first,\n }, :status => err[2]\n end",
"def send_by_code request, response, code, headers = {}\n\t\t\t\tbegin\n\t\t\t\t\tresponse.status = code\n\t\t\t\t\theaders.each {|k, v| response[k] = v}\n\t\t\t\t\treturn ErrorCtrl.new(request, response).index\n\t\t\t\trescue => e\n\t\t\t\t\tPlezi.error e\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend",
"def success_response code, meta, data\n render status: code,\n json: {\n meta: meta,\n data: data\n }\n end",
"def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend",
"def generic(code)\n {}.tap do |data|\n data[:errors] = { code: code, message: status.fetch(code.to_s.to_sym) }\n end\n end",
"def success_with_data(data)\n\n # Allow only Hash data to pass ahead\n data = {} unless Util::CommonValidator.is_a_hash?(data)\n\n OstKycSdkRuby::Util::Result.success({data: data})\n\n end",
"def response code, desc, media_type = nil, data: { }, type: nil\n self[:responses][code] = ResponseObj.new(desc) unless (self[:responses] ||= { })[code].is_a?(ResponseObj)\n self[:responses][code].add_or_fusion(media_type, { data: type || data })\n end",
"def response code=nil, body=nil, headers=nil\n args = [code, body, headers].compact\n\n headers = {'Content-Type' => DEFAULT_CONTENT_TYPE}\n code = 200\n body = \"\"\n\n args.each do |arg|\n case arg\n when Hash then headers.merge!(arg)\n when String then body = arg\n when Integer then code = arg\n end\n end\n\n [code, headers, body]\n end",
"def initialize(code)\n raise StatusCodeError, \"Invalid status code: #{code}\" unless StatusCode.valid_code?(code)\n case code\n when String\n if (code =~ /^[\\d]{3}/).nil? # wildcards or idk\n @code = code.downcase\n @exact = @code == 'idk'\n else # whole number\n @code = code.to_i\n @exact = true\n end\n when Recluse::StatusCode\n @code = code.code\n @exact = code.exact\n when Integer\n @code = code\n @exact = true\n end\n end",
"def raw_data_to_response_object(data)\n case data['status']\n when 'success'\n if data['flags']['paginated'] && data['data'].is_a?(Array)\n MoonropeClient::Responses::PaginatedCollection.new(self, data)\n else\n MoonropeClient::Responses::Success.new(self, data)\n end\n when 'parameter-error' then MoonropeClient::Responses::ParameterError.new(self, data)\n when 'access-denied' then MoonropeClient::Responses::AccessDenied.new(self, data)\n when 'validation-error' then MoonropeClient::Responses::ValidationError.new(self, data)\n else\n MoonropeClient::Response.new(self, data)\n end\n end",
"def build_success_output(data)\n\t \t{data: data, code: 200, result: \"success\"}\n\t end",
"def structure_with_code(code)\n structure = Baps::Responses::Structures.structure(code)\n structure.nil? ? unknown_response(code) : structure.clone\n end",
"def responder(code=:ok, message=nil, args=nil)\n message ||= default_message[code]\n args ||= {}\n if code == :ok\n return render json: {status: 'success', success: true, message: message}.merge(args), status: code\n else\n return render json: {status: 'error', errors: message, success: false, message: message}.merge(args), status: code\n end\n end",
"def response code, desc, media_type = nil, hash = { }\n (self[:responses] ||= { })[code] = ResponseObj.new(desc, media_type, hash)\n end",
"def generate_response(code, format)\n @message = \"Returning code #{code} in #{format} format\"\n response_data = case format\n when \"txt\"\n content_type 'text/plain'\n @message\n when \"json\"\n content_type 'application/json'\n { message: @message }.to_json\n when \"xml\"\n content_type 'application/xml'\n erb :'status.xml', layout: false\n else\n erb :status\n end\n [code.to_i, response_data]\nend",
"def challenge_response(challenge_code)\n {\n :body => challenge_code,\n :status => 200\n }\n end",
"def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end",
"def prepare_status_response( request, status_info )\n\t\tstatus_code, message = status_info.values_at( :status, :message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\trequest.notes[:status_info] = status_info\n\t\tresponse = request.response\n\t\tresponse.reset\n\t\tresponse.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it. Append the\n\t\t# message for those that allow one.\n\t\tunless request.verb == :HEAD || response.bodiless?\n\t\t\tself.log.debug \"Writing plain-text response body: %p\" % [ message ]\n\t\t\tresponse.content_type = 'text/plain'\n\t\t\tresponse.puts( message )\n\t\tend\n\n\t\t# Now assign any headers to the response that are part of the status\n\t\tif status_info.key?( :headers )\n\t\t\tstatus_info[:headers].each do |hdr, value|\n\t\t\t\tresponse.headers[ hdr ] = value\n\t\t\tend\n\t\tend\n\n\t\treturn response\n\tend",
"def status(code)\n response.status = code\n end",
"def initialize(status = nil, message = nil, data = nil, code = nil)\n @status = status\n @message = message\n @data = data\n @code = code\n end",
"def create_success_response\n response = {\n body: {\n status: \"ok\"\n },\n status: 200\n }\n return response\n end",
"def type\n case code\n when 100..199 then :informational_response\n when 200..299 then :success\n when 300..399 then :redirection\n when 400..499 then :client_error\n when 500..599 then :server_error\n else :unknown\n end\n end",
"def check_response(code = :success, expected_msg = nil, line = nil)\n line = line ? \" [*_test:\" + line.to_s + \"]\" : \"\"\n assert_response code, \"expected \" + code.to_s + \", server response: \" + response.body.to_s + line\n if (code.class == Symbol)\n # Not sure why this list isn't the right one: (has :ok instead). Should fix once...\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:success] = 200\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:redirect] = 302\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code]\n end\n return if (code == 302) # redirect, html body\n\n body = JSON.parse(response.body)\n #Success payloads should contain one of these.\n assert (body[0] && body[0][\"server_time\"]) ||\n body[\"status\"] == code ||\n body[\"status\"] == \"destroyed\" ||\n body[\"server_time\"] ||\n body[\"device_id\"] ||\n body[\"key_data\"] ||\n body[\"authtoken\"], \"success payload not one of the usual patterns\" + line\n return if ! expected_msg\n\n if expected_msg.class == Symbol\n expected_msg = ApplicationController.MESSAGES[expected_msg]\n assert expected_msg != nil, \"oops, your check_response passed a non-existant expected message symbol!\" + line\n end\n\n if (code == 200)\n return assert body[\"message\"] = expected_msg, \"wrong message\" + line\n end\n\n # Simple generic check against message template to see that we got\n # the right one - there will be at least 12 chars without a\n # substitution at either start or end in all our MESSAGES strings.\n # Or a whole string without formatting anywhere (when array of validation errors is stringified).\n len = 12\n ret_msg = body[\"error\"]\n # Handle short expected strings (INVALID_PARAM)\n assert ret_msg.start_with?(expected_msg.first(len)) ||\n ret_msg.end_with?(expected_msg.last(len)) ||\n ret_msg.include?(expected_msg),\n \"reply error message doesn't match:\\\"\" + ret_msg + \"\\\"!=\\\"\"+ expected_msg + \"\\\"\" + line\n end",
"def code\n response&.code\n end",
"def prepare_status_response( txn, status_code, message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\ttxn.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it.\n\t\tunless BODILESS_HTTP_RESPONSE_CODES.include?( status_code )\n\t\t\ttxn.content_type = 'text/plain'\n\t\t\treturn message.to_s\n\t\tend\n\n\t\t# For bodiless responses, just tell the dispatcher that we've handled \n\t\t# everything.\n\t\treturn true\n\tend"
]
| [
"0.6052174",
"0.55225223",
"0.5418228",
"0.5374258",
"0.5374032",
"0.5334785",
"0.53197",
"0.530625",
"0.5239993",
"0.5202389",
"0.51979333",
"0.5196144",
"0.5151053",
"0.5093738",
"0.5084425",
"0.5067291",
"0.50454336",
"0.4987059",
"0.49779797",
"0.4945318",
"0.49262756",
"0.491224",
"0.4896716",
"0.48784178",
"0.48720744",
"0.48579836",
"0.48528826",
"0.48324132",
"0.48228306",
"0.4819088"
]
| 0.57564694 | 1 |
Returns +true+ if the status code is FX_OK; +false+ otherwise. | def ok?
code == FX_OK
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ok?\n @status == OK\n end",
"def is_ok?\n code == OK_CODE\n end",
"def success?\n (status_code.to_s =~ /2../) ? true : false\n end",
"def ok?\n @status == 200\n end",
"def is_successful?\n status_code == '0'\n end",
"def success?\n\t\t!!( @status and @status.exitstatus == 0 )\n\tend",
"def success?\n status == \"ok\"\n end",
"def successful?\n status_code == 0 ? true : false\n end",
"def ok?\n @result.code.to_i != 200\n end",
"def check\n @response = get_fixity_response_from_fedora\n status.match(\"SUCCESS\") ? true : false\n end",
"def success?\n @status.between?(200, 299) if @status\n end",
"def success?\n @data[:status_code] == '200' || @data[:status_code] == '201' || @data[:status_code] == '407'\n end",
"def success?\n code == 200\n end",
"def success?\n status < 400\n end",
"def success?\n response.message == 'OK'\n end",
"def complete?\n status_code == 'OK'\n end",
"def ok?\n @result.retval == 0\n end",
"def successful?\n (200...300).include?(@status_code)\n end",
"def success?\n [200, 201, 204, 280, 281].include?(code)\n end",
"def success?\n status == 200\n end",
"def is_ok?\n return (self.status == HostResult::STATUS_OK)\n end",
"def ok?\n return @data[\"stat\"] == \"ok\" ? true : false\n end",
"def is_ok\n [\"OK\", \"QueuedForProcessing\"].include?(code);\n end",
"def status\n return false if [email protected]?(200)\n \n true\n end",
"def success?\n 200 <= code && code < 300\n end",
"def successful?\n @code == 0\n end",
"def ok?(code)\n [200, 201, 202, 204, 206].include?(code)\n end",
"def success?\n @status == SUCCESS_FLAG\n end",
"def successful?\n !!get_status_method\n end",
"def success?\n @status >= 200 && @status < 300\n end"
]
| [
"0.74520737",
"0.7108859",
"0.7098609",
"0.7043127",
"0.7035813",
"0.6967889",
"0.6966165",
"0.6905255",
"0.6896311",
"0.6857539",
"0.6839474",
"0.6802789",
"0.6788055",
"0.6776196",
"0.6763993",
"0.6753299",
"0.6742513",
"0.6727451",
"0.6726015",
"0.6707289",
"0.6688147",
"0.6682339",
"0.6676614",
"0.66712093",
"0.66592515",
"0.6651976",
"0.66371024",
"0.66367567",
"0.66174257",
"0.66072327"
]
| 0.83634627 | 0 |
Returns +true+ if the status code is FX_EOF; +false+ otherwise. | def eof?
code == FX_EOF
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n return @stream.eof?\n end",
"def eof?\n io.eof?\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n if @buffer.size > 0\n false\n else\n @io.eof?\n end\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @stream.eof?\n end",
"def eof?\n @io.closed? || @io.eof?\n end",
"def eof_found?\n @eof_found\n end",
"def eof?\r\n false\r\n end",
"def eof?\n raise IOError, 'not opened for reading' if closed?\n @total == @size && @buffer.empty?\n end",
"def eof?\n wait_for_chars(1)\n @cursor == @buffer.length && @eof_found\n end",
"def eof_flag\n @eof_flag\n end",
"def eof?\n ready_token\n if @buffer\n @buffer.empty? && @io.eof?\n else\n @io.eof?\n end\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?\n !@io || (@io.closed? || @io.eof?) && @buffer.empty?\n end",
"def eof?\n !@io || (@io.closed? || @io.eof?) && @buffer.empty?\n end",
"def eof?\n stream = @_st_stream\n stream and stream.eof?\n end",
"def eof?\n @pos == @data.bytesize\n end",
"def eof?()\n #This is a stub, used for indexing\n end",
"def eof?\n end",
"def eof?\n @input.eof?\n end"
]
| [
"0.7336073",
"0.7336073",
"0.7336073",
"0.72984815",
"0.72851884",
"0.7255248",
"0.7255248",
"0.7255248",
"0.72539973",
"0.7221933",
"0.7221933",
"0.7221933",
"0.7211516",
"0.71952873",
"0.71592677",
"0.7016629",
"0.6980623",
"0.6976482",
"0.69627213",
"0.69623184",
"0.6924465",
"0.6924465",
"0.6924465",
"0.69140244",
"0.69140244",
"0.69095737",
"0.6903747",
"0.6900224",
"0.68684834",
"0.683556"
]
| 0.8081804 | 0 |
GET /polling_sessions/new GET /polling_sessions/new.json | def new
@polling_session = PollingSession.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @polling_session }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @polling_session = PollingSession.new(params[:polling_session])\n\n respond_to do |format|\n if @polling_session.save\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }\n format.json { render json: @polling_session, status: :created, location: @polling_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @session = Session.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end",
"def new\r\n @session = Session.new\r\n @session.state = 'waiting'\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @session }\r\n format.json { render :json => @session }\r\n end\r\n end",
"def new\n @session = Session.new\n\n respond_to do |format|\n format.json { render json: @session }\n format.html # new.html.erb\n end\n end",
"def new\n @user_session ||= UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_session }\n end\n end",
"def new\n @ykt_session = YktSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ykt_session }\n end\n end",
"def new\n @session_type = SessionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session_type }\n end\n end",
"def new\n @yoga_session = YogaSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yoga_session }\n end\n end",
"def new\n @heartbeat = Heartbeat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heartbeat }\n end\n end",
"def new\n @discovery_session = DiscoverySession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discovery_session }\n end\n end",
"def new\n @session = Session.new\n\n render 'sessions/login'\n #respond_to do |format|\n # format.html # new.html.erb\n #format.json { render json: @session }\n # end\n end",
"def new\n @session_info = SessionInfo.new\n @downloads = Download.all(order: 'name')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session_info }\n end\n end",
"def new\n @tutoring_session = TutoringSession.new\n #@tutoring_session = TutoringSession.new\n @tutoring_session.user_id = current_user.id if !current_user.nil?\n @tutoring_session.start_time = Time.now\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutoring_session }\n end\n end",
"def create\n @current_session = CurrentSession.new(params[:current_session])\n\n if @current_session.save\n render json: @current_session, status: :created, location: @current_session\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def new\n @training_session = TrainingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_session }\n end\n end",
"def new\n return false if !userCan :timer\n @timer = Timer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timer }\n end\n end",
"def generateSession\n sessionId = SecureRandom.base58(24)\n @test.update(session_id: sessionId)\n\n # set expiry date to 15 minutes from now\n @test.update(session_expired_at: Time.now + 15*60)\n\n render json: sessionId\n end",
"def new\n @interval = Interval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interval }\n end\n end",
"def new\n @chatroom = Chatroom.new\n @user = User.find(session[:user_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chatroom }\n end\n end",
"def new\n session[:guests] = nil\n @guest_response = GuestResponse.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guest_response }\n end\n end",
"def new\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n @timetable = Timetable.new\n puts @timetable.to_json\n end",
"def new \n unless current_user.nil?\n redirect_to backend_root_url\n return\n end\n \n @user_session = UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_session }\n end\n end",
"def new\n debugger\n flash[:failure_provider] = request.env['omniauth.error.strategy'].name\n flash[:failre_type] = request.env['omniauth.error.type']\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end",
"def new\n @user_session = UserSession.new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n end",
"def create\n config_opentok\n session = @opentok.create_session request.remote_addr\n params[:room][:sessionId] = session.session_id\n \n @room = Room.new(params[:room])\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render json: @room, status: :created, location: @room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @session = Session.new\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 @title = \"Create a New Training Session\"\n session[:interval_order] = nil\n @trainingsession = Trainingsession.new\n @trainingsession.interval.build\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trainingsession }\n end\n end",
"def new\n @session = Session.new('')\n end"
]
| [
"0.7200673",
"0.6922426",
"0.68400216",
"0.679016",
"0.66888666",
"0.6647991",
"0.63777757",
"0.63396496",
"0.6328666",
"0.6305696",
"0.6293725",
"0.62511176",
"0.6195757",
"0.61729836",
"0.6103391",
"0.60841775",
"0.6060703",
"0.6017639",
"0.59978026",
"0.5979473",
"0.59757984",
"0.5970026",
"0.5963199",
"0.59619206",
"0.59495044",
"0.5942145",
"0.5937317",
"0.5936691",
"0.59267014",
"0.5923181"
]
| 0.80017734 | 0 |
POST /polling_sessions POST /polling_sessions.json | def create
@polling_session = PollingSession.new(params[:polling_session])
respond_to do |format|
if @polling_session.save
format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }
format.json { render json: @polling_session, status: :created, location: @polling_session }
else
format.html { render action: "new" }
format.json { render json: @polling_session.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @polling_session = PollingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polling_session }\n end\n end",
"def create_single_poll_session(poll_id,poll_sessions__course_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :poll_sessions__course_id__ => poll_sessions__course_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def start_session(nick)\n usr = User.first(:nickname=>params[:nickname])\n p User.all\n if usr != nil\n sid = gen_sessionid\n\n #associate nick with sid & IP & communication password\n $sessions[nick] = {:ip=>@env['REMOTE_ADDR'], :sid=> sid, :lastrequest=> Time.now.to_i}\n\n #return JSON with sessionid\n return {:sid => sid}\n end\n return 'error'\nend",
"def list_opened_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/opened\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def generateSession\n sessionId = SecureRandom.base58(24)\n @test.update(session_id: sessionId)\n\n # set expiry date to 15 minutes from now\n @test.update(session_expired_at: Time.now + 15*60)\n\n render json: sessionId\n end",
"def list_poll_sessions_for_poll(poll_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def index\n active_sessions = []\n my_sessions = []\n history_sessions = []\n join_sessions = current_user.join_sessions\n Session.all.each { |session|\n if session.user_id == current_user.id\n my_sessions.push session_srz(session)\n elsif join_sessions.any? {|js| js.session_id == session.id} and session.close\n history_sessions.push session_srz(session)\n else\n active_sessions.push session_srz(session)\n end\n }\n\n\n json_object = {\n data: {\n active_sessions: active_sessions,\n my_sessions: my_sessions,\n history_sessions: history_sessions\n #history_sessions: current_user.join_sessions\n }\n }\n\n render json: json_object,\n status: :ok,\n include: %w(session.lock)#nil\n\n #ok_request render_json#, %w(user)\n end",
"def submitSessionInfos\n # check if data submission is offline\n is_offline_sensor_data_collection = false\n\n # not having valid device id or device type. \n if params.has_key?(:uid) == true && !params[:uid].empty?\n @deviceType = nil\n if (\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil || \n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n if (\n params.has_key?(:sensor_infos) == false || params[:sensor_infos].empty? || \n params[:sensor_infos].kind_of?(Array) == false || params[:sensor_infos].count == 0\n )\n render json: { 'status' => 'OK' }.to_json\n end\n\n # check device pairing. \n @deviceId = params[:did]\n if isPairedDeviceValid(@deviceId, params[:uid]) == false\n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n needToCreateSession = false\n if params.has_key?(:is_initiator) && params[:is_initiator] == true\n needToCreateSession = true\n else\n # check if devicepairconnotp is not expired yet\n @devicepairconnections = @devicepairs.ute_device_pair_connections.where(\n :expire_by.gte => Time.now.getutc.to_f, \n :is_active => true\n )\n firststartdate = params[:sensor_infos][0][:t]\n @devicepairconnections.each do |devicepairconnection|\n si = devicepairconnection.ute_ex_session\n unless si.nil?\n if firststartdate > si.range_start_at && firststartdate < si.range_end_at \n #found the paired connection\n @devicepairconnection = devicepairconnection\n @session = @devicepairconnection.ute_ex_session\n break\n end\n end\n end\n\n if @devicepairconnection == nil && @session == nil \n #session to pair is not found\n render json: { 'status' => 'FAILED', 'code' => 404 }.to_json\n return\n end\n end\n\n if needToCreateSession \n # create new session\n @sessionId = generateNewSessionId\n\n while isSessionIdAlreadyExist(@experiment.experiment_code, @sessionId) do\n @sessionId = generateNewSessionId\n end\n\n @session = @experiment.ute_ex_sessions.create!(\n session_code: @sessionId,\n is_active: true,\n initiated_by_device_id: @deviceId,\n is_created_offline: true\n )\n end\n\n if @session\n @sessionConnection = @session.ute_ex_session_connections.create!(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: params[:sensor_infos][0][:t])\n \n @devicepairconnotp = generateNewDevicePairConnOtp\n\n while isActiveDevicePairConnOtpAlreadyExist(@devicepairs, @devicepairconnotp) do\n @devicepairconnotp = generateNewDevicePairConnOtp\n end\n\n dpc = @devicepairs.ute_device_pair_connections.new(\n is_active: true,\n otp: @devicepairconnotp,\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME, \n ute_ex_session: @session\n )\n dpc.save! \n\n @session.ute_device_pair_connection = dpc\n @session.save!\n\n is_offline_sensor_data_collection = true\n end\n end \n\n if isDataSubmissionInvalidForExpAndSession(request, params) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n begin\n if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n UteDataSubmissionService.delay.handlesensorinfos(@session, @sessionConnection, params)\n end\n rescue => e\n puts(e.message)\n raise 'an error has occured'\n #puts(e.backtrace.join(\"\\n\"))\n end\n\n #begin\n # if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n # puts('receiving first item: ' + params[:sensor_infos][0][:t].to_s)\n # end\n #rescue => e\n # puts('TRY TO RESCUE')\n #\n # puts(e.message)\n # raise 'an error has occured'\n # #puts(e.backtrace.join(\"\\n\"))\n #end\n\n if @devicepairconnection != nil && is_offline_sensor_data_collection \n #otp needs to be renewed\n @devicepairconnection.update_attributes(\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME\n )\n end \n \n if is_offline_sensor_data_collection\n render json: { 'status' => 'OK', 'otp' => @devicepairconnotp, 'session_id' => @session.session_code }.to_json\n else\n render json: { 'status' => 'OK' }.to_json\n end\n end",
"def list_closed_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/closed\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def create\n @session = @event.sessions.new(params[:session])\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render json: [@event, @session], status: :created, location: [@event, @session] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def on_new_session(session)\n self.session_count += 1\n self.successful = true\n end",
"def refresh_session_token\n session_signature = Digest::MD5.hexdigest(@toodle_uid + Babar::Base.toodle_app_token) \n session_token_url = \"http://api.toodledo.com/2/account/token.php?\" + self.parse_params({:userid => @toodle_uid, :appid => Babar::Base.toodle_app_id , :sig => session_signature,})\n puts session_signature, session_token_url\n @session_token = JSON.parse(Typhoeus::Request.get(session_token_url).body)[\"token\"]\n @toodle_token_death = Time.now + Babar::Base.toodle_app_token_lifetime\n [@session_token, @toodle_token_death]\n end",
"def create\n session = Session.new\n session.name = params[:name]\n session.description = params[:description]\n session.start_time = params[:date]\n # TODO: need date\n # TODO: need topic\n session.active = true;\n # add ot_session.id\n ot_session = @@opentok.create_session({media_mode: :routed})\n session.session_id = ot_session.session_id\n # try and save the session\n saved = session.save\n # add moderators\n params[:moderators].each do |moderator|\n SessionUser.create(session_id: session.id, user_id: moderator[:id], role: 'moderator', center_stage: true)\n end\n # add subscribers\n params[:subscribers].each do |subscriber|\n puts subscriber\n SessionUser.create(session_id: session.id, user_id: subscriber[:id], role: 'publisher', center_stage: false)\n end\n if saved\n render json: {message: \"Event: #{session.name} successfully added\"}, status: 200\n else\n render json: {errors: session.errors.to_json}, status: 500\n end\n end",
"def check_session\n data = { :account => Encryptor.encrypt({:id => id, :phone => phone, :password => password}.to_json, :key => $secret_key) }\n\n response = RestClient.post \"#{$service_url}/api/account/check_session\", data, { :content_type => :json, :accept => :json }\n\n JSON.parse(response)\n rescue => error\n { :session => false }\n end",
"def create\n @session = Session.new(session_params)\n\n newYear = session_params[\"sessionDate(1i)\"]; # year\n newMonth = session_params[\"sessionDate(2i)\"]; # month\n newDay = session_params[\"sessionDate(3i)\"]; # day\n newHour = session_params[\"sessionDate(4i)\"]; # hour\n newMin = session_params[\"sessionDate(5i)\"]; # minute\n sessionLen = session_params[\"sessionLength\"]; # session length\n sessionLen = (sessionLen.to_i + 15)/60; # 15 minute break between sessions\n \n newDate = Time.new(newYear, newMonth, newDay, newHour, newMin);\n \n #temporarily hardcoding open/close times. \n openHour = Time.new(newYear, newMonth, newDay, 9, 0);\n closeHour = Time.new(newYear, newMonth, newDay, 21, 0);\n \n #temporarily hardcoding lunch hours\n lunchHour = Time.new(newYear, newMonth, newDay, 12, 0);\n \n validSessionTime = isValidSessionTime(newDate, openHour, closeHour, lunchHour, sessionLen)\n \n respond_to do |format|\n if validSessionTime\n format.html { render :new }\n flash[:alert] = \"Session unavailable at that time.\"\n else\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def reset_session_clock\n render json: { status: 'ok' }\n end",
"def create\n config_opentok\n session = @opentok.create_session request.remote_addr\n params[:room][:sessionId] = session.session_id\n \n @room = Room.new(params[:room])\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render json: @room, status: :created, location: @room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end",
"def create\n \n # remove any existing session of this user\n # TODO: update custom validations in model to work with this\n @session = Session.where(\"sender_id = #{session_params[:sender_id]} OR recipient_id = #{session_params[:sender_id]}\").first\n @session.destroy if @session\n \n @session = Session.new(session_params)\n \n if @session.valid?\n @session.session_id = Session.createSession(request.remote_addr).to_s\n @session.sender_token = Session.generateToken(@session.session_id, @session.sender.id.to_s)\n @session.recipient_token = Session.generateToken(@session.session_id, @session.recipient.id.to_s)\n end\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render action: 'show', status: :created, location: @session }\n else\n format.html { render action: 'new' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return unless restrict_to_hosts\n\n @session = @event.sessions.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: [@event, @session] }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ykt_session = YktSession.new(params[:ykt_session])\n\n respond_to do |format|\n if @ykt_session.save\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully created.' }\n format.json { render json: @ykt_session, status: :created, location: @ykt_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @session = SessionService.new(current_user).create_from_web! session_params\n\n respond_to do |format|\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created }\n end\n end",
"def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end",
"def create\n if Rails.env == 'development'\n Rails.logger.debug \"Cookies:\\n\" + cookies.to_yaml\n Rails.logger.debug \"Session:\\n\" + session.to_yaml\n end\n \n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n @user_session.user.reset_appearance!\n \n # Make sure any stale forum logins are cleared\n cookies[\"Vanilla\"] = {:value => \"\", :domain => \".worlize.com\"}\n cookies[\"Vanilla-Volatile\"] = {:value => \"\", :domain => \".worlize.com\"}\n\n # default_url = enter_room_url(@user_session.user.worlds.first.rooms.first.guid)\n default_url = enter_room_url(Room.gate_room_guid)\n\n format.html { redirect_back_or_default(default_url) }\n format.json do\n render :json => {\n :success => true,\n :redirect_to => get_redirect_back_or_default_url(default_url)\n }\n end\n else\n format.html { render :action => \"new\" }\n format.json do\n render :json => {\n :success => false\n }\n end\n end\n end\n end",
"def create\n @current_session = CurrentSession.new(params[:current_session])\n\n if @current_session.save\n render json: @current_session, status: :created, location: @current_session\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def refresh_session\n \t@watson_message = RoomMessage.create user: current_user,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\troom: @room,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twatsonmsg: true,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"The session has expired. Starting a new chat.\",\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: @room.params\n\t\tRoomChannel.broadcast_to @room, @watson_message\n\n\t\tauthenticator = Authenticators::IamAuthenticator.new(\n\t\t\tapikey: @room.apikey\n\t\t)\n\t\tassistant = AssistantV2.new(\n\t\t\tversion: \"2019-02-28\",\n\t\t\tauthenticator: authenticator\n\t\t)\n\t\tassistant.service_url = @room.serviceurl\t\n\t\tresponse = assistant.create_session(\n\t\t\tassistant_id: @room.assistantid\n\t\t)\n\t\[email protected] = response.result[\"session_id\"]\n\t\[email protected]\n\t\t\n\t\t@welcome_message = RoomMessage.create user: current_user,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\troom: @room,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twatsonmsg: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"Welcome to Movie On Rails! How can I help you?\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: @room.params\n\t\tRoomChannel.broadcast_to @room, @welcome_message\n end",
"def start_session(endpoint); end",
"def create\n @manager_session = ManagerSession.create(ManagerSession.all_sessions_endpoint)\n respond_to do |format|\n format.html { redirect_to manager_sessions_path }\n format.json { render :show, status: :created, location: @manager_session }\n end\n if @manager_session.count > 50000000\n @manager_session.first.delete\n end\n end",
"def post_params(path, params, session)\n post path, params, {\"rack.session\" => {\"uid\" => session['uid']}}\n end"
]
| [
"0.6141677",
"0.6007205",
"0.59136736",
"0.59000343",
"0.58953667",
"0.58930206",
"0.58599037",
"0.58243406",
"0.5788784",
"0.57812786",
"0.5772482",
"0.5752685",
"0.5741058",
"0.57021147",
"0.57020754",
"0.56545407",
"0.56434214",
"0.5627708",
"0.5618583",
"0.55769926",
"0.5556405",
"0.5540935",
"0.5533976",
"0.5524472",
"0.55227447",
"0.55197316",
"0.54965997",
"0.54944587",
"0.5492625",
"0.54366267"
]
| 0.6964131 | 0 |
PUT /polling_sessions/1 PUT /polling_sessions/1.json | def update
@polling_session = PollingSession.find(params[:id])
respond_to do |format|
if @polling_session.update_attributes(params[:polling_session])
format.html { redirect_to @polling_session, notice: 'Polling session was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @polling_session.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_single_poll_session(poll_id,id,poll_sessions__course_id__,poll_sessions__course_section_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n raise \"poll_sessions__course_section_id__ is required\" if poll_sessions__course_section_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id,\n :poll_sessions__course_id__ => poll_sessions__course_id__,\n :poll_sessions__course_section_id__ => poll_sessions__course_section_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end",
"def create\n @polling_session = PollingSession.new(params[:polling_session])\n\n respond_to do |format|\n if @polling_session.save\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }\n format.json { render json: @polling_session, status: :created, location: @polling_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @current_session = CurrentSession.find(params[:id])\n\n if @current_session.update(params[:current_session])\n head :no_content\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def update\n @session = Session.find_by_id(params[:id])\n\n if @session.nil?\n render json: {message: \"404 Not Found\"}, status: :not_found\n else\n @session.update(session_params)\n end\n end",
"def update\r\n @session = Session.find(params[:id])\r\n\r\n\r\n json = ActiveSupport::JSON.decode(request.raw_post)\r\n logger.debug json\r\n\r\n #@session.pla\r\n\r\n #json = ActiveSupport::JSON.decode(request.raw_post)\r\n #@session.state = json['state']\r\n\r\n respond_to do |format|\r\n if @session.save\r\n format.html { redirect_to(@session, :notice => 'Session was successfully updated.') }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\r\n format.json { render :json => @session.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @session_resource = SessionResource.find(params[:id])\n\n if @session_resource.update(session_resource_params)\n head :no_content\n else\n render json: @session_resource.errors, status: :unprocessable_entity\n end\n end",
"def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end",
"def update\n if @session\n @session.update_session(marshalize(@data))\n end\n end",
"def update\n @session = Session.find(params[:id])\n authorize @session\n @session.update(session_params)\n redirect_to trainings_path\n end",
"def _session_update sid = \"\", uid = 0\n\t\tds = DB[:_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend",
"def update\n params[:trainingsession][:existing_interval_attributes] ||= {}\n @trainingsession = Trainingsession.find(params[:id])\n\n respond_to do |format|\n if @trainingsession.update_attributes(params[:trainingsession])\n flash[:notice] = 'Trainingsession was successfully updated.'\n format.html { redirect_to(@trainingsession) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trainingsession.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reset_session_clock\n render json: { status: 'ok' }\n end",
"def update\n @sessions = SessionEvent.find(params[:id])\n if @sessions.update_attributes(session_event_params)\n flash[:success] = \"Your session has been updated\"\n redirect_to @sessions\n end\n respond_to do |format|\n if @session_event.update(session_event_params)\n format.html { redirect_to @session_event, notice: 'Session event was successfully updated.' }\n format.json { render :show, status: :ok, location: @session_event }\n else\n format.html { render :edit }\n format.json { render json: @session_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lift_session.update(lift_session_params)\n format.html { redirect_to @lift_session, notice: 'Lift session was successfully updated.' }\n format.json { render :show, status: :ok, location: @lift_session }\n else\n format.html { render :edit }\n format.json { render json: @lift_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n if @ykt_session.update_attributes(params[:ykt_session])\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @otg_sess.update(otg_sess_params)\n format.html { redirect_to @otg_sess, notice: 'Otg sess was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_sess }\n else\n format.html { render :edit }\n format.json { render json: @otg_sess.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_session(data)\n connection = self.class.session_connection\n if @id\n # if @id is not nil, this is a session already stored in the database\n # update the relevant field using @id as key\n if SmartSession::SqlSession.locking_enabled?\n self.class.query(\"UPDATE #{SmartSession::SqlSession.table_name} SET `updated_at`=NOW(), `data`=#{self.class.quote(data)}, lock_version=lock_version+1 WHERE id=#{@id}\")\n @lock_version += 1 #if we are here then we hold a lock on the table - we know our version is up to date\n else\n self.class.query(\"UPDATE #{SmartSession::SqlSession.table_name} SET `updated_at`=NOW(), `data`=#{self.class.quote(data)} WHERE id=#{@id}\")\n end\n else\n # if @id is nil, we need to create a new session in the database\n # and set @id to the primary key of the inserted record\n self.class.query(\"INSERT INTO #{SmartSession::SqlSession.table_name} (`created_at`, `updated_at`, `session_id`, `data`) VALUES (NOW(), NOW(), '#{@session_id}', #{self.class.quote(data)})\")\n @id = connection.last_id\n @lock_version = 0\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_session(env, sid, session, options); end",
"def update\n return unless restrict_to_hosts\n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: [@event, @session] }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session_time.update(session_time_params)\n format.html { redirect_to @session_time, notice: 'Session time was successfully updated.' }\n format.json { render :show, status: :ok, location: @session_time }\n else\n format.html { render :edit }\n format.json { render json: @session_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @polling_session = PollingSession.find(params[:id])\n @polling_session.destroy\n\n respond_to do |format|\n format.html { redirect_to polling_sessions_url }\n format.json { head :no_content }\n end\n end",
"def update\n @yoga_session = YogaSession.find(params[:id])\n\n respond_to do |format|\n if @yoga_session.update_attributes(params[:yoga_session])\n format.html { redirect_to @yoga_session, notice: 'Yoga session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yoga_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refresh_session_token\n session_signature = Digest::MD5.hexdigest(@toodle_uid + Babar::Base.toodle_app_token) \n session_token_url = \"http://api.toodledo.com/2/account/token.php?\" + self.parse_params({:userid => @toodle_uid, :appid => Babar::Base.toodle_app_id , :sig => session_signature,})\n puts session_signature, session_token_url\n @session_token = JSON.parse(Typhoeus::Request.get(session_token_url).body)[\"token\"]\n @toodle_token_death = Time.now + Babar::Base.toodle_app_token_lifetime\n [@session_token, @toodle_token_death]\n end",
"def refresh_session\n \t@watson_message = RoomMessage.create user: current_user,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\troom: @room,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twatsonmsg: true,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"The session has expired. Starting a new chat.\",\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: @room.params\n\t\tRoomChannel.broadcast_to @room, @watson_message\n\n\t\tauthenticator = Authenticators::IamAuthenticator.new(\n\t\t\tapikey: @room.apikey\n\t\t)\n\t\tassistant = AssistantV2.new(\n\t\t\tversion: \"2019-02-28\",\n\t\t\tauthenticator: authenticator\n\t\t)\n\t\tassistant.service_url = @room.serviceurl\t\n\t\tresponse = assistant.create_session(\n\t\t\tassistant_id: @room.assistantid\n\t\t)\n\t\[email protected] = response.result[\"session_id\"]\n\t\[email protected]\n\t\t\n\t\t@welcome_message = RoomMessage.create user: current_user,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\troom: @room,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twatsonmsg: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"Welcome to Movie On Rails! How can I help you?\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: @room.params\n\t\tRoomChannel.broadcast_to @room, @welcome_message\n end"
]
| [
"0.62015176",
"0.6142145",
"0.6055531",
"0.6052481",
"0.5942413",
"0.59289163",
"0.58133686",
"0.5766334",
"0.5756454",
"0.57487214",
"0.57074255",
"0.5697528",
"0.56855774",
"0.5656672",
"0.5631655",
"0.56300336",
"0.5626987",
"0.56072384",
"0.56072384",
"0.5606675",
"0.5598127",
"0.5575571",
"0.5563653",
"0.5542502",
"0.55388033",
"0.553751",
"0.5536306",
"0.55294555",
"0.5524289",
"0.5522743"
]
| 0.68678343 | 0 |
DELETE /polling_sessions/1 DELETE /polling_sessions/1.json | def destroy
@polling_session = PollingSession.find(params[:id])
@polling_session.destroy
respond_to do |format|
format.html { redirect_to polling_sessions_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def destroy\n @yoga_session = YogaSession.find(params[:id])\n @yoga_session.destroy\n\n respond_to do |format|\n format.html { redirect_to yoga_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ykt_session = YktSession.find(params[:id])\n @ykt_session.destroy\n\n respond_to do |format|\n format.html { redirect_to ykt_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_session\n\n if @session.destroy\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, notice: t(\"dashboard.batch_connect_sessions_status_blurb_delete_success\") }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, alert: t(\"dashboard.batch_connect_sessions_status_blurb_delete_failure\") }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n begin\n obj = User.find(params[:id])\n\n unless session.user.id == obj.id\n response.status = 403\n render json: {}\n return\n end\n\n # This is what slows down the response.\n # Big DB transactions that delete by foreign key.\n obj.time_sessions.destroy_all\n obj.login_sessions.destroy_all\n\n obj.destroy\n response.status = 20\n render json: {msg: obj.time_sessions.methods}\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: {msg: e}\n end\n\n end",
"def delete(url)\n setup_or_refresh_rest_session\n @session.delete(url: url)\n end",
"def destroy\n @user=User.where(:authentication_token=>params[:api_key]).first\n @user.reset_authentication_token!\n render :json => { :message => [\"Session deleted.\"] }, :success => true, :status => :ok\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @discovery_session = DiscoverySession.find(params[:id])\n @discovery_session.destroy\n\n respond_to do |format|\n format.html { redirect_to discovery_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Session.delete(params[:id])\n reset_session\n\n if request.format.html?\n redirect_to \"/sessions/new\"\n elsif requeset.format.json?\n render json: {success: true}\n end\n end",
"def delete_session(env, sid, options); end",
"def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_session2_id\n url = \"https://208.65.111.144/rest/Session/logout/{'session_id':'#{get_session2}'}\"\n begin\n apiRequest(url)\n rescue Restclient::InternalServerError => e\n error_message = e.response[e.response.index('faultstring')+14..-3]\n if error_message != \"Session id is expired or doesn't exist\"\n puts \"Something went wrong trying to logout\"\n end\n end\n @@session_id = nil\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tsession.destroy\n respond_to do |format|\n format.html { redirect_to tsessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heartbeat.destroy\n\n head :no_content\n end",
"def destroy\n @session_info = SessionInfo.first\n @session_info.destroy\n\n respond_to do |format|\n format.html { redirect_to session_infos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n return if Settings.readonly \n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session_operation.destroy\n respond_to do |format|\n format.html { redirect_to session_operations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @session = Session.find(params[:id])\r\n @session.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(sessions_url) }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n\r\n end\r\n end",
"def destroy\n @session_replica.destroy\n respond_to do |format|\n format.html { redirect_to session_replicas_url }\n format.json { head :no_content }\n end\n end",
"def delete_sessions(node)\n @sessions.delete_all(node)\n end",
"def destroy\n @session_time.destroy\n respond_to do |format|\n format.html { redirect_to session_times_url, notice: 'Session time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
]
| [
"0.6872393",
"0.6747178",
"0.66962314",
"0.6695935",
"0.66853786",
"0.66851443",
"0.66586506",
"0.6655968",
"0.66477543",
"0.6643424",
"0.66171086",
"0.6616865",
"0.6606987",
"0.6604662",
"0.6598259",
"0.65948504",
"0.65540737",
"0.65282935",
"0.652107",
"0.65035516",
"0.6440746",
"0.64343244",
"0.64159095",
"0.64108646",
"0.64092606",
"0.6396344",
"0.6381303",
"0.63606435",
"0.63606435",
"0.63606435"
]
| 0.7535422 | 0 |
Extract url from json and get files | def download
URI.extract(json, ['http', 'https']).each do |url|
get_asset(url)
end
json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def get_file(url); end",
"def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end",
"def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"def handle_links(json) end",
"def extract_links(json)\n json[\"roots\"].collect do |key, children|\n extract_children(children[\"name\"], children[\"children\"])\n end\n end",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def get_json_url(url) \n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url\n\n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n\n begin\n\n res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n\n end\n j = nil\n begin\n j = JSON.parse(res.body)\n rescue OpenURI::HTTPError=>e\n case e.to_s\n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return j\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 fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end",
"def get_file(url)\n get(url).body\n end",
"def return_result(url)\n json_file = open(url) { |f| f.read }\n JSON.parse(json_file)\n end",
"def extract_observations(url)\n\n JSON.load(open(url))\n\n end",
"def parse_url_data(url)\n filename = URI.decode(url).split('/')[-1]\n { filename: filename,\n version: filename.split('-')[-2].split('_')[-1],\n build: filename.split('-')[-1].split('.')[0].split('_')[0] }\n end",
"def url\n data['url']\n end",
"def images_with_urls images\n result_images = []\n\n images.each do |image|\n url = image.file_url\n result = image.as_json\n result[\"url\"] = url\n result_images << result\n end\n result_images\n end",
"def extract_datas_from_json(path)\n file = File.read(path)\n data_details = JSON.parse(file)\n return data_details\nend",
"def directorytraversaltest\n Dir.foreach('./jsons/') do |item|\n next if item == '.' or item == '..'\n\n #print item.pretty_inspect\n puts item\n\n #it doesn't appear to treat 'item' as a file object it is a just a string of the filename..\n obj = JSON.parse(File.read('./jsons/' + item))\n print obj[0][\"_source\"][\"description\"]\n puts \"\\n\"\n end\n end",
"def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end",
"def get_json(url, options = {})\n\t\t\tresponse = get_file(url, options)\n\t\t\traw_json = response.scan(/\\w+\\((.+)\\);\\z/)[0][0]\n\t\t\treturn JSON.parse(raw_json)\n\t\tend",
"def swapi_fetch(url)\n JSON.parse(open(url).read)\nend",
"def href\n link.gsub(\".json\", \"\")\n end",
"def extract_metadata_for_video url\n mfile = metadata_file_for(url)\n unless File.file? mfile\n\n # self << url\n # self << %w[ skip-download write-info-json ignore-errors ]\n # self << { output: mfile.gsub(/\\.info\\.json$/, '') }\n # self.run\n\n # Run directly:\n command = \"#{url} --skip-download --write-info-json --ignore-errors\"\n command += \" -o '#{mfile.gsub(/\\.info\\.json$/, '')}'\"\n delegator.run command\n end\n JSON.parse File.read(mfile) rescue nil\n end",
"def parse_response\n\t\tfile = File.read(\"#{@file_path}/#{@output_json}\")\n\t\tdata = JSON.parse(file)\n\t\tfigures_array = data[\"figures\"]\n\t\tfigures_array.each do |fig|\n\t\t\tfig[\"renderURL\"] = fig[\"renderURL\"]\n\t\t\t\t.gsub(\"public/\",\"\")\n\t\t\t\t.gsub(\"pdf-\",\"\")\n\t\tend\n\t\tfigures_array\n\tend",
"def apartments_urls(url)\n JSON(Net::HTTP.get(URI(url)))['apartments'].map { |value| value['url'] }\n #Net::HTTP.get(URI(url)).scan(/https\\:\\\\\\/\\\\\\/r\\S{10,}.s\\\\\\/\\d{4,7}/).map { |val| val.gsub(\"\\\\\", \"\") }\n end",
"def initialize url\n open(url) {|f| @json = f.read}\n @root = JSON.parse @json\n end",
"def get_file_for_url(url, params)\n selected_files = params[\"selected_files\"].values\n return unless selected_files.map { |a| a[\"url\"] }.include?(url)\n selected_files.select { |a| a[\"url\"] == url }.first[\"file_name\"]\n end",
"def process_file(filename)\n results = {}\n\n begin\n File.foreach(filename) do |line|\n if @options[:debug]\n puts \"processing: #{line}\"\n end\n\n line.gsub!(/\\W+$/,'');\n\n if url_ok(line)\n results[line] = process_url(line)\n\n if @options[:debug]\n puts JSON.pretty_generate(results)\n end\n else\n error \"Not an absolute uri: #{line}\"\n end\n end\n rescue => e\n error \"Error when processing file: #{filename} : #{e.message}!\"\n exit EXIT_UNKNOWN\n end\n\n return results\n end",
"def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend"
]
| [
"0.67730147",
"0.67432445",
"0.6627193",
"0.66143686",
"0.64659387",
"0.64624846",
"0.6248586",
"0.6248171",
"0.62244123",
"0.6207111",
"0.620166",
"0.609987",
"0.6023666",
"0.6012393",
"0.6009479",
"0.6003042",
"0.5988958",
"0.5979974",
"0.59771436",
"0.59398866",
"0.59390694",
"0.5933244",
"0.5918101",
"0.59119517",
"0.5900305",
"0.58619237",
"0.58492285",
"0.5848503",
"0.5799757",
"0.57967883"
]
| 0.69814074 | 0 |
GET /solicitacao_tipos GET /solicitacao_tipos.json | def index
@solicitacao_tipos = SolicitacaoTipo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n tips = Tip.all\n json_response(tips)\n end",
"def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def show\n json_response(@tip)\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end",
"def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipp }\n end\n end",
"def index\n @tipovestuarios = Tipovestuario.all\n end",
"def index\n @tipoplatos = Tipoplato.all\n end",
"def index\n @tipos = Tipo.all\n end",
"def index\n @tipos = Tipo.all\n end",
"def tips\n\t \tbase_url = \"https://api.foursquare.com/v2/venues/#{venue_id}/tips?sort=popular&oauth_token=333XGVNQCUY0LI4GGL4B4MXWAM022G1EKD0JZWXOLKESCFK3&v=20140401\"\n\t\tresponse = HTTParty.get(base_url)\n\t\tresponse[\"response\"][\"tips\"][\"items\"].map do |item|\n\t\t\titem['text']\n\t\tend\n\tend",
"def show\n @tip = Tip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip }\n end\n end",
"def index\n @solicitacoes = Solicitacao.all\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def new\n @tip_so = TipSo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def index\n @tiposervicos = Tiposervico.all\n end",
"def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def index\n @tipocuenta = Tipocuentum.all\n end",
"def show\n @solicitante= Solicitante.find(params[:solicitante_id])\n @beneficiario= Beneficiario.find(params[:id])\n @solicitudes = Solicitud.where(solicitante_id: @solicitante.id, beneficiario_id: @beneficiario.id).all\n end",
"def index\n @tipos_contatos = TiposContato.all\n end",
"def index\n @solicitantes = Solicitante.all\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def index\n @solicitacao_pontuals = SolicitacaoPontual.all\n end",
"def index\n @response_tips = ResponseTip.all\n @tip = Tip.all\n end",
"def venue_tips(id, options = {})\n get(\"venues/#{id}/tips\", options).tips\n end",
"def index\n @tipics = Tipic.all\n end",
"def index\n @tiposveiculos = Tiposveiculo.all\n end",
"def index\n @tipotermos = Tipotermo.all\n end",
"def index\n @tipoveiculos = Tipoveiculo.all\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end"
]
| [
"0.65108067",
"0.64022475",
"0.61986303",
"0.61943024",
"0.61738473",
"0.60719556",
"0.60466915",
"0.6017275",
"0.5969186",
"0.5969186",
"0.5964207",
"0.59610367",
"0.59297687",
"0.59143305",
"0.591277",
"0.590865",
"0.59049314",
"0.58742553",
"0.58641595",
"0.5852805",
"0.5792326",
"0.5752998",
"0.5740865",
"0.5722674",
"0.57151985",
"0.5700381",
"0.5695156",
"0.5693295",
"0.56703144",
"0.5670011"
]
| 0.7046238 | 0 |
DELETE /solicitacao_tipos/1 DELETE /solicitacao_tipos/1.json | def destroy
@solicitacao_tipo.destroy
respond_to do |format|
format.html { redirect_to solicitacao_tipos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tip_so = TipSo.find(params[:id])\n @tip_so.destroy\n\n respond_to do |format|\n format.html { redirect_to tip_sos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipocliente = Tipocliente.find(params[:id])\n @tipocliente.destroy\n\n respond_to do |format|\n format.html { redirect_to tipoclientes_url }\n #format.json { head :ok }\n end\n end",
"def destroy\n @tb_solicitud.destroy\n respond_to do |format|\n format.html { redirect_to tb_solicituds_url, notice: 'Tb solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipovestuario.destroy\n respond_to do |format|\n format.html { redirect_to tipovestuarios_url, notice: 'Tipovestuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiposveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitante.destroy\n respond_to do |format|\n format.html { redirect_to solicitantes_url, notice: 'Solicitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: \"Solicitud was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipos_contato.destroy\n respond_to do |format|\n format.html { redirect_to tipos_contatos_url, notice: 'Tipos contato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipomedalla = Tipomedalla.find(params[:id])\n @tipomedalla.destroy\n\n respond_to do |format|\n format.html { redirect_to tipomedallas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao.destroy\n respond_to do |format|\n format.html { redirect_to solicitacoes_url, notice: 'Solicitacao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao_pontual.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_pontuals_url, notice: 'Solicitacao pontual was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipocuentum.destroy\n respond_to do |format|\n format.html { redirect_to tipocuenta_url, notice: 'Tipocuentum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiposervico.destroy\n respond_to do |format|\n format.html { redirect_to tiposervicos_url, notice: 'Tiposervico was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipus_indicador.destroy\n respond_to do |format|\n format.html { redirect_to tipus_indicadors_url, notice: 'Tipus indicador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoplato.destroy\n respond_to do |format|\n format.html { redirect_to tipoplatos_url, notice: 'Tipoplato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipos_encuestum.destroy\n respond_to do |format|\n format.html { redirect_to tipos_encuesta_url, notice: 'Tipos encuestum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tip = Tip.find(params[:id])\n @tip.destroy\n\n respond_to do |format|\n format.html { redirect_to tips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_distribucion.destroy\n respond_to do |format|\n format.html { redirect_to tipos_distribuciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipomovifinanceiro.destroy\n respond_to do |format|\n format.html { redirect_to tipomovifinanceiros_url, notice: 'Tipomovifinanceiro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipos_dato.destroy\n respond_to do |format|\n format.html { redirect_to tipos_datos_url, notice: 'Tipos dato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiposcontrato = Tiposcontrato.find(params[:id])\n @tiposcontrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposcontratos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_alerta = TipoAlerta.find(params[:id])\n @tipo_alerta.destroy\n\n respond_to do |format|\n format.html { redirect_to tipos_alertas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitador.destroy\n respond_to do |format|\n format.html { redirect_to solicitadors_url, notice: 'Solicitador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitudinforme.destroy\n respond_to do |format|\n format.html { redirect_to solicitudinformes_url, notice: 'Solicitudinforme was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end"
]
| [
"0.7579861",
"0.7466454",
"0.74196404",
"0.7383597",
"0.7359379",
"0.7359123",
"0.73443264",
"0.73396087",
"0.73336804",
"0.73320884",
"0.7324677",
"0.7316358",
"0.73079914",
"0.7290945",
"0.72845405",
"0.71892256",
"0.7168368",
"0.71579796",
"0.7135689",
"0.7111101",
"0.7103224",
"0.70938843",
"0.708521",
"0.7072122",
"0.7057565",
"0.7042497",
"0.7042392",
"0.7042116",
"0.702896",
"0.702896"
]
| 0.784042 | 0 |
GET /u_sers/1 GET /u_sers/1.json | def show
@u_ser = USer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @u_ser }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @u_sers = USer.all\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end",
"def index\n @uzsers = Uzser.all\n end",
"def set_u_ser\n @u_ser = USer.find(params[:id])\n end",
"def new\n @u_ser = USer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u_ser }\n end\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"def index\n @ussers = Usser.all\n end",
"def get_handle\n logger.debug \"Hoo ha!\"\n s = Swimmer.find(:all, :conditions => \"last = '#{params[:last]} and first like '#{params[:first]}'\").map {er|x| x.id }\n respond_to do |format|\n json { render s.to_json }\n end\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show_my_disposisi\n\t\t@user = UserDisposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend",
"def load_tailors\n\t\t@shop_name=params[:shop_name]\n\t\t@title=params[:title]\n\t\tuser = User.where(:user_type => \"tailor\", :shop_name => @shop_name, :title => @title).select(\"id\",\"username\",\"email\")\n\t\tif user.nil?\n\t\t\trender json: {message: \"No any tailor in this group\"}\n\t\telse\t\t\t\n\t\t \tdetails = []\n\t\t\tuser.each do |chat|\n\t\t\t\tdetails << { :id => chat.id, :type => chat.username, :email => chat.email}\n\t\t\tend\n\t\t\trender :json => details.to_json\t\n\t\tend\n\tend",
"def show_disposisi_user\n\t\t@user = Disposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend",
"def userReponses\n user=User.find(params[:userId])\n render :json=> user.response\n end",
"def users\n\t\t@recipes = Recipe.where('published = ?',1).find_by_user_id(params[:id])\n\t\trespond_with @recipes\t\n\tend",
"def show\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uset }\n end\n end",
"def index\n json_response(User.all) \n end",
"def index\n # 1 is for UserType : 'Professeur'\n @users = User.find_all_by_class_room_id_and_user_type_id(current_user.class_room, 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end",
"def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end",
"def search\n render json: User.first(10)\n end",
"def show\n @sluzby = Sluzby.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sluzby }\n end\n end",
"def get_users\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n response = RestClient.get \"#{@api_endpoint}/users?writerId=#{@writer_id}\", headers\n\n return response\n\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n @user = User.find(params[:id])\n @readings = @user.readings\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n @creations = Creation.where(user_id: params[:user_id])\n\n render json: @creations\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n puts render json: @user.students, each_serializer: UserSerializer\n end",
"def show\n @user_sc = UserSc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_sc }\n end\n end",
"def select_user\n # @users = ['ichthala', 'wescarr17', 'seraphicmanta', 'tcclevela', 'antonwheel', 'horse_ebooks', 'catlandbooks']\n # @users.each_with_index do |user, index|\n # @users[index] = Twitter.user(user)\n # end\n\n @users = []\n\n while @users.count < 9\n offset = rand(Twitteruser.count)\n rand_sn = Twitteruser.first(:offset => offset).screen_name\n unless @users.find_index(rand_sn)\n @users << rand_sn\n end\n end\n\n @users << 'horse_ebooks'\n\n @users.each_with_index do |user, index|\n @users[index] = Twitter.user(user)\n end\n\n respond_to do |format|\n format.html\n format.json {render json: @users}\n end\n\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end"
]
| [
"0.72598606",
"0.64190686",
"0.61925536",
"0.6137131",
"0.6118909",
"0.58885694",
"0.58674437",
"0.584617",
"0.57275486",
"0.57150984",
"0.5712456",
"0.57095677",
"0.57087487",
"0.56723416",
"0.56693363",
"0.5663225",
"0.5655754",
"0.5607923",
"0.5603253",
"0.55927724",
"0.5592211",
"0.55823034",
"0.558114",
"0.5575995",
"0.5569424",
"0.5565434",
"0.55548966",
"0.5553174",
"0.5546716",
"0.5544432"
]
| 0.669042 | 1 |
GET /u_sers/new GET /u_sers/new.json | def new
@u_ser = USer.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @u_ser }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end",
"def new\n @usr = Usr.new\n \n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @usr }\n format.json { render :json => @usr }\n end\n end",
"def new\n @uset = Uset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uset }\n end\n end",
"def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end",
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end",
"def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def newent\n @user = User.new\n respond_to do |format|\n format.html # newent.html.erb\n format.json { render :json => @user }\n end\n end",
"def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n #@user = User.new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\r\n @usertable = Usertable.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @usertable }\r\n end\r\n end",
"def new\n @spieler = Spieler.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spieler }\n end\n end",
"def new\n p 'new called'\n @user = User.new\n\n p \"#{@user}\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end",
"def new\n @srsa = Srsa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @srsa }\n end\n end",
"def new\n @ministerio = Ministerio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ministerio }\n end\n end",
"def new\n @user = User.new\n render :json => @user\n end",
"def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end",
"def new\n @suplente = Suplente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suplente }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @sluzby = Sluzby.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sluzby }\n end\n end",
"def new\n @user = User.new\n\n render json: @user\n end",
"def new\n @spdatum = Spdatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spdatum }\n end\n end",
"def new\n @recinto = Recinto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recinto }\n end\n end",
"def new\n @seguro = Seguro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguro }\n end\n end",
"def new\r\n @salle = Salle.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end",
"def new\n @users = User.all\n render json: @users\n end",
"def new\n @sotrudniki = Sotrudniki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sotrudniki }\n end\n end",
"def new\n @sala = Sala.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sala }\n end\n end"
]
| [
"0.7417012",
"0.71170324",
"0.7092639",
"0.70402247",
"0.7038747",
"0.69986254",
"0.6989611",
"0.6915032",
"0.69037205",
"0.68724126",
"0.68586445",
"0.685825",
"0.68405515",
"0.68140286",
"0.680881",
"0.6794129",
"0.67895055",
"0.67843366",
"0.67783564",
"0.67762804",
"0.67507356",
"0.674956",
"0.67310715",
"0.6721438",
"0.6717827",
"0.67165464",
"0.6707969",
"0.6704191",
"0.67033833",
"0.6701698"
]
| 0.7504908 | 0 |
POST /u_sers POST /u_sers.json | def create
@u_ser = USer.new(params[:u_ser])
respond_to do |format|
if @u_ser.save
format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }
format.json { render json: @u_ser, status: :created, location: @u_ser }
else
format.html { render action: "new" }
format.json { render json: @u_ser.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @u_ser = USer.new(u_ser_params)\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render :show, status: :created, location: @u_ser }\n else\n format.html { render :new }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @u_sers = USer.all\n end",
"def create\n @uzser = Uzser.new(uzser_params)\n\n respond_to do |format|\n if @uzser.save\n format.html { redirect_to @uzser, notice: 'Uzser was successfully created.' }\n format.json { render :show, status: :created, location: @uzser }\n else\n format.html { render :new }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @renter = Renter.new(params[:renter])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @renter.save\n @users.each do |user|\n RenterMailer.registration_welcome(@renter, user).deliver\n Renter.increment_counter(\"times_forwarded\", @renter.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @renter, :status => :created, :location => @renter }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def create\n @sesiune = Sesiune.new(sesiune_params)\n\n respond_to do |format|\n if @sesiune.save\n\n # duplic temele si domeniile din ultima sesiune si le adaug in baza de date cu sesiune_id asta pe care tocmai am creat-o\n @ultima_sesiune = Sesiune.where(este_deschisa: false).last\n Domeniu.where(sesiune_id: @ultima_sesiune.id).each do |dom|\n nou_dom = Domeniu.create(nume: dom.nume, descriere: dom.descriere, user_id: dom.user_id, sesiune_id: @sesiune.id)\n Tema.where(sesiune_id: @ultima_sesiune.id).where(domeniu_id: dom.id).each do |tema|\n Tema.create(nume: tema.nume, descriere: tema.descriere, domeniu_id: nou_dom.id, este_libera: true, user_id: tema.user_id, sesiune_id: @sesiune.id)\n # ce faci dc user_id-ul temei este un student care a terminat? si th i se desfiinteaza contul?\n end\n end\n\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sesiune }\n else\n format.html { render action: 'new' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usser = Usser.new(usser_params)\n\n respond_to do |format|\n if @usser.save\n format.html { redirect_to @usser, notice: 'Usser was successfully created.' }\n format.json { render :show, status: :created, location: @usser }\n else\n format.html { render :new }\n format.json { render json: @usser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @u_ser = USer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u_ser }\n end\n end",
"def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end",
"def users(name, args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&name#{name}\"\n path = __method__.to_s\n http_post(path, query)\n end",
"def set_u_ser\n @u_ser = USer.find(params[:id])\n end",
"def create\n @serie = Serie.new(serie_params)\n\n unless a = Author.find_by_id(params[:author_id]) || Author.find_by_name(params[:author_name].strip)\n a = Author.new\n a.name = params[:author_name].strip\n a.save!\n end\n @serie.authors << a\n\n unless m = Magazine.find_by_id(params[:magazine_id]) || Magazine.find_by_name(params[:magazine_name].strip)\n m = Magazine.new\n m.name = params[:magazine_name].strip\n m.publisher = params[:magazine_publisher].strip\n m.save!\n end\n @serie.magazines << m if m\n\n if params[:book_ids]\n params[:book_ids].each do |bid|\n @serie.books << Book.find(bid)\n end\n end\n\n respond_to do |format|\n if @serie.save\n format.html { redirect_to(root_path, :notice => 'Serie was successfully created.') }\n format.xml { render :xml => @serie, :status => :created, :location => @serie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def u_ser_params\n params.require(:u_ser).permit(:name, :email)\n end",
"def create\n\n @semestre = current_user.semestres.new(semestre_params)\n\n respond_to do |format|\n if @semestre.save\n format.html { redirect_to semestres_url, notice: 'Semestre was successfully created.' }\n format.json { render :show, status: :created, location: @semestre }\n else\n format.html { render :new }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @uzsers = Uzser.all\n end",
"def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end",
"def new\n @serie = current_user.series.build\n @serie.genres.build\n @serie.countries.build\n @serie.languages.build\n @serie.subtitles.build\n @serie.actors.build\n @serie.directors.build\n end",
"def suscriber_wm\n\t\turi = URI(\"http://staging.benchprep.com/api/v1/test/fixtures.json\")\t\n\n\t\tres = Net::HTTP.post_form(uri, 'email' => '[email protected]&enrollments_persona=subscriber&devices_persona=web_and_mobile')\n\t\t# write this output to a file\n\t\toutput = File.open( \"spec/fixtures/sp_wm_persona.json\",'w' ){|f| \n\t\t\tf.flock(File::LOCK_EX)\n\t\t\tf.write(res.body)\n\t\t}\n\n\t\t# Now parse this string as json\n\t\tjson = File.read('spec/fixtures/sp_wm_persona.json')\n\t\templs = JSON.parse(json)\n\n\t\treturn empls #pretty printed output\n\tend",
"def create\n @user = User.new(params[:user])\n\n # RestClient.post(\"http://sms.ru/sms/send\", :api_id => \"9d3359eb-9224-2384-5d06-1118975a2cd2\", :to => \"79051916188\", :text => \"Ваш ID на велопробег #{@user.id}\")\n\n respond_to do |format|\n if @user.save\n\n \n\n format.html { redirect_to edit_user_path(@user), notice: 'Участник успешно создан!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { redirect_to root_path,\n notice: 'Поздравляем! Вы подали заявку на регистрацию. Для подтверждения регистрации \n необходимо внести взнос.' }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def new\n @user = User.new\n sem = Seminar.all\n @seminars = Hash.new\n @topics = Hash.new\n sem.each do |t|\n @seminars[t.id] = t;\n @topics[t.id] = Hash.new\n t.topics.each do |u|\n @topics[t.id][u.id] = u;\n @user.selections.build(:seminar_id=>t.id, :topic_id=>u.id)\n end\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def create\n @uder = Uder.new(uder_params)\n\n respond_to do |format|\n if @uder.save\n format.html { redirect_to @uder, notice: 'Uder was successfully created.' }\n format.json { render action: 'show', status: :created, location: @uder }\n else\n format.html { render action: 'new' }\n format.json { render json: @uder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sejour = current_user.sejours.build(sejour_params)\n\n respond_to do |format|\n if @sejour.save\n format.html { redirect_to @sejour, notice: 'Le sejour a bien ete cree.' }\n format.json { render :show, status: :created, location: @sejour }\n else\n format.html { render :new }\n format.json { render json: @sejour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sensor_list\n #this is making a post request by intializing the restclient gem with RestClient::Request.new to get sensors list\n #if the call is successful it provide the response.body\n #if fails and returns a 400 with the error.\n response = RestClient::Request.new({\n method: :post,\n url:\"https://api.samsara.com/v1/sensors/list?access_token=#{Rails.application.credentials.secret_key}\",\n payload:{ \"groupId\": 32780 }.to_json,\n headers: { :accept => :json, content_type: :json }\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, (response.to_json) ]\n when 200\n [ :success, (response.to_json) ]\n else\n fail \"Invalid response #{response} received.\"\n end\n # here I setting the body to an elemnet that will be availble in the views.\n @sensor_list = response.body\n end\n end",
"def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend",
"def create\n @souvenir = Souvenir.new(souvenir_params)\n\n respond_to do |format|\n if @souvenir.save\n format.html { redirect_to @souvenir, notice: 'Souvenir was successfully created.' }\n format.json { render json: { user: @souvenir, status: 200, description: 'Souvenir was successfully created.' }, status: :ok }\n else\n format.html { render :new }\n format.json { render json: { user: @souvenir, status: 500, description: 'Internal server error : faliled to save' }, status: :internal_server_error }\n end\n end\n end",
"def create\n @pessoa_receber = PessoaReceber.new(params[:pessoa_receber])\n @pessoa_receber.user_id = current_user.id\n respond_to do |format|\n if @pessoa_receber.save\n format.html { redirect_to @pessoa_receber, :notice => 'Pessoa receber was successfully created.' }\n format.json { render :json => @pessoa_receber, :status => :created, :location => @pessoa_receber }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pessoa_receber.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n\t @recipient_array = User.all.map &:nick\n @postum = Postum.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @postum }\n end\n end",
"def create\n @siritori = Siritori.new(siritori_params)\n\n respond_to do |format|\n if @siritori.save\n format.html { redirect_to @siritori, notice: 'Siritori was successfully created.' }\n format.json { render :show, status: :created, location: @siritori }\n else\n format.html { render :new }\n format.json { render json: @siritori.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(user,pass,firstname,lastname,sso_provider)\n\n # test_user = '[email protected]'\n # pass = 'akbvgdrz77'\n # firstname = 'J'\n # lastname = 'T'\n\n values = \"{\\\"writerId\\\": \\\"#{@writer_id}\\\", \\\"email\\\": \\\"#{user}\\\", \\\"password\\\": \\\"#{pass}\\\", \\\"firstName\\\": \\\"#{firstname}\\\", \\\"lastName\\\": \\\"#{lastname}\\\", \\\"ssoProvider\\\": \\\"#{sso_provider}\\\"}\"\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n begin\n response = RestClient.post \"#{@api_endpoint}/users\", values, headers\n\n rescue Exception => msg\n\n puts msg\n #manager.clean_csv(variable_file,message)\n #manager.set_existing_variable_bulk(variable_file,$gd_pid)\n #puts message\n end\n\n return response\n\n end"
]
| [
"0.634905",
"0.6186928",
"0.57403594",
"0.5651373",
"0.56368405",
"0.5628509",
"0.55825585",
"0.5521971",
"0.5495161",
"0.5338382",
"0.5268426",
"0.5267577",
"0.5261323",
"0.52466214",
"0.52267075",
"0.520776",
"0.5193178",
"0.5183848",
"0.51413196",
"0.51302457",
"0.51100314",
"0.51065767",
"0.509599",
"0.5095353",
"0.50860184",
"0.5071925",
"0.50688225",
"0.50457317",
"0.5041106",
"0.5038812"
]
| 0.6416255 | 0 |
PUT /u_sers/1 PUT /u_sers/1.json | def update
@u_ser = USer.find(params[:id])
respond_to do |format|
if @u_ser.update_attributes(params[:u_ser])
format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @u_ser.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @u_ser.update(u_ser_params)\n format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }\n format.json { render :show, status: :ok, location: @u_ser }\n else\n format.html { render :edit }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_u_ser\n @u_ser = USer.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @usser.update(usser_params)\n format.html { redirect_to @usser, notice: 'Usser was successfully updated.' }\n format.json { render :show, status: :ok, location: @usser }\n else\n format.html { render :edit }\n format.json { render json: @usser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update\n load_user\n build_user\n respond_to do |format|\n if user.save\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @ser }\n else\n format.html { render :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n @u = U.find(params[:id])\n\n respond_to do |format|\n if @u.update_attributes(params[:u])\n format.html { render action: \"edit\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @u.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def set_usser\n @usser = Usser.find(params[:id])\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def set_suscriber\n @suscriber = Suscriber.find(params[:id])\n end",
"def set_souvenior\n @souvenior = Souvenior.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @uzser.update(uzser_params)\n format.html { redirect_to @uzser, notice: 'Uzser was successfully updated.' }\n format.json { render :show, status: :ok, location: @uzser }\n else\n format.html { render :edit }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @u_ser = USer.new(params[:u_ser])\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render json: @u_ser, status: :created, location: @u_ser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @souvenir.update(souvenir_params)\n format.html { redirect_to @souvenir, notice: 'Souvenir was successfully updated.' }\n format.json { render json: { user: @souvenir, status: 200, description: 'Souvenir was successfully updated.' }, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: { user: @souvenir, status: 500, description: 'Internal server error : faliled to save' }, status: :internal_server_error }\n end\n end\n end",
"def update\n @routine = Routine.find(params[:id])\n # @routine.user_id = @user.id\n @users = User.all if @user.admin?\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update_cheer_up\n user = User.find(params[:id])\n updating_cheer_up = CheerUp.find(params[:cheer_up_id])\n updating_cheer_up.update(cheer_up_params)\n render json:\n {\n status: 200,\n user: user,\n cheer_ups: user.cheer_ups,\n updated_cheer_up: updating_cheer_up\n } # end render json\n end",
"def update\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n if @uset.update_attributes(params[:uset])\n format.html { redirect_to @uset, notice: 'Uset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @souvenior.update(souvenior_params)\n format.html { redirect_to @souvenior, notice: 'Souvenior was successfully updated.' }\n format.json { render :show, status: :ok, location: @souvenior }\n else\n format.html { render :edit }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suscriber.update(suscriber_params)\n format.html { redirect_to @suscriber, notice: 'Suscriber was successfully updated.' }\n format.json { render :show, status: :ok, location: @suscriber }\n else\n format.html { render :edit }\n format.json { render json: @suscriber.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_serasa.update(socio_serasa_params)\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find_by_id(params[:user])\n @study.user = @user\n @sec = Sec.find_by_id(params[:sec])\n @study.sec = @sec\n respond_to do |format|\n if @study.update(study_params)\n format.html { redirect_to @study, notice: 'Study was successfully updated.' }\n format.json { render :show, status: :ok, location: @study }\n else\n format.html { render :edit }\n format.json { render json: @study.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @u_ser = USer.new(u_ser_params)\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render :show, status: :created, location: @u_ser }\n else\n format.html { render :new }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @u_ser = USer.find(params[:id])\n @u_ser.destroy\n\n respond_to do |format|\n format.html { redirect_to u_sers_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @sneaker.update(sneaker_params)\n Sneaker.reindex\n format.html { redirect_to @sneaker, notice: 'Sneaker was successfully updated.' }\n format.json { render :show, status: :ok, location: @sneaker }\n else\n format.html { render :edit }\n format.json { render json: @sneaker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def set_singer\n @singer = Singer.find(params[:id])\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end"
]
| [
"0.63182807",
"0.6270266",
"0.598554",
"0.58476627",
"0.5657172",
"0.5600045",
"0.55445385",
"0.5544309",
"0.55440676",
"0.5539058",
"0.5495385",
"0.5483849",
"0.54661477",
"0.54532695",
"0.54205054",
"0.5383168",
"0.5339815",
"0.5328165",
"0.532579",
"0.53112024",
"0.5309192",
"0.5307221",
"0.5304799",
"0.53005177",
"0.5263429",
"0.5246781",
"0.5245408",
"0.5235085",
"0.52333903",
"0.5224097"
]
| 0.65416086 | 0 |
DELETE /u_sers/1 DELETE /u_sers/1.json | def destroy
@u_ser = USer.find(params[:id])
@u_ser.destroy
respond_to do |format|
format.html { redirect_to u_sers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @u_ser.destroy\n respond_to do |format|\n format.html { redirect_to u_sers_url, notice: 'U ser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uder.destroy\n respond_to do |format|\n format.html { redirect_to uders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @u = U.find_by_name(params[:id])\n @u.destroy\n\n respond_to do |format|\n format.html { redirect_to us_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n user = User.find(params[:id])\n senator = Senator.find(params[:senator_id])\n user.senators.delete(senator)\n render json: user.senators\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @uzser.destroy\n respond_to do |format|\n format.html { redirect_to uzsers_url, notice: 'Uzser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sluzby = Sluzby.find(params[:id])\n @sluzby.destroy\n\n respond_to do |format|\n format.html { redirect_to sluzbies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @usser.destroy\n respond_to do |format|\n format.html { redirect_to ussers_url, notice: 'Usser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @sesh.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 @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronists_url }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @surah.destroy\n respond_to do |format|\n format.html { redirect_to surahs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @strosek.destroy\n respond_to do |format|\n format.html { redirect_to stroseks_url }\n format.json { head :no_content }\n end\n end"
]
| [
"0.6946302",
"0.69276553",
"0.667342",
"0.6612868",
"0.65867144",
"0.6580875",
"0.6554371",
"0.65526795",
"0.6550917",
"0.6549767",
"0.654431",
"0.65373445",
"0.6532813",
"0.6529876",
"0.65264964",
"0.65020865",
"0.6501794",
"0.64871585",
"0.64734113",
"0.64729655",
"0.64545804",
"0.644622",
"0.64199376",
"0.64147925",
"0.64128417",
"0.6412245",
"0.6400706",
"0.63956034",
"0.63932794",
"0.6389923"
]
| 0.7272203 | 0 |
returns whether conversation has any associated unread posts | def any_unread? usr
@conv.posts.each do |post|
if post.unread?(usr) && post.recipient_id == usr.id
return true
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_unread?\n Message.any_in(conversation_id: conversations.map(&:id)).ne(read_by: id).present?\n end",
"def has_unread_messages?\n received_messages.count > 0\n end",
"def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end",
"def unread? user_id\n !unread_messages(user_id).blank?\n end",
"def unread_messages\n current_user.messages_in.where(read: false).count\n end",
"def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end",
"def unread?\n self.status == 'unread'\n end",
"def unread?\n (status == UNREAD)\n end",
"def unread?\n return (self.status == Email::STATUS_UNREAD)\n end",
"def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def unread?\n !read?\n end",
"def unread?\n read_at.nil?\n end",
"def unread?\n !read?\n end",
"def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end",
"def is_unread?(participant)\n return false if participant.nil?\n return self.receipts_for(participant).not_trash.is_unread.count!=0\n end",
"def any?\n messages.count.positive?\n end",
"def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end",
"def is_unread?(participant)\n return false unless participant\n receipts_for(participant).not_trash.is_unread.count != 0\n end",
"def has_message?\n has_message\n # && messages.count > 0\n end",
"def unread_messages\n @user_wise_unread_messages = current_user.user_messages\n .where(is_read: false)\n .joins(:message)\n .group('messages.user_id').count\n end",
"def unread_discussions\n discussions.find_unread_by(self)\n end",
"def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end",
"def has_unread_messages?(user)\n latest_message = self.last_message\n if latest_message\n chat_participation = self.chat_participations.where(user_id: user.id).first\n chat_participation.try(:unread_message?, latest_message)\n end\n end",
"def unread?\n !read?\nend",
"def should_update_inbox_unread_count!\n i = mailbox.inbox.unread(self).pluck(\"distinct conversations.id\").size\n update_attributes(inbox_unread_count: i) if i != inbox_unread_count\n end",
"def unread_qotds\n admin_conversations.current.recent.find_unread_by(self)\n end",
"def unread_messages_count\n @unread_messages_count ||= messages.unread.count\n end"
]
| [
"0.79774034",
"0.7608553",
"0.73700744",
"0.730161",
"0.7006697",
"0.6941816",
"0.6934406",
"0.6927607",
"0.69178337",
"0.6910893",
"0.68594486",
"0.68594486",
"0.68594486",
"0.6850814",
"0.68155205",
"0.6780257",
"0.6730168",
"0.6643015",
"0.66117275",
"0.66050315",
"0.66005343",
"0.6566318",
"0.65255284",
"0.65106845",
"0.65015",
"0.648717",
"0.64706874",
"0.6452868",
"0.63372976",
"0.6330513"
]
| 0.80610716 | 0 |
sets all posts in a convo to 'removed' | def remove_posts usr
@conv.posts.each do |post|
if usr.id == post.user_id
post.status = 'removed'
elsif usr.id == post.recipient_id
post.recipient_status = 'removed'
end
post.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_posts usr\n ConversationProcessor.new(self).remove_posts usr\n end",
"def clear!\n @posts = nil\n end",
"def after_destroy(post)\n post = post.to_post\n Notification.where(:scope => 'mention',\n :source_ids => {'Post' => post.id}).each do |notification|\n notification.remove_source(post)\n notification.update_actors\n end\n end",
"def onRemoved(links)\n @set -= links\n end",
"def delete_tags\n tags = self.tags\n tags.each do |tag|\n tag.destroy if tag.posts.count == 1\n end\n end",
"def unpublished_posts\n @blog_posts = BlogPost.where(:deleted => '0').where(:publish => \"0\").order('created_at DESC')\n end",
"def delete post\n\t\t$DIRTY << :news\n\t\tpost = @children[post] if post.kind_of? Integer\n\t\traise ArgumentError, \"Post not found\" unless @children.include? post\n\n\t\tif @children[-1] == post and post.children.size == 0\n\t\t\[email protected] post\n\t\telse\n\t\t\tpost.title = \"<Deleted>\"\n\t\t\tpost.body = \"<Post deleted>\"\n\t\t\tpost.drill(true){|b| b.locked = true}\n\t\tend\n\n\t\tpost.sticky = false if post.sticky\n\tend",
"def destroy_cleanup\n\tadd_to_deleted(@micropost)\n end",
"def wipeout_unposted_works\n works.find(:all, :conditions => {:posted => false}).each do |w|\n w.destroy\n end\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def delete_pic\n self.posts.each do |post|\n post.pic.destroy\n end\n end",
"def cleanup_unposted_works\n works.find(:all, :conditions => ['works.posted = ? AND works.created_at < ?', false, 1.week.ago]).each do |w|\n w.destroy\n end\n end",
"def unfave!(post)\n fave = self.faves.find_by_post_id(post.id)\n fave.destroy!\n end",
"def unheart!(post)\n heart = self.hearts.find_by_post_id(post.id)\n heart.destroy!\n end",
"def destroy\n @blog_post.destroy\n end",
"def destroy\n destroy_q(@post, posts_url)\n end",
"def cms_setpost_trash cpid\n\t\tDB[:cms_post].filter(:cpid => cpid).update(:ctid => 2)\n\tend",
"def mark_as_removed!\n self.removed = true\n self.save\n end",
"def destroy\n @post.destroy\n end",
"def destroy\n @post.destroy\n end",
"def destroy\n @post.destroy\n end",
"def destroy\n @post.destroy\n end",
"def destroy\n @post.destroy\n\n end",
"def clear_cache\n $redis.del \"posts\"\n end",
"def decrement_posts_stats\n # first post don't count towards counters\n if self.topic.posts.length > 1\n self.topic.forum.update_attribute(:post_count, self.topic.forum.post_count - 1)\n self.topic.update_attribute(:replies, self.topic.replies - 1)\n self.user.update_attribute(:post_count, self.user.post_count - 1)\n end\n end",
"def destroy\n @post.destroy\n if @post.destroyed?\n @post.categories.clear\n @post.tags.clear\n @post.comments.clear\n redirect_to admin_posts_url, notice: 'Post was successfully destroyed.'\n else\n flash.now[:alert] = 'Post has not been destroyed.'\n redirect_to admin_posts_url\n end\n end",
"def prune\n @set.clear\n end",
"def destroy_all\n posts = current_user.posts\n\n posts.each do |post|\n post.destroy\n end\n\n redirect_to posts_url, :notice => \"Destroyed all Posts.\"\n end"
]
| [
"0.6978334",
"0.6913233",
"0.6187236",
"0.61253244",
"0.6107475",
"0.60547864",
"0.604865",
"0.6046654",
"0.60339445",
"0.6005888",
"0.6005888",
"0.6005888",
"0.6005485",
"0.5974702",
"0.5935466",
"0.59247625",
"0.59185445",
"0.59035033",
"0.58933",
"0.5884303",
"0.58808655",
"0.58808655",
"0.58808655",
"0.58808655",
"0.5874344",
"0.5864508",
"0.5853501",
"0.5848219",
"0.58390784",
"0.582004"
]
| 0.73982596 | 0 |
mark all posts in a conversation | def mark_all_posts usr
return false if usr.blank?
@conv.posts.each do |post|
post.mark_as_read! for: usr if post
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_all_posts usr\n ConversationProcessor.new(self).mark_all_posts usr\n end",
"def mark_all_readed\n doctor.notifications.update_all unreaded: false\n send_json doctor.notifications, true\n end",
"def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end",
"def mark(_ = nil)\n answers.each do |answer|\n answer.publish! if answer.submitted?\n end\n end",
"def mark_all_read\r\n @channel.mark_messages_read_for current_user\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel), notice: 'Nachrichten als gelesen markiert.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def mark(_ = nil)\n publish_answers\n end",
"def update_mentions\n post.update_mentions\n end",
"def after_numbered(post)\n return unless post.is_a?(Post)\n return unless post.topic\n return unless post.topic.status == 'publish'\n return unless post.floor and post.floor > 0\n send_mention(post)\n end",
"def mark_as_unread\n @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)])\n end",
"def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end",
"def show\n @messages = @conversation.messages.sort_by(&:updated_at)\n @messages.each do |m|\n (m[:viewed] = true) && m.save if m.viewed == false && @current_user.id != m.author\n end\n end",
"def remove_posts usr\n @conv.posts.each do |post|\n if usr.id == post.user_id\n post.status = 'removed'\n elsif usr.id == post.recipient_id\n post.recipient_status = 'removed'\n end\n post.save\n end\n end",
"def set_to_read\n\t\t#We find all the messages in the current conversation\n\t\t@conversation_messages = PersonalMessage.where(conversation_id: @conversation).all\n\t\t@conversation_messages.each do |message|\n\t\t\t# We mark as read the messages recieved by the current user \n\t\t\tif message.user_id != current_user.id\n\t\t\t\tmessage.update(read: true) unless message.read != false\n\t\t\tend\n\t\tend\n\tend",
"def reset_unread_conversations_counter\n unread_count = conversations.unread.count\n if self.unread_conversations_count != unread_count\n self.class.where(:id => id).update_all(:unread_conversations_count => unread_count)\n end\n end",
"def update_read_statuses\n person_conversations.each do |p_c|\n if p_c.person_id == last_message.sender.id\n p_c.update_attribute(:last_sent_at, last_message.created_at)\n else\n p_c.update_attributes({ :is_read => 0, :last_received_at => last_message.created_at })\n end \n end\n end",
"def set_conversation\n @conversation = Conversation.where(featured: true).find(params[:id])\n end",
"def set_conversations\n if current_user == @listing.seller\n @conversations = @listing.conversations\n else\n @conversations = @listing.conversations.between(@listing.seller, current_user)\n if @conversations.empty? \n @conversations = create_conversation\n end\n end\n end",
"def enable_inbox_replies\n client.post('/api/sendreplies', id: read_attribute(:name), state: true)\n end",
"def mark_old_broadcasts\n BroadcastMessage.all.each do |broadcast|\n broadcast.users_viewed << self.id\n broadcast.save\n end\n end",
"def send_mention(post)\n post.mentioned.each do |mentioned_user|\n Notification.send_to mentioned_user, 'mention', post.topic, post.user, post\n end unless post.mentioned.blank?\n end",
"def mark_as_spam!\n update_attribute(:approved, true)\n Akismetor.submit_spam(akismet_attributes)\n end",
"def set_conversations\n @conversations = @conversations.send(@order) unless @conversations.blank?\n @conversations = @conversations.page(params[:page]).per(15)\n\n render :index\n end",
"def mark_as_spam!\n update_attribute(:approved, false)\n Akismetor.submit_spam(akismet_attributes)\n end",
"def set_members\n members_ids = params[:message][:recipient_ids].reject(&:empty?)\n members_ids.each do |members_id|\n @message = current_user.messages.create(:conversation_id => members_id , :body => params[:message][:body])\n\n #send notification\n reciver = User.find(members_id)\n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has send a message #{@message.topic} \", notificable: @message, :accept => false)\n end\n end\n end",
"def mark_as_read\n\t\tunread_messages = current_user.received_messages.where(read: false).order('id desc').limit(10)\n\t\tunread_messages.each do |m|\n\t\t\tm.update_attribute(:read, true)\n\t\t\tm.save\n\t\tend\n\t\tredirect_to request.referer\n\tend",
"def all_post\n end",
"def flag\n @conversation = @admin.mailbox.conversations.find(params[:id])\n @conversation.update_column :flagged, params[:flag]\n @conversation.update_column :flagged_at, Time.now\n @conversation.update_column :mailboxer_label_id, Mailboxer::Label::CONVERSATION\n @structure.delay.compute_response_rate\n respond_to do |format|\n format.html { redirect_to pro_structure_conversations_path(@structure), notice: \"Le message a été signalé\" }\n end\n end",
"def wall_post_members\n Member.related_to_notification(self)\n end",
"def mark_all_as_read(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/conversations/mark_all_as_read\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end",
"def perform\n ActiveRecord::Base.transaction do\n reply.update(deleted: true)\n reply.taggings.delete_all\n reply.mentionings.delete_all\n end\n end"
]
| [
"0.8151513",
"0.6205402",
"0.6189774",
"0.58371794",
"0.56703055",
"0.56609356",
"0.55997",
"0.55727977",
"0.5549892",
"0.54906887",
"0.54813874",
"0.5453417",
"0.54390085",
"0.54188335",
"0.5398069",
"0.5370722",
"0.5357503",
"0.53451574",
"0.53398174",
"0.53383404",
"0.53074694",
"0.5306967",
"0.53016657",
"0.5282683",
"0.52692896",
"0.52469164",
"0.52418643",
"0.5235547",
"0.52286476",
"0.522823"
]
| 0.69614565 | 1 |
Initializes an instance url:: URL to a BigBlueButton server (e.g. salt:: Secret salt for this server version:: API version: 0.7 (valid for 0.7, 0.71 and 0.71a) | def initialize(url, salt, version='0.7', debug=false)
@supported_versions = ['0.7','0.8']
@url = url
@salt = salt
@debug = debug
if version.nil?
@version = get_api_version
else
@version = version
end
unless @supported_versions.include?(@version)
raise BigBlueButtonException.new("BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}")
end
puts "BigBlueButtonAPI: Using version #{@version}" if @debug
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(url, salt, version='0.7', debug=false)\n @supported_versions = ['0.7', '0.8']\n @url = url\n @salt = salt\n @debug = debug\n @timeout = 10 # default timeout for api requests\n @request_headers = {} # http headers sent in all requests\n\n @version = version || get_api_version\n unless @supported_versions.include?(@version)\n raise BigBlueButtonException.new(\"BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}\")\n end\n\n puts \"BigBlueButtonAPI: Using version #{@version}\" if @debug\n end",
"def initialize(url=\"\")\n @serverURL = url\n end",
"def initialize(server_url)\n uri = URI.parse(server_url)\n @host = uri.host\n @port = uri.port\n @username = uri.user\n @password = uri.password\n @use_ssl = (uri.scheme == \"https\")\n end",
"def initialize\n self.url = Yolo::Config::Settings.instance.deploy_url\n end",
"def initialize(url_or_port, api_key_or_file, api_version=nil)\n url_or_port = \"http://localhost:#{url_or_port}\" if url_or_port.is_a? Integer\n @uri = URI.parse(url_or_port)\n @api_key = api_key_or_file.is_a?(IO) ? api_key_or_file.read : api_key_or_file\n @api_version = api_version ? api_version.to_s : current_api_version.to_s\n @ssl_verify = OpenSSL::SSL::VERIFY_PEER\n end",
"def initialize(uri, api_checksum_salt, api_version)\n @api_checksum_salt = api_checksum_salt\n @api_version = api_version\n @uri = uri.start_with?('http') ? uri : 'https://' + uri\n end",
"def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end",
"def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end",
"def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end",
"def initialize(url, options = {})\n # sets the URL to be shortened\n self.url = url\n # allows an instance-level override for the api key\n @api_key = options[:api_key]\n # allows an instance-level override for the timeout\n @timeout = options[:timeout]\n # allows an instance-level override for the proxy\n @proxy = URI(options[:proxy]) if options[:proxy]\n end",
"def initialize(base_url: BASE_URL, api_version: API_VERSION, api_key: API_KEY)\n @base_url = base_url\n @api_version = api_version\n @api_key = api_key\n end",
"def initialize(api_key, url='http://localhost:9001/api')\n @uri = URI.parse(url)\n raise ArgumentError, \"#{url} is not a valid url\" unless @uri.host and @uri.port\n @api_key = api_key\n connect!\n end",
"def initialize(api_url, app_name = DEFAULT_APP_NAME)\n @app_name = app_name\n @key = Digest::MD5.hexdigest(@app_name)\n @api_endpoint = \"http://#{api_url}/api\"\n end",
"def initialize(server, api_version, api_key)\n self.class.base_uri \"http://#{server}/api/#{api_version}\"\n self.class.headers 'Accept' => 'application/json', \"X-CCApiKey\" => api_key\n end",
"def init\n Biilabs.configuration do |config|\n config.host = SET_HOST_URL_HERE_HERE\n end\nend",
"def prepare\n @api = BigBlueButton::BigBlueButtonApi.new(URL, SECRET, VERSION.to_s, true)\n end",
"def initialize(instance, user: nil, password: nil, oauth_token: nil, client_id: nil, client_secret: nil, use_ssl: true)\n #instance example: https://dev99218.service-now.com\n instance_with_protocol = use_ssl ? \"https://#{instance}\" : \"http://#{instance}\"\n @instance = URI.parse(instance_with_protocol)\n @user = user\n @password = password\n if (client_id && client_secret && user && password)\n @oauth_token = get_token(client_id, client_secret)\n else\n @oauth_token = oauth_token\n end\n end",
"def initialize(url)\n self.url = url\n end",
"def initialize(base_url)\n @base_url = base_url\n end",
"def initialize(server_uri = nil, api_key = nil)\n config = Shacip::Client.configuration\n @server_uri = URI.parse(server_uri&.to_s || config.server_uri.to_s)\n @api_key = api_key || config.api_key\n @http = Net::HTTP.new(@server_uri.host, @server_uri.port)\n end",
"def initialize(url = 'https://api.tictail.com')\n @url = url\n end",
"def initialize(api_url:, api_key:, verbose: false)\n self.api_url = api_url.is_a?(Addressable::URI) ? api_url : Addressable::URI.parse(api_url)\n self.api_key = api_key\n self.verbose = verbose\n end",
"def initialize(api_url)\n\t\turi = URI(api_url)\n\t\tcall_api(uri)\n\tend",
"def initialize(url, secret = nil)\n self.url = URI.parse(url.to_s)\n self.secret = secret\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def initialize(url, &on_reconnect)\n @url = url\n @beanstalk = nil\n @on_reconnect = on_reconnect\n connect!\n end",
"def api\n if @api.nil?\n @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.salt,\n self.version.to_s, false)\n end\n @api\n end",
"def initialize(url)\n @url = url\n end",
"def init(url = 'localhost:3000', app = 'weapp')\n @url = url\n @app = app\n end",
"def initialize(url)\n @url = url\n end"
]
| [
"0.7773854",
"0.75203896",
"0.7190561",
"0.6984908",
"0.6750601",
"0.67253166",
"0.67134416",
"0.67134416",
"0.67134416",
"0.66722953",
"0.6669814",
"0.66446024",
"0.66299945",
"0.6591506",
"0.6515754",
"0.649704",
"0.64923084",
"0.6490326",
"0.6474378",
"0.6450362",
"0.64403874",
"0.6439932",
"0.6411786",
"0.63969177",
"0.63892496",
"0.63870263",
"0.6378495",
"0.6375538",
"0.6374883",
"0.6373525"
]
| 0.7768183 | 1 |
Returns the url used to join the meeting meeting_id:: Unique identifier for the meeting user_name:: Name of the user password:: Password for this meeting used to set the user as moderator or attendee user_id:: Unique identifier for this user web_voice_conf:: Custom voiceextension for users using VoIP | def join_meeting_url(meeting_id, user_name, password,
user_id = nil, web_voice_conf = nil)
params = { :meetingID => meeting_id, :password => password, :fullName => user_name,
:userID => user_id, :webVoiceConf => web_voice_conf }
get_url(:join, params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_meeting_url(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n get_url(:join, params)\n end",
"def join_meeting(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n send_api_request(:join, params)\n end",
"def join_url(username, role, key=nil, options={})\n server = BigbluebuttonRails.configuration.select_server.call(self, :join_meeting_url)\n\n pass = case role\n when :moderator\n self.moderator_api_password\n when :attendee\n self.attendee_api_password\n when :guest\n if BigbluebuttonRails.configuration.guest_support\n options = { guest: true }.merge(options)\n end\n self.attendee_api_password\n else\n map_key_to_internal_password(key)\n end\n\n r = server.api.join_meeting_url(self.meetingid, username, pass, options)\n r.strip! unless r.nil?\n r\n end",
"def join_meeting(meeting_id, user_name, password, user_id = nil, web_voice_conf = nil)\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name,\n :userID => user_id, :webVoiceConf => web_voice_conf }\n send_api_request(:join, params)\n end",
"def get_meeting_url(id, password)\n prepare\n @api.join_meeting_url(id, 'Guest', password)\n end",
"def join_path(room, name, options = {}, uid = nil)\n\n # Destroy otp current_session\n current_user.destroy_otp if current_user&.room_otp.present?\n session.delete(:otp_name)\n\n # Create the meeting, even if it's running\n start_session(room, options)\n\n # Determine the password to use when joining.\n password = options[:user_is_moderator] ? room.moderator_pw : room.attendee_pw\n\n # Generate the join URL.\n join_opts = {}\n join_opts[:userID] = uid if uid\n join_opts[:join_via_html5] = true\n\n bbb_server.join_meeting_url(room.bbb_id, name, password, join_opts)\n end",
"def update_url\n answer_meeting_registration_path(meeting_id: meeting.id)\n end",
"def get_authentication_url\n @wll.getConsentUrl(\"Contacts.Invite\")\n end",
"def craft_url(user=nil,session=nil,return_to=\"http://www.instructure.com\")\n logger.debug \"calling craft url in wiziq_conference\"\n user ||= self.user\n initiate_conference and touch or return nil\n if (user == self.user || self.grants_right?(user,session,:initiate))\n admin_join_url(user, return_to)\n else\n participant_join_url(user, return_to)\n end\n end",
"def embed_url\n params = {\n showChat: false,\n userName: Rack::Utils.escape(h.current_user.username)\n }\n\n \"#{url}?#{params.to_query}\"\n end",
"def meet_invitation(root_url, url, user, invitee, message, meet)\n @root_url, @url = root_url, url\n @user, @invitee, @message, @meet = user, invitee, message, meet\n mail(#:cc => user.email, \n :to => invitee.email,\n :subject => \"You've been added to a Kaya Meet\")\n end",
"def htlal_users_url\n if htlal_language_id\n \"http://how-to-learn-any-language.com/forum/languages.asp?language=#{htlal_language_id}\"\n end\n end",
"def youtube_url; \"https://youtube.com/user/#{youtube}\" end",
"def join_web_url\n return @join_web_url\n end",
"def join_web_url\n return @join_web_url\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def guest_link\n return guest_hearing_link if guest_hearing_link.present?\n\n \"#{VirtualHearing.base_url}?join=1&media=&escalate=1&\" \\\n \"conference=#{formatted_alias_or_alias_with_host}&\" \\\n \"pin=#{guest_pin}&role=guest\"\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def url\n \"#{@client.url}#{self.class.path}#{@user1.username};#{@user2.username}\"\n end",
"def set_meeting\n @meeting = User.find(params[:user_id]).meetings.find(params[:id])\n end",
"def send_join_my_video_email(from_user,to_user,video_id)\n @from_user = from_user\n @to_user = to_user\n @video = Video.find(video_id)\n @video_link = \"#{ENV['MOOVI_URL']}/www/#/app/join-video/#{video_id}/#{to_user.id}\"\n mail(:from => self.moovi_email, :to => @to_user.email, :subject => \"Join #{from_user.name} to create the best video for #{@video.receiver.name}\" )\n end",
"def user_url(user)\n \"http://last.fm/user/\" + user\n end",
"def invitee_string\n\t\n\tend",
"def get_invitation_link\n\t\tscope = self.scope\n\t\trace_id = self.race_id\n\t\t\n\t\tbase_url = InvitationEmailTarget.get_base_url(race_id, scope)\n\t\t\n\t\tbase_url += case self.scope\n\t\twhen (COMPETITION_SCOPE[:SITE])\n\t\t\t'competitions/' + self.id.to_s + '?code=' + self.invitation_code\n\t\twhen (COMPETITION_SCOPE[:CYCLINGTIPS])\n\t\t\t'?competition_id=' + self.id.to_s + '&code=' + self.invitation_code\n\t\tend\n\t\t\n\t\treturn base_url\n\tend",
"def user_ref\n @messaging['optin']['user_ref']\n end",
"def start_session(room, options = {})\n create_options = {\n record: options[:record].to_s,\n logoutURL: options[:meeting_logout_url] || '',\n moderatorPW: room.moderator_pw,\n attendeePW: room.attendee_pw,\n moderatorOnlyMessage: options[:moderator_message],\n muteOnStart: options[:mute_on_start].to_s || \"false\",\n breakoutRoomsEnabled: options[:breakoutRoomsEnabled],\n \"logo\": options[:customLogoUrl] || '',\n \"meta_#{META_LISTED}\": options[:recording_default_visibility].to_s || \"false\",\n \"meta_whistle-origin-version\": \"1.0\",\n \"meta_whistle-origin\": \"WhistleRoom\",\n \"meta_whistle-origin-server-name\": options[:host],\n \"meta_roomPassword\": room.attendee_pw,\n \"meta_inviteMsgPassword\": \"#{options[:moderator_message]}\",\n \"meta_meetingUrl\": options[:meeting_url],\n \"meta_auth-mandatory\": options[:auth_mandatory].to_s || \"false\",\n \"meta_auth-multi-factor\": options[:auth_multi_factor].to_s || \"false\",\n \"meta_auth-room-key\": room.access_code.present?,\n \"meta_room-key\": room.access_code.to_s,\n \"meta_auth-lobby\": options[:auth_lobby].to_s || \"false\",\n \"meta_auth-onetime\": options[:auth_one_time_invite_link].to_s || \"false\",\n \"meta_encrypt-transit\": \"true\",\n \"meta_encrypt-recording\": \"true\",\n \"meta_encrypt-content\": \"true\",\n \"meta_privacy-record-consent\": \"true\",\n \"meta_privacy-data-deletion\": \"true\",\n \"meta_owner\": options[:owner].to_s || \"false\",\n \"meta_email\": options[:owner_email].to_s || \"\",\n \"meta_webinar\": options[:listen_only].to_s || \"false\",\n \"meta_google-calendar-url\": options[:google_calendar_url] || '',\n \"meta_banner-message\": options[:banner_message] || ''\n }\n\n create_options[:guestPolicy] = \"ASK_MODERATOR\" if options[:require_moderator_approval]\n create_options[:maxParticipants] = options[:maxParticipants] if options[:maxParticipants]\n create_options[:lockSettingsDisableMic] = options[:listen_only]\n create_options[:listenOnlyMode] = options[:listen_only]\n create_options[:forceListenOnly] = options[:listen_only]\n create_options[:enableListenOnly] = options[:listen_only]\n create_options[:lockSettingsLockOnJoin] = true\n create_options[:record] = options[:record]\n\n # Send the create request.\n begin\n meeting = if room.presentation.attached?\n modules = BigBlueButton::BigBlueButtonModules.new\n url = rails_blob_url(room.presentation).gsub(\"&\", \"%26\")\n logger.info(\"Support: Room #{room.uid} starting using presentation: #{url}\")\n modules.add_presentation(:url, url)\n bbb_server.create_meeting(room.name, room.bbb_id, create_options, modules)\n else\n bbb_server.create_meeting(room.name, room.bbb_id, create_options)\n end\n\n unless meeting[:messageKey] == 'duplicateWarning'\n room.update_attributes(sessions: room.sessions + 1, last_session: DateTime.now)\n end\n rescue BigBlueButton::BigBlueButtonException => e\n puts \"BigBlueButton failed on create: #{e.key}: #{e.message}\"\n raise e\n end\n end",
"def show\n user = self.load_user(params)\n meeting = load_meeting(params)\n\n if user != nil && meeting != nil\n self.send_json(\n meeting.to_json(:include => {\n :participants => {:only => [:id, :name, :email]},\n :suggestions => {:include => [:votes]}\n })\n )\n else\n self.send_error 401\n end\n end",
"def url\n '/users/show/' + login\n end",
"def new_user_hash\n # source: https://github.com/tapster/omniauth-meetup\n {\n \"provider\"=>\"meetup\",\n \"uid\"=>12345,\n \"info\"=> {\n \"id\"=>12345,\n \"name\"=>\"elvis\",\n \"photo_url\"=>\"http://photos3.meetupstatic.com/photos/member_pic_111.jpeg\"\n },\n \"credentials\"=> {\n \"token\"=>\"abc123...\", # OAuth 2.0 access_token, which you may wish to store\n \"refresh_token\"=>\"bcd234...\", # This token can be used to refresh your access_token later\n \"expires_at\"=>1324720198, # when the access token expires (Meetup tokens expire in 1 hour)\n \"expires\"=>true\n },\n \"extra\"=> {\n \"raw_info\"=> {\n \"lon\"=>-90.027181,\n \"link\"=>\"http://www.meetup.com/members/111\",\n \"lang\"=>\"en_US\",\n \"photo\"=> {\n \"photo_link\"=> \"http://photos3.meetupstatic.com/photos/member_pic_111.jpeg\",\n \"highres_link\"=> \"http://photos1.meetupstatic.com/photos/member_pic_111_hires.jpeg\",\n \"thumb_link\"=> \"http://photos1.meetupstatic.com/photos/member_pic_111_thumb.jpeg\",\n \"photo_id\"=>111\n },\n \"city\"=>\"Memphis\",\n \"state\" => \"TN\",\n \"country\"=>\"us\",\n \"visited\"=>1325001005000,\n \"id\"=>12345,\n \"topics\"=>[],\n \"joined\"=>1147652858000,\n \"name\"=>\"elvis\",\n \"other_services\"=> {\"twitter\"=>{\"identifier\"=>\"@elvis\"}},\n \"lat\"=>35.046677\n }\n }\n }\n end",
"def invite_url(server: nil, permission_bits: nil)\n @client_id ||= bot_application.id\n\n server_id_str = server ? \"&guild_id=#{server.id}\" : ''\n permission_bits_str = permission_bits ? \"&permissions=#{permission_bits}\" : ''\n \"https://discord.com/oauth2/authorize?&client_id=#{@client_id}#{server_id_str}#{permission_bits_str}&scope=bot\"\n end"
]
| [
"0.8092655",
"0.7162452",
"0.713902",
"0.7123276",
"0.700276",
"0.6416468",
"0.5919399",
"0.5888902",
"0.5880316",
"0.5797665",
"0.57330704",
"0.5627439",
"0.54624236",
"0.5445873",
"0.5445873",
"0.5440448",
"0.5386621",
"0.53849703",
"0.5333603",
"0.5322903",
"0.531965",
"0.531545",
"0.52822727",
"0.5255568",
"0.5237582",
"0.5220786",
"0.52163714",
"0.5209025",
"0.51964444",
"0.5150385"
]
| 0.80475104 | 1 |
Returns true or false as to whether meeting is open. A meeting is only open after at least one participant has joined. meeting_id:: Unique identifier for the meeting | def is_meeting_running?(meeting_id)
hash = send_api_request(:isMeetingRunning, { :meetingID => meeting_id } )
hash[:running].downcase == "true"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meeting_running?(id)\n prepare\n @api.is_meeting_running?(id)\n end",
"def is_meeting_running?(meeting_id)\n hash = send_api_request(:isMeetingRunning, { :meetingID => meeting_id } )\n BigBlueButtonFormatter.new(hash).to_boolean(:running)\n end",
"def open?\n\t\t@time = Time.now.to_formatted_s(:time)\n\t\t#Recupere le numero du jour actuel\n\t\tday = Time.now\n\t\tday = day.strftime(\"%w\")\n\t#Recupere l'operating_hour du jour actuel\n\t\t@open = self.operating_hours.find_by(day: day)\n\t\[email protected](close_soon: false)\n\n\t\t@open_time = @open[:open].to_formatted_s(:time)\n\t\t@close_time = @open[:close].to_formatted_s(:time)\n\n\n\t\tif @open_time < @close_time\n\t\t\tif @time >= @open_time && @time <= @close_time\n\t\t\t\tif @time >= @open[:close] - 60*30\n\t\t\t\t\[email protected](close_soon: true)\n\t\t\t\tend\n\t\t\treturn true\n\t\t\telse\n\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\tif @time <= @open_time && @time >= @close_time\n\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\tif @time >= @open[:close] - 60*45\n\t\t\t\t\t\[email protected](close_soon: true)\n\t\t\t\t\tend\n\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\tend",
"def appointment?\n !open && !close\n end",
"def appointment?\n !open && !close\n end",
"def open?\n event_status_id == 1\n end",
"def find_open_meetings( check_date = Date.today() )\n @meetings_found = true\n\n # If no seasons_ids check out\n if !@seasons_found\n find_manageable_seasons()\n end\n\n @meetings_ids = Meeting.\n where( are_results_acquired: false ).\n where( season_id: @seasons_ids ).\n where(['meetings.header_date >= ? and (meetings.entry_deadline is null or meetings.entry_deadline >= ?)', check_date, check_date] ).\n select( :id ).\n map{ |m| m.id }\n end",
"def check_close_data_presence(meeting)\n return if meeting.closed_at.present? || !minutes_data?(meeting)\n\n meeting.closed_at = Time.current\nend",
"def is_open?\n @open\n end",
"def open?\n open = false\n\n # if any door is open, consider the entrance open\n self.doors.each do |door|\n if door.open?\n open = true\n end\n end\n\n open\n end",
"def open?\n state == :open\n end",
"def open?\n @opened\n end",
"def open_entry?\n opened_at <= DateTime.now.to_date && closed_at >= DateTime.now.to_date\n end",
"def open?\n open_date < Time.now && !past_deadline? rescue nil\n end",
"def check_closing_visibility(meeting)\n return unless meeting.minutes_visible.nil?\n return if minutes_data?(meeting) || meeting.closed_at.blank?\n\n meeting.minutes_visible = true\nend",
"def is_meeting_response\n return @is_meeting_response\n end",
"def open?\n return accepted_proposal_id == nil\n end",
"def is_open?()\n return !@closed\n end",
"def is_open?\n\t\treturn !!@open\n\tend",
"def not_yet_open?\n opened_at > DateTime.now\n end",
"def opening?\n !(open? || closed?)\n end",
"def open?\n @state == :open\n end",
"def current_meeting?\n Meeting.where(committee: self).and(Meeting.where(end_time: nil)).exists?\n end",
"def is_meeting_request\n return @is_meeting_request\n end",
"def is_open?\n return state == :open\n end",
"def open_at_this_time?\n now = timenow\n time_inside?(now, start_time.utc, end_time.utc)\n end",
"def open?\n @handshake&.finished? && !@closed\n end",
"def open?\n @open || true\n end",
"def open?\n registration_open_time < DateTime.now rescue false\n end",
"def closed?\n # the conference has been created the virtual hearing was deleted\n conference_id.present? && conference_deleted?\n end"
]
| [
"0.6380261",
"0.62248003",
"0.6221971",
"0.6039648",
"0.6039648",
"0.59506863",
"0.590294",
"0.57762027",
"0.57440346",
"0.572106",
"0.5709472",
"0.5704064",
"0.5704059",
"0.57009107",
"0.5669436",
"0.5643488",
"0.5627048",
"0.5624854",
"0.55969566",
"0.5593739",
"0.55860245",
"0.5576971",
"0.55761963",
"0.55659354",
"0.5554448",
"0.553411",
"0.5532574",
"0.551463",
"0.5495333",
"0.54896206"
]
| 0.6326372 | 1 |
Make a simple request to the server to test the connection | def test_connection
response = send_api_request(:index)
response[:returncode]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_connection\n args = get_connection_args(\"#{endpoint}/auth\")\n args[:raw_response] = true\n RestClient::Request.execute(args)\n end",
"def make_http_request\n Net::HTTP.get_response('localhost', '/ping', 3000).body\nend",
"def talk_to_server(host, port, request)\n socket = TCPSocket.open(host, port)\n socket.print(request)\n response = socket.read\n socket.close\n\n response\nend",
"def test_can_get_ping\n get '/ping'\n assert last_response.ok?\n assert_equal 'PONG', last_response.body\n end",
"def attempt_connection\n conn = Puppet.runtime[:http]\n\n response = conn.get(test_uri, headers: test_headers, options: options)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (#{test_uri}): [#{response.code}] #{response.reason}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (#{test_uri}): #{e.message}\"\n return false\n end",
"def test\n base_url = url_for(path: '')\n logger.debug \"Testing the #{fqdn} fora\"\n client.url = base_url.to_s\n begin\n # this is network library code; it MUST be rescued\n client.perform\n if client.response_code >= 300\n logger.error \"HTTP code not as expected! (#{client.response_code})\"\n end\n rescue => e\n # log the problem and move on\n logger.fatal \"#{e.class}: #{e.message} (#{e.backtrace[0]})\"\n end\n logger.info client.status.to_s\n logger.debug client.header_str.to_s\n # REVIEW: this netcode might need to be rescued\n driver.get base_url.to_s\n logger.info \"#{driver.title} (#{base_url})\"\n logger.debug \"Cookies:\\n\" + cookies.map { |cookie| \"\\t#{cookie[:name]} => #{cookie[:value]}\" }.join(\"\\n\")\n end",
"def ping\n response, body = send_request :get, '', :binary\n true\n end",
"def send_request(request = \"\", host = \"127.0.0.1\", port = 40600)\n begin\n @server.connect(host, port)\n @server.send(request, 0)\n response, address = @server.recvfrom(1024*1024)\n rescue Exception => e\n response = e.message\n end\n puts response\n end",
"def test\n Srchio::Response.new(self.class.get(\"/test\"))\n end",
"def test_get\n req = c.get(0, \"/ping\", &blk)\n\n assert_sent req.tag, :verb => V::GET, :path => \"/ping\"\n assert_recv reply(req.tag, :cas => 123, :value => \"pong\")\n end",
"def attempt_connection\n conn = Puppet::Network::HttpPool.http_instance(http_server, http_port, use_ssl, verify_peer)\n\n response = conn.get(test_path, test_headers)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): #{e.message}\"\n return false\n end",
"def connect\n\t\tsocket = TCPSocket.open(@host, @port) # Connect to server\n\t\tsocket.print(@request) # Send request\n\t\tresponse = socket.read # Read complete response\n\t\t\n\t\tputs \"------------------------------------\"\n\t\tputs \"Request to server: #{@request}\"\n\t\tputs \"------------------------------------\"\n\t\tputs \"Response is:\"\n\t\tputs \"\"\n\t\tputs response\n\tend",
"def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end",
"def server_ready?\n begin\n url = URI.parse(TEST_URI)\n req = Net::HTTP.new(url.host, url.port)\n res = req.request_head(\"/\")\n res.code == \"200\"\n rescue Errno::ECONNREFUSED\n false\n end\nend",
"def connect(options={})\n query = query_string(options)\n request = generate_request(query)\n begin\n response = Net::HTTP.get_response(request)\n Response.new response\n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, SocketError,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts \"Failed to connect: #{e}\"\n end\n end",
"def ping\n get('')\n end",
"def ping\n url = URI.parse(\"http://localhost:#{@port_number}/selenium-server/driver/?cmd=testComplete&sessionId=smoketest\")\n request = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) {|http|\n http.read_timeout=5\n http.request(request)\n }\n end",
"def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend",
"def connect\n @connection = Net::HTTP.new(@params[:server], @params[:port])\n @connection.use_ssl = true if @params[:scheme] == 'https'\n @connection.start\n end",
"def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end",
"def serverup?(ip, port)\n http = Net::HTTP.start(ip, port, {open_timeout:3, read_timeout:3})\n response = http.send_request('GET', '/')\n JSON.parse(response.body)\nrescue Timeout::Error, SocketError, Errno::ECONNREFUSED\n nil\nend",
"def test_connection\n end",
"def connect\n http = Net::HTTP.new @host, @port\n # http.set_debug_output($stdout)\n http.use_ssl = @ssl\n http.start\n http\n end",
"def test_connection\n synchronize{|conn|}\n true\n end",
"def test_request\n get \"/example/route\"\n assert last_response.ok?\n body = last_response.body\n assert body[\"Hello\"]\n end",
"def test_connection\n call :test_connection\n end",
"def request(*args, &blk)\n (@client ||= connect).request(*args, &blk)\n end",
"def test_racket_key\n server_run app: ->(env) { [200, {'Racket' => 'Bouncy'}, []] }\n data = send_http_and_read \"GET / HTTP/1.0\\r\\n\\r\\n\"\n\n assert_match(/HTTP\\/1.0 200 OK\\r\\nRacket: Bouncy\\r\\nContent-Length: 0\\r\\n\\r\\n/, data)\n end",
"def request(method)\n setup_client\n respond_with @client.request(method, @request.url, nil, @request.body, @request.headers, &@request.on_body)\n rescue OpenSSL::SSL::SSLError\n raise SSLError\n rescue Errno::ECONNREFUSED # connection refused\n $!.extend ConnectionError\n raise\n end",
"def connect!\n @connection = Net::HTTP.new(@server, 80)\n if @ssl\n @connection.use_ssl = true\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n @connection.start\n end"
]
| [
"0.7246728",
"0.6996201",
"0.6960943",
"0.69358444",
"0.6804451",
"0.67962855",
"0.6730802",
"0.6646011",
"0.6623835",
"0.660756",
"0.65600026",
"0.6557589",
"0.6467756",
"0.643878",
"0.64028424",
"0.6393356",
"0.6374452",
"0.6329454",
"0.6299891",
"0.62986606",
"0.62953645",
"0.6291279",
"0.6265853",
"0.6260751",
"0.6253393",
"0.62393326",
"0.62387437",
"0.6230733",
"0.62305015",
"0.6211616"
]
| 0.7188415 | 1 |
alias for summary also add descr shortcut?? | def desc() summary; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary\n # TODO\n end",
"def description\n return summary\n end",
"def summary\n end",
"def summary\n end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary *args\n @summary = args.first if args.size > 0\n end",
"def summary\n \n end",
"def summary\n {}\n end",
"def summary\n\t\tobject.summary || \"\"\n\tend",
"def describe(desc, *additional_desc, &block); end",
"def define_summary(name, opts = {}, &block)\n define_metric(:summary, name, opts, &block)\n end",
"def article_summary\n respond_to?(:summary) ? summary : ''\n end",
"def dump_summary *args; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def summary\n \"#{name} (#{email})\"\n end",
"def summary\n Rinku.auto_link(description.html_safe) rescue nil\n end",
"def summary\n description_section.first\n end",
"def base_description(_); end"
]
| [
"0.7998052",
"0.7950138",
"0.7838732",
"0.7838732",
"0.77272326",
"0.77272326",
"0.77272326",
"0.77272326",
"0.7421978",
"0.7414017",
"0.74064475",
"0.73783284",
"0.7327787",
"0.7302037",
"0.7216659",
"0.7126676",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7095259",
"0.7082772",
"0.69972223",
"0.699011"
]
| 0.80219734 | 0 |
We allow document series to be assigned directly on an edition for speed tagging | def document_series_ids=(ids)
raise(StandardError, 'cannot assign document series to an unsaved edition') unless persisted?
document.document_series_ids = ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_series\n @series = Series.find(params[:id])\n @cv = ControlledVocabulary.physical_object_cv('Film')\n @l_cv = ControlledVocabulary.language_cv\n end",
"def doc_series=(doc_series)\n if !doc_series.nil? && doc_series.to_s.length > 64\n fail ArgumentError, 'invalid value for \"doc_series\", the character length must be smaller than or equal to 64.'\n end\n\n @doc_series = doc_series\n end",
"def set_series\n @series = Series.friendly.find(params[:id])\n end",
"def set_article\n @series = Series.find(params[:id])\n end",
"def set_series\n @collection = Collection.find(params[:id])\n end",
"def add_series\n @bib.series.each do |s|\n case s.type\n when \"journal\"\n @item.journal = s.title.title\n @item.number = s.number if s.number\n when nil then @item.series = s.title.title\n end\n end\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def set_series\n @serie = Serie.find(params[:id])\n end",
"def series_issue\n end",
"def set_series\n @series = Serie.find(params[:id])\n end",
"def index_suppressed(solr_document)\n solr_document[suppressed_field] = object.suppressed?\n end",
"def set_bookseries\n @bookseries = Bookseries.find(params[:id])\n end",
"def change_series\n return unless request.xhr?\n serie_id = params[:serie_id]\n @quotation_line = QuotationLine.new(params[:quotation_line])\n @openings = {} #params[:openings]\n @section_height = params[:section_height] || {}\n @section_width = params[:section_width] || {}\n @serie = Serie.includes(:options => [:pricing_method, :options_minimum_unit]).find(serie_id)\n initialize_options_for_series()\n end",
"def series_params\n params.require(:collection).permit(:title, :volume_count, :author, :description, :release_year)\n end",
"def series_params\n params.require(:series).permit(:name, :description, :logo, :feeds_id, :calendar_id)\n end",
"def set_series_event\n @series_event = SeriesEvent.find(params[\"id\"] || params[\"series_event_id\"])\n end",
"def series_params\n params.require(:series).permit(:title, :summary, :created_by_id, :modified_by_id, :production_number, :total_episodes, :date)\n end",
"def set_engine_tag\n @engine_tag = EngineTag.find(params[:id])\n end",
"def set_series\n @episode = Episode.find(params[:id])\n end",
"def seriesAdded\n tag_range(\"800\", \"83X\")\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n # Only do this after the indexer has the file_set\n unless object.file_sets.nil?\n load_elections_xml(object)\n if @noko.nil?\n Rails.logger.warn(\"Couldn't find the Voting Record XML for #{solr_doc['id']}\")\n else\n solr_doc['voting_record_xml_tesi'] = @noko.to_xml\n solr_doc['format_ssim'] = 'Election Record' # solr_doc['format_tesim']\n solr_doc['title_ssi'] = solr_doc['title_tesim'].first # solr_doc['title_tesi']\n\n solr_doc['party_affiliation_sim'] = get_all_vs('//candidate/@affiliation', '//elector/@affiliation')\n solr_doc['party_affiliation_id_ssim'] = get_all_vs('//candidate/@affiliation_id', '//elector/@affiliation_id')\n # solr_doc['party_affiliation_id_ssim'].delete_if { |party_id| Party.find(party_id).nil? }\n\n solr_doc['date_tesim'] = get_all_vs('/election_record/@date')\n solr_doc['date_isi'] = solr_doc['date_tesim'].map(&:to_i).first\n # solr_doc[\"date_sim\"] = date.first[0..3] unless date.first.nil?\n\n solr_doc['office_id_ssim'] = get_v('/election_record/office/@office_id')\n solr_doc['office_role_title_tesim'] = get_all_vs('//role/@title')\n solr_doc['office_name_tesim'] = get_authority_from_nnv(solr_doc['office_id_ssim'], \"office\")\n\n solr_doc['state_name_tesim'] = solr_doc['state_name_sim'] = get_all_vs('//admin_unit[@type=\"State\"]/@name')\n\n solr_doc['election_id_ssim'] = [get_v('/election_record/@election_id')]\n solr_doc['election_type_tesim'] = solr_doc['election_type_sim'] = [get_v('/election_record/@type')]\n\n solr_doc['candidate_id_ssim'] = get_all_vs('//candidate/@name_id')\n solr_doc['candidate_name_tesim'] = get_all_vs('//candidate/@name')\n\n solr_doc['elector_name_tesim'] = get_all_vs(\"//elector/@name\")\n\n solr_doc['jurisdiction_tesim'] = solr_doc['jurisdiction_sim'] = [get_v('/election_record/office/@scope')]\n\n solr_doc['handle_ssi'] = get_v('/election_record/@handle')\n solr_doc['iteration_tesim'] = [get_v('/election_record/@iteration')]\n # solr_doc['page_image_urn_ssim'] = get_all_vs(\"//reference[@type='page_image']/@urn\").uniq\n solr_doc['iiif_page_images_ssim'] = get_iiif_ids(get_all_vs(\"//reference[@type='page_image']/@urn\").uniq)\n\n solr_doc['all_text_timv'] = get_all_text(solr_doc)\n end\n end\n end # End super.tap\n end",
"def set_scn_tag\n\t\t# Creating the limitation for the question tags\n\t\tscn_tag_limit = setting.build_scn_tag(scn_tag_limit: params[:scn_tag_limit])\n\t\t# creating the question tags limit\n\t\tif scn_tag_limit.save\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Scn Tag limit Successfully Updated.\",response: {scn_tag_limit: scn_tag_limit.scn_tag_limit.as_json }},:status=>200\n\t else\n\t render :json=> { success: false, message: scn_tag_limit.errors },:status=> 203\n\t end\t\n\tend",
"def edit \n @series = Series.all.map{ |s| [s.name, s.id] }\n \n end",
"def createSeries(createSeriesId, meeting_metadata, real_start_time)\n BigBlueButton.logger.info( \"Attempting to create a new series...\")\n # Check if a series with the given identifier does already exist\n seriesExists = false\n seriesFromOc = requestIngestAPI(:get, '/series/allSeriesIdTitle.json', DEFAULT_REQUEST_TIMEOUT, {})\n begin\n seriesFromOc = JSON.parse(seriesFromOc)\n seriesFromOc[\"series\"].each do |serie|\n BigBlueButton.logger.info( \"Found series: \" + serie[\"identifier\"].to_s)\n if (serie[\"identifier\"].to_s === createSeriesId.to_s)\n seriesExists = true\n BigBlueButton.logger.info( \"Series already exists\")\n break\n end\n end\n rescue JSON::ParserError => e\n BigBlueButton.logger.warn(\" Could not parse series JSON, Exception #{e}\")\n end\n\n # Create Series\n if (!seriesExists)\n BigBlueButton.logger.info( \"Create a new series with ID \" + createSeriesId)\n # Create Series-DC\n seriesDcData = parseDcMetadata(meeting_metadata, getSeriesDcMetadataDefinition(meeting_metadata, real_start_time))\n seriesDublincore = createDublincore(seriesDcData)\n # Create Series-ACL\n seriesAcl = createSeriesAcl(parseAclMetadata(meeting_metadata, getSeriesAclMetadataDefinition(),\n $defaultSeriesRolesWithReadPerm, $defaultSeriesRolesWithWritePerm))\n BigBlueButton.logger.info( \"seriesAcl: \" + seriesAcl.to_s)\n\n requestIngestAPI(:post, '/series/', DEFAULT_REQUEST_TIMEOUT,\n { :series => seriesDublincore,\n :acl => seriesAcl,\n :override => false})\n\n # Update Series ACL\n else\n BigBlueButton.logger.info( \"Updating series ACL...\")\n seriesAcl = requestIngestAPI(:get, '/series/' + createSeriesId + '/acl.xml', DEFAULT_REQUEST_TIMEOUT, {})\n roles = parseAclMetadata(meeting_metadata, getSeriesAclMetadataDefinition(), $defaultSeriesRolesWithReadPerm, $defaultSeriesRolesWithWritePerm)\n\n if (roles.length > 0)\n updatedSeriesAcl = updateSeriesAcl(seriesAcl, roles)\n requestIngestAPI(:post, '/series/' + createSeriesId + '/accesscontrol', DEFAULT_REQUEST_TIMEOUT,\n { :acl => updatedSeriesAcl,\n :override => false})\n BigBlueButton.logger.info( \"Updated series ACL\")\n else\n BigBlueButton.logger.info( \"Nothing to update ACL with\")\n end\n end\nend",
"def write_series_indexes\n series_posts = {}\n\n series = posts.docs.flat_map { |p| p.data[\"series\"] }.compact.uniq\n series.each do |name|\n safe_name = name.gsub(/_|\\P{Word}/, '-').gsub(/-{2,}/, '-').downcase\n path = File.join(\"series\", safe_name)\n\n this_series_posts = posts.select { |p| p.data[\"series\"] == name }.sort { |x, y| x.date <=> y.date }\n series_posts[name] = this_series_posts\n\n authors = this_series_posts.map { |p| p.data[\"author\"] }.flatten.uniq.map { |key| self.config['authors'][key] }\n write_series_index(path, name, series_posts, authors)\n end\n end",
"def target_edition=(value)\n @target_edition = value\n end",
"def create_from_goodreads(series)\n self['Title'] = series.title\n self.save\n end",
"def series_params\n params.require(:series).permit(:name, :date_aired, :synopsis, :status, :cover)\n end"
]
| [
"0.6066456",
"0.59444135",
"0.586813",
"0.5756031",
"0.5699041",
"0.56461513",
"0.5550231",
"0.5543285",
"0.55068195",
"0.549942",
"0.5484264",
"0.5462294",
"0.5453271",
"0.53783274",
"0.5371826",
"0.5329701",
"0.5264035",
"0.5261391",
"0.52533966",
"0.5242429",
"0.52258044",
"0.52206665",
"0.52021813",
"0.51838905",
"0.51796794",
"0.51767",
"0.51281947",
"0.5127558",
"0.5119704",
"0.5092183"
]
| 0.6322694 | 0 |
Return the width of the named style. +style_name+ defaults to the attribute's default_style. | def width(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
from_examination :@original_width
else
dimensions(style_name).at(0)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def width=(value)\n @style.width = value\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n geometry.bordered_width\n\n else\n value.size\n\n end\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n if left_aligned?\n value.size\n\n else\n geometry.bordered_width\n\n end\n\n else\n value.size\n\n end\n end",
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end",
"def style\n defined?(@style) ? @style : 0\n end",
"def width\r\n assert_exists\r\n return @o.invoke(\"width\").to_s\r\n end",
"def size\n\t\treturn @styles.size\n\tend",
"def style\n @style ||= Style.new(attributes[:style])\n end",
"def style(attachment, style_name)\n style_name || attachment.default_style\n end",
"def width\n return options[:width] if present?(options[:width])\n return geometry.width if registered?\n\n raise Vedeu::Error::MissingRequired,\n 'The text provided cannot be wrapped or pruned because a ' \\\n ':width option was not given, or a :name option was either not ' \\\n 'given or there is no geometry registered with that name.'\n end",
"def width\n metadata[:width] if valid?\n end",
"def font_size\n return nil unless @styles\n\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def getStyleName\n styleNameHelper(MODE_GET)\n end",
"def style\n return @style\n end",
"def width(value)\n attributes[:width] = value\n end",
"def width\n attr('width')\n end",
"def width\n get_geometry if @width.nil?\n return @width\n end",
"def get_width\n width = self.unpadded_width\n\n if not width.nil? and width != 0\n return { :width => \"#{width}px\" }\n else\n return {}\n end\n end",
"def width\r\n has_width? ? parms[0].to_i : 0\r\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def width\n @font.text_width(self.text)\n end",
"def width\n size_a[0]\n end",
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def width\n `#{clientRect}.width`\n end",
"def font_size\r\n @style.font_size || @default_font_size\r\n end",
"def get_width(dta)\n get_dimension('width', dta)\n end",
"def dimensions(style = default_style)\n m = meta_for_style(style)\n w = m[:width]\n h = m[:height]\n \"#{w}#{h && \"x#{h}\"}\" if w || h\n end",
"def width(value)\n fail InvalidWidth if x_out_of_bounds?(value)\n\n attributes[:geometry][:width] = value\n end",
"def GetStringWidth(s)\n\t\t#Get width of a string in the current font\n\t\ts = s.to_s;\n\t\tcw = @current_font['cw']\n\t\tw = 0;\n\t\tif (@is_unicode)\n unicode = UTF8StringToArray(s);\n unicode.each do |char|\n\t\t\t\tif (!cw[char].nil?)\n\t\t\t\t\tw += cw[char];\n\t\t\t\t# This should not happen. UTF8StringToArray should guarentee the array is ascii values.\n # elsif (c!cw[char[0]].nil?)\n # w += cw[char[0]];\n # elsif (!cw[char.chr].nil?)\n # w += cw[char.chr];\n\t\t\t\telsif (!@current_font['desc']['MissingWidth'].nil?)\n\t\t\t\t\tw += @current_font['desc']['MissingWidth']; # set default size\n\t\t\t\telse\n\t\t\t\t\tw += 500;\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t s.each_byte do |c|\n\t\t\t\tif cw[c.chr]\n\t\t\t\t\tw += cw[c.chr];\n\t\t\t\telsif cw[?c.chr]\n\t\t\t\t\tw += cw[?c.chr]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn (w * @font_size / 1000.0);\n\tend"
]
| [
"0.81040615",
"0.6777788",
"0.6354896",
"0.63064265",
"0.6129217",
"0.60608274",
"0.6014019",
"0.5883229",
"0.5732189",
"0.57186073",
"0.56601983",
"0.5639279",
"0.5637219",
"0.56321603",
"0.55771065",
"0.55676115",
"0.5557213",
"0.5552883",
"0.5549331",
"0.55278665",
"0.5527266",
"0.5520857",
"0.5509983",
"0.55074716",
"0.5504335",
"0.5503273",
"0.5484978",
"0.54561365",
"0.5451603",
"0.54330665"
]
| 0.8343923 | 0 |
Return the height of the named style. +style_name+ defaults to the attribute's default_style. | def height(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
from_examination :@original_height
else
dimensions(style_name).at(1)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def height=(value)\n @style.height = value\n end",
"def css_style_height(height = '')\n height = height.to_s.as_css_size\n height.blank? ? '' : \"height:#{height};\"\n end",
"def height(name)\n Tk.execute(:image, :height, name)\n end",
"def font_height(size = nil)\n size = @font_size if size.nil? or size <= 0\n\n select_font(\"Helvetica\") if @fonts.empty?\n hh = @fonts[@current_font].fontbbox[3].to_f - @fonts[@current_font].fontbbox[1].to_f\n (size * hh / 1000.0)\n end",
"def height\n @font.height\n end",
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end",
"def height\n if alignment == :vertical\n @height ||= @options.count * @options.first.height\n else\n @height ||= @options.first.height\n end\n end",
"def height\n attr('height')\n end",
"def height\n size_a[1]\n end",
"def height\n `#{clientRect}.height`\n end",
"def height\n metadata[:height] if valid?\n end",
"def retrieve_height(param)\n unless (height = param[:height])\n height = self::DEFAULT_HEIGHT if param[:list_direction] == :vertical\n height ||= param[:list_height]\n height ||= self::DEFAULT_HEIGHT\n end\n return height\n end",
"def height\n attributes.map { |field| field.height }.max\n end",
"def height\n get_geometry if @height.nil?\n return @height\n end",
"def height(value)\n fail InvalidHeight if y_out_of_bounds?(value)\n\n attributes[:geometry][:height] = value\n end",
"def height\n line_count = layout.line_count\n h = (line_count - 1) * layout.spacing\n line_count.times do |i|\n h += layout.get_line_bounds(i).height\n end\n h\n end",
"def height(lines=1)\n return @font.height * lines + 4 # Where's this magic '4' come from?\n end",
"def height\n if clear_border?\n geometry.height\n\n else\n border.height\n\n end\n end",
"def font_size\r\n @style.font_size || @default_font_size\r\n end",
"def height\n size.first\n end",
"def height\n size.first\n end",
"def get_height(dta)\n get_dimension('height', dta)\n end",
"def height\r\n assert_exists\r\n return @o.invoke(\"height\").to_s\r\n end",
"def formatted_height\n '000'\n end",
"def height\n case target\n when :editable then height_for_editable_target\n when :cc, :kiddom, :qti, :schoology then image_height\n end\n end",
"def height\n instance.options[:height]\n end",
"def height\n @height || 100\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def font_size\n return nil unless @styles\n\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end"
]
| [
"0.8258957",
"0.6859417",
"0.6647148",
"0.6227877",
"0.5940879",
"0.57866794",
"0.5767589",
"0.5680373",
"0.5674596",
"0.5670273",
"0.5635982",
"0.5614297",
"0.5612909",
"0.55806106",
"0.5521675",
"0.5512786",
"0.5479372",
"0.5478817",
"0.5478198",
"0.5468598",
"0.54672617",
"0.54672617",
"0.5460796",
"0.5441306",
"0.54107773",
"0.5404523",
"0.53807324",
"0.5380427",
"0.53659534",
"0.5355825"
]
| 0.84590805 | 0 |
Return the aspect ratio of the named style. +style_name+ defaults to the attribute's default_style. | def aspect_ratio(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
original_width = from_examination(:@original_width)
original_height = from_examination(:@original_height)
original_width.to_f / original_height
else
w, h = *dimensions(style_name)
w.to_f / h
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end",
"def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end",
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end",
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def aspect_ratio(size)\n size[:width].to_f / size[:height]\n end",
"def aspect_ratio\n return 'none' unless fixed_ratio?\n dims = fullsize_settings[:dimensions]\n dims[0].to_f / dims[1]\n end",
"def aspect_ratio\n if self.width && self.height\n return self.width/self.height.to_f\n else\n return 1.324 # Derived from the default values, above\n end\n end",
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def convert(m)\n return auto(m) if @style[m] == :auto\n return @style[m] unless @style[m].percent?\n parent = self.parent || Viewport.new\n return (@style[m] * parent.inner.width / 100.0).round if [:x, :width].include?(m)\n return (@style[m] * parent.inner.height / 100.0).round\n end",
"def aspect_ratio\n height.to_f / width.to_f\n end",
"def aspect\n width / height\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def aspectratio\n if not @ratio then\n # Only calc the ratio the first time. Memoization!\n @ratio = Rational(@width, @height) # Ruby reduces fractions for us! How handy.\n end\n\n if @ratio == Rational(16, 10) # 16x10 is a special case, since we don't want it reduced down to 8x5\n return \"16x10\"\n else\n return \"#{@ratio.numerator}x#{@ratio.denominator}\" # Return the aspect ratio in WxH format\n end\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def aspect\n width.to_f / height\n end",
"def aspect_ratio\n if self.native_width && self.native_height\n return self.native_width/self.native_height.to_f\n else\n return 1.324 # Derived from the default values, above\n end\n end",
"def aspect_ratio(avail_width=nil, avail_height=nil)\n case self.aspect_ratio_method\n when ASPECT_RATIO_DEFAULT_METHOD\n return ASPECT_RATIO_DEFAULT_WIDTH / ASPECT_RATIO_DEFAULT_HEIGHT.to_f\n when ASPECT_RATIO_MANUAL_METHOD\n return self.native_width/self.native_height.to_f\n when ASPECT_RATIO_MAX_METHOD\n width = avail_width || ASPECT_RATIO_DEFAULT_WIDTH\n height = avail_height || ASPECT_RATIO_DEFAULT_HEIGHT\n return width / height.to_f\n end\n end",
"def resize_dimensions(original_dimensions, style)\n if style.filled?\n style.dimensions\n else\n original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1]\n target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1]\n if original_aspect_ratio > target_aspect_ratio\n width = style.dimensions[0]\n height = (width / original_aspect_ratio).round\n else\n height = style.dimensions[1]\n width = (height * original_aspect_ratio).round\n end\n [width, height]\n end\n end",
"def geometry(style_name='original')\n if style_name == 'original'\n Paperclip::Geometry.parse(\"#{original_width}x#{original_height}\")\n else\n Paperclip::Geometry.parse(style_dimensions(style_name))\n end\n end",
"def aspect\n width.to_f / height.to_f if !(width.blank? && height.blank?)\n end",
"def style(attachment, style_name)\n style_name || attachment.default_style\n end",
"def style_average(style_id)\n\n # find out the which of the user's rated beers belong to a style\n style_specific_beers = beers.select(\"beers.id\").where(\"style_id = ?\", style_id).distinct\n\n # gather the ids of those beers in order to find the ratings\n style_specific_beer_ids = []\n\n style_specific_beers.each do |style_beer|\n style_specific_beer_ids << style_beer.id\n end\n\n # calc avg for the beers of the style\n style_average = ratings.where(beer_id: style_specific_beer_ids).average(:score)\n end",
"def dimensions(style = :original)\n @dimensions ||= {}\n return {} unless is_bitmap? && File.exist?(attachment.path(style))\n @dimensions[style] ||= [:width, :height].zip(FastImage.size(attachment.path(style))).to_h\n end",
"def resize_ratio_for asset\n base_geo = asset.geometry(:base_to_crop)\n original_geo = asset.geometry\n # Returning the biggest size as the ratio will be more exact.\n field = base_geo.width > base_geo.height ? :width : :height\n #Ratio to original / base\n original_geo.send(field).to_f / base_geo.send(field).to_f\n end",
"def font_size\n return nil unless @styles\n\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def width=(value)\n @style.width = value\n end",
"def style\n @style ||= Style.new(attributes[:style])\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n geometry.bordered_width\n\n else\n value.size\n\n end\n end",
"def as_css_size\n size = self\n size += 'px' unless size.blank? || size.end_with?('px', '%', 'em') || size == 'auto' || size == 'inherit'\n return size\n end",
"def geometry(style_name='original')\n # These calculations are all memoised.\n @geometry ||= {}\n begin\n @geometry[style_name] ||= if style_name.to_s == 'original'\n # If no style name is given, or it is 'original', we return the original discovered dimensions.\n original_geometry\n else\n # Otherwise, we apply a mock transformation to see what dimensions would result.\n style = self.file.styles[style_name.to_sym]\n original_geometry.transformed_by(style.geometry)\n end\n rescue Paperclip::TransformationError => e\n # In case of explosion, we always return the original dimensions so that action can continue.\n original_geometry\n end\n end"
]
| [
"0.66587573",
"0.6197773",
"0.61951274",
"0.6068867",
"0.60096115",
"0.5917236",
"0.58478194",
"0.5703756",
"0.56912726",
"0.5612362",
"0.5597567",
"0.559034",
"0.5562877",
"0.55475664",
"0.5538559",
"0.5532147",
"0.5456631",
"0.5376528",
"0.5312218",
"0.52979004",
"0.5293787",
"0.52828074",
"0.52486795",
"0.5208119",
"0.5177219",
"0.51590306",
"0.5125673",
"0.5121971",
"0.5093052",
"0.507933"
]
| 0.85200244 | 0 |
Return the width and height of the named style, as a 2element array. | def dimensions(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
original_width = from_examination(:@original_width)
original_height = from_examination(:@original_height)
[original_width, original_height]
else
resize_dimensions(dimensions(:original), reflection.styles[style_name])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dimensions\n case @options[:style]\n when 'horizontal'\n [@colors.size, 1]\n when 'vertical'\n [1, @colors.size]\n end\n end",
"def styles\n return @metadata[:styles]\n end",
"def dimensions(style = :original)\n @dimensions ||= {}\n return {} unless is_bitmap? && File.exist?(attachment.path(style))\n @dimensions[style] ||= [:width, :height].zip(FastImage.size(attachment.path(style))).to_h\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def dimensions(style = default_style)\n m = meta_for_style(style)\n w = m[:width]\n h = m[:height]\n \"#{w}#{h && \"x#{h}\"}\" if w || h\n end",
"def style_names\n styles.keys\n end",
"def size\n\t\treturn @styles.size\n\tend",
"def style\n \"#{width}px;height:#{height}px;#{@style}\"\n end",
"def size\n [width, height]\n end",
"def size\n [width, height]\n end",
"def inline_styles\n parser.css(\"style\").to_a\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def geometry(style_name='original')\n if style_name == 'original'\n Paperclip::Geometry.parse(\"#{original_width}x#{original_height}\")\n else\n Paperclip::Geometry.parse(style_dimensions(style_name))\n end\n end",
"def size\n return @peer.width_style.to_s, @peer.height_style.to_s\n end",
"def dimensions\n [width,height]\n end",
"def styles\n mentos(:get_all_styles)\n end",
"def to_array str\n array = []\n str.split().each do |i|\n entry = i.split(\",\")\n\n width = entry[0].to_i\n height = entry[1].to_i\n\n if entry.length == 2\n array << [width, height]\n else\n ALL_MACROS[entry[2]].call(width, height, array)\n end\n end\n\n array\nend",
"def style_params\n params[:style]\n end",
"def styles\n if position == 1 || position == 2\n { :medium => \"175x150>\" }\n elsif position == 3\n { :medium => \"350x150>\" } \n elsif position == 4\n { :medium => \"350x300>\" } \n else\n { :medium => \"175x150>\" }\n end\n end",
"def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end",
"def styles\n return if @styles.empty?\n @styles.uniq.sort\n end",
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def resize_dimensions(original_dimensions, style)\n if style.filled?\n style.dimensions\n else\n original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1]\n target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1]\n if original_aspect_ratio > target_aspect_ratio\n width = style.dimensions[0]\n height = (width / original_aspect_ratio).round\n else\n height = style.dimensions[1]\n width = (height * original_aspect_ratio).round\n end\n [width, height]\n end\n end",
"def css_styles\n @css_styles ||= []\n end",
"def styles\n @styles ||= DEFAULT_STYLES\n end",
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def font_sizes\n @font_sizes ||= begin\n sizes = []\n doc.css(\"[style]\").each do |element|\n sizes.push element.font_size.round(-1) unless element.font_size.nil?\n end\n sizes.uniq.sort\n end\n end",
"def [](type)\n (@styles_by_type ||= {})[type.to_sym] ||= []\n end",
"def style\n return @style\n end",
"def styles\n @styles ||= Hash.new{ |h, k| h[k] = {} }\n end"
]
| [
"0.6866974",
"0.67288405",
"0.6516567",
"0.65090215",
"0.64856255",
"0.6415302",
"0.634943",
"0.6193142",
"0.6119825",
"0.6119825",
"0.603385",
"0.58650863",
"0.5858989",
"0.58505297",
"0.58187747",
"0.5804687",
"0.57633615",
"0.5755147",
"0.56933",
"0.5682097",
"0.56781006",
"0.56780994",
"0.56682056",
"0.5667699",
"0.56623256",
"0.5658569",
"0.5651684",
"0.56181526",
"0.5604636",
"0.55983055"
]
| 0.7086445 | 0 |
Return the dimensions, as an array [width, height], that result from resizing +original_dimensions+ for the given +style+. | def resize_dimensions(original_dimensions, style)
if style.filled?
style.dimensions
else
original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1]
target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1]
if original_aspect_ratio > target_aspect_ratio
width = style.dimensions[0]
height = (width / original_aspect_ratio).round
else
height = style.dimensions[1]
width = (height * original_aspect_ratio).round
end
[width, height]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def dimensions(style = :original)\n @dimensions ||= {}\n return {} unless is_bitmap? && File.exist?(attachment.path(style))\n @dimensions[style] ||= [:width, :height].zip(FastImage.size(attachment.path(style))).to_h\n end",
"def get_dimensions\n case @options[:style]\n when 'horizontal'\n [@colors.size, 1]\n when 'vertical'\n [1, @colors.size]\n end\n end",
"def extract_dimensions\n return unless is_image?\n {original: 'image_dimensions', resized: 'resized_dimensions'}.each_pair do |style, method|\n tempfile = media.queued_for_write[style]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.send(\"#{method}=\", [geometry.width.to_i, geometry.height.to_i])\n end\n end\n end",
"def actual_dimensions(version = nil)\n if :original == version || [:original] == version\n version = nil\n elsif :fullsize == version || [:fullsize] == version\n version = fullsize_version\n end\n current_version = version.present? ? get_version(*version) : self\n path = current_version.path\n image = {}\n image = MiniMagick::Image.open(path) if File.exists?(path)\n [image[:width], image[:height]]\n end",
"def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n when :aspect\n new_width = @width unless @width.nil?\n new_height = @height unless @height.nil?\n end\n\n [new_width, new_height].collect! { |v| v.round }\n end",
"def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n when :aspect\n new_width = @width unless @width.nil?\n new_height = @height unless @height.nil?\n end\n\n [new_width, new_height].collect! { |v| v.round }\n end",
"def dimensions(style = default_style)\n m = meta_for_style(style)\n w = m[:width]\n h = m[:height]\n \"#{w}#{h && \"x#{h}\"}\" if w || h\n end",
"def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end",
"def geometry(style_name='original')\n # These calculations are all memoised.\n @geometry ||= {}\n begin\n @geometry[style_name] ||= if style_name.to_s == 'original'\n # If no style name is given, or it is 'original', we return the original discovered dimensions.\n original_geometry\n else\n # Otherwise, we apply a mock transformation to see what dimensions would result.\n style = self.file.styles[style_name.to_sym]\n original_geometry.transformed_by(style.geometry)\n end\n rescue Paperclip::TransformationError => e\n # In case of explosion, we always return the original dimensions so that action can continue.\n original_geometry\n end\n end",
"def geometry(style_name='original')\n if style_name == 'original'\n Paperclip::Geometry.parse(\"#{original_width}x#{original_height}\")\n else\n Paperclip::Geometry.parse(style_dimensions(style_name))\n end\n end",
"def dimensions\n [width,height]\n end",
"def extract_dimensions\n tempfile = file.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.dimensions = [geometry.width.to_i, geometry.height.to_i]\n end\n end",
"def size\n\t\treturn @styles.size\n\tend",
"def dimensions\n height = count\n width = collect { |a| a.length }.max\n [width, height]\n end",
"def size\n [width, height]\n end",
"def size\n [width, height]\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def dimensions\n dim = [width, height]\n def dim.to_s\n join 'x'\n end\n dim\n end",
"def dimensions\n @dimensions ||= extract_dimensions\n end",
"def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end",
"def extract_dimensions\n tempfile = img.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.img_dimensions = [geometry.width.to_i, geometry.height.to_i]\n end\n end",
"def intrinsic_image_dimensions path\n if path.end_with? '.svg'\n img_obj = ::Prawn::Svg::Interface.new ::IO.read(path), self, {}\n img_size = img_obj.document.sizing\n { width: img_size.output_width, height: img_size.output_height }\n else\n # NOTE build_image_object caches image data previously loaded\n _, img_size = ::File.open(path, 'rb') {|fd| build_image_object fd }\n { width: img_size.width, height: img_size.height }\n end\n end",
"def dimensions\n return @dimensions if @dimensions\n @dimensions = {}\n (raw['Dimensions'] || {}).each do |name, values|\n values = [values] unless Array === values\n @dimensions[name] = values.map{|value| Dimension.new(value)}\n end\n @dimensions\n end",
"def aspect_ratio(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n original_width.to_f / original_height\n else\n w, h = *dimensions(style_name)\n w.to_f / h\n end\n end",
"def normalize_size(height:, width:)\n [\n normalize_single_size(height, ref_size: base_height),\n normalize_single_size(width, ref_size: base_width),\n ]\n end",
"def width_x_height\n container_multiplier = @options.size.split( '' ).first.to_i\n dcp_dimensions = @dcp_functions.dimensions\n container_width, container_height = dcp_dimensions[ CinemaslidesCommon::ASPECT_CONTAINER ].collect{|x| x * container_multiplier}\n @logger.debug( \"Container: #{ container_width } x #{ container_height } (1k multiplier: #{ container_multiplier })\" )\n \n if dcp_dimensions.has_key?( @options.aspect ) \n\twidth, height = dcp_dimensions[ @options.aspect ].collect{|x| x * container_multiplier}\n else # Custom aspect ratio\n\twidth, height = scale_to_fit_container( @options.aspect, container_width, container_height )\n end\n return [ width, height ].join( 'x' )\n end",
"def sizes\n @sizes ||= self.class.image_sizes.dup\n end",
"def image_dimensions\n unless self.height && self.width\n self.height, self.width = file.calculate_geometry\n if persisted?\n self.update_column(:height, self.height)\n self.update_column(:width, self.width)\n end\n end\n [self.height, self.width]\n end"
]
| [
"0.82603425",
"0.72764045",
"0.7099696",
"0.6898156",
"0.64568",
"0.63955665",
"0.63532746",
"0.63532746",
"0.63038194",
"0.5962581",
"0.5961278",
"0.59209335",
"0.57798636",
"0.57654184",
"0.57485104",
"0.5705169",
"0.57042444",
"0.57042444",
"0.5652785",
"0.56102395",
"0.55196166",
"0.55192095",
"0.55098945",
"0.54968995",
"0.54916334",
"0.54674476",
"0.5359959",
"0.5357491",
"0.53550386",
"0.53435975"
]
| 0.82804507 | 0 |
NOM pvalue: Nominal p value; that is, the statistical significance of the enrichment score. The nominal p value is not adjusted for gene set size or multiple hypothesis testing; therefore, it is of limited use in comparing gene sets. | def nominal_p_value
@nominal_p_value ||= @fields[5].to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_protein_probability(protein_node)\n\n\t\t#MS:1002403\n\t\tis_group_representative=(self.get_cvParam(protein_node,\"MS:1002403\")!=nil)\n\t\tif is_group_representative\n\t\t\treturn \tself.get_cvParam(protein_node.parent,\"MS:1002470\").attributes['value'].to_f*0.01\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def p_value(probability, n, m)\n return Float::NAN if n <= 0.0 || m <= 0.0\n\n if n == Float::INFINITY || n == -Float::INFINITY || m == Float::INFINITY || m == -Float::INFINITY\n return 1.0\n end\n\n if n <= m && m > 4e5\n return Distribution::ChiSquare.p_value(probability, n) / n.to_f\n elsif n > 4e5 # thus n > m\n return m.to_f / Distribution::ChiSquare.p_value(1.0 - probability, m)\n else\n # O problema está aqui.\n tmp = Distribution::Beta.p_value(1.0 - probability, m.to_f / 2, n.to_f / 2)\n value = (1.0 / tmp - 1.0) * (m.to_f / n.to_f)\n return value.nan? ? Float::NAN : value\n end\n end",
"def normalDistributionPValue(confidence)\n return Distribution::Normal.p_value(confidence)\n end",
"def propn\n xpos 'NNP'\n end",
"def nper\n z = payment * (1.0 + monthly_rate * ptype) / monthly_rate\n\n Math.log(-future_value + z / (amount + z)) / Math.log(1.0 + monthly_rate)\n end",
"def noi(property)\n property.noi\n end",
"def nose\n @nose ||= Nose.new self[:NOSE_BOTTOM_LEFT],\n self[:NOSE_BOTTOM_CENTER], self[:NOSE_TIP],\n self[:MIDPOINT_BETWEEN_EYES],\n self[:NOSE_BOTTOM_RIGHT]\n end",
"def neginv(b) return \"@SP\\nA=M-1\\nM=\"+b+\"M\\n\" end",
"def noisify_value(value)\n bound = Entropy * value.abs\n noise = Prng.rand(bound)\n noise *= -1 if Prng.rand > 0.5\n\n value + noise\nend",
"def na\n field_fetch('NA')\n end",
"def puppet_value; nil; end",
"def ne(value)\n set_operator_and_value(:ne, value)\n end",
"def nan\n BigDecimal('0')/BigDecimal('0')\n end",
"def estimation_n0(d,prop,margin=0.95)\n t=Distribution::Normal.p_value(1-(1-margin).quo(2))\n var=prop*(1-prop)\n t**2*var.quo(d**2)\n end",
"def get_neg_log(pval)\n if pval == 0\n return 50\n elsif pval == 1\n return 0.0\n else\n return -Math.log10(pval.to_f)\n end\n end",
"def ndp_tgt; self[:ndp_tgt].to_i; end",
"def recommended_value; nil; end",
"def nino=(value)\n @nino = value&.delete(' ')\n end",
"def get_dominant_allele_probability(k, m, n)\r\n poblation = k + m + n\r\n probs = {}\r\n probs[\"mn\"] = ( (m.to_f/poblation)*(n.to_f/(poblation - 1)) + (n.to_f/poblation)*(m.to_f/(poblation -1)) ) * 0.5\r\n probs[\"kn\"] = ( (k.to_f/poblation)*(n.to_f/(poblation - 1)) + (n.to_f/poblation)*(k.to_f/(poblation - 1)) ) * 1\r\n probs[\"km\"] = ( (k.to_f/poblation)*(m.to_f/(poblation - 1)) + (m.to_f/poblation)*(k.to_f/(poblation - 1)) ) * 1\r\n probs[\"kk\"] = ( (k.to_f/poblation)*((k.to_f - 1)/(poblation - 1))) * 1\r\n probs[\"mm\"] = ( (m.to_f/poblation)*((m.to_f - 1)/(poblation - 1))) * 0.75\r\n return (probs.values.sum()).round(5)\r\nend",
"def aceite\n 'N'\n end",
"def npv\n # setup_npv_step calls the back office in order to calculate the npv value on the npv_page\n wizard_step(:returns_lbtt_summary) { { after_merge: :update_tax_calculations } }\n end",
"def nan?\n end",
"def understrain_omnifacial_paroemiac()\n nonsolicitation_manship_podilegous?(unionism)\n end",
"def nan?() end",
"def ppn(what = :dataset)\n runopts_for(:ppn, what)\n end",
"def pov\n default_pov unless @pov\n @pov\n end",
"def npi; end",
"def get_recommended_value\n 'no'\n end",
"def unattended_value\n unattended? ? 'Y' : 'N'\n end",
"def default_value\n return :not_applicable if c100.consent_order? || c100.child_protection_cases?\n\n GenericYesNo::NO\n end"
]
| [
"0.56107986",
"0.55354834",
"0.5495203",
"0.53964394",
"0.53731257",
"0.5365285",
"0.51771814",
"0.50220495",
"0.5021046",
"0.48743036",
"0.48438528",
"0.48422042",
"0.48233116",
"0.48105547",
"0.4800551",
"0.4794564",
"0.47921255",
"0.4788358",
"0.4784487",
"0.47657344",
"0.47409597",
"0.4729747",
"0.47275275",
"0.47196564",
"0.4716315",
"0.47109962",
"0.47003007",
"0.4684874",
"0.46847183",
"0.46798754"
]
| 0.62969375 | 0 |
FDR qvalue: False discovery rate; that is, the estimated probability that the normalized enrichment score (NES) represents a false positive finding. For example, an FDR of 25% indicates that the result is likely to be valid 3 out of 4 times. | def fdr_q_value
@fdr_q_value ||= @fields[6].to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fdr(error_rate = 0.0001)\n sequences = self.dna_hash.values\n if sequences.size == 0\n return {}\n else\n seq_count = self.size\n observed_hash = variant_for_poisson(sequences)\n p_unadjusted = []\n observed_hash.each do |k, v|\n p_value = 1 - `Rscript -e \"cat(pbinom(#{k}-1, #{seq_count}, #{error_rate}))\"`.to_f # compute unadjusted exact p-value, ie under null, probability of observing observed_hash[k] or more extreme\n p_unadjusted += Array.new(v, p_value)\n end\n p_fdr = `Rscript -e \"cat(p.adjust(c(#{p_unadjusted.join(',')}), 'fdr'))\"`.split(\"\\s\").count_freq.to_a # controls fdr. aka Benjamini-Hochberg correction\n vars_pair = observed_hash.to_a\n fdr_hash = Hash.new(0)\n (0..(p_fdr.size - 1)).each do |i|\n fdr_hash[vars_pair[i][0]] = p_fdr[i][0].to_f\n end\n return fdr_hash\n end\n end",
"def duty_ratio=(dr_value)\n @duty = dr_value < 1.0 ? dr_value : (dr_value / 100.0)\n\n return unless @period\n\n calc_resistors\n end",
"def anticipated_fixed_payment(present_value, rate, term)\n\t\t((present_value.to_f) / ((1 - (1 - rate.to_f ) ** term ) / rate.to_f )).round(4)\n end",
"def do_rff(fv, sv)\n hf = get_marginal_entropy(fv)\n hs = get_marginal_entropy(sv)\n hfs = get_conditional_entropy(fv, sv)\n \n # symmetrical uncertainty\n 2*(hf-hfs)/(hf+hs)\n end",
"def disbursed_amount_factor\n disbursed_amount.to_f / Country.max_disbursed_amount\n end",
"def fare\n return PENALTY_FARE if penalty?\n return MINIMUM_FARE\n end",
"def perc\n rfd / (rfd + 1)\n end",
"def scanning_error_rate()\n\t\[email protected] do |v| \n\t\t\tnot is_value_compatible_with_at_least_one_rule?(v)\n\t\tend.reduce(:+) || 0\n\tend",
"def standard_deviation_denominator\n (reading_values.length - 1).to_f\n end",
"def q_f(df1, df2, f)\r\n if (f <= 0.0) then return 1.0; end\r\n if (df1 % 2 != 0 && df2 % 2 == 0)\r\n return 1.0 - q_f(df2, df1, 1.0 / f)\r\n end\r\n cos2 = 1.0 / (1.0 + df1.to_f * f / df2.to_f)\r\n sin2 = 1.0 - cos2\r\n \r\n if (df1 % 2 == 0)\r\n prob = cos2 ** (df2.to_f / 2.0)\r\n temp = prob\r\n i = 2\r\n while i < df1\r\n temp *= (df2.to_f + i - 2) * sin2 / i\r\n prob += temp\r\n i += 2\r\n end\r\n return prob\r\n end\r\n prob = Math.atan(Math.sqrt(df2.to_f / (df1.to_f * f)))\r\n temp = Math.sqrt(sin2 * cos2)\r\n i = 3\r\n while i <= df1\r\n prob += temp\r\n temp *= (i - 1).to_f * sin2 / i.to_f;\r\n i += 2.0\r\n end\r\n temp *= df1.to_f\r\n i = 3\r\n while i <= df2\r\n prob -= temp\r\n temp *= (df1.to_f + i - 2) * cos2 / i.to_f\r\n i += 2\r\n end\r\n prob * 2.0 / Math::PI\r\n end",
"def cdf(z_score)\n (0.5 * (1.0 + Math.erf((z_score * 1.0) / Math.sqrt(2))))\n end",
"def undisbursed_amount_factor\n disbursement_remaining.to_f / Country.max_disbursement_remaining\n end",
"def efective_given_nominal_anticipated(nominal_rate, term)\n (((1/((1-((nominal_rate.to_f/100)/term))**term))-1)*100).round(4)\n end",
"def get_inflation_rate()\r\n #assume a inflation rate between 2% and 7%\r\n inflation_rate=(rand(7)*0.01)\r\n if inflation_rate > 0.02\r\n return inflation_rate\r\n else\r\n return 0.02\r\n end\r\nend",
"def efg\n return 0.0 if fg.zero? || fga.zero?\n\n ((fg.to_f + 0.5 * three_p.to_f)/fga).round(3)\n end",
"def autosizedReferenceCondenserFluidFlowRate\n\n return self.model.getAutosizedValue(self, 'Reference Condenser Water Flow Rate', 'm3/s')\n \n end",
"def find_efactor(e_factor, quality)\n e_factor = e_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))\n [e_factor, 1.3].max\n end",
"def freq(f=false)\n if f\n @dial_freq=f-@carrier\n else\n # If the last time we checked the dial frequency is more than\n # @fexpire seconds ago, re-read the frequency and update the\n # timestamp.\n if Time.now().to_i-@ftime>@fexpire\n @dial_freq=(self.radio_freq()+self.get_carrier()).to_i\n @ftime=Time.now().to_i\n end\n return (@dial_freq+self.get_carrier()).to_i\n end\n end",
"def calculate_easiness_factor(quality)\n easiness_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))\n end",
"def quality\n return PRECISE unless within_range?\n return ULTRA_PRECISE if standard_deviation < 3.0\n return VERY_PRECISE if standard_deviation < 5.0\n PRECISE\n end",
"def disbursement_percentage\n disbursement_factor * 100\n end",
"def dust_value(card_rarity)\n\t\tcase card_rarity\n\t\twhen \"Free\"\n\t\t\treturn 0\n\t\twhen \"Common\"\n\t\t\treturn 40\n\t\twhen \"Rare\"\n\t\t\treturn 100\n\t\twhen \"Epic\"\n\t\t\treturn 400\n\t\twhen \"Legendary\"\n\t\t\treturn 1600\n\t\tend\n\tend",
"def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end",
"def fudge(stat)\n stat * rand(0.8..1.2)\n end",
"def ship_fedex\n 0.0\n end",
"def get_frac_covered patients, cover\n return 0 if patients.size == 0\n (patients.keys.count { |pat| !(patients[pat]&cover).empty? }.to_f/patients.size).round($d_prec)\nend",
"def farey(value, limit)\n a,b = 0,1\n c,d = 1,1\n\n while (b <= limit) && (d <= limit)\n mediant = Float(a+c)/Float(b+d)\n\n if value > mediant\n a,b = a+c, b+d\n else\n c,d = a+c, b+d\n end\n\n end\n\n (b <= limit) ? [a,b] : [c,d]\nend",
"def update_easiness_factor(quality)\n new_easiness_factor = calculate_easiness_factor(quality)\n # If EF is less than 1.3 then let EF be 1.3\n self.easiness_factor = new_easiness_factor < 1.3 ? 1.3 : new_easiness_factor\n end",
"def disbursement_factor\n approved_amount == 0 ? 0 : disbursed_amount / approved_amount.to_f\n end",
"def sfullness\n staken.to_f/slimit.to_f\n end"
]
| [
"0.6152747",
"0.57610196",
"0.57374275",
"0.5729737",
"0.5564448",
"0.54393005",
"0.54335916",
"0.5427187",
"0.5425854",
"0.5371067",
"0.5337704",
"0.5335693",
"0.5324293",
"0.531646",
"0.5305478",
"0.5281855",
"0.52783436",
"0.5275544",
"0.5264172",
"0.5223553",
"0.5222835",
"0.52207714",
"0.5214406",
"0.5213237",
"0.5199879",
"0.519317",
"0.5193058",
"0.51767844",
"0.5157161",
"0.5151332"
]
| 0.6098612 | 1 |
FWER pvalue: Familywiseerror rate; that is, a more conservatively estimated probability that the normalized enrichment score represents a false positive finding. Because the goal of GSEA is to generate hypotheses, the GSEA team recommends focusing on the FDR statistic. | def fwer_p_value
@fwer_p_value ||= @fields[7].to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fare\n return PENALTY_FARE if penalty?\n return MINIMUM_FARE\n end",
"def do_rff(fv, sv)\n hf = get_marginal_entropy(fv)\n hs = get_marginal_entropy(sv)\n hfs = get_conditional_entropy(fv, sv)\n \n # symmetrical uncertainty\n 2*(hf-hfs)/(hf+hs)\n end",
"def efg\n return 0.0 if fg.zero? || fga.zero?\n\n ((fg.to_f + 0.5 * three_p.to_f)/fga).round(3)\n end",
"def fdr(error_rate = 0.0001)\n sequences = self.dna_hash.values\n if sequences.size == 0\n return {}\n else\n seq_count = self.size\n observed_hash = variant_for_poisson(sequences)\n p_unadjusted = []\n observed_hash.each do |k, v|\n p_value = 1 - `Rscript -e \"cat(pbinom(#{k}-1, #{seq_count}, #{error_rate}))\"`.to_f # compute unadjusted exact p-value, ie under null, probability of observing observed_hash[k] or more extreme\n p_unadjusted += Array.new(v, p_value)\n end\n p_fdr = `Rscript -e \"cat(p.adjust(c(#{p_unadjusted.join(',')}), 'fdr'))\"`.split(\"\\s\").count_freq.to_a # controls fdr. aka Benjamini-Hochberg correction\n vars_pair = observed_hash.to_a\n fdr_hash = Hash.new(0)\n (0..(p_fdr.size - 1)).each do |i|\n fdr_hash[vars_pair[i][0]] = p_fdr[i][0].to_f\n end\n return fdr_hash\n end\n end",
"def feature_probability(index, value, class_name)\r\n features_of_class = get_feature_of_class(index, class_name)\r\n\r\n #statistical properties of the feature set\r\n fc_std = features_of_class.standard_deviation\r\n fc_mean = features_of_class.mean\r\n fc_var = features_of_class.variance \r\n\r\n # Calc prbobability of Normal Distribui\r\n\r\n exp = -((value - fc_mean)**2)/(2*fc_var)\r\n densy = (1.0/(Math.sqrt(2*Math::PI*fc_var))) * (Math::E**exp)\r\n\r\n return densy\r\n end",
"def farenheit\n self.fahrenheit\n end",
"def value\n (\n 0.7 * (annual_income / average_income) +\n 0.3 * (base_manpower / avearge_manpower)\n ).round(6)\n end",
"def stat_ftc\n percentage(self.heifers_first, self.heifers_first_calved)\n end",
"def female_body_fat\n weight_kg = user_weight / 2.2\n multipy_weight = 0.732 * weight_kg\n wrist_cm = user_wrist / 0.394\n multipy_wrist = 3.786 * wrist_cm\n forearm_circumference = user_forearm / 3.14\n multipy_forearm = 0.434 * forearm_circumference\n lean_body_weight = 8.987 + multipy_weight + multipy_wrist + multipy_forearm\n lean_diff = user_weight - lean_body_weight\n lean_diff_times_100 = lean_diff * 100\n body_fat = lean_diff_times_100 / user_weight\n return body_fat\n end",
"def fscore(beta)\n b2 = Float(beta**2)\n ((b2 + 1) * precision * recall) / (b2 * precision + recall)\n end",
"def fuel_efficiency\n ((mileage - predecessor.mileage) / liter).round(1) if predecessor\n end",
"def calculate_probability\n @value.denominator.fdiv(@value.denominator + @value.numerator)\n end",
"def anticipated_fixed_payment(present_value, rate, term)\n\t\t((present_value.to_f) / ((1 - (1 - rate.to_f ) ** term ) / rate.to_f )).round(4)\n end",
"def farenheit\n self.to_f\n end",
"def male_body_fat\n converted_weight = 1.082 * user_weight\n converted_waist = 4.15 * user_waist\n added_converted_weight = 94.42 + converted_weight\n lean_body_weight = added_converted_weight - converted_waist\n lean_diff = user_weight - lean_body_weight\n lean_diff_times_100 = lean_diff * 100\n body_fat = lean_diff_times_100 / user_weight\n return body_fat\n end",
"def score\n s = Settings.instance\n s.faculty_weight.to_f * (s.rank_weight.to_f/self.rank.to_f + s.mandatory_weight.to_f*(self.mandatory ? 1.0 : 0.0))\n end",
"def processor_family_check_failed_percentage=(value)\n @processor_family_check_failed_percentage = value\n end",
"def moving_fuel_efficiency\n if predecessor\n logger.debug(\"[#{self.class}.moving_fuel_efficiency] Calculating for #{description}: #{running_total_mileage} / #{running_total_liter} = #{(running_total_mileage.to_f / running_total_liter).round(1)}\")\n (running_total_mileage.to_f / running_total_liter).round(1)\n end\n end",
"def get_fwr()\n get_window_area().to_f / get_area.to_f\n end",
"def get_fwr()\n get_window_area().to_f / get_area.to_f\n end",
"def disbursed_amount_factor\n disbursed_amount.to_f / Country.max_disbursed_amount\n end",
"def calculate_probability(useful_results, reroll_count)\n return 100.0 * useful_results / ( 6 ** reroll_count )\n end",
"def calculate(t, fraud, type)\r\n#\t\tpp \"1\"\r\n\t\treturn 0.0 if type == 'billable' && self.bid_fee #if this fee is a bid fee and we are not looking at the bid fees then return 0, else continue on\r\n\t#\tpp \"2\"\r\n \t\r\n \tfee = self.fixed if self.price_type == 'F'\r\n \r\n fee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) if self.price_type == 'V' #calculate the fee\r\n \r\n return fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\r\n\t\t#if we get here we know we are dealing with a variable fee\r\n\t\t#puts (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min)\r\n\t#\tfee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) #calculate the fee\r\n\t#\tpp fee\r\n\t#\tpp \"3\"\r\n\t#\treturn fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\t\r\n\t\t#otherwise we need to determine the sign and threshold before we can return\r\n\t\tcase self.sign\r\n\t\t\twhen '>'\r\n\t\t\t #pp \">\"\r\n\t\t\t\treturn fee if t.amount > self.threshold\r\n\t\t\twhen '>='\r\n\t\t\t #pp \">=\"\r\n\t\t\t\treturn fee if t.amount >= self.threshold\r\n\t\t\twhen '<'\r\n\t\t\t #pp \"<\"\r\n\t\t\t\treturn fee if t.amount < self.threshold\r\n\t\t\twhen '<='\r\n\t\t\t #pp \"<=\"\r\n\t\t\t\treturn fee if t.amount <= self.threshold\r\n\t\t\telse\r\n\t\t\t #pp \"4\"\r\n\t\t\t\treturn 0.0\r\n\t\tend\r\n\t\t\r\n\t\t#if we get here then we have no idea what to do so just return 0\r\n\t\treturn 0.0\r\n\tend",
"def set_feelings_average\n return if persisted? || feelings_project_evaluations.empty?\n sum = 0\n feelings_project_evaluations.each do |fp|\n sum += fp.percent * fp.feeling.value\n end\n self.feelings_average = sum / Feeling.count\n end",
"def calc_potential_wtruck_fueled(val1= calc_upg_ch4, val2= 35750)\n\t\t(val1 / val2).round 1\n\tend",
"def results(values, weight)\n gpa = weight.reduce(:+).to_f / values.reduce(:+)\n\n puts $divide\n puts \"\\n#{$first.capitalize} #{$last.capitalize}, your GPA is #{gpa.to_s} \\n\\n\"\nend",
"def find_efactor(e_factor, quality)\n e_factor = e_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))\n [e_factor, 1.3].max\n end",
"def calc_koef(f, fs)\r\n 2 * Math.cos(2 * Math::PI * f / fs)\r\n end",
"def fulfillment_fee\n begin\n if variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee > 0\n variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee * quantity\n else\n self.order.retailer.fulfillment_fee * quantity\n end\n rescue\n begin\n self.order.retailer.fulfillment_fee * quantity\n rescue\n 0.0\n end\n end\n end",
"def disbursement_percentage\n disbursement_factor * 100\n end"
]
| [
"0.6240372",
"0.6228662",
"0.6042909",
"0.59502393",
"0.59360594",
"0.5899151",
"0.58332646",
"0.58183885",
"0.580707",
"0.56314766",
"0.55448127",
"0.5517625",
"0.5503823",
"0.5485083",
"0.54778224",
"0.54732966",
"0.5448831",
"0.54374516",
"0.54349446",
"0.54298985",
"0.5409298",
"0.5408415",
"0.54047304",
"0.5395871",
"0.5390159",
"0.53702545",
"0.5342699",
"0.53419197",
"0.5332967",
"0.5325687"
]
| 0.68583584 | 0 |
POST /practitioner_roles POST /practitioner_roles.json | def create
@practitioner_role = PractitionerRole.new(practitioner_role_params)
respond_to do |format|
if @practitioner_role.save
format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully created.' }
format.json { render :show, status: :created, location: @practitioner_role }
else
format.html { render :new }
format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_role(role)\n role = {\n \"id\"=>nil,\n \"name\"=>nil, \n \"description\"=>\"\", \n \"sessionTimeout\"=>\"60\",\n \"roles\"=>[],\n \"privileges\"=>[]\n }.merge(role);\n post(\"#{url_base}/roles\", {\"data\"=>role})[\"data\"]\n end",
"def CreateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n chef_server_rest.post(\"roles\", self)\n self\n end",
"def create_roles\n Role.create_roles(self)\n end",
"def create\n if !grant_access(\"edit_roles\", current_user)\n head(403)\n end\n @role = Role.new(role_params)\n @role.user_id = current_user.id\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_roles user\n user.add_role(params[:role_name])\n end",
"def set_practitioner_role\n @practitioner_role = PractitionerRole.find(params[:id])\n end",
"def create\n @team_role = TeamRole.new(team_role_params)\n\n respond_to do |format|\n if @team_role.save\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team_role }\n else\n format.html { render action: 'new' }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_roles\n ['admin', 'lector', 'jefe_calidad', 'jefe_bodega', 'op_bodega'].each do |role_name|\n Role.create!(name: role_name)\n end\nend",
"def create\n\n @user = User.new(params[:user])\n tutorRole = Role.find_by_name('tutor')\n @user.roles = [ tutorRole ]\n @user.save\n success = @user.save && @user.errors.empty?\n errors = @user.errors\n if(success) \n @tutor = Tutor.new()\n @tutor.user_id = @user.id\n success = @tutor.save && @tutor.errors.empty? \n errors = @tutor.errors\n if(! success)\n @user.delete\n end\n end\n\n @user.roles << Role[:tutor]\n \n respond_to do |format|\n if success\n flash[:notice] = 'Tutor was successfully created.'\n format.html { redirect_to(@tutor) }\n format.xml { render :xml => @tutor, :status => :created, :location => @tutor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @role = @company.roles.new(safe_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to [@company, @role], notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to admin_roles_path, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if role.save\n current_user.add_role :admin, role\n format.html { redirect_to admin_role_path(role), notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: role }\n else\n format.html { render :new }\n format.json { render json: role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @client.roles << @role\n flash[:notice] = 'Role was successfully created.'\n format.html { redirect_to client_role_url(@client, @role) }\n format.xml { render :xml => @role, :status => :created, :location => [@client, @role] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def practitioner_role_params\n params.fetch(:practitioner_role, {})\n end",
"def create\n @role = Role.new(params[:role])\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employees_role = EmployeesRole.create(employees_role_params)\n redirect_to employees_roles_path\n end",
"def create\n @user = User.new(user_params)\n\n if roles = params[:user][:roles]\n roles.map { |r| r.downcase }.each do |role|\n unless role.empty?\n @user.roles << Role.new(type: role)\n\n if role == \"admin\"\n respond_to do |format|\n if @user.save\n format.html { redirect_to (flash[:redirect] || :attendees), notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n\n if role == \"staff\"\n redirect_to get_staff_list_path\n end\n\n end\n end\n end\n end",
"def create\n @role = Role.new(role_params) \n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @titan_role = TitanRole.new(titan_role_params)\n\n respond_to do |format|\n if @titan_role.save\n format.html { redirect_to @titan_role, notice: 'Titan role was successfully created.' }\n format.json { render :show, status: :created, location: @titan_role }\n else\n format.html { render :new }\n format.json { render json: @titan_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @users_role = UsersRole.new(users_role_params)\n\n respond_to do |format|\n if @users_role.save\n format.html { redirect_to @users_role, notice: 'Users role was successfully created.' }\n format.json { render :show, status: :created, location: @users_role }\n else\n format.html { render :new }\n format.json { render json: @users_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role_permision = RolePermision.new(params[:role_permision])\n\n respond_to do |format|\n if @role_permision.save\n format.html { redirect_to @role_permision, notice: 'Role permision was successfully created.' }\n format.json { render json: @role_permision, status: :created, location: @role_permision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role_permision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_roles(contributor:, json: {})\n return contributor unless contributor.present? && json.present? && json[:role].present?\n\n json.fetch(:role, []).each do |url|\n role = Api::V2::DeserializationService.translate_role(role: url)\n contributor.send(:\"#{role}=\", true) if role.present? &&\n contributor.respond_to?(:\"#{role}=\")\n end\n contributor\n end",
"def create\r\n @role = Role.new(role_params)\r\n @role.save\r\n end",
"def create_role(auth, server_id, name, color, hoist, mentionable, permissions, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_roles,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles\",\n { color: color, name: name, hoist: hoist, mentionable: mentionable, permissions: permissions }.to_json,\n Authorization: auth,\n content_type: :json,\n 'X-Audit-Log-Reason': reason\n )\n end"
]
| [
"0.70966846",
"0.68966454",
"0.67919576",
"0.66241574",
"0.66051143",
"0.65650886",
"0.653956",
"0.64436543",
"0.6442777",
"0.6413613",
"0.63957596",
"0.635207",
"0.63496995",
"0.6345488",
"0.63403267",
"0.6282266",
"0.6282266",
"0.6282266",
"0.62611324",
"0.62566733",
"0.6252347",
"0.6236681",
"0.6231733",
"0.62285405",
"0.6220152",
"0.6218521",
"0.62108886",
"0.6167492",
"0.6162041",
"0.6160713"
]
| 0.7032563 | 1 |
PATCH/PUT /practitioner_roles/1 PATCH/PUT /practitioner_roles/1.json | def update
respond_to do |format|
if @practitioner_role.update(practitioner_role_params)
format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully updated.' }
format.json { render :show, status: :ok, location: @practitioner_role }
else
format.html { render :edit }
format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @team_role.update(team_role_params)\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n if current_user.role.id == 7\n params[:assessment_practice_test][:status] = 6\n end\n respond_to do |format|\n if@assessment_practice_test.update_attributes(params[:assessment_practice_test])\n format.html { redirect_to@assessment_practice_test, notice: 'AssessmentPracticeTest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@assessment_practice_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = @client.roles.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to client_role_url(@client, @role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if !grant_access(\"alter_roles\", current_user)\n head(403)\n end\n @role.user_id = current_user.id\n @role.start_point = false if !params[:role][:start_point]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, 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 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 update\n @lab_role = LabRole.find(params[:id])\n\n respond_to do |format|\n if @lab_role.update_attributes(params[:lab_role])\n format.html { redirect_to @lab_role, notice: 'Lab role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # @personnel.first_name = params[\"first_name\"]\n # @personnel.last_name = params[\"last_name\"]\n # @personnel.phone_number = params[\"phone_number\"]\n # @personnel.title = params[\"title\"]\n # @personnel.email = params[\"email\"]\n\n respond_to do |format|\n if @personnel.update(personnel_params)\n @personnel.user_roles.update(:role_id => params[\"role_id\"][\"user_role_id\"])\n format.html { redirect_to personnel_path(@personnel), notice: 'Personnel was successfully updated.' }\n format.json { render :show, status: :ok, location: @personnel }\n else\n format.html { render :edit }\n format.json { render json: @personnel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n \n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @required_role.update(required_role_params)\n format.html { redirect_to @required_role, notice: 'Required role was successfully updated.' }\n format.json { render :show, status: :ok, location: @required_role }\n else\n format.html { render :edit }\n format.json { render json: @required_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n \n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n @role.update_attributes(params[:role])\n respond_with(@role)\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if role.update(role_params) && update_users_roles\n format.html { redirect_to admin_role_path(role), 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 update\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n if @role_permision.update_attributes(params[:role_permision])\n format.html { redirect_to @role_permision, notice: 'Role permision was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role_permision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_role\n\t\t@role = Role.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @role.update_attributes(role_update_params)\n\t\t format.html { redirect_to(@role, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@role) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@role) }\n\t\t end\n\n \t end\n\tend",
"def update\n @user = User.find(params[:id])\n params[:user][:roles].reject!(&:blank?)\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_practitioner_role\n @practitioner_role = PractitionerRole.find(params[:id])\n end",
"def update\n authorize! :assign_roles, @user if params[:user][:assign_roles]\n if @user.update_attributes(params[:user])\n redirect_to @user, notice: 'User was successfully updated.'\n else\n render \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to admin_roles_path, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app_role = AppRole.find(params[:id])\n\n respond_to do |format|\n if @app_role.update_attributes(params[:app_role])\n format.html { redirect_to @app_role, notice: 'App role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json {\n render :json => @person, :include=>[:roles]\n # Don't use this, due to this View no Role Data NOde\n # render :show, status: :ok, location: @person, :include=>[:roles]\n }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:user_id])\n @roles = Role.all\n \n if current_user.is_admin?\n @user.roles.clear\n @roles.each do |role|\n if (params[:role][:role][role.rolename][:hasrole].to_s == 1.to_s)\n @user.roles << role\n end\n end\n else\n @roles.each do |role|\n if !role.admin_only\n if @user.has_role?(role.rolename)\n @user.roles.destroy(role)\n end\n if (params[:role][:role][role.rolename][:hasrole].to_s == 1.to_s)\n @user.roles << role\n end\n end\n end\n end\n \n flash[:notice] = I18n.t(\"user.success.roles_updated\")\n reload_page\n \n end",
"def update\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n if @roles_and_permission.update_attributes(params[:roles_and_permission])\n format.html { redirect_to [@roles,@roles_and_permission], notice: 'Roles and permission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roles_and_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_role(id, *roles)\n request(:put, \"/users/#{id}.json\", default_params(:role_ids => roles))\n end",
"def update\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n \n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to company_role_path(@company, @role), notice: 'El rol fue editado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roles = Role.all\n\n role = user_params[:role_id] ? user_params[:role_id] : @user.role_id\n if user_params[:password].empty?\n new_params = { :role_id => role,\n :first_name => user_params[:first_name],\n :last_name => user_params[:last_name],\n :email => user_params[:email],\n :telephone => user_params[:telephone] }\n else\n new_params = { :role_id => role,\n :first_name => user_params[:first_name],\n :last_name => user_params[:last_name],\n :email => user_params[:email],\n :telephone => user_params[:telephone],\n :password => user_params[:password],\n :password_confirmation => user_params[:password_confirmation] }\n end\n p = new_params\n respond_to do |format|\n if @user.update(p)\n format.html { redirect_to @user, notice: 'Benutzerdaten wurden aktualisiert.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, 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 update\n # this action is not provided for partyroles\n end"
]
| [
"0.7071717",
"0.686072",
"0.68333566",
"0.6822314",
"0.68108964",
"0.677246",
"0.6718536",
"0.6697436",
"0.66946715",
"0.6692879",
"0.66622573",
"0.666203",
"0.66609925",
"0.6653987",
"0.6629426",
"0.6610442",
"0.6591068",
"0.6565691",
"0.654898",
"0.6538467",
"0.65236104",
"0.651261",
"0.65101117",
"0.65045655",
"0.65030193",
"0.6496594",
"0.64947927",
"0.64777064",
"0.64686114",
"0.6468098"
]
| 0.7223109 | 0 |
DELETE /practitioner_roles/1 DELETE /practitioner_roles/1.json | def destroy
@practitioner_role.destroy
respond_to do |format|
format.html { redirect_to practitioner_roles_url, notice: 'Practitioner role was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lab_role = LabRole.find(params[:id])\n @lab_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_role.destroy\n respond_to do |format|\n format.html { redirect_to lab_team_roles_path(@lab) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = @client.roles.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n flash[:notice] = 'Role was successfully removed.' \n format.html { redirect_to(client_roles_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rol.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to management_roles_url, notice: 'Perfil was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to company_roles_url(@company), notice: 'Role was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n chef_server_rest.delete(\"roles/#{@name}\")\n end",
"def destroy\n @app_role = AppRole.find(params[:id])\n @app_role.destroy\n\n respond_to do |format|\n format.html { redirect_to app_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministerial_role.destroy\n respond_to do |format|\n format.html { redirect_to ministerial_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @required_role.destroy\n respond_to do |format|\n format.html { redirect_to required_roles_url, notice: 'Required role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to company_roles_path(@company) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @titan_role.destroy\n respond_to do |format|\n format.html { redirect_to titan_roles_url, notice: 'Titan role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n @lab_permissions_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_permissions_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_role = Role.find(params[:id])\n @admin_role.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_user_role.destroy\n respond_to do |format|\n format.html { redirect_to core_user_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url , :notice => t('hurricane.notice.delete_record_success', :type => t_type)}\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n @role_permision = RolePermision.find(params[:id])\n @role_permision.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n\n respond_to do |format|\n format.html { redirect_to role_permisions_url }\n format.json { head :ok }\n end\n end",
"def DeleteRole id\n \n APICall(path: \"custom_roles/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n role.destroy\n respond_to do |format|\n format.html { redirect_to admin_roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n @roles_and_permission.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_and_permissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to system_roles_url, notice: '删除角色成功.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @review_items_by_role.destroy\n respond_to do |format|\n format.html { redirect_to review_items_by_roles_url, notice: 'Review items by role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if !grant_access(\"alter_roles\", current_user)\n head(403)\n end\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
]
| [
"0.7363247",
"0.7234942",
"0.72219765",
"0.71962875",
"0.7191758",
"0.7175023",
"0.7149711",
"0.71210355",
"0.71153915",
"0.71071374",
"0.7080056",
"0.70769376",
"0.7055473",
"0.7050793",
"0.70415354",
"0.7039209",
"0.7012131",
"0.70101774",
"0.7009771",
"0.69979894",
"0.6991923",
"0.697802",
"0.6964852",
"0.6962931",
"0.6950504",
"0.69498944",
"0.69379026",
"0.6935016",
"0.6935016",
"0.6935016"
]
| 0.7533551 | 0 |
Following method will delete actual credentials and update default signing credentials in signing.properties file (inside SigningConfigs folder) | def restore_default_signing_credentials()
system($cmd_to_remove_signing_directory)
system($cmd_to_create_new_signing_file)
IO.copy_stream($path_to_default_signing_file, $path_to_actual_signing_file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset()\n Dir[File.join(@keystore, \"*\")].each { |f| FileUtils.remove_entry_secure f }\n end",
"def rotate_credentials!\n clear_all_reviewer_sessions!\n generate_credentials\n save!\n end",
"def destroy()\n FileUtils.remove_entry_secure(@keystore)\n end",
"def sign_out\n Rails.cache.delete(keyring(:projects))\n end",
"def clear!\n self.public_key, self.secret_key, self.username, self.password = []\n end",
"def reset\n self.apikey = DEFAULT_APIKEY\n self.endpoint = DEFAULT_ENDPOINT\n self.sandbox_endpoint = DEFAULT_SANDBOX_ENDPOINT\n self.sandbox_enabled = DEFAULT_SANDBOX_ENABLED\n self.fmt = DEFAULT_FMT\n self.uid = UUID.new.generate(:compact)\n end",
"def clear_auth\n [:apikey, :username, :authkey].each { |key| DEFAULT_PARAMS.delete(key) }\n end",
"def clear!\n self.access_key, self.secret_key = []\n end",
"def reset\n self.company_id = DEFAULT_COMPANY_ID\n self.user_key = DEFAULT_USER_KEY\n self.secret_key = DEFAULT_SECRET_KEY\n self.endpoint = DEFAULT_ENDPOINT\n end",
"def reset_client_api_credentials\n\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n @client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(@client_api_secret_d)\n return r unless r.success?\n\n api_secret_e = r.data[:ciphertext_blob]\n api_key = SecureRandom.hex\n\n @client.api_key = api_key\n @client.api_secret = api_secret_e\n @client.save!\n success\n end",
"def reset_configuration!\n @configuration = Auth::Configuration.new\n end",
"def set_firebase_credentials(org_id: String, firebase_project_id: String)\n if firebase_project_id.nil?\n firebase_project_id = get_firebase_project_id(org_id)\n end\n if firebase_project_id.nil?\n return nil\n end\n\n ssm = Aws::SSM::Client.new\n begin\n # Get the Google Cloud credentials from SSM Parameter Store\n # and write them to a file\n ssm_response = ssm.get_parameter({\n name: \"/google_cloud_ci_cd_service_account_generator/firebase_service_account_keys/#{firebase_project_id}\",\n with_decryption: true\n })\n service_account_key = ssm_response.parameter.value\n service_account_key_file = File.expand_path(\"firebase_service_account_key.json\")\n File.write(service_account_key_file, service_account_key)\n # Set the GOOGLE_APPLICATION_CREDENTIALS environment variable\n # so that the firebase-tools can use the credentials\n ENV[\"GOOGLE_APPLICATION_CREDENTIALS\"] = service_account_key_file\n # Unset the deprecated FIREBASE_TOKEN environment variable\n ENV.delete(\"FIREBASE_TOKEN\")\n return service_account_key_file\n rescue Aws::SSM::Errors::ServiceError => e\n UI.error(\"Unable to get Google Cloud credentials for firebase project '#{firebase_project_id}'\")\n UI.error(e.message)\n return nil\n end\nend",
"def write_credentials\n # AWS CLI is needed because writing AWS credentials is not supported by the AWS Ruby SDK.\n return unless system('which aws >/dev/null 2>&1')\n Aws::SharedCredentials::KEY_MAP.transform_values(&@credentials.method(:send)).\n merge(expiration: @expiration).each do |key, value|\n system(\"aws configure set #{key} #{value} --profile #{@session_profile}\")\n end\n end",
"def signing_key= new_key\n @signing_key = new_key\n end",
"def signing_key; end",
"def refresh_credentials\n if credentials_stale?\n authorization_data = ecr_client.get_authorization_token.authorization_data.first\n\n self.credentials_expire_at = authorization_data.expires_at || raise(\"NO EXPIRE FOUND\")\n user, pass = Base64.decode64(authorization_data.authorization_token).split(\":\", 2)\n ENV['DOCKER_REGISTRY_USER'] = user\n ENV['DOCKER_REGISTRY_PASS'] = pass\n end\n rescue Aws::ECR::Errors::InvalidSignatureException\n raise Samson::Hooks::UserError, \"Invalid AWS credentials\"\n end",
"def clear\n @lock.synchronize do\n @credentials = nil\n end\n end",
"def aws_credentials(access_key, secret_access_key)\n unless access_key.empty? || secret_access_key.empty?\n credentials = { access_key_id: access_key, secret_access_key: secret_access_key }\n File.write('../.credentials.yml', credentials.to_yaml)\n $preferences_window.destroy\n else \n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Keys',\n 'message' => 'Access and secret keys must not be empty') \n end \n end",
"def clear_credentials!\n @access_token = nil\n @refresh_token = nil\n @id_token = nil\n @username = nil\n @password = nil\n @code = nil\n @issued_at = nil\n @expires_at = nil\n end",
"def doctor_project(project,target, identity, profileUuid)\n log( \"Modifiying Project FIle to sign with #{identity} identity ...\")\n\n project = ZergXcode.load(project)\n configuration = 'Release'\n build_configurations = project[\"buildConfigurationList\"][\"buildConfigurations\"]\n configuration_object = build_configurations.select { |item| item['name'] == configuration }[0]\n configuration_object[\"buildSettings\"][\"PROVISIONING_PROFILE\"] = profileUuid\n configuration_object[\"buildSettings\"][\"PROVISIONING_PROFILE[sdk=iphoneos*]\"] = profileUuid\n configuration_object[\"buildSettings\"][\"CODE_SIGN_IDENTITY\"] = identity\n configuration_object[\"buildSettings\"][\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"] = identity\n\n target = project[\"targets\"].select {|item| item['name'] == target }[0]\n build_configurations = target[\"buildConfigurationList\"][\"buildConfigurations\"]\n configuration_object = build_configurations.select {|item|item['name'] == configuration }[0]\n configuration_object[\"buildSettings\"][\"PROVISIONING_PROFILE[sdk=iphoneos*]\"] = profileUuid\n configuration_object[\"buildSettings\"][\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"] = identity\n\n project.save!\nend",
"def save\r\n SystemConfig.set :auth, to_h, true\r\n end",
"def store_credentials(credentials)\n conf = configuration\n conf[:credentials] = {}\n conf[:credentials][:access_key], conf[:credentials][:secret_key] = credentials[0], credentials[1]\n store_configuration(conf)\n end",
"def signing_information\n super\n end",
"def sign_certificate\n sign_certificate_for(default)\n end",
"def delete_temp_keychain()\n FileUtils.rm_rf(@temp_kc_path) if FileTest.exists? @temp_kc_path\n end",
"def sign_out!\n self.current_account = AnonymousAccount.instance\n end",
"def destroy account\n destroy_file File.join(@ssh_home, account + \".identity\")\n destroy_file File.join(@ssh_home, account + \".identity.pub\")\n end",
"def reset_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n client_api_secret_e = r.data[:ciphertext_blob]\n\n @client_webhook_setting.secret_key = client_api_secret_e\n @client_webhook_setting.set_decrypted_secret_key(client_api_secret_d)\n @client_webhook_setting.source = GlobalConstant::AdminActivityChangeLogger.web_source\n\n @client_webhook_setting.save! if @client_webhook_setting.changed?\n end",
"def clear_authentication\n authenticate(nil, nil)\n end",
"def set_defaults\n self.imagepath ||= Rails.application.config.missing_sign_image\n end"
]
| [
"0.6000053",
"0.57287073",
"0.5718047",
"0.5712944",
"0.5558645",
"0.55017227",
"0.54360753",
"0.5368876",
"0.5344141",
"0.5324556",
"0.5323831",
"0.53217494",
"0.5254176",
"0.5242718",
"0.5236519",
"0.52344626",
"0.52273536",
"0.5218138",
"0.52134675",
"0.51720977",
"0.51638734",
"0.5161907",
"0.5154964",
"0.5112514",
"0.5108392",
"0.50953037",
"0.50939226",
"0.50897616",
"0.5068921",
"0.50628185"
]
| 0.7454791 | 0 |
GET /fake_answers GET /fake_answers.json | def index
@fake_answers = FakeAnswer.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answers\n request('answers')\n end",
"def show\n render json: @answer\n end",
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def show\n @quiz = params[:quiz_id]\n @fake_answers = FakeAnswer.where(question_id: params[:id])\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = @question.answers\n respond_with( @answers )\n end",
"def get_answers_for\n user = current_user\n render_401 and return unless user\n prospect = User.find_by_id(params[:for_user_id])\n render_404 and return unless prospect\n\n answers = ShortQuestion.get_latest_n_answers_for(prospect.id, params[:num], params[:start])\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end",
"def get_answers\n @answers\n end",
"def index\n @given_answers = GivenAnswer.all\n end",
"def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def create\n @fake_answer = FakeAnswer.new(fake_answer_params)\n @fake_answer.question_id = params[:question_id]\n respond_to do |format|\n if @fake_answer.save\n format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }\n format.json { render :show, status: :created, location: @fake_answer }\n else\n format.html { render :new }\n format.json { render json: @fake_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def verify_answer\n answer = Answer.find(params[:id])\n\n respond_to do |format|\n if answer.verify_answer(params)\n format.json { render :json => true }\n else\n format.json { render :json => false }\n end\n end\n end",
"def set_fake_answer\n @fake_answer = FakeAnswer.find(params[:id])\n end",
"def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end",
"def index\n if get_event\n @v1_answers = @event.alternatives\n render json: @v1_answers\n else\n @v1_answers = V1::Answer.all\n render json: @v1_answers\n end\n end",
"def index\n @actual_answers = ActualAnswer.all\n end",
"def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def show\n @submitted_answer = SubmittedAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitted_answer }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def fake_answer_params\n params.require(:fake_answer).permit(:answer, :question_id, :quiz_id)\n end"
]
| [
"0.72328824",
"0.6914773",
"0.6857219",
"0.6836569",
"0.6794836",
"0.6794836",
"0.6794836",
"0.6794836",
"0.6748096",
"0.6711686",
"0.67115384",
"0.6679088",
"0.6662031",
"0.6576235",
"0.6550996",
"0.6509215",
"0.6509215",
"0.6509215",
"0.65022916",
"0.6499834",
"0.6479792",
"0.6430619",
"0.6420127",
"0.63545656",
"0.6346984",
"0.63268924",
"0.63186115",
"0.63032913",
"0.63032913",
"0.62908727"
]
| 0.76433223 | 0 |
POST /fake_answers POST /fake_answers.json | def create
@fake_answer = FakeAnswer.new(fake_answer_params)
@fake_answer.question_id = params[:question_id]
respond_to do |format|
if @fake_answer.save
format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }
format.json { render :show, status: :created, location: @fake_answer }
else
format.html { render :new }
format.json { render json: @fake_answer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fake_answer_params\n params.require(:fake_answer).permit(:answer, :question_id, :quiz_id)\n end",
"def index\n @fake_answers = FakeAnswer.all\n end",
"def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer = Answer.new(answers_params(ans))\n if @answer.save\n if @answer.correct\n count = count + 1\n # update_result ans[:user_id], ans[:quiz_id]\n end\n else\n passed = false\n end\n end\n if passed\n create_result params[:answers].first[:user_id], params[:answers].first[:quiz_id], count\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n else\n @answer = Answer.new(answer_params)\n if @answer.save\n if @answer.correct\n update_result\n end\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @answer = Form::Answer.new(answer_params)\n respond_to do |format|\n if @answer.save\n format.html { redirect_to thanks_path, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = AttemptAnswer.new(answer_params) \n \n if @answer.save\n render json: @answer, status: :created \n else\n head(:unprocessable_entity)\n end\n end",
"def answers\n request('answers')\n end",
"def create\n @given_answer = GivenAnswer.new(given_answer_params)\n\n respond_to do |format|\n if @given_answer.save\n format.html { redirect_to @given_answer, notice: 'Given answer was successfully created.' }\n format.json { render :show, status: :created, location: @given_answer }\n else\n format.html { render :new }\n format.json { render json: @given_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n answer = Answer.new(content: params[:content], upvotes: 0, downvotes:0, user_id: params[:user_id], question_id: params[:question_id])\n \n if answer.save\n render json: {answer: answer, create_time: (answer.created_at.to_f * 1000).to_i, success: true}\n else\n render json: @answer.errors, success: false\n end\n end",
"def create\n @actual_answer = ActualAnswer.new(actual_answer_params)\n\n respond_to do |format|\n if @actual_answer.save\n format.html { redirect_to @actual_answer, notice: 'Actual answer was successfully created.' }\n format.json { render :show, status: :created, location: @actual_answer }\n else\n format.html { render :new }\n format.json { render json: @actual_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully created.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_fake_answer\n @fake_answer = FakeAnswer.find(params[:id])\n end",
"def create\n @answers = params[:user_answers]\n @answers.each do |key, value|\n UserAnswer.create(:user_id => current_user.id, :survey_question_id => key.to_i, :text => value)\n end\n redirect_to :root\n end",
"def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html {\n redirect_to questions_url,\n notice: 'Answer submit successful.'\n }\n else\n format.html { render :new }\n format.json {\n render json: @answer.errors,\n status: :unprocessable_entity\n }\n end\n end\n end",
"def create \n\t\tquestionId = params[:questionId]\n\t\tanswerId = params[:answerId]\n\t\tanswer = params[:answer]\n\t\tnumAnswers = params[:numAnswers].to_i\n\n\t\tbegin\n\t\t\tsuccess = ParseManager.createUserAnswer(answer, answerId, questionId)\n\t\t\tnumAnswers -= 1\n\t\tend until numAnswers == 0\n\n\t\trender json:success\n\tend",
"def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end",
"def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:new, @answer)\n end\n end",
"def create\n @v1_answer = current_user.answers.new(v1_answer_params)\n if @v1_answer.save\n render json: @v1_answer, status: :created\n else\n render json: @v1_answer.errors, status: :unprocessable_entity\n end\n end",
"def add_answer\n request('answers/add')\n end",
"def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_post(body)\n make_response(200, validate_questions(body))\nend",
"def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end",
"def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end",
"def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\t\trespond_to do |format|\n\t\t\tif @answer.save\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @answer }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def answer\n RecallTest.create(recalled_correctly: params[:answer_correct],\n chunk_id: params[:chunk_id], recall_date: Time.now)\n render nothing: true\n end",
"def create\n # @answer = Answer.new\n # @answer.user_id = current_user.もid\n # @answer.question_id = params[:question_id]\n # @answer.content = params[:content]\n # @answer.save\n # 一個保存できれば、何個でも保存できる\n if !params[:answer][:content]\n render json: {errors: \"未入力の項目があります。\"}, status: 422\n\n end\n @answer = current_user.answers.build(answer_params)\n @answer.save\n end",
"def create\n @submitted_answer = SubmittedAnswer.new(params[:submitted_answer])\n\n respond_to do |format|\n if @submitted_answer.save\n format.html { redirect_to @submitted_answer, notice: 'Submitted answer was successfully created.' }\n format.json { render json: @submitted_answer, status: :created, location: @submitted_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.70002824",
"0.6714093",
"0.66228753",
"0.66215265",
"0.6574405",
"0.65624535",
"0.64825547",
"0.64625627",
"0.6457008",
"0.64533365",
"0.64462394",
"0.6436141",
"0.64115065",
"0.64115065",
"0.6404387",
"0.6402076",
"0.63927054",
"0.6369385",
"0.6366281",
"0.63653",
"0.6358095",
"0.6358095",
"0.6341335",
"0.6331524",
"0.63232076",
"0.6313959",
"0.6310636",
"0.6295245",
"0.6286099",
"0.62689114"
]
| 0.7353894 | 0 |
PATCH/PUT /fake_answers/1 PATCH/PUT /fake_answers/1.json | def update
respond_to do |format|
if @fake_answer.update(fake_answer_params)
format.html { redirect_to @fake_answer, notice: 'Fake answer was successfully updated.' }
format.json { render :show, status: :ok, location: @fake_answer }
else
format.html { render :edit }
format.json { render json: @fake_answer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n if @answer.update(answer_params)\n head :no_content\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end",
"def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to questions_url, notice: 'Answer edited.' }\n else\n format.json {\n render json: @answer.errors,\n status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n answer = Answer.find(params[:answer_id])\n if answer.update(content: params[:content])\n render json: {answer: answer, success: true} \n else\n render json: @answer.errors, success: false \n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @answer.update(answer_params)\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Respuesta actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to answers_path, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n def answer_given(question_id)\n return (params[:answer] and params[:answer][question_id.to_s] and\n params[:answer][question_id.to_s].length > 0)\n end\n \n @resp = Response.find(params[:id])\n\n @questionnaire.questions.each do |question|\n if question.kind_of? Questions::Field\n ans = Answer.find_answer(@resp, question)\n if answer_given(question.id)\n if ans.nil?\n ans = Answer.new :question_id => question.id, :response_id => @resp.id\n end\n ans.value = params[:answer][question.id.to_s]\n ans.save\n else\n # No answer provided\n if not ans.nil?\n ans.destroy\n end\n end\n end\n end\n\n respond_to do |format|\n if @resp.update_attributes(params[:response])\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n format.js { redirect_to(response_url(@questionnaire, @resp, :format => \"js\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js { render :action => \"edit\" }\n format.xml { render :xml => @resp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @answer=AttemptAnswer.find_by_id(params[:id])\n \n @answer.update_attribute(:user_answer, params[:user_answer])\n if @answer.user_answer = params[:user_answer]\n render json: @answer, status: :no_content\n\n else\n head(:unprocessable_entity)\n\n end\n end",
"def update\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_answer\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to :planner, notice: 'Answer was successfully updated.' }\n format.json { respond_with_bip(@answer) }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question_answer = Question::Answer.find(params[:id])\n\n respond_to do |format|\n if @question_answer.update_attributes(params[:question_answer])\n format.html { redirect_to @question_answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.post.update(embedded_post_params)\n format.js { head :no_content }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # Using first or create allows users to update their answer (or create it obviously)\n answer = Answer.where(:question_id => params[:question_id], :user_id => current_user.id).first_or_create! do |answer|\n answer.user_id = current_user.id\n answer.survey_id = params[:survey_id]\n answer.group_id = current_user.group.id\n answer.question_id = params[:question_id]\n answer.answer = params[:answer]\n\n @created = true\n\n if answer.save\n q = IQuestion.find_by_id(params[:question_id])\n\n if q.present?\n qdes = q.description\n else\n qdes = \"Orphaned question\"\n end\n\n s = ISurvey.find_by_id(params[:survey_id])\n\n if s.present?\n sdes = s.title\n else\n sdes = \"Orphaned survey\"\n end\n #sendCable(\"#{current_user.name} <#{current_user.email}>\", \"[#{sdes}] #{qdes}:\", params[:answer])\n\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n if !@created && answer\n answer.answer = params[:answer]\n if answer.save\n #sendCable(\"#{current_user.name} <#{current_user.email}>\", \"Updated Answer: \", params[:answer])\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n if @client_answer.update_attributes(params[:client_answer])\n format.html { redirect_to @client_answer, notice: 'Client answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end"
]
| [
"0.68757325",
"0.6873886",
"0.6738325",
"0.6663481",
"0.64679563",
"0.64679563",
"0.6457721",
"0.64376235",
"0.6424249",
"0.64161676",
"0.64153993",
"0.6397989",
"0.6345244",
"0.63425946",
"0.6326939",
"0.6321163",
"0.6320706",
"0.6319739",
"0.63186616",
"0.6309624",
"0.6309624",
"0.6309624",
"0.6305421",
"0.6293541",
"0.62847936",
"0.62639403",
"0.62475497",
"0.62475497",
"0.62475497",
"0.62468797"
]
| 0.7129221 | 0 |
DELETE /fake_answers/1 DELETE /fake_answers/1.json | def destroy
@fake_answer.destroy
respond_to do |format|
format.html { redirect_to fake_answers_url, notice: 'Fake answer was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = current_user.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n\n head :no_content\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Answer deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t#@answer.destroy\n\t\t#respond_to do |format|\n\t\t#\tformat.html { redirect_to answers_url }\n\t\t#\tformat.json { head :no_content }\n\t\t#end\n\n\tend",
"def destroy\n @actual_answer.destroy\n respond_to do |format|\n format.html { redirect_to actual_answers_url, notice: 'Actual answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @given_answer.destroy\n respond_to do |format|\n format.html { redirect_to given_answers_url, notice: 'Given answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answerable = @answer\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @answerable }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submitted_answer = SubmittedAnswer.find(params[:id])\n @submitted_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to submitted_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_answer = UserAnswer.find(params[:id])\n @user_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_answers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @pre_test_answer.destroy\n respond_to do |format|\n format.html { redirect_to pre_test_answers_url, notice: 'Pre test answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz_answer.destroy\n respond_to do |format|\n format.html { redirect_to quiz_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_answer.destroy\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end"
]
| [
"0.75515115",
"0.74374837",
"0.74374837",
"0.74100095",
"0.7392629",
"0.73762643",
"0.73700905",
"0.73700905",
"0.7281447",
"0.7258693",
"0.72482276",
"0.7225049",
"0.7220558",
"0.71750474",
"0.7172923",
"0.7167194",
"0.7167163",
"0.7167163",
"0.7167163",
"0.7167163",
"0.7167163",
"0.7162893",
"0.71309096",
"0.71254617",
"0.7085483",
"0.7078459",
"0.7072104",
"0.70705205",
"0.70629036",
"0.70629036"
]
| 0.76496696 | 0 |
This method is invoked whenever Burp Scanner discovers a new, unique issue. | def newScanIssue(issue)
event = {
'details' => issue.getIssueDetail,
'vulnerability' => issue.issueName,
'severity' => issue.severity,
'url' => issue.url.to_s,
'port' => issue.port,
'host' => issue.host
}
send_event(event)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_stale_issues\n handle_newly_stale_issues\n handle_stale_and_unmergable_prs\n end",
"def after_create(issue)\n user_agent_detail_service.create\n handle_add_related_issue(issue)\n resolve_discussions_with_issue(issue)\n create_escalation_status(issue)\n\n super\n end",
"def already_reported; end",
"def already_reported; end",
"def after_dispatch_to_default_hook(issue)\n end",
"def after_dispatch_to_default_hook(issue)\n end",
"def reload_issues!\n issues(true)\n end",
"def scan_for_issue message, hash, cookies, http\n\tif !$issue_regex.match(message)\n\t\tputs \"[Policy Violation] - No YouTrack issues found in commit message. Please amend git commit #{hash}.\"\n\t\tfixme_text hash\n\t\treturn ''\n\tend\n\tmessage.scan($issue_regex) do |m, issue|\n\t\tissue_url = \"/youtrack/rest/issue/#{issue}\"\n\t\trequest = Net::HTTP::Get.new(issue_url)\n\t\trequest['Cookie'] = cookies\n\t\tresponse = http.request(request)\n\t\tif response.code == '404'\n\t\t\tputs \"[Policy Violation] - Issue not found: ##{issue}. Please amend git commit #{hash}.\"\n\t\t\tfixme_text hash\n\t\t\treturn ''\n\t\telsif response.code == '200'\n\t\t\treturn issue \n\t\telse\n\t\t\tputs \"[Policy Violation] - Issue returns invalid HTTP response. Check your youtrack status.\"\n\t\t\treturn ''\n\t\tend\n\tend\nend",
"def handle_ack_msg( their_msg )\r\n begin\r\n if their_msg.startup_ack\r\n super\r\n send_next_case\r\n warn \"Started, shouldn't see this again...\" if self.class.debug\r\n return\r\n end\r\n if their_msg.result\r\n self.class.lookup[:results][their_msg.result]||=0\r\n self.class.lookup[:results][their_msg.result]+=1\r\n if their_msg.result=='crash' and their_msg.crashdetail\r\n crashdetail=their_msg.crashdetail\r\n self.class.lookup[:buckets][DetailParser.hash( crashdetail )]=true\r\n # You might want to clear this when outputting status info.\r\n self.class.queue[:bugs] << DetailParser.long_desc( crashdetail )\r\n # Just initials - NOT EXPLOITABLE -> NE etc\r\n classification=DetailParser.classification( crashdetail).split.map {|e| e[0]}.join\r\n self.class.lookup[:classifications][classification]||=0\r\n self.class.lookup[:classifications][classification]+=1\r\n end\r\n else\r\n # Don't cancel the ack timeout here - this is the first ack\r\n # We wait to get the full result, post delivery.\r\n super\r\n send_next_case\r\n end\r\n rescue\r\n raise RuntimeError, \"#{COMPONENT}: Unknown error. #{$!}\"\r\n end\r\n end",
"def issue(*)\n raise NotImplementedError, 'This should be defined in a subclass'\n end",
"def inspector_received_empty_report(_, inspector)\n UI.puts 'Found no similar issues. To create a new issue, please visit:'\n UI.puts \"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new\"\n end",
"def create_issue\n logger.info \"Creating new issue in project #{project.jira_project}: #{pull_request.title}\"\n\n jira_issue = PuppetLabs::Jira::Issue.build(client, project)\n fields = PuppetLabs::Jira::Formatter.format_pull_request(pull_request)\n\n jira_issue.create(fields[:summary], fields[:description])\n link_issue(jira_issue)\n\n logger.info \"Created jira issue with webhook-id #{pull_request.identifier}\"\n rescue PuppetLabs::Jira::APIError => e\n logger.error \"Failed to save #{pull_request.title}: #{e.message}\"\n end",
"def reprocess_request_issues_update!(request_issue, request_issues_update, index)\n DecisionReviewProcessJob.perform_now(request_issues_update)\n @logs.push(\"#{Time.zone.now} ContentionNotFoundRemediation::Log - Number: #{index}\"\\\n \" RIU ID: #{request_issues_update.id}. RI ID: #{request_issue.id}. Reprocessing Request Issues Update.\")\n end",
"def after_recover\n end",
"def handle_backtrack\n\t\tend",
"def populate_issues_status(issue)\n @issues_status.push(IssueStatus.find_by_id(issue.status_id))\n end",
"def process_expn\n send_data \"502 Command not implemented\\r\\n\"\n end",
"def notifier; end",
"def notifier; end",
"def before_recover\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def process_fix\n super\n end",
"def hotfix_information\n super\n end",
"def initialize(jira, issue)\n @jira = jira\n @issue = issue\n end",
"def pull_request_hook\n unless request.request_parameters[:action] == 'opened'\n render(plain: 'Not a newly-opened PR. Uninterested.') && return\n end\n\n pull_request = params[:pull_request]\n\n SmokeDetector.send_message_to_charcoal(\"[PR##{pull_request[:number]}]\"\\\n \"(https://github.com/Charcoal-SE/SmokeDetector/pull/#{pull_request[:number]})\"\\\n \" (\\\"#{pull_request[:title]}\\\") opened by #{pull_request[:user][:login]}\")\n\n unless pull_request[:user][:login] == 'SmokeDetector'\n render(plain: 'Not from SmokeDetector. Uninterested.') && return\n end\n\n text = pull_request[:body]\n\n response_text = ''\n\n # Identify blacklist type and use appropriate search\n\n domains = text.scan(/<!-- METASMOKE-BLACKLIST-WEBSITE (.*?) -->/)\n\n domains.each do |domain|\n domain = domain[0]\n\n num_tps = Post.where('body REGEXP ?', domain).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', domain).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', domain).where(is_naa: true).count\n\n response_text += get_line domain, num_tps, num_fps, num_naa\n end\n\n keywords = text.scan(/<!-- METASMOKE-BLACKLIST-KEYWORD (.*?) -->/)\n\n keywords.each do |keyword|\n keyword = keyword[0]\n\n num_tps = Post.where('body REGEXP ?', keyword).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', keyword).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', keyword).where(is_naa: true).count\n\n response_text += get_line keyword, num_tps, num_fps, num_naa\n end\n\n usernames = text.scan(/<!-- METASMOKE-BLACKLIST-USERNAME (.*?) -->/)\n\n usernames.each do |username|\n username = username[0]\n\n num_tps = Post.where('username REGEXP ?', username).where(is_tp: true).count\n num_fps = Post.where('username REGEXP ?', username).where(is_fp: true).count\n num_naa = Post.where('username REGEXP ?', username).where(is_naa: true).count\n\n response_text += get_line username, num_tps, num_fps, num_naa\n end\n\n watches = text.scan(/<!-- METASMOKE-BLACKLIST-WATCH_KEYWORD (.*?) -->/)\n\n watches.each do |watch|\n watch = watch[0]\n\n num_tps = Post.where('body REGEXP ?', watch).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', watch).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', watch).where(is_naa: true).count\n\n response_text += get_line watch, num_tps, num_fps, num_naa\n end\n\n Octokit.add_comment 'Charcoal-SE/SmokeDetector', pull_request[:number], response_text\n\n render plain: response_text, status: 200\n end",
"def report_ready\n write_verbose_log(\"Notifier #{VERSION} ready to catch errors\", :info)\n end",
"def hijacked; end",
"def new_issue(title)\n result = YAML.load(RestClient.post(\"https://github.com/api/v2/yaml/issues/open/#{@repository}\", :login => @username,\n :token => @api_token, :title => title))\n result[\"issue\"][\"number\"]\n end",
"def report_issues_to_master( issues )\n @master.framework.register_issues( issues, master_priv_token ){}\n true\n end",
"def create\n @issue = @issuable.issues.new(params[:issue])\n\n respond_to do |format|\n if @issue.save\n track_activity(@issuable, 'open', nil, @issue)\n format.html { redirect_to [@issuable, @issue], notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.6083699",
"0.6028642",
"0.58497536",
"0.58497536",
"0.5809531",
"0.5809531",
"0.54663014",
"0.5306853",
"0.52345395",
"0.5159733",
"0.51464957",
"0.5123844",
"0.5071489",
"0.50656337",
"0.50563616",
"0.5019229",
"0.49901628",
"0.49799582",
"0.49799582",
"0.49753729",
"0.49444193",
"0.4943748",
"0.492571",
"0.4923878",
"0.49151143",
"0.49150583",
"0.49143213",
"0.49029464",
"0.49022317",
"0.4895481"
]
| 0.69553334 | 0 |
turn a gray entry to white | def turn_to_white(entry)
raise "Only a gray entry can be turned to white" unless entry.mode == Entry::MODE_GRAY
entry.be_white!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend",
"def white\n colorize(37)\n end",
"def white!\n self.color = :white\n end",
"def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be_gray!\n\t\tincrement!(:entries_num)\n\tend",
"def black_and_white\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.quantize(256, Magick::GRAYColorspace)\n img.write('public' + @photo.attachment_url)\n end",
"def white\n Wasko::Color.color_from_string(\"white\")\n end",
"def white?\n color == \"white\"\n end",
"def opposite_color\n @base.brightness > 0.5 ? black : white\n end",
"def filter_color(col)\n col =~ /transparent|false/i ? nil : col\n end",
"def white; return self.trays[Hive::Color[:white]]; end",
"def white\n find color: :white\n end",
"def white?\n @color == \"White\" ? true : false\n end",
"def show\n @bg_gray = true\n\n end",
"def colorize!; @colors = true; end",
"def draw_greyscale_pixel(col,row, teint)\n\t\t@image[ col,row ] = ChunkyPNG::Color.grayscale(teint)\t\t\n\tend",
"def white_light\n @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00])\n\n self\n end",
"def colorized?; end",
"def gray=(val)\n @r = @g = @b = g\n end",
"def black_and_white?\n entries == [ChunkyPNG::Color::BLACK, ChunkyPNG::Color::WHITE]\n end",
"def red?\n not black?\n end",
"def set(color)\n color == :w ? whites : blacks\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 invert\n r = 1.0 - self.red\n g = 1.0 - self.green\n b = 1.0 - self.blue\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end",
"def normal_color\n #return Color.new(255,255,255)\n end",
"def grayscale!\n set(grayscale)\n end",
"def white\n self.on\n command Command::WHITE[@group]\n end",
"def piece_color(piece); ((piece.color == :white) ? \"#FFEED5\" : \"#063848\") end",
"def gray?\n colorspace == \"gray\"\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end"
]
| [
"0.76192683",
"0.72442156",
"0.68534315",
"0.6730867",
"0.65915555",
"0.65083206",
"0.63472074",
"0.6335894",
"0.62846035",
"0.62692386",
"0.62544256",
"0.61990064",
"0.5952079",
"0.59362036",
"0.5896998",
"0.58859175",
"0.5861792",
"0.583852",
"0.5828988",
"0.58006966",
"0.57812715",
"0.5780526",
"0.57650304",
"0.57520807",
"0.5746688",
"0.5742566",
"0.57417285",
"0.5733014",
"0.5684024",
"0.5684024"
]
| 0.87834173 | 0 |
turn a gray entry to black | def turn_to_black(entry)
raise "Only a gray entry can be turned to black" unless entry.mode == Entry::MODE_GRAY
entry.be_black!
decrement!(:entries_num)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_white!\n\tend",
"def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be_gray!\n\t\tincrement!(:entries_num)\n\tend",
"def opposite_color\n @base.brightness > 0.5 ? black : white\n end",
"def black_and_white\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.quantize(256, Magick::GRAYColorspace)\n img.write('public' + @photo.attachment_url)\n end",
"def filter_color(col)\n col =~ /transparent|false/i ? nil : col\n end",
"def white\n colorize(37)\n end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def blacks\n matrix.select { |piece| piece && piece.color == :b }\n end",
"def black?\n @color == :black\n end",
"def remove_black_color(env)\n node = env[:node]\n return unless node.element?\n return unless node.attr('style').present?\n node['style'] = node['style'].gsub(/(?<!background-)(color:#000000;?)/, '')\n end",
"def gray=(val)\n @r = @g = @b = g\n end",
"def red?\n not black?\n end",
"def gray?\n colorspace == \"gray\"\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 draw_greyscale_pixel(col,row, teint)\n\t\t@image[ col,row ] = ChunkyPNG::Color.grayscale(teint)\t\t\n\tend",
"def darker(k=1)\n k = 0.7 ** k\n Rubyvis.rgb(\n [0, (k * r).floor].max,\n [0, (k * g).floor].max,\n [0, (k * b).floor].max,\n a)\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def black?(hex)\n hex == \"#000000\"\n end",
"def white!\n self.color = :white\n end",
"def unvisited_color\n { r: 221, g: 212, b: 213 }\n end",
"def unvisited_color\n { r: 221, g: 212, b: 213 }\n end",
"def colorize!; @colors = true; end",
"def black_and_white?\n entries == [ChunkyPNG::Color::BLACK, ChunkyPNG::Color::WHITE]\n end",
"def colorized?; end",
"def binarization(color, threshold)\n mid = ((color.red / 257) + (color.green / 257) + (color.blue / 257)) / 3\n return mid > threshold ? \"#fff\" : '#000'\nend",
"def monochrome! \n\t\treturn @image = @image.quantize(2, Magick::GRAYColorspace) \n\tend",
"def grayscale(teint)\n teint << 24 | teint << 16 | teint << 8 | 0xff\n end",
"def grayscale(teint)\n teint << 24 | teint << 16 | teint << 8 | 0xff\n end"
]
| [
"0.7797748",
"0.75115925",
"0.6641252",
"0.66394764",
"0.65816045",
"0.6565367",
"0.6558141",
"0.6558141",
"0.6283044",
"0.6276112",
"0.6149354",
"0.6124538",
"0.61047447",
"0.60704416",
"0.6023583",
"0.600836",
"0.59670526",
"0.5965099",
"0.5965099",
"0.59643584",
"0.59512293",
"0.5901346",
"0.5901346",
"0.58936137",
"0.58843595",
"0.5850596",
"0.5844737",
"0.58339196",
"0.5818403",
"0.5818403"
]
| 0.85430205 | 0 |
cancel a black entry to gray | def cancel_black(entry)
raise "Ony a black entry can be canceled to gray" unless entry.mode == Entry::MODE_BLACK
entry.be_gray!
increment!(:entries_num)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend",
"def safe_colorize_deactive\n CLIColorize.off\n end",
"def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_white!\n\tend",
"def cancel\n # clear the Gtk::Entry\n @search_entry.set_text(\"\")\n\n # Colorize the Gtk::Entry\n state(CLEAR)\n\n # Refresh the modules treeview\n $gtk2driver.module_tree.refresh\n\n # Register the current state\n @@state = CLEAR\n end",
"def disable_color\n return translate_color(7)\n end",
"def no_color\n reset_prev_formatting self, :color\n end",
"def uncolorize\n @uncolorized || self\n end",
"def opposite_color\n @base.brightness > 0.5 ? black : white\n end",
"def disable_colorization=(value); end",
"def filter_color(col)\n col =~ /transparent|false/i ? nil : col\n end",
"def disable_colorization(value = T.unsafe(nil)); end",
"def red?\n not black?\n end",
"def clear\n self.color = COLOR_CLEAR unless self.color == COLOR_CLEAR\n end",
"def onCancel(flag, view)\n self.reset(view)\n \tSketchup.undo\n end",
"def white!\n self.color = :white\n end",
"def no_color(&block)\n block.call\n end",
"def no_color\n add option: \"-no-color\"\n end",
"def off\n color(:passive)\n end",
"def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.ox = @cw/2\n self.opacity = 255\n end",
"def remove_black_color(env)\n node = env[:node]\n return unless node.element?\n return unless node.attr('style').present?\n node['style'] = node['style'].gsub(/(?<!background-)(color:#000000;?)/, '')\n end",
"def maybe_no_color(toggle:)\n toggle and no_color or self\n end",
"def state(state)\n if (state == RUNNING)\n @search_entry.modify_base(Gtk::STATE_NORMAL, Gdk::Color.parse('gray'))\n elsif (state == CLEAR)\n @search_entry.modify_base(Gtk::STATE_NORMAL, Gdk::Color.parse('white'))\n end\n end",
"def undo!\n bb = @stack.pop\n set_black(bb[:black])\n set_white(bb[:white])\n end",
"def no_colors\n @style = {\n :title => nil,\n :header => nil,\n :value => nil\n }\n @no_colors = true\n end",
"def red=(_); end",
"def disable_colour\n @colour.disable_colours\nend",
"def green=(_); end",
"def cancel_move\n @cursor.active = true\n @active_battler.moveto(@pre_x, @pre_y)\n clear_tr_sprites\n draw_ranges(@active_battler, 3)\n end",
"def decolorize!\n gsub!(/\\e\\[\\d+[;\\d]*m/, '')\n self\n end",
"def decolorize\n dup.decolorize!\n end"
]
| [
"0.7253252",
"0.6806319",
"0.67141515",
"0.6550353",
"0.6340775",
"0.6270994",
"0.609823",
"0.60920995",
"0.60874283",
"0.60336524",
"0.60202163",
"0.6017151",
"0.5893231",
"0.5872357",
"0.581119",
"0.57405347",
"0.571675",
"0.5708805",
"0.56946933",
"0.5683745",
"0.5659697",
"0.5634899",
"0.5630489",
"0.56007016",
"0.5593372",
"0.5590193",
"0.5589325",
"0.5557969",
"0.5534204",
"0.5502613"
]
| 0.8708618 | 0 |
Get typographic and morphosyntactic normalization of an input text using an analyzer of ElasticSearch. (string) text Input text. | def normalize2(text, analyzer = nil)
Entry.normalize(text, normalizer2, analyzer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_normalize(text); end",
"def normalize1(text, analyzer = nil)\n\t\tEntry.normalize(text, normalizer1, analyzer)\n\tend",
"def normalize(text) #:nodoc:\n normalized_text = text.to_s.downcase\n normalized_text = Numerizer.numerize(normalized_text)\n normalized_text.gsub!(/['\"\\.]/, '')\n normalized_text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n normalized_text\n end",
"def normalize(text) #:nodoc:\n normalized_text = text.to_s.downcase\n normalized_text = Numerizer.numerize(normalized_text)\n normalized_text.gsub!(/['\"\\.]/, '')\n normalized_text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n normalized_text.gsub!(/\\btoday\\b/, 'this day')\n normalized_text.gsub!(/\\btomm?orr?ow\\b/, 'next day')\n normalized_text.gsub!(/\\byesterday\\b/, 'last day')\n normalized_text.gsub!(/\\bnoon\\b/, '12:00')\n normalized_text.gsub!(/\\bmidnight\\b/, '24:00')\n normalized_text.gsub!(/\\bbefore now\\b/, 'past')\n normalized_text.gsub!(/\\bnow\\b/, 'this second')\n normalized_text.gsub!(/\\b(ago|before)\\b/, 'past')\n normalized_text.gsub!(/\\bthis past\\b/, 'last')\n normalized_text.gsub!(/\\bthis last\\b/, 'last')\n normalized_text.gsub!(/\\b(?:in|during) the (morning)\\b/, '\\1')\n normalized_text.gsub!(/\\b(?:in the|during the|at) (afternoon|evening|night)\\b/, '\\1')\n normalized_text.gsub!(/\\btonight\\b/, 'this night')\n normalized_text.gsub!(/(?=\\w)([ap]m|oclock)\\b/, ' \\1')\n normalized_text.gsub!(/\\b(hence|after|from)\\b/, 'future')\n normalized_text = numericize_ordinals(normalized_text)\n end",
"def normalize_text(text)\n letters = text.upcase.split ''\n letters.delete_if { |x| ! @table[0].include?(x) }\n letters.join ''\n end",
"def normalize(string); end",
"def tokenize_text(text)\n data = Doc.new(text)\n featurize(data)\n classify(data)\n return data.segment\n end",
"def normalizer; end",
"def tokenize_text(text)\n data = Doc.new(text)\n featurize(data)\n classify(data)\n return data.segment\n end",
"def analyze_raw(txt)\n stem_freq = {}\n stem_lead = {}\n \n returning Hash.new(0) do |dict|\n txt.downcase.split(/[\\s,;!\\?]+/).each do |w|\n # Apply some custom rejection conditions\n next if skip_word?(w)\n # strip non-words chars\n w.gsub!(/[\"\\(\\)\\.]+/, '')\n dict[w] += 1\n end\n\n # Peform stemming analysis\n dict.each do |w, freq|\n @stems[w] ||= @stemmer.stem(w)\n (stem_freq[@stems[w]] ||= {})[w] = freq\n end\n \n stem_freq.each_key do |stem|\n #puts \"Analyzing stem #{stem}\"\n total_freq = 0\n lead_freq = 0\n lead_word = \"\"\n \n #puts \"stems => #{stem_freq[stem].inspect}\"\n stem_freq[stem].each do |word, freq|\n total_freq += freq\n if freq > lead_freq\n lead_word = word\n lead_freq = freq\n end\n end\n #puts \"lead word => #{lead_word} (#{total_freq})\"\n stem_lead[lead_word] = total_freq\n end\n # Replace word frequency hash with leading stem frequency hash\n dict = stem_lead\n end\n end",
"def normalize(text)\n normalized = text.gsub(\" '\",\" \").gsub(\"' \",\" \")\n normalized.delete! \".\" \",\" \"(\" \")\" \";\" \"!\" \":\" \"?\" \"\\\"\"\n normalized.downcase.split\nend",
"def norm_text(text)\n text.to_s.strip.gsub(/\\s+/,' ').\n gsub(/(RuntimeException|RelationShip|ValueObject|OperationNotSupportedException)/, '`\\1`')\nend",
"def normalize( text )\n text.gsub(/\\s/,'').gsub(/[[:punct:]]/, '').gsub(/\\p{S}/,'').downcase\nend",
"def normalize(text)\n text.downcase.gsub(\"'\",\"\").gsub(/[^a-z ]/, ' ').split\nend",
"def normalize_synonyms(text_string)\n text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(W)\\.\\s/, \" West \")\n #ext_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\nend",
"def normalize(text)\n text.downcase.split(\"\").map! {|i| i if ('a'..'z').include?(i) || i == \" \"}.join.split(\" \")\nend",
"def preprocess_text(text)\n\n # Warn user if text exceeds max_length.\n if text.length > @max_length\n text = text[0..@max_length]\n warn(\"WARNING:: string cut length > #{@max_length}:\\n\")\n warn('text:: '+text)\n end\n\n text = @encoder.clean(text)\n text = remove_diacritics(text)\n\n # correct expected length for vectors with 0's\n @encoder.input_to_sequence(text)\n end",
"def normalize(slug_text)\n s = slug_text.clone\n s.gsub!(/[\\?‘’'“”\",.;:]/, '')\n s.gsub!(/\\W+/, ' ')\n s.strip!\n s.downcase!\n s.gsub!(/\\s+/, '-')\n s.gsub(/-\\Z/, '')\n end",
"def normalize\n return self unless @text\n return self if @normalized # TODO eliminate duplicate normalization\n\n @text = normalize_comment @text\n\n @normalized = true\n\n self\n end",
"def morph_words\n words = @query.split(/[^a-zA-Z0-9]/)\n morphed_words = words.map{|word| [word,Text::Metaphone.double_metaphone(word)]}\n morphed_words\n end",
"def improve(text)\n return Typogruby.improve(text.to_s)\n end",
"def mltify_text text\n \n coder = HTMLEntities.new\n text = coder.decode text\n text = sanitize( text, okTags = \"\" )\n text = coder.encode text\n words = text.downcase.gsub( /[^A-za-z0-9\\s'\\-#]/, \" \" ).split( /\\s/ )\n \n final_words = []\n words.each do |w|\n unless stop_words.include? w\n final_words << w\n end\n end\n RAILS_DEFAULT_LOGGER.info final_words.join( ' ' ).squish\n final_words.join( ' ' ).squish\n end",
"def pre_normalize(text)\n text = text.to_s.downcase\n text.gsub!(/\\b(\\d{1,2})\\.(\\d{1,2})\\.(\\d{4})\\b/, '\\3 / \\2 / \\1')\n text.gsub!(/\\b([ap])\\.m\\.?/, '\\1m')\n text.gsub!(/(\\s+|:\\d{2}|:\\d{2}\\.\\d+)\\-(\\d{2}:?\\d{2})\\b/, '\\1tzminus\\2')\n text.gsub!(/\\./, ':')\n text.gsub!(/([ap]):m:?/, '\\1m')\n text.gsub!(/'(\\d{2})\\b/) do\n number = $1.to_i\n\n if Chronic::Date::could_be_year?(number)\n Chronic::Date::make_year(number, options[:ambiguous_year_future_bias])\n else\n number\n end\n end\n text.gsub!(/['\"]/, '')\n text.gsub!(/,/, ' ')\n text.gsub!(/^second /, '2nd ')\n text.gsub!(/\\bsecond (of|day|month|hour|minute|second|quarter)\\b/, '2nd \\1')\n text.gsub!(/\\bthird quarter\\b/, '3rd q')\n text.gsub!(/\\bfourth quarter\\b/, '4th q')\n text.gsub!(/quarters?(\\s+|$)(?!to|till|past|after|before)/, 'q\\1')\n text = Numerizer.numerize(text)\n text.gsub!(/\\b(\\d)(?:st|nd|rd|th)\\s+q\\b/, 'q\\1')\n text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n text.gsub!(/(?:^|\\s)0(\\d+:\\d+\\s*pm?\\b)/, ' \\1')\n text.gsub!(/\\btoday\\b/, 'this day')\n text.gsub!(/\\btomm?orr?ow\\b/, 'next day')\n text.gsub!(/\\byesterday\\b/, 'last day')\n text.gsub!(/\\bnoon|midday\\b/, '12:00pm')\n text.gsub!(/\\bmidnight\\b/, '24:00')\n text.gsub!(/\\bnow\\b/, 'this second')\n text.gsub!('quarter', '15')\n text.gsub!('half', '30')\n text.gsub!(/(\\d{1,2}) (to|till|prior to|before)\\b/, '\\1 minutes past')\n text.gsub!(/(\\d{1,2}) (after|past)\\b/, '\\1 minutes future')\n text.gsub!(/\\b(?:ago|before(?: now)?)\\b/, 'past')\n text.gsub!(/\\bthis (?:last|past)\\b/, 'last')\n text.gsub!(/\\b(?:in|during) the (morning)\\b/, '\\1')\n text.gsub!(/\\b(?:in the|during the|at) (afternoon|evening|night)\\b/, '\\1')\n text.gsub!(/\\btonight\\b/, 'this night')\n text.gsub!(/\\b\\d+:?\\d*[ap]\\b/,'\\0m')\n text.gsub!(/\\b(\\d{2})(\\d{2})(am|pm)\\b/, '\\1:\\2\\3')\n text.gsub!(/(\\d)([ap]m|oclock)\\b/, '\\1 \\2')\n text.gsub!(/\\b(hence|after|from)\\b/, 'future')\n text.gsub!(/^\\s?an? /i, '1 ')\n text.gsub!(/\\b(\\d{4}):(\\d{2}):(\\d{2})\\b/, '\\1 / \\2 / \\3') # DTOriginal\n text.gsub!(/\\b0(\\d+):(\\d{2}):(\\d{2}) ([ap]m)\\b/, '\\1:\\2:\\3 \\4')\n text\n end",
"def preprocess_text data\n parse_formatted_text data\n end",
"def normalize; end",
"def entities(text)\n return Typogruby.entities(text.to_s)\n end",
"def analyze(text, analysis_params)\n request(:get, \"_analyze\") do |req|\n req.body = { text: text }.merge(analysis_params)\n end\n end",
"def preprocess(text)\n text = text.downcase\n .gsub('.', ' .')\n words = text.split(' ')\n\n word_to_id = {}\n id_to_word = {}\n\n words.each do |word|\n unless word_to_id.include?(word)\n new_id = word_to_id.length\n word_to_id[word] = new_id\n id_to_word[new_id] = word\n end\n end\n\n corpus = Numo::NArray[*words.map { |w| word_to_id[w] }]\n\n [corpus, word_to_id, id_to_word]\nend",
"def analysis\n @str = params[:text] ||= '解析対象の文字列'\n @words = Tag.counter(Tag.generate(@str))\n end",
"def normalize(str) return str end"
]
| [
"0.73448277",
"0.68200576",
"0.65461254",
"0.62681997",
"0.6033383",
"0.59138775",
"0.58968383",
"0.58936214",
"0.5863743",
"0.5764376",
"0.5729348",
"0.56959754",
"0.56768626",
"0.5668627",
"0.5617253",
"0.5614357",
"0.56085706",
"0.56003666",
"0.5592124",
"0.5585808",
"0.54711854",
"0.54670966",
"0.5455115",
"0.54544085",
"0.5453406",
"0.5450893",
"0.542838",
"0.5398942",
"0.53948635",
"0.53652495"
]
| 0.6842146 | 1 |
Calculate Krippendorff's alpha (interrater reliability) Assumed input (Matrix) [ [ nil, nil, nil, nil, nil, 3, 4, 1, 2, 1, 1, 3, 3, nil, 3 ], coder 1 [ 1, nil, 2, 1, 3, 3, 4, 3, nil, nil, nil, nil, nil, nil, nil], coder 2 [ nil, nil, 2, 1, 3, 4, 4, nil, 2, 1, 1, 3, 3, nil, 4 ] coder 3 ] | def krippendorff_alpha
in_array = self.to_a
in_array_flattened = in_array.transpose.flatten
unique_values = in_array.flatten.compact.uniq
# We need to keep track of the skip indexes separately since we can't send nils via C array of double
skip_indexes = []
in_array_flattened.each_with_index do |element, i|
skip_indexes << i if element.nil?
end
# Reformat the in_array to not have nil
skip_indexes.each {|i| in_array_flattened[i] = 0 }
FFI::MemoryPointer.new(:double, in_array_flattened.size) do |in_array_ptr|
FFI::MemoryPointer.new(:double, unique_values.size) do |unique_values_ptr|
FFI::MemoryPointer.new(:int, skip_indexes.size) do |skip_indexes_ptr|
in_array_ptr.write_array_of_double(in_array_flattened)
unique_values_ptr.write_array_of_double(unique_values)
skip_indexes_ptr.write_array_of_int(skip_indexes)
return _krippendorff_alpha(in_array_ptr, row_count, column_count, skip_indexes_ptr, skip_indexes.size, unique_values_ptr, unique_values.size)
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fleiss(matrix)\n debug = true\n\n # n Number of rating per subjects (number of human raters)\n n = checkEachLineCount(matrix) # PRE : every line count must be equal to n\n i_N = matrix.size\n k = matrix[0].size\n\n if debug\n puts \"#{n} raters.\"\n puts \"#{i_N} subjects.\"\n puts \"#{k} categories.\"\n end\n\n # Computing p[]\n p = [0.0] * k\n (0...k).each do |j|\n p[j] = 0.0\n (0...i_N).each {|i| p[j] += matrix[i][j] } \n p[j] /= i_N*n \n end\n\n puts \"p = #{p.join(',')}\" if debug\n\n # Computing f_P[] \n f_P = [0.0] * i_N\n\n (0...i_N).each do |i|\n f_P[i] = 0.0\n (0...k).each {|j| f_P[i] += matrix[i][j] * matrix[i][j] } \n f_P[i] = (f_P[i] - n) / (n * (n - 1)) \n end \n\n puts \"f_P = #{f_P.join(',')}\" if debug\n\n # Computing Pbar\n f_Pbar = sum(f_P) / i_N\n puts \"f_Pbar = #{f_Pbar}\" if debug\n\n # Computing f_PbarE\n f_PbarE = p.inject(0.0) { |acc,el| acc + el**2 }\n\n puts \"f_PbarE = #{f_PbarE}\" if debug \n\n kappa = (f_Pbar - f_PbarE) / (1 - f_PbarE)\n puts \"kappa = #{kappa}\" if debug \n\n kappa \nend",
"def icc_1_k_ci(alpha=0.05)\n per=1-(0.5*alpha)\n fu=icc_1_f.f*Distribution::F.p_value(per, @df_wt, @df_bt)\n fl=icc_1_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_wt))\n [1-1.quo(fl), 1-1.quo(fu)]\n end",
"def icc_1_1_ci(alpha=0.05)\n per=1-(0.5*alpha)\n \n fu=icc_1_f.f*Distribution::F.p_value(per, @df_wt, @df_bt)\n fl=icc_1_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_wt))\n \n [(fl-1).quo(fl+k-1), (fu-1).quo(fu+k-1)]\n end",
"def index_of_coincidence(matrix)\n\n matrix.inject([]) do |indices, row_letters|\n frequencies = letter_frequencies(row_letters)\n\n indices << (\"A\"..\"Z\").inject(0) { |a,v|\n x = frequencies[v]\n a += x*(x-1)\n a\n } / (row_letters.size * (row_letters.size - 1))\n end\n\nend",
"def calc_karps_algo_values\n 🛑 ::RuntimeError.new(\"| c{CurrencyMatrix}-> m{calc_karps_algo_values} already has warm cache |\") unless @cached_stats[:karp_vals].empty?\n (0...@len).∀ do |i|\n @cached_stats[:karp_vals] << self.karps_algorithm(i)\n end\n @cached_stats[:karp_vals]\n end",
"def kamen_rider(*eras); end",
"def floyd_warshall_variation()\n edges = %w( 0,1 1,2 2,3 1,3 )\n num = edges.join.gsub(\",\",\"\").split(\"\").uniq.size\n\n a = Array.new(num) { Array.new(num) { Array.new(num) } }\n \n # initialize\n num.times do |k|\n num.times do |i|\n num.times do |j|\n a[i][j][k] = Float::INFINITY\n a[i][j][k] = 0 if i == j\n a[i][j][k] = 1 if edges.include? \"#{i},#{j}\"\n end\n end\n end\n\n # run\n (1..num-1).each do |k|\n num.times do |i|\n num.times do |j|\n a[i][j][k] = [\n a[i][j][k-1] +\n a[i][k][k-1] * a[k][j][k-1]\n ].min\n end\n end\n end\n\n # print\n num.times do |i|\n num.times do |j|\n puts \"#{i},#{j}: #{a[i][j][num-1]}\"\n end\n end\n\nend",
"def alpha; end",
"def get_accuracy_matrix\n matrix = Hash.new\n\n (1..ISSUE_NAMES.length).each do |i| #for every pair\n (1..ISSUE_NAMES.length).each do |j|\n \n num_incr = 0\n num_decr = 0\n EXPERT_GRAPHS.each_value do |expert| #count how many experts had an edge in each direction\n num_incr += 1 if expert[[i,j]] == 1\n num_decr += 1 if expert[[i,j]] == -1\n end\n \n matrix[[i,j,1]] = RUBRIC[num_incr] #have increase and decrease, so technically 3d matrix\n matrix[[i,j,-1]] = RUBRIC[num_decr]\n end\n end\n \n #matrix.each {|key,value| puts key.to_s+\":\"+value.to_s if value > 0}\n ### should probably just hard-code this once it's done...\n return matrix\n end",
"def alg; end",
"def err_asymptotic( x, alpha )\n for k in 2...x.size do\n ek = (x[k-2]-alpha).abs\n ekp1 = (x[k-1]-alpha).abs \n ekp2 = (x[k] -alpha).abs\n p = Math::log(ekp1/ekp2)/Math::log(ek/ekp1)\n puts \"k = #{k}, order p = #{p}\"\n end\nend",
"def scoreExclusivity(mat)\n covered = 0\n xor = 0\n mat.first.each_index{|i|\n sum = 0\n mat.each{|node|\n sum += node[i].to_i\n }\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n \n return xor.to_f/covered.to_f\nend",
"def kernel_basis\n\t\trr = self.clone\n\t\trr.row_echelon_form\n\t\trank = rr.rank_rr\n\t\tdimker = rr.num_cols - rank\n\t\tif dimker == 0\n\t\t\treturn nil\n\t\tend\n\n\t\tbasis = Bit_matrix.new(dimker, rr.num_cols)\n\n\t\tfree_flags = [1] * @num_cols\n\t\tfree_indices = [0] * @num_cols\n\t\tnfree = 0 # Must == dimker, but I'll compute it anyway\n\n\t\tfor i in 0..(rank-1)\n\t\t\tdep_pos = rr.rows[i].find_leader_pos\n\t\t\tif dep_pos >= 0\n\t\t\t\tfree_flags[dep_pos] = 0\n\t\t\tend\n\t\tend\n\n\t\tfor i in 0..(@num_cols-1)\n\t\t\tif free_flags[i] != 0\n\t\t\t\tfree_indices[nfree] = i\n\t\t\t\tnfree += 1\n\t\t\tend\n\t\tend\n\n\t\tif nfree != dimker\n\t\t\traise \"Coding error detected: file #{__FILE__} line #{__LINE__}\"\n\t\tend\n\n\t\t# For each free coefficient:\n\t\t# Let that free coefficient be 1 and the rest be zero.\n\t\t# Also set any dependent coefficients which depend on that\n\t\t# free coefficient.\n\n\t\tfor i in 0..(dimker-1)\n\t\t\tbasis.rows[i][free_indices[i]] = 1\n\n\t\t\t# Matrix in row echelon form:\n\t\t\t#\n\t\t\t# 0210 c0 = ?? c0 = 1 c0 = 0\n\t\t\t# 1000 c1 = -2 c2 c1 = 0 c1 = 5\n\t\t\t# 0000 c2 = ?? c2 = 0 c2 = 1\n\t\t\t# 0000 c3 = 0 c3 = 0 c3 = 0\n\n\t\t\t# j = 0,1\n\t\t\t# fi = 0,2\n\n\t\t\t# i = 0:\n\t\t\t# j = 0 row 0 fi 0 = row 0 c0 = 0\n\t\t\t# j = 1 row 1 fi 0 = row 1 c0 = 0\n\t\t\t# i = 1:\n\t\t\t# j = 0 row 0 fi 1 = row 0 c2 = 2 dep_pos = 1\n\t\t\t# j = 1 row 1 fi 1 = row 1 c2 = 0\n\n\t\t\t# 0001\n\t\t\t# 01?0\n\n\t\t\tfor j in 0..(rank-1)\n\t\t\t\tif rr.rows[j][free_indices[i]] == 0\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tdep_pos = rr.rows[j].find_leader_pos\n\t\t\t\tif dep_pos < 0\n\t\t\t\t\traise \"Coding error detected: file \" \\\n\t\t\t\t\t\t\"#{__FILE__} line #{__LINE__}\"\n\t\t\t\tend\n\t\t\t\tbasis.rows[i][dep_pos] = rr.rows[j][free_indices[i]]\n\t\t\tend\n\t\tend\n\t\treturn basis\n\tend",
"def test_ce_deBoer_1\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n n = 10\n y_true = NArray[1,1,1,1,1,0,0,0,0,0]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n\n mp.to_score_sample do |sample|\n y_true.eq(sample).count_false # to be minimized\n end\n\n mp.solve\n\n if y_true != mp.most_likely_solution\n warn \"expected #{y_true}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end",
"def test_rosenbrock_banana\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n a = 0.5\n b = 100.0\n smooth = 0.1\n\n alpha = NArray[1.0, 1.0]\n beta = NArray[1.0, 1.0]\n\n problem = CrossEntropy::BetaProblem.new(alpha, beta)\n problem.num_samples = 1000\n problem.num_elite = 10\n problem.max_iters = 10\n\n problem.to_score_sample { |x| (a - x[0])**2 + b * (x[1] - x[0]**2)**2 }\n\n problem.to_update do |new_alpha, new_beta|\n smooth_alpha = smooth * new_alpha + (1 - smooth) * problem.param_alpha\n smooth_beta = smooth * new_beta + (1 - smooth) * problem.param_beta\n [smooth_alpha, smooth_beta]\n end\n\n problem.solve\n\n estimates = problem.param_alpha / (problem.param_alpha + problem.param_beta)\n assert_narray_close NArray[0.5, 0.25], estimates\n assert problem.num_iters <= problem.max_iters\n end",
"def ener_kj \n\t\t@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25\n\t\treturn @ener_kj\n\tend",
"def alpha\n end",
"def am(amida, y, x)\n #p \"==== NOW ===\"\n #p y \n #p x\n #p amida\n\n if y == H \n #p \"=====GOAL\"\n if x + 1 == K\n $cnt = $cnt + 1\n end\n return\n end\n\n if x < W - 1\n to_right_amida = Marshal.load(Marshal.dump(amida))\n to_right_amida[y][x] = 1\n am(to_right_amida, y + 1, x + 1)\n end\n\n to_streight_amida = Marshal.load(Marshal.dump(amida))\n am(to_streight_amida, y + 1, x)\n\n if x > 0\n to_left_amida = Marshal.load(Marshal.dump(amida))\n to_left_amida[y][x - 1] = 1\n am(to_left_amida, y + 1, x - 1)\n end\nend",
"def key_expansion(key_arr)\n w_key = []\n \n (0..Nk-1).each do |i|\n w_key << key_arr[(4*i)..(4*i + 3)]\n end\n\n (Nk..(Nb*(Nr + 1) - 1)).each do |i|\n temp = w_key[i-1]\n if i % Nk == 0\n temp = temp.rotate.map{ |b| S_BOX[b] }\n temp[0] ^= RCON[i / Nk]\n end\n\n w_key << w_key[i - Nk].map.with_index{ |b, i| b ^ temp[i]}\n end\n\n w_key.each_slice(4).map{ |k| array_to_matrix(k.flatten) }\n end",
"def exercise_1113 (matrix)\n end",
"def hourglassSum(arr)\n m = Matrix[*arr]\n\n # minimum possible result\n result = -9*7\n\n for i in (0..3)\n for j in (0..3)\n aux = lilHourglass(m.minor((i..i+2),(j..j+2)) )\n if aux > result\n result = aux \n end\n end\n end\n result\nend",
"def test(i,j,k)\nreturn A[i]*6 + B[j]*9 + C[k]*20\nend",
"def alpha\n return @alpha\n end",
"def finalscore(h,flattenarray,originalarray)\r\n # puts \"==>> #{originalarray}\"\r\n max_index = originalarray.each_index.max_by { |i| originalarray[i].size }\r\n # puts \"max index = #{max_index}\"\r\n # puts \"abcscs = #{originalarray[max_index].length}\"\r\n maxsize = originalarray[max_index].length+1\r\n min_index = originalarray.each_index.min_by { |i| originalarray[i].size }\r\n minsize = originalarray[min_index].length+1\r\n frequency = flattenarray.length\r\n # puts \"***** max= #{maxsize} min = #{minsize} f= #{frequency}\"\r\n h.each do |key,value|\r\n # if key == \"B00APE06UA\"\r\n # puts \"value = #{value }\"\r\n # puts \"value[0] = #{value[0] }\"\r\n # puts \"value[1] = #{value[1]}== #{(value[1]-minsize+1)}/#{(maxsize-minsize)}\"\r\n # puts \"value[0] = #{value[0]} == #{value[0].clone}/#{frequency}\"\r\n # end\r\n\r\n # value[0]= 10000*value[0]/frequency\r\n # value[1]= 100*(value[1]-minsize+1)/(maxsize-minsize)\r\n value [1] = 10000*( value[1]/value[0])\r\n # if key ==\"B00APE06UA\"\r\n # puts \"value [1] = #{value[1]}\"\r\n # puts \" ==>>>> #{value[0]} =========#{value[1]} #{(value[1]-minsize+1)}/#{(maxsize-minsize)} \"\r\n # end\r\n total_score = value[0]+value[1]\r\n # puts\" #{total_score}\"\r\n h[key] = total_score\r\n end\r\n return h\r\nend",
"def perform\n # Execute the naive algorithm and puts the result\n @standard_algorithm = StandardAlgorithm.new @a_matrix, @b_matrix\n puts 'Naive Algorithm:'\n @standard_algorithm.perform.print\n\n # This use the Ruby library to check the result\n puts @standard_algorithm.result == @a_matrix * @b_matrix ? 'OK' : 'NOK'\n\n # Same as above, using Strassen algorithm\n @strassen_algorithm = StrassenAlgorithm.new @a_matrix, @b_matrix\n puts 'Strassen Algorithm:'\n @strassen_algorithm.perform.print\n puts @strassen_algorithm.result == @a_matrix * @b_matrix ? 'OK' : 'NOK'\n end",
"def test_ce_deBoer_2\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n # Cost matrix\n n = 5\n c = NArray[[0,1,3,5,6],\n [1,0,3,6,5],\n [3,3,0,2,2],\n [5,6,2,0,2],\n [6,5,2,2,0]]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.pr[true,0] = NArray[0.0,1.0] # put vertex 0 in subset 1\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n smooth = 0.4\n\n max_cut_score = proc do |sample|\n weight = 0\n for i in 0...n\n for j in 0...n\n weight += c[j,i] if sample[i] < sample[j]\n end\n end\n -weight # to be minimized\n end\n best_cut = NArray[1,1,0,0,0]\n assert_equal(-15, max_cut_score.call(NArray[1,0,0,0,0]))\n assert_equal(-28, max_cut_score.call(best_cut))\n\n mp.to_score_sample(&max_cut_score)\n\n mp.to_update do |pr_iter|\n smooth*pr_iter + (1 - smooth)*mp.pr\n end\n\n mp.for_stop_decision do\n #p mp.pr\n mp.num_iters >= mp.max_iters\n end\n\n mp.solve\n\n if best_cut != mp.most_likely_solution\n warn \"expected #{best_cut}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end",
"def vigenereCipher(string, key, alphabet)\n aryStr = string.split(\"\")\n nStr = Array.new\n i = 0\n while i < aryStr.length\n j = 0\n while j < key.length\n nStr << (alphabet[(alphabet.index(aryStr[i]) + key[j])])\n j += 1\n i += 1\n end\n end\n return nStr.join('')\nend",
"def cramers_rule(ax,ay,az,a)\n # ax = array for all coefficients of x\n # ay = array for all coefficients of y\n # az = array for all coefficients of z\n # a = array for all constants\n x = Matrix[a,ay,az].determinant/Matrix[ax,ay,az].determinant.to_f\n y = Matrix[ax,a,az].determinant/Matrix[ax,ay,az].determinant.to_f\n z = Matrix[ax,ay,a].determinant/Matrix[ax,ay,az].determinant.to_f\n p x\n p y \n p z\n end",
"def ener_kcal \n\t\t@ener_kcal = @saturadas * 9 + @monoinsaturadas * 9 + @polinsaturadas * 9 + @azucares * 4 + @polialcoles * 2.4 + @almidon * 4 + @fibra * 2 + @proteinas * 4 + @sal * 6\n\t\treturn @ener_kcal\n\tend",
"def marcsCakewalk(calorie)\n arr = calorie.sort.reverse!\n\n sum = 0\n arr.each_with_index do |cal, index|\n sum += cal * (2**index)\n end\n sum\nend"
]
| [
"0.659812",
"0.56843007",
"0.54977244",
"0.52980226",
"0.520264",
"0.5083619",
"0.5061918",
"0.50556916",
"0.50504255",
"0.5031081",
"0.49978867",
"0.4965376",
"0.49543536",
"0.49212122",
"0.4915246",
"0.4910321",
"0.49029636",
"0.4896388",
"0.48898193",
"0.48720384",
"0.48610783",
"0.48326987",
"0.48214152",
"0.48127103",
"0.48096833",
"0.47985578",
"0.4761112",
"0.47537354",
"0.4733936",
"0.47267762"
]
| 0.61531466 | 1 |
GET /wishlist_items GET /wishlist_items.xml | def index
@wishlist_items = WishlistItem.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @wishlist_items }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def index\n @wish_lists = WishList.find(:all, :order => 'created_at DESC').paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wish_lists }\n end\n end",
"def wish_list(options={})\n get('/wish_list', options)\n end",
"def show\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def index\n @wish_list_items = WishListItem.all\n end",
"def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def show\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def show\n @wishlist = Wishlist.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def show\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def index\n\t@wishlist = Wishlist.all\n\t@client = Client.all\n\t#@product = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end",
"def index\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_items = Wishitem.where(:wishlist_id => @wishlist)\n end",
"def show\n \t@wishlist = Wishlist.find(params[:id])\n \t@client = @wishlist.client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by!(access_hash: params[:id])\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end",
"def index\n @wish_lists = WishList.all\n end",
"def set_wishlist_item\n @wishlistitem = Wishlistitem.find(params[:id])\n end",
"def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end",
"def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end",
"def set_wishlist_item\n @wishlist_item = WishlistItem.find(params[:id])\n end",
"def index\n @wishlists = Wishlist.all\n @mywishlists = Wishlist.where('user_id' => current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end",
"def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end",
"def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end",
"def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end",
"def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\n end\n end",
"def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end"
]
| [
"0.7702818",
"0.7389687",
"0.7069813",
"0.70656097",
"0.70206",
"0.6967141",
"0.6891797",
"0.68861693",
"0.688251",
"0.6779779",
"0.67751074",
"0.6771312",
"0.6677934",
"0.6667456",
"0.64915663",
"0.6464108",
"0.64375645",
"0.6430342",
"0.632434",
"0.6292687",
"0.62863684",
"0.62757736",
"0.6263078",
"0.62604606",
"0.6235385",
"0.6219399",
"0.61805713",
"0.614557",
"0.61399776",
"0.6126991"
]
| 0.7948633 | 0 |
GET /wishlist_items/1 GET /wishlist_items/1.xml | def show
@wishlist_item = WishlistItem.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @wishlist_item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def show\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def index\n @wish_lists = WishList.find(:all, :order => 'created_at DESC').paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wish_lists }\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def show\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def wish_list(options={})\n get('/wish_list', options)\n end",
"def show\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def show\n @wishlist = Wishlist.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def index\n @wish_list_items = WishListItem.all\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def show\n \t@wishlist = Wishlist.find(params[:id])\n \t@client = @wishlist.client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def index\n\t@wishlist = Wishlist.all\n\t@client = Client.all\n\t#@product = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by!(access_hash: params[:id])\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end",
"def index\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_items = Wishitem.where(:wishlist_id => @wishlist)\n end",
"def set_wishlist_item\n @wishlistitem = Wishlistitem.find(params[:id])\n end",
"def set_wishlist_item\n @wishlist_item = WishlistItem.find(params[:id])\n end",
"def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end",
"def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end"
]
| [
"0.78592396",
"0.751913",
"0.7107771",
"0.70018244",
"0.69793105",
"0.69069713",
"0.68212384",
"0.6718996",
"0.6705311",
"0.6702776",
"0.6637464",
"0.6612683",
"0.6573811",
"0.6497558",
"0.6494542",
"0.64729625",
"0.6472366",
"0.6445448",
"0.6427236",
"0.64050853",
"0.6292535",
"0.6274277",
"0.6242827",
"0.6242827",
"0.6242827",
"0.6242827",
"0.6242827",
"0.6242827",
"0.6242246",
"0.6214615"
]
| 0.7829301 | 1 |
GET /wishlist_items/new GET /wishlist_items/new.xml | def new
@wishlist_item = WishlistItem.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @wishlist_item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :created, :location => @wish_list_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\r\n @item = Item.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item }\r\n end\r\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end",
"def new\n @favourites = Favourites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favourites }\n end\n end",
"def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @wish = Wish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish }\n end\n end",
"def new\n @item = BudgetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @clone_item_request = CloneItemRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clone_item_request }\n end\n end",
"def new\n @favorite = Favorite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favorite }\n end\n end",
"def new\n @receiving_item = ReceivingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end",
"def new\n @favourite = Favourite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favourite }\n end\n end",
"def new\n @auction_item = AuctionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auction_item }\n end\n end",
"def new\n @action_item = ActionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_item }\n end\n end",
"def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\n end\n end",
"def new\n @shop_item = ShopItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shop_item }\n end\n end"
]
| [
"0.80365664",
"0.7672576",
"0.75745106",
"0.75463885",
"0.72669226",
"0.72669226",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.7104713",
"0.7048624",
"0.70458513",
"0.6994171",
"0.69870645",
"0.698051",
"0.69617605",
"0.69043726",
"0.6903325",
"0.6878056",
"0.68719935",
"0.6858777",
"0.68247515",
"0.6780134",
"0.6774266",
"0.6768752"
]
| 0.8076632 | 0 |
PUT /wishlist_items/1 PUT /wishlist_items/1.xml | def update
@wishlist_item = WishlistItem.find(params[:id])
respond_to do |format|
if @wishlist_item.update_attributes(params[:wishlist_item])
format.html { redirect_to(@wishlist_item, :notice => 'Wishlist item was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_wishlist_item\n @wishlistitem = Wishlistitem.find(params[:id])\n end",
"def set_wishlist_item\n @wishlist_item = WishlistItem.find(params[:id])\n end",
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n if @wishlistitem.update_attributes(params[:wishlistitem])\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :index, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlist = current_user.wishlists.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wish_list_item.update(wish_list_item_params)\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish_list_item }\n else\n format.html { render :edit }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_wish_list_item\n @wish_list_item = WishListItem.find(params[:id])\n end",
"def update\n @wish.update(wish_params)\n redirect_to wishlist_path(@wish.wishlist_id)\n end",
"def update\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n if @wish_list.update_attributes(params[:wish_list])\n flash[:notice] = 'WishList was successfully updated.'\n format.html { redirect_to(admin_wish_lists_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wishlist_item_params\n params.require(:wishlist_item).permit(:wishlist_id, :item_id)\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n # @wishlist = Wishlist.find(params[:id])\n end",
"def wishlist_item_params\n params.require(:wishlistitem).permit(:id, :user_id, :item_id)\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n @product = Product.all\n\n if @wishlist.update_attributes(params[:wishlist])\n \t\tparams[:product_id].each do |product|\n \t\t\tif @wishlist.products.where(:id => product).count == 0\n \t\t\t @wishlist.products << Product.find(product)\n \t\t\tend\n \t\tend\n\t\t\n \tredirect_to :action => \"show\", :id => @wishlist\n \t\tend\n\n# if @wishlist.update_attributes(params[:wishlist])\n# format.html { redirect_to Wishlist, notice: 'Pickup list was successfully updated.' }\n# format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: Wishlist.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def update\n @wish = Wish.find(params[:id])\n\n respond_to do |format|\n if @wish.update_attributes(params[:wish])\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = current_wishlist\n product = Product.find(params[:product_id])\n @wishlist_item = @wishlist.wishlist_items.build(:product => product)\n\n respond_to do |format|\n if @wishlist_item.save\n format.html { redirect_to(@wishlist, :notice => 'Wishlist item was successfully created.') }\n format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_item }\n else\n format.html { redirect_to(store_url, :notice => 'Item already added to wishlist') }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_wishlist\n @wishlist = current_user.wishlists.find(params[:id])\n end",
"def update\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_item = Wishitem.find_by(:wishlist_id => @wishlist, :product_id => params[:id])\n @wishlist_item.destroy\n if params.has_key?(:page)\n redirect_to \"/products?page=#{params[:page]}\"\n else\n redirect_to mywishlist_path\n end\n end"
]
| [
"0.7283253",
"0.7260425",
"0.7176752",
"0.7163197",
"0.70719266",
"0.706832",
"0.70471656",
"0.70294124",
"0.69872826",
"0.6974909",
"0.6967413",
"0.6899808",
"0.68313503",
"0.6638728",
"0.6629651",
"0.6618489",
"0.6618489",
"0.6618489",
"0.6618489",
"0.6618489",
"0.66137534",
"0.65970093",
"0.6567678",
"0.6507659",
"0.64869905",
"0.6439098",
"0.64316076",
"0.6430209",
"0.6415932",
"0.64104897"
]
| 0.7591988 | 0 |
DELETE /wishlist_items/1 DELETE /wishlist_items/1.xml | def destroy
@wishlist_item = WishlistItem.find(params[:id])
@wishlist_item.destroy
respond_to do |format|
format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wish_list_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wishlistitem = Wishlistitem.find(params[:id])\n @wishlistitem.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlistitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @item.container_type == 'Wishlist'\n @wishlist = Wishlist.find(@item.container_id)\n @wishlist.items.delete_if{|o| o.id == @item.id}\n @wishlist.save\n elsif @item.container_type == 'Store'\n @store = Store.find(@item.container_id)\n @store.items.delete_if{|o| o.id == @item.id}\n @store.save\n end\n\n @item.destroy\n respond_to do |format|\n @wishlist = Wishlist.find(session[:wishlist_id])\n format.html { redirect_to edit_wishlist_url(@wishlist) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wish_list_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wish_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wish_list_item.destroy\n respond_to do |format|\n format.html { redirect_to wish_list_url(@wish_list_item.wish_list), notice: 'Wish list item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish.destroy\n redirect_to wishlist_path(@wish.wishlist_id)\n end",
"def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n redirect_to welcome_homepage_url\n end",
"def remove_wishlist_item\n if item = Item.find_by_id(params[:id])\n @customer.remove_item_from_wishlist(item)\n end\n render :text => ''\n end",
"def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Záznam vo wishliste bol úspešne zmazaný.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n user = current_user\n item_id = Sneaker.find(params[:id])\n Wishlist.where(sneaker_id: params[:id]).destroy_all\n item_id.destroy\n redirect_to user_path(user)\n end",
"def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish_list.destroy\n respond_to do |format|\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billitem = Billitem.find(params[:id])\n @billitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(billitems_url) }\n format.xml { head :ok }\n end\n end",
"def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end",
"def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end",
"def delete_item\n\nend",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wish.destroy\n redirect_to root_url\n end",
"def destroy\r\n @item = Item.find(params[:id])\r\n\r\n @item.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(items_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @auction_item = AuctionItem.find(params[:id])\n @auction_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(auction_items_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end"
]
| [
"0.7499399",
"0.72535795",
"0.7193845",
"0.71509445",
"0.7015333",
"0.699125",
"0.69773203",
"0.69632375",
"0.69632375",
"0.69607407",
"0.6893657",
"0.68016624",
"0.67435944",
"0.6742987",
"0.6742987",
"0.67184496",
"0.6668846",
"0.6650799",
"0.66481614",
"0.6621747",
"0.66061425",
"0.66061425",
"0.66061425",
"0.66061425",
"0.66061425",
"0.66061425",
"0.6602876",
"0.6602462",
"0.65896314",
"0.658537"
]
| 0.7620046 | 0 |
Whether or not this event is a search event. | def search?
type == :search
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search?\n self.rel == \"search\"\n end",
"def has_simple_search?\n self.search_type.to_s == \"simple\" && !self.is_static?\n end",
"def searchable?\n @args[:search].present?\n end",
"def event?\n entry_type == :event\n end",
"def searching?\n @searching\n end",
"def has_event_with_options?(name, options = {})\n event = Event.new(name, options)\n event.type = :search\n events.dup.keep_if { |e| e.match? self, event }.to_a.first\n end",
"def override_search?(search_ui)\n respond_to?(override_search(search_ui))\n end",
"def override_search?(search_ui)\n respond_to?(override_search(search_ui))\n end",
"def is_event?\n self.object_type.downcase.to_s == \"event\"\n end",
"def event?\r\n is_category_type? 'event'\r\n end",
"def is_searchable\n return @is_searchable\n end",
"def event?(event)\n event_names.include?(event.to_s)\n end",
"def has_event_with_options?(name, options = {})\n event = Event.new(name, options)\n event.type = :search\n events.dup.keep_if { |e| e.match? Star.new, event }.to_a.first\n end",
"def event?\n type == :event_id\n end",
"def event?\n type == :event_id\n end",
"def has_complex_search?\n self.search_type.to_s == \"complex\" && !self.is_static?\n end",
"def searching?\n @searching\n end",
"def searching?\n return true unless params[:search].nil?\n end",
"def search_engine_class\n EventSearch\n end",
"def event?(name)\n @events.keys.include?(name.to_sym)\n end",
"def event? eve\n @_events.include? eve\n end",
"def event?(state)\n @events.key?(state)\n end",
"def event?\n !! @event\n end",
"def searchable?\n return @paginable_params[:search].present?\n end",
"def has_event?(name)\n return self.events(true).include? name.to_sym\n end",
"def has_event?(event_model)\n\t bound_events.has_key?(event_model)\n\tend",
"def has_search_parameters?\n params[:search_field].present? || search_state.has_constraints?\n end",
"def on_search_page?\n params['controller'] == 'catalog' && params['action'] == 'index'\n end",
"def search_type\n\t\tif is_user_search == \"1\"\n\t\t\treturn \"User Search\"\n\t\telsif is_tag_search == \"1\"\n\t\t\treturn \"Tag Search\"\n\t\tend\n\tend",
"def has_event?(event_model)\n bound_events.has_key?(event_model)\n end"
]
| [
"0.7050877",
"0.68856",
"0.68108463",
"0.6662095",
"0.66348374",
"0.6611465",
"0.65955347",
"0.65955347",
"0.6538532",
"0.6480304",
"0.64727294",
"0.64443326",
"0.64290655",
"0.6394361",
"0.6394361",
"0.63826466",
"0.63657427",
"0.6335163",
"0.62802213",
"0.62311774",
"0.6182962",
"0.61784875",
"0.6061994",
"0.60610133",
"0.6046416",
"0.60463667",
"0.6033718",
"0.59924114",
"0.5939356",
"0.5899203"
]
| 0.77010936 | 0 |
Checks the given runtime options for required options. If no required options exist, returns true. Otherwise, checks the keys of the runtime options to see if they contain all of the required options. | def check_options_requirements(runtime_options)
required_options = options[:requires] || options[:require]
return true unless required_options
([required_options].flatten - runtime_options.keys).size == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?(options)\n (@required_options - options.keys).size == 0\n end",
"def required_by_option?(options)\n req = (options.is_a?(Hash) ? options.stringify_keys[:required] : options)\n !(req.to_s === 'false' || req.nil?)\n end",
"def requiredOptionsSet()\n\t\t@@opt.each{|d| return false if d[\"required\"] == true and (d[\"value\"] == nil or d[\"value\"] == \"\")}\n\n\t\treturn true\n\tend",
"def options_valid?\n missing = MANDATORY_OPTIONS.select { |arg| @options[arg].nil? }\n missing.empty?\n end",
"def check_required(options)\n all_right = true\n options.each do |x,y|\n if y[\"required\"] == \"yes\" and y[\"value\"] == \"\"\n all_right = false\n end\n end\n return all_right\nend",
"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?\n options[:required] == true\n end",
"def required(options)\n default = true\n return default unless options.is_a?(Hash)\n return default unless options.key?(:required)\n return options[:required]\n end",
"def validate_options\n required_keys = {\n # 'azure' => %w(cert_path subscription_id region default_key_name logical_name),\n 'azure' => %w(),\n 'registry' => []\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if !options.has_key?(key) || !options[key].has_key?(value)\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def has_options?\n bounty_expiration.present? || upon_expiration.present? || promotion.present?\n end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"def required? #:nodoc:\n options[:required]\n end",
"def has_options?\n properties.include?(\"has_options\")\n end",
"def required?\n unless @required\n @required = options_by_type(:required)\n @required = true if @required.nil?\n end\n return @required\n end",
"def check_options(options, *supported)\n unsupported = options.to_hash.keys - supported.flatten\n raise ArgumentError, \"No such option: #{unsupported.join(' ')}\" unless unsupported.empty?\n end",
"def validate_options\n required_keys = %w(endpoint user password\n container_name agent ntp blobstore)\n missing_keys = []\n required_keys.each do |key|\n unless @options.has_key?(key)\n missing_keys << key\n end\n end\n message = \"Missing configuration parameters: #{missing_keys}\"\n raise ArgumentError, message unless missing_keys.empty?\n end",
"def has_option?(k)\n raise ParseError.new(\"`nil' cannot be an option key\") if (k.nil?)\n @options.has_key?(k.to_sym)\n end",
"def required?\n required.any?\n end",
"def ab_options_is_complete?(ab_options = {})\n result = true\n\n ab_options.values.each do |value|\n # Has :a, :b and :goal options\n result = value.keys.size >= 3 && value.key?(:a) && value.key?(:b) && value.key?(:goal)\n break if result == false\n end\n\n result\n end",
"def test_option_required\n\n # All options are optional by default\n assert(!Option.new(nil, nil).required)\n assert(!Option.new(\"-h|--help\", nil).required)\n\n # All options may be required\n assert(Option.new(nil, nil, required:true).required)\n assert(Option.new(\"-h|--help\", nil, required:true).required)\n end",
"def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end",
"def optional?\n required.empty? && required_keywords.empty?\n end",
"def has_correct_options?\n options.corrects.any?\n end",
"def options_ok?\n end",
"def includes_arguments?\n !default_data.empty? || !flags.empty? ||\n !required_args.empty? || !optional_args.empty? ||\n !remaining_arg.nil? || flags_before_args_enforced?\n end",
"def meets_requirements?(params)\n requirements.reject {|k| params.keys.map(&:to_s).include? k.to_s }.empty?\n end",
"def check_option_support\n assert_option_supported(:foodcritic) &&\n assert_option_supported(:scmversion, 'thor-scmversion') &&\n assert_default_supported(:no_bundler, 'bundler')\n end"
]
| [
"0.74803275",
"0.7443251",
"0.71763015",
"0.69971865",
"0.672289",
"0.6709709",
"0.66750807",
"0.66280764",
"0.660845",
"0.6574304",
"0.6508954",
"0.6440833",
"0.6428106",
"0.6428106",
"0.64270777",
"0.64260393",
"0.6373272",
"0.6348179",
"0.6328891",
"0.6257842",
"0.6226288",
"0.62008137",
"0.61787695",
"0.61707467",
"0.61395645",
"0.6136177",
"0.61156744",
"0.6114244",
"0.61072856",
"0.6106896"
]
| 0.86579126 | 0 |
kill all processes including servers, clients and trema PIDs for server and clients are in PID files | def kill_all_processes
puts "KILL : all processes"
pid_servers = PID_DIR_PATH + "/" + PID_FILE_PREFIX_SERVER + "*"
pid_clients = PID_DIR_PATH + "/" + PID_FILE_PREFIX_CLIENT + "*"
# for servers
Dir::glob(pid_servers).each do |f|
if File::ftype(f) == "file"
pid_server = f.split( "." )[1]
$pids_s.delete(pid_server)
begin
File.delete(f)
Process.kill('KILL', pid_server.to_i)
# puts "KILL : server [" + pid_server + "] was killed"
rescue Errno::ESRCH
STDERR.puts "KILL : server [" + pid_server + "]: No such process"
rescue
STDERR.puts "ERROR : Can't kill server process [" + pid_server + "]"
end
end
end
# for clients
Dir::glob(pid_clients).each do |f|
if File::ftype(f) == "file"
pid_client = f.split( "." )[1]
$pids_c.delete(pid_client)
begin
File.delete(f)
Process.kill('KILL', pid_client.to_i)
# puts "KILL : client [" + pid_client + "] was killed"
rescue Errno::ESRCH
STDERR.puts "KILL : client [" + pid_client + "]: No such process"
rescue
STDERR.puts "ERROR : Can't kill client process [" + pid_client + "]"
end
end
end
# for trema
cmd = TREMA + " killall"
system(cmd)
$pids_c.each{|pid|
if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end
}
$pids_s.each{|pid|
if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill_procs(options={})\n # Give it a good try to delete all processes.\n # This abuse is necessary to release locks on polyinstantiated\n # directories by pam_namespace.\n\n procfilter=\"-u #{uid}\"\n if options[:init_owned]\n procfilter << \" -P 1\"\n end\n\n # If the terminate delay is specified, try to terminate processes nicely\n # first and wait for them to die.\n if options[:term_delay]\n ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill #{procfilter}\")\n etime = Time.now + options[:term_delay].to_i\n while (Time.now <= etime)\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n break unless rc == 0\n sleep 0.5\n end\n end\n\n oldproclist=\"\"\n stuckcount=0\n while stuckcount <= 10\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill -9 #{procfilter}\")\n break unless rc == 0\n\n sleep 0.5\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if oldproclist == out\n stuckcount += 1\n else\n oldproclist = out\n stuckcount = 0\n end\n end\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if rc == 0\n procset = out.split.join(' ')\n logger.error \"ERROR: failed to kill all processes for #{uid}: PIDs #{procset}\"\n end\n end",
"def kill_workers\n pids = %x{ps --ppid #{pid}}.split(/\\n+/).map {|line| line.sub(%r{^\\s*(\\d+)\\s+.*}, '\\\\1').to_i}\n pids.shift\n pids.each {|id| Process.kill('KILL', id) rescue nil}\n end",
"def kill_processes(pid_array)\n command = 'taskkill '\n pid_array.each do |pid|\n command = command + \"/pid #{pid} \"\n end\n `#{command}`\n end",
"def setup\n %w{ echo_server deaf_server stubborn_server simple_server }.each do |server|\n begin\n Process.kill 9, possible_pid(server)\n rescue Errno::ESRCH\n # good, no process to kill\n end\n begin\n File.unlink pid_file(server)\n rescue Errno::ENOENT\n # good, no pidfile to clear\n end\n end\n end",
"def kill_importers\n ps = `ps -ef | grep 'importer:start'`\n rake_processes = ps.split(\"\\n\").select { |process| process !~ /grep/ }\n rake_pids = rake_processes.map { |process| process.split[1] }\n pids = rake_pids.reject { |pid| Process.pid.to_s == pid }.map(&:to_i)\n pids.each { |pid| Process.kill('TERM', pid) }\n end",
"def kill_processes(pid_json)\n unless File.exist? pid_json\n $logger.error \"File `#{pid_json}` not found. It is possible that processes have been orphaned.\"\n exit 1\n end\n windows = is_windows?\n find_windows_pids(pid_json) if windows\n pid_hash = ::JSON.parse(File.read(pid_json), symbolize_names: true)\n pid_array = []\n pid_array << pid_hash[:mongod_pid] if pid_hash[:mongod_pid]\n pid_array += pid_hash[:dj_pids] if pid_hash[:dj_pids]\n pid_array << pid_hash[:rails_pid] if pid_hash[:rails_pid]\n pid_array += pid_hash[:child_pids] if pid_hash[:child_pids]\n pid_array.each do |pid|\n begin\n if windows\n # Check if a process with this PID exists before attempting to kill\n pid_exists = system('tasklist /FI' + ' \"PID eq ' + pid.to_s + '\" 2>NUL | find /I /N \"' + pid.to_s + '\">NUL')\n if pid_exists\n system_return = system('taskkill', '/pid', pid.to_s, '/f', '/t')\n raise StandardError unless system_return\n else\n $logger.warn \"No process with PID #{pid} exists, did not attempt to kill\"\n next\n end\n else\n ::Process.kill('SIGKILL', pid)\n end\n rescue\n $logger.error \"Attempted to kill process with PID `#{pid}`. The success of the attempt is unclear\"\n next\n end\n $logger.debug \"Killed process with PID `#{pid}`.\"\n end\n ::File.delete(pid_json)\nend",
"def kill_all_proxies\n processes = Zerg::Support::Process.processes\n processes.each do |proc_info|\n next unless /tem_proxy/ =~ proc_info[:command_line]\n @logger.info \"Mass-killing TEM proxy (pid #{proc_info[:pid]})\"\n Zerg::Support::Process::kill_tree proc_info[:pid]\n end\n end",
"def stop_local_server(rails_pid, dj_pids, mongod_pid, child_pids = [])\n successful = true\n windows = is_windows?\n dj_pids.reverse.each do |dj_pid|\n pid_kill_success = kill_pid(dj_pid, 'delayed-jobs', windows)\n successful = false unless pid_kill_success\n end\n\n pid_kill_success = kill_pid(rails_pid, 'rails', windows)\n successful = false unless pid_kill_success\n\n pid_kill_success = kill_pid(mongod_pid, 'mongod', windows)\n successful = false unless pid_kill_success\n\n child_pids.each do |child_pid|\n kill_pid(child_pid, 'child-process', windows)\n successful = false unless pid_kill_success\n end\n\n sleep 2 # Keep the return from beating the stdout text\n\n unless successful\n $logger.error 'Not all PID kills were successful. Please investigate the error logs.'\n return false\n end\n\n true\nend",
"def clean_exit_pids(pids)\n pids.map do |pid|\n begin\n pid if Process.kill 0, pid\n rescue Errno::ESRCH\n nil\n end\n end.compact\n end",
"def stop_apps\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n File.open(Conf,'r').each do |filename|\n filename.chomp!\n next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n pid_to_kill = 0\n\n # First we check to see if we have mention of the app in the PID\n # database. Normally, we should. If we don't have mention of the\n # app in the PID database, then the process table must be searched\n # to attempt to find the app and it's PID so that we have something\n # to kill.\n\n if ((@pid_db[filename].to_i || 0) > 0)\n pid_to_kill = @pid_db[filename].to_i\n else\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tif (ps.cmdline =~ /ruby\\s+#{filename}\\s*$/)\n\t\t\t\t\t\t\tpid_to_kill = ps.pid.to_i\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n ps_out.each do |line|\n if (line =~ /ruby\\s+#{filename}\\s*$/)\n line =~ /^\\S+\\s+(\\d+)/\n pid_to_kill = $1.to_i\n\t\t\t\t\t\tbreak\n end\n\t\t\t\tend\n\t\t\tend\n end\n\n # Make sure that a PID to kill was found. This is paranoia in case\n # the app were killed manually or died unexpectedly at some point.\n # it'd be a real bummer to kill someone's shell session just because\n # they had the dumb luck to inherit a PID number that used to belong\n # to an Iowa app.\n\n k = false\n if (pid_to_kill > 0)\n begin\n Process.kill('SIGTERM',pid_to_kill)\n k = true\n rescue Exception\n puts \"Error killing PID #{pid_to_kill} (#{filename})\"\n\t\t\tend\n puts \"Stopped PID #{pid_to_kill} (#{filename})\" if k\n else\n puts \"Warning: Can't find a PID for #{filename}\"\n\t\tend\n\n @pid_db.delete filename if k\n end\nend",
"def kill_and_reap(pids)\n puts \"Sending signals...\"\n sig = :KILL\n pids.each do |pid|\n puts \"== kill #{pid} with #{sig}\"\n Process.kill(sig, -1 * pid.to_i)\n end\n\n pids.each do |pid|\n puts \"=== Waiting for: #{pid} #{Process.waitpid2(pid)}\"\n end\nend",
"def killall_cmd\n \"kill -9 `pgrep #{soffice_pname} #{unoconv_pname}`\"\n end",
"def stop_all(force = false)\n @monitor.stop if @monitor\n \n failed_to_kill = false\n debug = options[:debug]\n wait = options[:force_kill_wait].to_i\n pids = unix_pids\n if wait > 0 && pids.size > 0\n puts \"[daemons_ext]: Killing #{app_name} with force after #{wait} secs.\"\n STDOUT.flush\n\n # Send term first, don't delete PID files.\n pids.each {|pid| Process.kill('TERM', pid) rescue Errno::ESRCH}\n\n begin\n Timeout::timeout(wait) {block_on_pids(wait, debug, options[:sleepy_time] || 1)}\n rescue Timeout::Error\n puts \"[daemons_ext]: Time is up! Forcefully killing #{unix_pids.size} #{app_name}(s)...\"\n STDOUT.flush\n unix_pids.each {|pid| `kill -9 #{pid}`}\n begin\n # Give it an extra 30 seconds to kill -9\n Timeout::timeout(30) {block_on_pids(wait, debug, options[:sleepy_time] || 1)}\n rescue Timeout::Error\n failed_to_kill = true\n puts \"[daemons_ext]: #{unix_pids} #{app_name}(s) won't die! Giving up.\"\n STDOUT.flush\n end\n ensure\n # Delete Pidfiles\n @applications.each {|a| a.zap!}\n end\n\n puts \"[daemons_ext]: All #{app_name}s dead.\" unless failed_to_kill\n STDOUT.flush\n else\n @applications.each {|a| \n if force\n begin; a.stop; rescue ::Exception; end\n else\n a.stop\n end\n }\n end\n end",
"def cleanup\n @omicli_pgids.each do |pgid|\n `pkill -KILL -g #{pgid}`\n end\n @omicli_pgids.clear\n end",
"def kill_instruments(_=nil)\n instruments_pids.each do |pid|\n terminator = RunLoop::ProcessTerminator.new(pid, \"QUIT\", \"instruments\")\n unless terminator.kill_process\n terminator = RunLoop::ProcessTerminator.new(pid, \"KILL\", \"instruments\")\n terminator.kill_process\n end\n end\n end",
"def stop_remote_processes\n\t remote_processes.reverse.each do |pid, quit_w|\n\t\tbegin\n\t\t quit_w.write('OK') \n\t\trescue Errno::EPIPE\n\t\tend\n\t\tbegin\n\t\t Process.waitpid(pid)\n\t\trescue Errno::ECHILD\n\t\tend\n\t end\n\t remote_processes.clear\n\tend",
"def kill_spork(pid_file)\n pid = File.read(pid_file).to_i\n Process.kill(\"INT\", pid); sleep 1\n pid\n end",
"def stop\n system(\"ps -aux | grep rackup\")\n puts \"Stoping clusters...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/doozer.#{app[:port]}.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n File.open(pid_file, 'r'){ | f | \n pid = f.gets.to_i\n puts \"=> Shutting down process #{pid}\"\n system(\"kill -9 #{pid}\")\n\n }\n File.delete(pid_file) \n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n end\n sleep(1)\n system(\"ps -aux | grep rackup\")\nend",
"def kill\n active_slaves.each_value { |s| s.kill(join: false) }\n while has_active_slaves?\n finished_child = Process.waitpid2(-1)\n process_finished_slave(*finished_child)\n end\n rescue Errno::ECHILD\n end",
"def kill_all!\n @monkeys.each(&:kill) unless @monkeys.empty?\n monkeys = @monkeys.dup\n @monkeys.clear\n\n monkeys\n end",
"def stop_remote_processes\n remote_processes.reverse.each do |pid, quit_w|\n begin\n quit_w.write(\"OK\")\n rescue Errno::EPIPE\n end\n begin\n Process.waitpid(pid)\n rescue Errno::ECHILD\n end\n end\n remote_processes.clear\n end",
"def kill_orphaned_services\n cleaned_labels = []\n cleaned_services = []\n running.each do |label|\n if (service = FormulaWrapper.from(label))\n unless service.dest.file?\n cleaned_labels << label\n cleaned_services << service\n end\n else\n opoo \"Service #{label} not managed by `#{bin}` => skipping\"\n end\n end\n kill(cleaned_services)\n cleaned_labels\n end",
"def terminate_process_tree(pid)\n child_pids = remote_processes.select { |p| p.ppid == pid }.collect(&:pid)\n child_pids.each { |cpid| terminate_process_tree(cpid) }\n terminate_process(pid)\n end",
"def kill_pids_by_regexp(regexp)\n pids = pids_by_regexp(regexp).keys\n kill_pids pids\n end",
"def kill_each_worker(signal)\n WORKERS.keys.each { |wpid| kill_worker(signal, wpid) }\n end",
"def kill_children(signal=\"SIGTERM\")\n if Foreman.windows?\n @running.each do |pid, (process, index)|\n system \"sending #{signal} to #{name_for(pid)} at pid #{pid}\"\n begin\n Process.kill(signal, pid)\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n else\n begin\n pids = @running.keys.compact\n Process.kill signal, *pids unless pids.empty?\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n end",
"def reap_children\n @child_list.each do |pid|\n Process.kill('SIGKILL', pid)\n\t Process.wait pid\n end\n end",
"def reap_workers\n workers.each do |pid, _|\n terminate(pid)\n end\n\n begin\n # waits for every children to terminate\n loop { Process.wait }\n rescue Errno::ECHILD\n # if there are no more children, continue\n end\n\n # clean up the PID data structure for the worker processes\n workers.clear\n end",
"def kill\n server.kill\n end",
"def kill_monkeys\n ADB.kill_monkeys(@device_list)\n end"
]
| [
"0.7158874",
"0.7088136",
"0.70101285",
"0.70016754",
"0.66099197",
"0.65603936",
"0.65290403",
"0.6455944",
"0.644798",
"0.6398452",
"0.6323112",
"0.6299266",
"0.62884915",
"0.62718755",
"0.62341315",
"0.6202883",
"0.6136912",
"0.61367756",
"0.6114428",
"0.6107549",
"0.6093969",
"0.6082763",
"0.60612774",
"0.60390997",
"0.6031982",
"0.6008636",
"0.6005811",
"0.5997084",
"0.5962058",
"0.5961439"
]
| 0.84458905 | 0 |
List all the groups. | def list
@groups = Group.find(:all, :order => 'name')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_groups\n BrickFTP::API::Group.all\n end",
"def list_groups\n BrickFTP::API::Group.all\n end",
"def hc_group_list_all(id)\n org=Org.find(id)\n org.hc_groups.all(:order=>'group_name')\n end",
"def groups\n find(:group).map { |g| g.content }\n end",
"def hc_group_list(id)\n org=Org.find(id)\n org.hc_groups.group_list\n end",
"def groups_list(params = {})\n response = @session.do_post \"#{SCOPE}.list\", params\n Slack.parse_response(response)\n end",
"def list_groups\n groups = CanvasSpaces.GroupCategory.groups.active.order(:name)\n # filter out non-public groups for non-admins\n groups = groups.where(join_level: 'parent_context_auto_join') unless @current_user.account.site_admin?\n groups_json = Api.paginate(groups, self, api_v1_canvas_spaces_groups_url).map do |g|\n include = @current_user.account.site_admin? || @current_user.id == g.leader_id ? ['users'] : []\n group_formatter(g, { include: include })\n end\n render :json => groups_json\n end",
"def index\n @groups = query(GROUP, :name)\n\n # restrict the groups to the groups of the current user\n # unless the current user is allowed to create groups\n # and need to see all\n unless allowed(:create)\n allowed_group_ids = current_user.groups.collect {|g| g.id }\n @groups.delete_if do |g|\n ! allowed_group_ids.member?(g.id)\n end\n end\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @groups }\n end\n end",
"def index\n @groups = Group.display_for_user(current_user)\n end",
"def group_all(options={})\n result = request(\n :method => :get,\n :path => '/groups',\n :expects => 200\n )\n result.fetch(:body, 'groups', []).map do |lb|\n Group.new(\n self,\n :id => lb[:id],\n :name => lb.get(:state, :name),\n :current_size => lb.get(:state, 'activeCapacity'),\n :desired_size => lb.get(:state, 'desiredCapacity')\n ).valid_state\n end\n end",
"def groups(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Groups\", params: params)\n end",
"def send_group_list\n I3.server.send_object(I3.directory.find_all_groups)\n end",
"def show_groups\n content = Accio::Parser.read\n content.groups.each do |group|\n puts \"#{group.title}\\n\"\n end\n end",
"def groups\r\n @groups ||= fetch_groups\r\n end",
"def group_list\n execute('dscacheutil -q group') do |result|\n groups = []\n result.stdout.each_line do |line|\n groups << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n groups\n end\n end",
"def index\n @list_groups = ListGroup.all\n end",
"def groups\n return [] if self.group_list.nil?\n self.group_list\n end",
"def index\n @groups = []\n for member in current_user.members\n @groups << member.group\n end\n end",
"def groups_list(trace: false, &block)\n r = dropbox_query(query: '2/team/groups/list', trace: trace)\n r['groups'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/groups/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['groups'].each(&block)\n end\n end",
"def list_groups\n {\n count: inventory.group_names.count,\n groups: inventory.group_names.sort,\n inventory: {\n default: config.default_inventoryfile.to_s,\n source: inventory.source\n }\n }\n end",
"def index\n @groups = @flr.groups.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end"
]
| [
"0.80761874",
"0.80761874",
"0.7736165",
"0.75816",
"0.75493896",
"0.74877626",
"0.74477017",
"0.7395149",
"0.7394693",
"0.7374675",
"0.7362523",
"0.73018074",
"0.72810775",
"0.726793",
"0.72521836",
"0.72483486",
"0.7229844",
"0.72212493",
"0.72163373",
"0.7161532",
"0.7132768",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493"
]
| 0.82609266 | 0 |
Give the given group either ALL or NO permissions to all the folders | def give_permissions_to_folders(group, permission_to_everything)
Folder.find(:all).each do |folder|
add_to_group_permissions(group, folder, permission_to_everything)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def folder_permissions_groups_only\n @attributes[:folder_permissions_groups_only]\n end",
"def add_to_group_permissions(group, folder, permission_to_everything)\n group_permission = GroupPermission.new\n group_permission.folder = folder\n group_permission.group = group\n group_permission.can_create = permission_to_everything\n group_permission.can_read = permission_to_everything\n group_permission.can_update = permission_to_everything\n group_permission.can_delete = permission_to_everything\n group_permission.save\n end",
"def add_group_permission(g)\n\t\t\n\tend",
"def create\n if request.post?\n @group = Group.new(params[:group])\n\n if @group.save\n # give the new group permissions to the folders\n give_permissions_to_folders(@group, params[:permission_to_everything][:checked] == 'yes' ? true : false)\n\n redirect_to :action => 'list'\n else\n render :action => 'new'\n end\n end\n end",
"def set_perms(data)\n permission = data[:permission] || 2 \n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def deny_all_access\n @permissions = 0\n end",
"def chg_permission(groups, arg, mode)\n arg = UserGroup.one_user(arg) if arg.is_a?(User)\n if (mode == :add) &&\n groups.exclude?(arg)\n groups.push(arg)\n elsif (mode == :remove) &&\n groups.include?(arg)\n groups.delete(arg)\n end\n end",
"def groups\n g = File.join(@root,'groups')\n FileUtils.mkdir_p g\n Dir.chdir(File.join(@root,'groups')) do\n Dir['*']\n end\n end",
"def chown_r(user, group, options={})\n #list = list.to_a\n fileutils.chown_r(user, group, list, options)\n end",
"def update_permissions\r\n if request.post? and @logged_in_user.is_admin?\r\n # update the create, read, update, delete right for this folder:\r\n update_group_permissions(folder_id, params[:create_check_box], 'create', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:read_check_box], 'read', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:update_check_box], 'update', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:delete_check_box], 'delete', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n end\r\n\r\n # Return to the folder\r\n redirect_to :action => 'list', :id => folder_id\r\n end",
"def change_group!\n tgt_gid = self.target_group.is_a?(Fixnum) ? self.target_group : Etc.getgrnam(self.target_group).gid\n chown_params = [nil, tgt_gid, self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chown'))\n File.lchown *chown_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chown'))\n #DOcumenation for FileUtils.chown_R is wrong (at least for Ubuntu 8.1, takes ID as String.)\n chown_params[1] = chown_params[1].to_s\n FileUtils.chown_R *chown_params\n else\n File.chown *chown_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchown is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change group for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end",
"def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end",
"def add_permission group, acl\n modify_permission(group, acl) { |perm|\n [perm.acl.to_s.split(\"\"), acl.split(\"\")].flatten.map(&:strip).\n uniq.sort.join\n }\n end",
"def chown(user_and_group)\n return unless user_and_group\n user, group = user_and_group.split(':').map {|s| s == '' ? nil : s}\n FileUtils.chown user, group, selected_items.map(&:path)\n ls\n end",
"def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def check_or_create_group_dirs\n change_dir(@working_directory)\n @config[:groups].each do |key, value|\n if value[:enable]\n Dir.mkdir(value[:name].downcase) unless Dir.exists?(value[:name].downcase) \n end \n end\n return Dir.glob('*').select { |f| File.directory? f }\n end",
"def authorize_for_group(group, actions=Permissions::View)\n authorize_for_user(nil, group, actions)\n end",
"def action_chgrp\n if @tgroup == nil\n Chef::Log::fatal \"target group need to be provided to perform chgrp\"\n elsif (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; chmod action not taken\")\n else\n converge_by(\"chgrp #{ @new_resource }\") do\n @client.chown(@path, 'group' => @tgroup)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown -R%s %s %s',\n (force ? 'f' : ''),\n (group ? \"#{user}:#{group}\" : user || ':'),\n list.join(' ')) if verbose\n return if noop\n uid = fu_get_uid(user)\n gid = fu_get_gid(group)\n list.each do |root|\n Entry_.new(root).traverse do |ent|\n begin\n ent.chown uid, gid\n rescue\n raise unless force\n end\n end\n end\n end",
"def chown(user, group, options={})\n #list = list.to_a\n fileutils.chown(user, group, list, options)\n end",
"def chown_r(user, group)\n util.chown_r(user, group, path)\n end",
"def apply_group_permissions(permission_types, ability = current_ability)\n groups = ability.user_groups\n return [] if groups.empty?\n permission_types.map do |type|\n field = solr_field_for(type, 'group')\n user_groups = type == 'read' ? groups - [::Ability.public_group_name, ::Ability.registered_group_name] : groups\n next if user_groups.empty?\n \"({!terms f=#{field}}#{user_groups.join(',')})\" # parens required to properly OR the clauses together.\n end\n end",
"def setable_permissions\n setable_permissions = Erp::AccessControl.permissions - Erp::AccessControl.public_permissions\n setable_permissions -= Erp::AccessControl.members_only_permissions if builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Erp::AccessControl.loggedin_only_permissions if builtin == BUILTIN_ANONYMOUS\n setable_permissions\n end",
"def update_group_permissions(folder_id_param, group_check_box_list, field, recursively)\r\n # iteratively update the GroupPermissions\r\n group_check_box_list.each do |group_id, can_do_it|\r\n # get the GroupPermissions\r\n group_permission = GroupPermission.find_by_group_id_and_folder_id(group_id, folder_id_param)\r\n\r\n # Do the actual update if the GroupPermission exists;\r\n # do not update the permissions of the admins group\r\n # (it should always be able to do everything)\r\n unless group_permission.blank? or group_permission.group.is_the_administrators_group?\r\n case field\r\n when 'create':\r\n group_permission.can_create = can_do_it\r\n when 'read':\r\n group_permission.can_read = can_do_it\r\n when 'update':\r\n group_permission.can_update = can_do_it\r\n when 'delete':\r\n group_permission.can_delete = can_do_it\r\n end\r\n group_permission.save\r\n end\r\n end\r\n\r\n # The recursive part...\r\n if recursively\r\n # Update the child folders\r\n folder = Folder.find_by_id(folder_id_param)\r\n if folder\r\n folder.children.each do |child_folder|\r\n update_group_permissions(child_folder.id, group_check_box_list, field, true)\r\n end\r\n end\r\n end\r\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def set_perms_dirs(dir_path, perm = 755)\n try_sudo \"find #{dir_path} -type d -exec chmod #{perm} {} \\\\;\"\nend",
"def can_manage_group?(project, group)\n group.is_child_of?(project)\n end"
]
| [
"0.6821695",
"0.67130405",
"0.657511",
"0.64386684",
"0.6430437",
"0.6218378",
"0.61804175",
"0.61694455",
"0.61454076",
"0.6142309",
"0.6113165",
"0.60897017",
"0.6087991",
"0.6047705",
"0.6013864",
"0.5988046",
"0.5961569",
"0.593958",
"0.592791",
"0.59166545",
"0.59166545",
"0.5911786",
"0.5896118",
"0.58585876",
"0.5852432",
"0.5837737",
"0.58300525",
"0.58247024",
"0.58127236",
"0.5778478"
]
| 0.72214156 | 0 |
Add the given group and folder to GroupPermissions and (dis)allow everything | def add_to_group_permissions(group, folder, permission_to_everything)
group_permission = GroupPermission.new
group_permission.folder = folder
group_permission.group = group
group_permission.can_create = permission_to_everything
group_permission.can_read = permission_to_everything
group_permission.can_update = permission_to_everything
group_permission.can_delete = permission_to_everything
group_permission.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_group_permission(g)\n\t\t\n\tend",
"def give_permissions_to_folders(group, permission_to_everything)\n Folder.find(:all).each do |folder|\n add_to_group_permissions(group, folder, permission_to_everything)\n end\n end",
"def chg_permission(groups, arg, mode)\n arg = UserGroup.one_user(arg) if arg.is_a?(User)\n if (mode == :add) &&\n groups.exclude?(arg)\n groups.push(arg)\n elsif (mode == :remove) &&\n groups.include?(arg)\n groups.delete(arg)\n end\n end",
"def create\n if request.post?\n @group = Group.new(params[:group])\n\n if @group.save\n # give the new group permissions to the folders\n give_permissions_to_folders(@group, params[:permission_to_everything][:checked] == 'yes' ? true : false)\n\n redirect_to :action => 'list'\n else\n render :action => 'new'\n end\n end\n end",
"def folder_permissions_groups_only\n @attributes[:folder_permissions_groups_only]\n end",
"def set_perms(data)\n permission = data[:permission] || 2 \n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def add_permission group, acl\n modify_permission(group, acl) { |perm|\n [perm.acl.to_s.split(\"\"), acl.split(\"\")].flatten.map(&:strip).\n uniq.sort.join\n }\n end",
"def update_group_permissions(folder_id_param, group_check_box_list, field, recursively)\r\n # iteratively update the GroupPermissions\r\n group_check_box_list.each do |group_id, can_do_it|\r\n # get the GroupPermissions\r\n group_permission = GroupPermission.find_by_group_id_and_folder_id(group_id, folder_id_param)\r\n\r\n # Do the actual update if the GroupPermission exists;\r\n # do not update the permissions of the admins group\r\n # (it should always be able to do everything)\r\n unless group_permission.blank? or group_permission.group.is_the_administrators_group?\r\n case field\r\n when 'create':\r\n group_permission.can_create = can_do_it\r\n when 'read':\r\n group_permission.can_read = can_do_it\r\n when 'update':\r\n group_permission.can_update = can_do_it\r\n when 'delete':\r\n group_permission.can_delete = can_do_it\r\n end\r\n group_permission.save\r\n end\r\n end\r\n\r\n # The recursive part...\r\n if recursively\r\n # Update the child folders\r\n folder = Folder.find_by_id(folder_id_param)\r\n if folder\r\n folder.children.each do |child_folder|\r\n update_group_permissions(child_folder.id, group_check_box_list, field, true)\r\n end\r\n end\r\n end\r\n end",
"def update_permissions\r\n if request.post? and @logged_in_user.is_admin?\r\n # update the create, read, update, delete right for this folder:\r\n update_group_permissions(folder_id, params[:create_check_box], 'create', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:read_check_box], 'read', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:update_check_box], 'update', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:delete_check_box], 'delete', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n end\r\n\r\n # Return to the folder\r\n redirect_to :action => 'list', :id => folder_id\r\n end",
"def copy_permissions_to_new_folder(folder)\r\n # get the 'parent' GroupPermissions\r\n GroupPermission.find_all_by_folder_id(folder_id).each do |parent_group_permissions|\r\n # create the new GroupPermissions\r\n group_permissions = GroupPermission.new\r\n group_permissions.folder = folder\r\n group_permissions.group = parent_group_permissions.group\r\n group_permissions.can_create = parent_group_permissions.can_create\r\n group_permissions.can_read = parent_group_permissions.can_read\r\n group_permissions.can_update = parent_group_permissions.can_update\r\n group_permissions.can_delete = parent_group_permissions.can_delete\r\n group_permissions.save\r\n end\r\n end",
"def modify_image_launch_perm_add_groups(image_id, user_group=['all'])\n modify_image_attribute(image_id, 'launchPermission', 'add', :user_group => user_group.to_a)\n end",
"def user_group(name, *permissions)\n return if permissions.empty?\n name = name.to_s\n ug = Lockdown::Configuration.find_or_create_user_group(name)\n\n permissions.each do |name|\n if (perm = Lockdown::Configuration.permission(name))\n ug.permissions << perm unless ug.permissions.include?(perm)\n end\n end\n\n Lockdown::Configuration.maybe_add_user_group(ug)\n end",
"def update\n @user_group = UserGroup.find_by_id(params[:id])\n permission_ids = params[\"permissions\"] || []\n permission_ids.map! {|p| p.to_i}\n current_permission_ids = @user_group.permission_ids\n group_name = params[\"user_group\"][\"name\"]\n\n existed_group = UserGroup.where(:name =>group_name)\n if existed_group.empty? || existed_group.first.id == params[:id].to_i\n if @user_group.update_attributes(params[\"user_group\"])\n\n # The update action make log saved or not\n is_logged = !@user_group.previous_changes.blank?\n if current_permission_ids != permission_ids\n @user_group.permission_ids = permission_ids\n\n # Create log if not logged before\n @user_group.create_activity :update, owner: current_user, params: {:detail => I18n.t('logs.update_group', group_name: @user_group.name)} if !is_logged\n end\n redirect_to organization_user_groups_path(params[:organization_id])\n end\n else\n flash[:error] = t('user_group.exist')\n redirect_to edit_organization_user_group_path(params[:organization_id],@user_group)\n end\n end",
"def add_group(key)\n key = key.to_sym\n if group_or_permission(key).nil?\n @groups[key] = PermissionGroup.new(@schema, self, key)\n else\n raise Error, \"Group or permission with key of #{key} already exists\"\n end\n end",
"def update_group_permissions \n if group_id.present?\n permissions = self.permissions\n # checking if user has permissions or not\n if permissions.present? && self.changed.include?('group_id')\n group_permissions = self.group.permissions\n if group_permissions.present? \n group_permissions.each do |p|\n if p.no_model_permission? \n permission = self.permissions.where(\"no_model_permission = ? AND subject_class = ? AND action = ?\",p.no_model_permission,p.subject_class,p.action).first_or_initialize \n else\n permission = self.permissions.where(\"no_model_permission = ? AND subject_class IS NULL AND action = ?\",p.no_model_permission,p.action).first_or_initialize \n end \n permission.actions_list = (permission.actions_list + p.actions_list).uniq \n permission.status = p.status\n permission.save\n end \n end\n else\n group_permissions = self.group.permissions\n if group_permissions.present?\n columns = (Permission.column_names) - [\"id\",\"resource_id\",\"resource_type\",'created_at','updated_at']\n # Creating all group permissions to user\n self.permissions.create( self.group.permissions.all(:select => columns.join(\",\") ).map(&:attributes) )\n end\n end\n end\n end",
"def may_not(*args)\n p = permissions.for(args.pop).first\n return Authorize::Permission::Mask[] unless p\n p.mask -= Authorize::Permission::Mask[*args].complete\n p.mask.empty? ? p.destroy : p.save\n p.mask.complete\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def can_manage_group?(project, group)\n group.is_child_of?(project)\n end",
"def may(*args)\n p = permissions.for(args.pop).find_or_initialize_by_role_id(id) # need a #find_or_initialize_by_already_specified_scope\n p.mask += Authorize::Permission::Mask[*args]\n p.save\n p.mask.complete\n end",
"def change_group!\n tgt_gid = self.target_group.is_a?(Fixnum) ? self.target_group : Etc.getgrnam(self.target_group).gid\n chown_params = [nil, tgt_gid, self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chown'))\n File.lchown *chown_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chown'))\n #DOcumenation for FileUtils.chown_R is wrong (at least for Ubuntu 8.1, takes ID as String.)\n chown_params[1] = chown_params[1].to_s\n FileUtils.chown_R *chown_params\n else\n File.chown *chown_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchown is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change group for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end",
"def apply_group_permissions(permission_types, ability = current_ability)\n groups = ability.user_groups\n return [] if groups.empty?\n permission_types.map do |type|\n field = solr_field_for(type, 'group')\n user_groups = type == 'read' ? groups - [::Ability.public_group_name, ::Ability.registered_group_name] : groups\n next if user_groups.empty?\n \"({!terms f=#{field}}#{user_groups.join(',')})\" # parens required to properly OR the clauses together.\n end\n end",
"def add_group_folder_member(folder_id:, group_id:, access_role: 'editor', custom_message: nil, trace: false)\n query_data = \"{\\\"shared_folder_id\\\":\\\"#{folder_id}\\\",\\\"members\\\":[{\\\"member\\\":{\\\".tag\\\":\\\"dropbox_id\\\",\\\"dropbox_id\\\":\\\"#{group_id}\\\"},\\\"access_level\\\":{\\\".tag\\\":\\\"#{access_role}\\\"}}],\\\"custom_message\\\":#{custom_message.nil? ? 'null' : \"\\\"#{custom_message}\\\"\"},\\\"quiet\\\":true}\"\n\n dropbox_query(query: '2/sharing/add_folder_member', query_data: query_data, trace: trace)\n end",
"def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end",
"def add_group_as_admin(group)\n add_group_as_member group\n promote_in_group group\n end",
"def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end",
"def set_user_group(name, *perms)\n user_groups[name] ||= []\n perms.each do |perm|\n if permission_assigned_automatically?(perm)\n raise Lockdown::InvalidPermissionAssignment, \"Permission is assigned automatically. Please remove it from #{name} user group\"\n end\n user_groups[name].push(perm)\n end\n end",
"def add_group(group, gid=nil)\n\t\t\tend",
"def add_group!( group )\n save if add_group( group )\n end",
"def grant_role_assignments_to_group_members_if_needed\n return unless entity.type == 'Group'\n\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n entity.members.each do |m|\n logger.info \"Granting role (#{role.id}, #{role.token}, #{role.application.name}) just granted to group (#{entity.id}/#{entity.name}) to its member (#{m.id}/#{m.name})\"\n ra = RoleAssignment.new\n ra.role_id = role.id\n ra.entity_id = m.id\n ra.parent_id = id\n ra.save!\n end\n end\n end"
]
| [
"0.7064186",
"0.70187306",
"0.6718033",
"0.66990846",
"0.66494733",
"0.6522002",
"0.6452796",
"0.6426728",
"0.6351635",
"0.6336575",
"0.59725577",
"0.59701014",
"0.5951281",
"0.594292",
"0.59112537",
"0.59099084",
"0.5904136",
"0.5890368",
"0.5828501",
"0.5821654",
"0.5812975",
"0.5812495",
"0.5804387",
"0.5787625",
"0.5776961",
"0.5766483",
"0.5744284",
"0.5733896",
"0.5722707",
"0.57210314"
]
| 0.76209146 | 0 |
The group called 'admins' can not be edited or deleted. By calling this method via a before_filter, you makes sure this doesn't happen. | def do_not_rename_or_destroy_admins_group
if @group and @group.is_the_administrators_group?
redirect_to :action => 'list' and return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prevent_zero_group_admins\n @membership = Membership.find(params[:id])\n @group = @membership.group\n if @group.has_one_admin? && (@membership.user == current_user)\n flash[:danger] = \"You cannot quit unless there are other group admins.\"\n redirect_to @group\n end\n end",
"def is_admin_in(group)\n unless group.admins.include? current_user\n flash[:danger] = \"Devi essere un amministratore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end",
"def require_admin_of_group\n if !admin_of(current_group)\n # TODO: add flash alert\n redirect_back fallback_location: current_group\n end\n end",
"def admin?\n super? or group_name == 'admin'\n end",
"def admin_user\n @group = Group.find(by_id)\n redirect_to @group unless @group.has_admin?(current_user)\n end",
"def authorization_required\n return true if admin?\n\n if [email protected]_edit?(logged_in_user)\n flash[:notice] = \"你沒有權限執行這個動作\"\n permission_denied\n @group = nil\n false\n end\n end",
"def group_admins\n group.blank? ? [] : group.has_admins\n end",
"def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end",
"def admin_of(group)\n current_user.is_admin?(group)\n end",
"def only_for_admins\n raise ActiveRecord::RecordNotFound unless current_user.has_role? :admin\n end",
"def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end",
"def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end",
"def admin?\n c_user = current_user\n not c_user.nil? and c_user.group==\"admin\"\n end",
"def group_required\n required_group = Group.find_or_create_by(:name => \"Admin\")\n unless current_user.groups.is_member?(required_group)\n flash[:error] = \"The function you wish to use is only available to admin users\"\n redirect_to root_path\n end\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def may_destroy_group?(group)\n\t\t\tmay_administrate?\n\t\tend",
"def admin_only\n false\n end",
"def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end",
"def admin_user\n @group = Membership.find(params[:id]).group\n redirect_to group_members_url(@group) unless @group.has_admin?(current_user)\n end",
"def is_admin?\n group_names.include?(ADMIN_GROUP_NAME)\n end",
"def group_admin? group\n g = group.groups_userss.detect{|i| i.user_id == session[:id]}\n g.is_admin unless g.nil?\n end",
"def group_admin?\n return false unless group\n\n group.admin?(user)\n end",
"def is_super_admin_in(group)\n unless group.super_admin == current_user\n flash[:danger] = \"Devi essere il fondatore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end",
"def must_be_admin!\n access_denied! unless current_admin?\n end",
"def is_admin?\n return self.belongs_to_group(ADMIN_FUNCTIONAL_GROUP)\n end",
"def can_edit\n producer.admin?(user) || group_admin?\n end",
"def admins_only\n if current_user.nil? or !current_user.is_admin?\n # Silently redirect, no need to tell anyone why. If they're\n # not an admin, they have no business here\n redirect_to root_path\n end\n end",
"def admin_user\n render_forbidden unless current_user.admin?\n end"
]
| [
"0.7619519",
"0.7419459",
"0.73993146",
"0.7336209",
"0.72050196",
"0.716738",
"0.71550626",
"0.71160245",
"0.7100673",
"0.707253",
"0.6985762",
"0.6985762",
"0.6983571",
"0.6955274",
"0.6932021",
"0.6932021",
"0.6932021",
"0.6890417",
"0.6867892",
"0.68626344",
"0.6836359",
"0.68319255",
"0.6826539",
"0.6824577",
"0.68130565",
"0.6812699",
"0.67942727",
"0.67908466",
"0.6787495",
"0.67317057"
]
| 0.8197735 | 0 |
Check if a group exists before executing an action. If it doesn't exist: redirect to 'list' and show an error message | def does_group_exist
@group = Group.find(params[:id])
rescue
flash.now[:group_error] = 'Someone else deleted the group. Your action was cancelled.'
redirect_to :action => 'list' and return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_group_exists\n if (Group.where(group_params).count != 0)\n redirect_to Group.where(group_params).first\n end\n end",
"def require_member_of_group\n if !member_of(current_group)\n # TODO: Add flash alert\n redirect_back fallback_location: home_path\n end\n end",
"def show\n @group = Group.find(params[:id])\n redirect_to groups_path, :flash => {:warning => \"Permission Denied\"}\\\n unless current_power.group? @group\n end",
"def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n group_name_exists = false\n current_user.owned_groups.each do |g|\n if g.name == @group.name\n group_name_exists = true\n break\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to groups_path, :alert => \"You already have a list by the name '#{@group.name}'.\" }\n format.json { render :json => @group, :status => :created, :location => @group }\n elsif @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n error_msg = 'Unexpected error while creating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to groups_path, :action => 'index', :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def load_group\n \n @group = nil\n \n if params.has_key?(:group_id)\n @group = Group.find_by_id(params[:group_id])\n elsif params.has_key?(:id)\n @group = Group.find_by_id(params[:id])\n end\n \n if @group.blank?\n respond_to do |format|\n format.js { render 'layouts/redirect' }\n format.html { render file: 'public/404', format: :html, status: 404 }\n end\n return false\n end\n \n return true\n \n end",
"def filter_group\n group_key = params[:group]\n @group = Group.find_by_identifier(group_key)\n if not @group\n redirect_to( :action => 'index', :group => Group.root.identifier )\n return false\n end\n \n @target = @group\n end",
"def view\n if params[:group][:id] == \"\"\n flash[:alert] = \"First select your class.\"\n redirect_to (:back)\n else \n redirect_to group_path(params[:group][:id])\n end\n end",
"def correct_group\n @group = Group.find(params[:id])\n redirect_to(root_url) unless @group == current_group\n end",
"def destroy\n begin\n if Group.size > 1\n @group.destroy\n redirect_to(list_groups_path(:page => params[:page]), :notice => t(\"group.destroyed\"))\n else\n redirect_to(list_groups_path(:page => params[:page]), :notice => t(\"group.last_one\"))\n end\n rescue\n redirect_to(list_groups_path(:page => params[:page]), :error => t(\"group.not_destroyed\"))\n end\n end",
"def group_entry\n unless @user.eql?('cchdo_admin')\n redirect_to :controller => '/staff', :action => 'index'\n end\n @groups = CruiseGroup.all\n render :partial => \"group_entry\"\n end",
"def show\n if user_signed_in?\n @membership.touch #last_attended_at\n template= 'show'\n else\n @group = Group.publicly_searchable.find( params[:id] )\n template= 'public_show'\n end\n respond_to do |format|\n format.html { render template: \"groups/#{template}\" }\n format.json { render json: @group }\n end\n\n rescue ActiveRecord::RecordNotFound\n redirect_to user_signed_in? ? groups_url : new_user_session_url\n end",
"def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"User Not In Group\", 404) and return \\\n unless @group\n end",
"def check_membership\n unless @group.includes_user?(current_user)\n respond_to do |format|\n flash.alert = \"Forbidden: must be a member.\"\n format.js { render js: \"window.location.href = '#{groups_url}'\" }\n format.html { redirect_to groups_url }\n end\n end\n end",
"def show\n redirect_to '/s_groups'\n end",
"def group_required\n required_group = Group.find_or_create_by(:name => \"Admin\")\n unless current_user.groups.is_member?(required_group)\n flash[:error] = \"The function you wish to use is only available to admin users\"\n redirect_to root_path\n end\n end",
"def require_admin_of_group\n if !admin_of(current_group)\n # TODO: add flash alert\n redirect_back fallback_location: current_group\n end\n end",
"def isUserMemberOfGroup \n redirect_to groups_path unless !GroupMember.userIsAlreadyInGroup(params[:group_id], current_user.id)\n end",
"def show\n @group = GROUP.first_or_get!(params[:id])\n\n # restrict the groups to the groups of the current user\n # unless the current user is allowed to create groups\n # and need to see all\n unless allowed(:create)\n allowed_groups = current_user.groups\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def require_request_group\n group = Group.find(params[:group])\n raise ActiveRecord::RecordNotFound unless group\n @request_group = group\n rescue LdapMixin::LdapException\n raise ActiveRecord::RecordNotFound\n end",
"def show\n @group = Group.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n end",
"def show\n @billboards = []\n Billboard.all.each {|a| @billboards << a if a.active }\n @group = Group.find(params[:id])\n\n message = \"You do not have access to the working group <strong>'#{@group.name}'</strong> at this time. If you are interested in joining this group, please let us know.\"\n authorize! :read, @group, :message => message.html_safe\n\n unless @group.overview_page.nil?\n redirect_to Page.find(@group.overview_page)\n else \n redirect_to group_posts_path(@group)\n end\n end",
"def do_not_rename_or_destroy_admins_group\n if @group and @group.is_the_administrators_group?\n redirect_to :action => 'list' and return false\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n if @group.users.length>0\n # format.html { redirect_to @group, notice: 'Group can not be deleted.' }\n render json: \"Group already contains users\", status: 412 \n else\n if @group.destroy\n # format.html { redirect_to groups_url }\n render 'show'\n else\n render json: \"Error\", status: 422 \n end\n end\n end",
"def complete\n group = Group.find_by_uid(params[:group_id])\n\n unless group\n redirect_to app_access_unauthorized_path\n return\n end\n\n # Prepare and return response\n respond_with_identity(current_user,group)\n end",
"def index\n @groups = current_user.groups.active\n render 'groups/welcome' if @groups.blank?\n end",
"def update\n @group = Group.find(params[:id])\n\n if @group.owner != current_user\n respond_to do |format|\n format.html { redirect_to @group, notice: 'User not authorized.' }\n format.json { render json: @group, status: :not_authorized, location: group }\n end\n return\n end\n\n new_group_name = params[:group][:name]\n group_name_exists = false\n\n if new_group_name != @group.name\n current_user.owned_groups.each do |g|\n if g.name == new_group_name\n group_name_exists = true\n end\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to @group, :alert => \"You already have a group by the name '#{new_group_name}'.\" }\n format.json { head :no_content }\n elsif new_group_name == @group.name\n format.html { redirect_to @group }\n format.json { head :no_content }\n elsif @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n error_msg = 'Unexpected error while updating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to @group, :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t #this won't work - it won't find children groups\n\t @group = Group.find_by_id(params[:id])\n\t @group = nil unless current_user.can_access_group?(@group)\n respond_to do |format|\n if @group\n format.html # show.html.erb\n format.xml { render :xml => @group }\n else\n flash[:notice] = 'Group invalid or you do not have access to this group.'\n format.html { redirect_to groups_path}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def exists?(group)\n url = build_url(group)\n rest_head(url) and true\n rescue Azure::Armrest::NotFoundException\n false\n end",
"def is_admin_in(group)\n unless group.admins.include? current_user\n flash[:danger] = \"Devi essere un amministratore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end",
"def show\n save_navi_state(['groups_title', 'browse_groups'])\n begin\n @group = Group.find(params[:id])\n @members = @group.members(session[:cookie]).paginate :page => params[:page], :per_page => per_page\n rescue RestClient::ResourceNotFound => e\n flash[:error] = :group_not_found\n redirect_to groups_path\n rescue ActiveRecord::RecordNotFound => e\n flash[:error] = :group_not_found\n redirect_to groups_path\n end\n end"
]
| [
"0.82312167",
"0.72790205",
"0.6956808",
"0.69134754",
"0.6887473",
"0.6844776",
"0.68217444",
"0.6724733",
"0.6607002",
"0.65707684",
"0.65427035",
"0.6513769",
"0.65013766",
"0.648523",
"0.64541197",
"0.6423775",
"0.64009565",
"0.6399634",
"0.63661057",
"0.6362678",
"0.6353682",
"0.63271445",
"0.6323592",
"0.63132906",
"0.6310986",
"0.63037",
"0.6285099",
"0.6271615",
"0.62539804",
"0.6247446"
]
| 0.78789526 | 1 |
Given a "square" array of subarrays, find the sum of values from the first value of the first array, the second value of the second array, the third value of the third array, and so on... Example 1: exampleArray = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] diagonalSum(exampleArray) => 4 Example 2: exampleArray = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]] diagonalSum(exampleArray) => 5 | def diagonalSum(matrix)
total = 0
(0...matrix.length).each {|sub| total += matrix[sub][sub]}
return total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def two_d_sum(array)\n sum = 0 \n array.each do |sub_array|\n sub_array.each do |num|\n sum += num \n end\n end\n\n sum\nend",
"def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def multi_dimensional_sum(array)\n array.flatten! #convert 2d array into 1d array [[4,3,1][8,1][2]] -> [4,3,1,8,1,2]\n sum = 0\n i = 0\n while i < array.length\n sum+=array[i] #add and store array numbers into sum\n i+=1\n end\n return sum\nend",
"def two_d_sum(arr)\n total = 0\n\n arr.each do |sub_array|\n sub_array.each do |num|\n total += num\n end\n end\n\n return total\nend",
"def multi_dimensional_sum(array)\n \n sum = 0\n\n # Make the array one dimensional, loop over the elements and add each of\n # them together into a counter.\n array.flatten.each do |num| \n sum += num\n end \n\n # Implicit return.\n sum\nend",
"def diagonalSum(matrix)\n sum = 0\n\n matrix.each_with_index do |current_arr, idx|\n sum += current_arr[idx]\n end\n\n sum\nend",
"def multi_dimensional_sum(arr)\n return arr.flatten.sum\nend",
"def multi_dimensional_sum(arr)\n arr.flatten.sum\nend",
"def diagonalSum(matrix)\n (0...matrix.size).map { |i| matrix[i][i] }.reduce(&:+)\nend",
"def two_d_sum(arr)\ntotal = 0\n\narr.each do |sub_array|\n sub_array.each do |num|\n total += num\n end\nend\n\nreturn total\nend",
"def two_d_sum(arr)\n\ttotal = 0\n\n\t# 1st Level: Looking at each element (these are also arrays)\n\tarr.each do |sub_arr|\n\t\t# 2nd Level: Looking at each elements of these arrays\n\t\tsub_arr.each do |ele|\n\t\t\t# add each element to the total\n\t\t\ttotal += ele\n\t\tend\n\tend\n\n\treturn total\nend",
"def sum_of_sums(array)\n sum = 0\n array.length.times do |index|\n sum += array[0, index + 1].reduce(&:+)\n end\n sum\nend",
"def sum_of_sums(array)\n elements = 1\n sums = 0 \n \n array.each_with_index do |element, index| \n counter = 0\n inner_sum = 0\n (index + 1).times do\n inner_sum += array[counter]\n counter += 1\n end\n\n sums += inner_sum\n end\n\n sums\nend",
"def two_d_sum(arr)\r\n totalSum = 0\r\n arr.each do |ele|\r\n partialSum = 0\r\n ele.each do |num|\r\n partialSum += num\r\n end\r\n totalSum += partialSum\r\n end\r\n return totalSum\r\nend",
"def sum_of_sums(array)\n sums = []\n index = 0\n loop do\n (0..index).each {|index| sums << array[index]}\n index += 1\n break if index == array.size\n end\n sums.reduce(:+)\nend",
"def multi_dimensional_sum(array)\n array.flatten\nend",
"def diags_sum_array(matrix)\n sum = []\n length = matrix.column(0).count\n \n d = matrix\n i = length\n while i > 0 do\n # multiply the values of the diagonal\n sum << d.each(:diagonal).inject(:*)\n d = d.first_minor(0,(i-1))\n i -= 1\n end\n \n # get the upper diagonals\n trans = matrix.transpose\n y = length - 1\n while y > 0 do\n # multiply the values of the diagonal\n trans = trans.first_minor(0,(y))\n sum << trans.each(:diagonal).inject(:*)\n y -= 1\n end\n \n return sum\n \n end",
"def sum_of_sums(array)\n result = 0\n array.each_index {|idx| result += array[0..idx].sum}\n result\nend",
"def sum_of_sums(arr)\n sum = 0\n index = arr.length\n while index >= 0\n sum += arr[0, index].sum\n index -= 1\n end\n sum\nend",
"def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend",
"def zero_sum_sub_arrays(xs)\n return 0 if xs.size < 2\n\n (2..xs.size)\n .flat_map { |n| xs.each_cons(n).to_a }\n .select { |xs| xs.sum == 0 }\n .size\nend",
"def sum_of_sums(array)\r\nend",
"def sum_array_of_arrays(some_array) \n big_sum = 0 \n \n some_array.each do |x|\n big_sum = big_sum + sum_array(x)\n end\n \n big_sum\n \n end",
"def sum_of_sums(array)\n total = 0\n loop do\n break if array.size == 0\n total += array.flatten.sum\n array.pop\n end\n total\nend",
"def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n elements = 1\n while elements - 1 < arr.size\n total_sum += arr.slice(idx, elements).reduce(:+)\n elements += 1\n end\n total_sum\nend",
"def sum_of_sums(array)\n current_sum = 0\n counter = 0\n loop do\n current_sum += array[0..counter].sum\n counter +=1\n break if counter == array.size\n end\n current_sum\nend",
"def sumAllArray(adjacency, index, central)\n\t\tvalue = 0\n\t\ti = 0\n\n\t\tadjacency.each do |e|\n\t\t\tif i == central\n\t\t\t\ti+=1\n\t\t\tend\n\n\t\t\tif @solutions[index+1][i].nil?\n\t\t\t\tvalue += (e*@solutions[index][i])\n\t\t\telse\n\t\t\t\tvalue += (e*@solutions[index+1][i])\n\t\t\tend\n\n\t\t\ti+=1\n\t\tend\n\n\t\treturn value\n\tend",
"def sum_of_sums(arr)\n sum = 0\n arr.each_with_index { |elem, i| sum += (arr.size - i) * elem }\n sum\nend"
]
| [
"0.7323168",
"0.7081612",
"0.70787966",
"0.70787966",
"0.7062459",
"0.7032922",
"0.6994547",
"0.6981598",
"0.69581056",
"0.69496137",
"0.688263",
"0.6870832",
"0.68320256",
"0.6738789",
"0.67178303",
"0.67083365",
"0.6698856",
"0.66214037",
"0.6598974",
"0.65600705",
"0.65573025",
"0.6554536",
"0.6520551",
"0.64712",
"0.6438128",
"0.64318717",
"0.6402062",
"0.6386585",
"0.6382942",
"0.6379958"
]
| 0.7112105 | 1 |
DELETE /test_bookings/1 DELETE /test_bookings/1.xml | def destroy
@test_booking = TestBooking.find(params[:id])
@test_booking.destroy
respond_to do |format|
format.html { redirect_to(test_bookings_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end",
"def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete_bookings()\n sql = \"DELETE FROM bookings\n WHERE bookings.member_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @guest_book = GuestBook.find(params[:id])\n @guest_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(guest_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @addbook = Addbook.find(params[:id])\n @addbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(addbooks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking = @room.bookings.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @house_book = HouseBook.find(params[:id])\n @house_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(house_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_book.destroy\n\n head :no_content\n end",
"def destroy\n @loanbook = Loanbook.find(params[:id])\n @loanbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(loanbooks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = UhaBook.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(uha_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testing = Testing.find(params[:id])\n @testing.destroy\n\n respond_to do |format|\n format.html { redirect_to(testings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end"
]
| [
"0.6633766",
"0.6633766",
"0.65779567",
"0.6555827",
"0.65358436",
"0.6470717",
"0.64569455",
"0.63899976",
"0.63726103",
"0.63538194",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6320892",
"0.63177156",
"0.63156176",
"0.6315317",
"0.62793726",
"0.62432146",
"0.62007385",
"0.6172852",
"0.61692065",
"0.6152539"
]
| 0.70728403 | 0 |
GET /company_types GET /company_types.json | def index
@company_types = CompanyType.all
render json: @company_types
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: @company_type\n end",
"def index\n @type_companies = TypeCompany.all\n end",
"def type\n fetch('company.type')\n end",
"def index\n @admin_company_types = Admin::CompanyType.all\n end",
"def byState\n @company_types = CompanyType.where(\"state_id = ?\", company_type_params[:state_id])\n\n render json: @company_types\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def index\n @catalog_contract_types = Catalog::ContractType.all\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def index\n @client_types = ClientType.all\n end",
"def index\n @contract_types = ContractType.all\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def index\n @entity_types = EntityType.all\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end"
]
| [
"0.72950727",
"0.7109263",
"0.70026845",
"0.6909386",
"0.66707665",
"0.65155303",
"0.6488321",
"0.6471277",
"0.6434962",
"0.6343553",
"0.6329315",
"0.6266198",
"0.626582",
"0.6236602",
"0.61953914",
"0.61433315",
"0.6132888",
"0.6130129",
"0.6122113",
"0.61215746",
"0.61131275",
"0.61124533",
"0.61124533",
"0.61124533",
"0.61124533",
"0.61115664",
"0.61047375",
"0.61029613",
"0.60794634",
"0.6079244"
]
| 0.78606737 | 0 |
GET /company_types/byState/1 GET /company_types/byState/1.json | def byState
@company_types = CompanyType.where("state_id = ?", company_type_params[:state_id])
render json: @company_types
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def byState\n @companies = Company.where(\"state_id = ?\", company_params[:state_id])\n\n render json: @companies\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def show\n render json: @company_type\n end",
"def index\n @type_companies = TypeCompany.all\n end",
"def by_state\n \tdata = City.where('state_id = ?', params[:state_id]).order(:name)\n \trespond_to do |format|\n \t\tformat.json {render :json => data, :status => 200}\n \tend\n end",
"def type\n fetch('company.type')\n end",
"def index\n @state_types = StateType.all\n end",
"def index\n @counties = Entity.where(entity_type: 'County').order(:entity_name)\n respond_with(@counties)\n end",
"def index\n @admin_company_types = Admin::CompanyType.all\n end",
"def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def index\n @typeofstatuses = Typeofstatus.all.page params[:page]\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n @q = ContactType.page(params[:page]).search(params[:q])\n @contact_types = @q.result(distinct: true)\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def show\n \n @states = State.find(:all)\n @state = State.find(params[:id], :include => [ { :offices => :office_type }, {:offices => :incumbents }])\n @us_senator_offices = []\n @us_rep_offices = []\n @state_senator_offices = []\n @state_rep_offices = []\n @state.offices.each do |o|\n case o.office_type.ukey\n when 'US_SENATOR'\n @us_senator_offices.push(o)\n when 'US_REP'\n @us_rep_offices.push(o)\n when 'HOUSE_DELEGATE'\n @us_rep_offices.push(o)\n when 'STATE_SENATOR'\n @state_senator_offices.push(o)\n when 'STATE_REP'\n @state_rep_offices.push(o)\n end\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state }\n end\n end",
"def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def show\n @business_type = BusinessType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business_type }\n end\n end",
"def index\n @contract_types = ContractType.all\n end",
"def cities_in_state\n cities = State.find(params[:id]).cities.order(name: :asc)\n\n render json: cities.to_json(), status: :ok\n end",
"def index\n @state = State.find(params[:state_id])\n @cities = City.where(:state_id => params[:state_id]).paginate(:page => params[:page], :per_page => 10, :order => 'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cities }\n end\n end",
"def index\n @q = ClientType.order(name: :asc).ransack(params[:q])\n @client_types = @q.result.page(params[:page]).per(10)\n end"
]
| [
"0.7681558",
"0.70722884",
"0.66862345",
"0.657447",
"0.650979",
"0.6132571",
"0.61007315",
"0.6017717",
"0.5965307",
"0.59387076",
"0.5898496",
"0.58936423",
"0.58797354",
"0.5841357",
"0.5807216",
"0.5777385",
"0.5771038",
"0.57659376",
"0.57552516",
"0.5754214",
"0.5742081",
"0.57273483",
"0.5723948",
"0.57121193",
"0.56998026",
"0.56854093",
"0.56845087",
"0.56704986",
"0.56654584",
"0.5661807"
]
| 0.8612504 | 0 |
GET /company_types/1 GET /company_types/1.json | def show
render json: @company_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def index\n @type_companies = TypeCompany.all\n end",
"def type\n fetch('company.type')\n end",
"def index\n @admin_company_types = Admin::CompanyType.all\n end",
"def set_type_company\n @type_company = TypeCompany.find(params[:id])\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def byState\n @company_types = CompanyType.where(\"state_id = ?\", company_type_params[:state_id])\n\n render json: @company_types\n end",
"def show\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contractor_type }\n end\n end",
"def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def show\n render json: @company\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end"
]
| [
"0.77569324",
"0.719821",
"0.7186441",
"0.6849857",
"0.66516054",
"0.6590242",
"0.6520687",
"0.64819556",
"0.6416951",
"0.6383246",
"0.63786995",
"0.63211143",
"0.62555534",
"0.6238684",
"0.6238684",
"0.6238684",
"0.6238684",
"0.6237996",
"0.6227353",
"0.6204575",
"0.6188086",
"0.61770976",
"0.61394453",
"0.61281407",
"0.61210424",
"0.61210424",
"0.61210424",
"0.61210424",
"0.61210424",
"0.61210424"
]
| 0.75830656 | 1 |
POST /company_types POST /company_types.json | def create
@company_type = CompanyType.new(company_type_params)
if @company_type.save
render json: @company_type, status: :created, location: @company_type
else
render json: @company_type.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @type_company = TypeCompany.new(type_company_params)\n\n respond_to do |format|\n if @type_company.save\n format.html { redirect_to @type_company, notice: 'Type company was successfully created.' }\n format.json { render :show, status: :created, location: @type_company }\n else\n format.html { render :new }\n format.json { render json: @type_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_company_type = Admin::CompanyType.new(admin_company_type_params)\n\n respond_to do |format|\n if @admin_company_type.save\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_company_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_company_params\n params.require(:type_company).permit(:name)\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def create\n \n @company = current_profile.companies.build(company_params)\n\n @company.companytype_id = params[:company_id]\n\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_type_company\n @type_company = TypeCompany.find(params[:id])\n end",
"def client_type_params\n params.require(:client_type).permit(:name, :description, :company_id, :branch_id)\n end",
"def company_type_params\n params.require(:company_type).permit(:is_confirm,:name,:code,:description)\n end",
"def create\n @company = Company.new(company_params)\n @company.tipo = '01'\n if @company.save \n render json: { status: :created }\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def create\n @tyc_company = Tyc::Company.new(tyc_company_params)\n\n respond_to do |format|\n if @tyc_company.save\n format.html { redirect_to @tyc_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @tyc_company }\n else\n format.html { render :new }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end",
"def create\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.new(params[:entity_type])\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'Type was successfully created.' }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Company.create(params[\"company\"])\n end",
"def show\n render json: @company_type\n end",
"def index\n @type_companies = TypeCompany.all\n end",
"def create_types\n\t[Domain]\nend",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @admin_company_types = Admin::CompanyType.all\n end",
"def create\n @entity_type = EntityType.new(entity_type_params)\n @entity_type.collection_id = @collection.id\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_type\n write_attribute(:type, Contact::Type::COMPANY)\n end",
"def type\n fetch('company.type')\n end",
"def create\n @company = Company.new(company_params[:company])\n @companyAuthority = @company.company_authority.new(company_params[:company_authority])\n\n if (!company_params[:lobs].blank?)\n company_params[:lobs].each do |lob|\n @companyAuthority.lob.new(lob)\n end\n end\n\n if @company.save\n render json: @company, status: :created, location: @company\n else\n render json: ErrorSerializer.serialize(@company.errors), status: :unprocessable_entity\n end\n end",
"def create\n exit_if_not_manager and return\n @relation_type = RelationType.new(relation_type_params)\n if params[:relation_type][:entity_type].present?\n @relation_type.entity_type = params[:relation_type][:entity_type].select{|a| a.present? }.join(\",\")\n end\n @relation_type.project_id = @project.id\n respond_to do |format|\n if @relation_type.save\n format.html { redirect_to project_relation_types_path(@project), notice: 'Relation type was successfully created.' }\n format.json { render :show, status: :created, location: @relation_type }\n else\n format.html { render :new }\n format.json { render json: @relation_type.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.6962814",
"0.680279",
"0.66868913",
"0.66208154",
"0.6563562",
"0.63400257",
"0.6174167",
"0.61677396",
"0.6143639",
"0.611549",
"0.6110198",
"0.60799456",
"0.6071588",
"0.6069727",
"0.6054",
"0.6036068",
"0.6017305",
"0.5914957",
"0.5914957",
"0.5900653",
"0.5900653",
"0.58896583",
"0.58611226",
"0.5855926",
"0.5852928",
"0.58270913",
"0.5785234",
"0.5766675",
"0.5759902",
"0.5752472"
]
| 0.74006945 | 0 |
PATCH/PUT /company_types/1 PATCH/PUT /company_types/1.json | def update
@company_type = CompanyType.find(params[:id])
if @company_type.update(company_type_params)
head :no_content
else
render json: @company_type.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_company_type.update(admin_company_type_params)\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_company.update(type_company_params)\n format.html { redirect_to @type_company, notice: 'Type company was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_company }\n else\n format.html { render :edit }\n format.json { render json: @type_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @tyc_company.update(tyc_company_params)\n format.html { redirect_to @tyc_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @tyc_company }\n else\n format.html { render :edit }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def update\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n if @contractor_type.update_attributes(params[:contractor_type])\n format.html { redirect_to @contractor_type, notice: 'Contractor type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_type_company\n @type_company = TypeCompany.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :show, status: :ok, location: @company }\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_company.update(company_params)\n format.html {redirect_to @client_company, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @client_company}\n else\n format.html {render :edit}\n format.json {render json: @client_company.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @opportunity_type = OpportunityType.find(params[:id])\n\n respond_to do |format|\n if @opportunity_type.update_attributes(params[:opportunity_type])\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to companies_url, notice: @company.name + ' was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @share_type.company = current_company\n respond_to do |format|\n if @share_type.update(share_type_params)\n format.html { redirect_to @share_type, notice: t('share_type.updated') }\n format.json { render :show, status: :ok, location: @share_type }\n else\n format.html { render :edit }\n format.json { render json: @share_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end",
"def update\n @contract_type = ContractType.find(params[:id])\n\n respond_to do |format|\n if @contract_type.update_attributes(params[:contract_type])\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # authorize @company\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to admin_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html {\n redirect_to @company, notice: 'Company was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.7487825",
"0.72119653",
"0.71939164",
"0.66199285",
"0.6487162",
"0.63711363",
"0.63375306",
"0.6316484",
"0.629656",
"0.628524",
"0.62073284",
"0.6207322",
"0.6205282",
"0.6205282",
"0.6192688",
"0.61853135",
"0.6184857",
"0.6184724",
"0.61748064",
"0.61711967",
"0.6154625",
"0.6153892",
"0.6153892",
"0.6153892",
"0.6153892",
"0.6153892",
"0.6153892",
"0.61408985",
"0.61396444",
"0.61396444"
]
| 0.7569093 | 0 |
DELETE /company_types/1 DELETE /company_types/1.json | def destroy
@company_type.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @admin_company_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_company.destroy\n respond_to do |format|\n format.html { redirect_to type_companies_url, notice: 'Type company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @contractor_type = ContractorType.find(params[:id])\n @contractor_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contractor_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_type = ContractType.find(params[:id])\n @contract_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rail_company.destroy\n respond_to do |format|\n format.html { redirect_to rail_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tyc_company.destroy\n respond_to do |format|\n format.html { redirect_to tyc_companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\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 @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n @admin_company_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_company_details_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_type = BusinessType.find(params[:id])\n @business_type.destroy\n\n respond_to do |format|\n format.html { redirect_to business_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @global_company = GlobalCompany.find(params[:id])\n @global_company.destroy\n\n respond_to do |format|\n format.html { redirect_to global_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crunch_company = CrunchCompany.find(params[:id])\n @crunch_company.destroy\n\n respond_to do |format|\n format.html { redirect_to crunch_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_type.destroy\n respond_to do |format|\n format.html { redirect_to contact_types_url }\n format.json { head :no_content }\n end\n end"
]
| [
"0.7776477",
"0.77046293",
"0.75599265",
"0.7225775",
"0.71949357",
"0.7111012",
"0.70134944",
"0.69842565",
"0.6972056",
"0.69720095",
"0.6943254",
"0.691763",
"0.691763",
"0.691763",
"0.687737",
"0.6860584",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6847305",
"0.6844622",
"0.683493",
"0.6813855"
]
| 0.78043586 | 0 |
GET /gltf_models GET /gltf_models.json | def index
@gltf_models = GltfModel.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def models(make, year, category)\n make_id = get_object_id make\n category_id = get_object_id category\n response = get_url \"Models/#{make_id}/#{year}/#{category_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetModelsResult\"].map{|r| Models::Model.from_response_hash(r)}\n end",
"def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end",
"def get_models\n relatable_category_id = params[:car_calculator][:fuel_type]\n relatable_category_ids = params[:car_calculator][:relatable_category_ids]\n result = CarApp.calculated_session.related_categories_from_relatable_category(relatable_category_id, \"model\", :relatable_category_ids => relatable_category_ids) \n final_result = []\n result = (result || []).each_pair do |key, value| \n final_result << {:name => value, :value => key}\n end\n render :json => {:options => final_result}.to_json\n end",
"def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_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::AutoML::V1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def find_bridge_models(params={}, headers=default_headers)\n @logger.info(\"Find Bridge models.\")\n get(\"#{@api_url}/models\", params, headers)\n end",
"def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_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::AutoML::V1beta1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end",
"def list_models dataset_id, max: nil, token: nil\n options = { skip_deserialization: true }\n # The list operation is considered idempotent\n execute backoff: true do\n json_txt = service.list_models @project, dataset_id, max_results: max, page_token: token, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end",
"def index\n\t @models = @model.get_many\n\t respond_to do |format|\n\t format.json do \n\t render json: @models.to_json\n\t end\n\t format.html do \n\t \trender :index\n\t end\n\t end\n\tend",
"def index\n @entities = Entity.find(:all, :limit=>100)\n EntitiesHelper.setModelGraph(\"public/UMLmodel.png\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end",
"def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end",
"def get_models(app_name)\n index = @apps.index(app_name)\n models = @apps[index].models\n end",
"def index\n @models = Model.all\n end",
"def index\n @models = Model.all\n end",
"def set_gltf_model\n if params[:id] != 'scene'\n @gltf_model = GltfModel.find(params[:id])\n end\n end",
"def index\n @models = ClientService.all\n end",
"def get_model_files(options); end",
"def list_models\n\[email protected] do |model|\n\t\tputs \"#{@models.index(model)}: #{model}\"\n\tend\nend",
"def models\n @models ||= []\n end",
"def index\n @linear_models = LinearModel.all\n end",
"def index\n @models = Model.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @models }\n end\n end",
"def index\n @trainmodels = Trainmodel.all\n end",
"def models\r\n\r\n end",
"def models\n @models ||= {}\n end",
"def show\n @model = Model.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model.to_json(\n :only =>[],\n :methods => [:dg_model_id, :model_make_id, :model_number, :model_description, :model_active, :dg_last_update])}\n end\n end",
"def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def model_classes\n @opts[:models]\n end",
"def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end",
"def index\n models = Model.all.to_json(:include => {:model_types => {:only => [:name], :methods => [:total_price]}}, :only => [:name]) \n respond_to do |format|\n format.json { render json: {models: JSON.parse(models)} , location: @model_type }\n end\n end"
]
| [
"0.6366516",
"0.6159299",
"0.6093915",
"0.60801965",
"0.60612905",
"0.6038504",
"0.6016536",
"0.5965578",
"0.5925854",
"0.59045404",
"0.5847773",
"0.58083856",
"0.580603",
"0.58016175",
"0.58016175",
"0.57885665",
"0.5757472",
"0.57548827",
"0.5749606",
"0.5745169",
"0.5740001",
"0.5732251",
"0.5700813",
"0.5697219",
"0.5675642",
"0.5628487",
"0.55803025",
"0.5570888",
"0.55567104",
"0.5551661"
]
| 0.7086729 | 0 |
POST /gltf_models POST /gltf_models.json | def create
@gltf_model = GltfModel.new(gltf_model_params)
respond_to do |format|
if @gltf_model.save
format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully created.' }
format.json { render :show, status: :created, location: @gltf_model }
else
format.html { render :new }
format.json { render json: @gltf_model.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'emotion_prediction_id'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :headers => {'Content-Type' => 'application/json'},\n :body_object => training\n )\n\n assemble_json_body(result)\n end",
"def gltf_model_params\n params.require(:gltf_model).permit(:global_path, :bin_global_path, :textures_directory_global_path)\n end",
"def add_bridge_model(body={}, headers=default_headers)\n @logger.info(\"Adding the \\\"#{body['name']}\\\" Bridge Model and Mappings.\")\n post(\"#{@api_url}/models\", body, headers)\n end",
"def model_params\n params.require(:model).permit(:id, :name, :dataset, :snippet, :image, :description, :accuracy, :algorithm, :organization, :size, :api_key, :endpoint,\n inputs_attributes: [:id, :name, :kind, :order, :_destroy],\n outputs_attributes: [:id, :name, :kind, :order, :default_value, :_destroy])\n end",
"def create\n @feature_model = FeatureModel.new(params[:feature_model])\n\n respond_to do |format|\n if @feature_model.save\n format.html { redirect_to @feature_model, :notice => 'Feature model was successfully created.' }\n format.json { render :json => @feature_model, :status => :created, :location => @feature_model }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @feature_model.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @model = @project.models.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'The model was successfully created.' }\n format.json { render :show, status: :created, location: @model }\n else\n format.html { render :new }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end",
"def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end",
"def linear_model_params\n params.require(:linear_model).permit(:class1, :class2, :model)\n end",
"def set_gltf_model\n if params[:id] != 'scene'\n @gltf_model = GltfModel.find(params[:id])\n end\n end",
"def create\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @operation = Operation.new(params[:operation])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.save\n if @model\n @operation.dependent.models << @model\n format.html { redirect_to user_model_path(@model.user, @model), notice: 'Operation was successfully created.' }\n else\n format.html { redirect_to root_path, notice: 'Operation was successfully created.' }\n end \n else\n format.html { render action: \"new\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trainmodel = Trainmodel.new(trainmodel_params)\n\n respond_to do |format|\n if @trainmodel.save\n format.html { redirect_to @trainmodel, notice: 'Trainmodel was successfully created.' }\n format.json { render :show, status: :created, location: @trainmodel }\n else\n format.html { render :new }\n format.json { render json: @trainmodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @gltf_models = GltfModel.all\n end",
"def create \n render json: Tuning.create(tuning_params)\n end",
"def generate_model\n\t\tclasses = CartesianClassifier.get_classes(Sample.find_all_by_classname(params[:classnames].split(',')))\n\t\tclassmodel = ClassModel.new({\n\t\t\t:classnames => params[:classnames], # split and join again for validation?\n\t\t\t:modelstring => ActiveSupport::JSON.encode(classes),\n\t\t\t:author => params[:author],\n\t\t\t:notes => params[:notes]\n\t\t})\n\t\tclassmodel.save\n\t\tredirect_to \"/\"\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def trainmodel_params\n params.require(:trainmodel).permit(:modid, :moddesc, :modname, :trainfile, :testfile, :addtnl, :modcheck)\n end",
"def test_send_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_send_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def create\n @linear_model = LinearModel.new(linear_model_params)\n\n respond_to do |format|\n if @linear_model.save\n format.html { redirect_to @linear_model, notice: 'Linear model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @linear_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @linear_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def translate_to_svf(object_id,access_token)\n base_64_urn = Base64.strict_encode64(object_id)\n response = RestClient.post(\"#{API_URL}/modelderivative/v2/designdata/job\",\n {\n input: {\n urn: base_64_urn\n },\n output: {\n formats: [\n {\n type: \"svf\",\n views: [\n \"3d\"\n ]\n }\n ]\n }\n }.to_json,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/json' })\n return response\nend",
"def create_model 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_model_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_model 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_model_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\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_model = @vehicle_brand.vehicle_models.build(vehicle_model_params)\n\n respond_to do |format|\n if @vehicle_model.save\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vehicle_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foo_model = FooModel.new(params[:foo_model])\n\n respond_to do |format|\n if @foo_model.save\n format.html { redirect_to @foo_model, notice: 'Foo model was successfully created.' }\n format.json { render json: @foo_model, status: :created, location: @foo_model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foo_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_scenario1\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"tags\" => [\"mytag\"]}, 'mytag', {\"petal width\" => 0.5}, 'Iris-setosa']]\n\n puts \n puts \"Scenario: Successfully creating a prediction from a multi model\"\n\n data.each do |filename,params,tag,data_input,prediction_result|\n puts \n puts \"Given I create a data source uploading a %s file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n [email protected]_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n list_of_models = []\n puts \"And I create model with params %s\" % JSON.generate(params)\n [email protected]_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n list_of_models << model \n puts \"And I create model with params %s\" % JSON.generate(params)\n [email protected]_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true) \n\n list_of_models << model\n\n puts \"And I create model with params %s\" % JSON.generate(params)\n [email protected]_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n list_of_models << model\n\n puts \"And I create a local multi model\"\n local_multimodel = BigML::MultiModel.new(list_of_models, @api)\n\n puts \"When I create a local prediction for <%s>\" % data_input\n prediction = local_multimodel.predict(data_input)\n\n puts \"Then the prediction is <%s>\" % prediction\n assert_equal(prediction, prediction_result)\n\n end\n\n end",
"def create_models\n @name = name.singularize.downcase\n @name_plural = @name.pluralize\n @attributes = attributes\n template(\"./templates/model.erb\", \"./models/#{@name}.rb\")\n end"
]
| [
"0.6156778",
"0.60116416",
"0.5969718",
"0.5738165",
"0.57204694",
"0.5691531",
"0.56770587",
"0.5587047",
"0.5572569",
"0.55326736",
"0.54894453",
"0.5426242",
"0.54190004",
"0.5395249",
"0.53938514",
"0.5375051",
"0.53728",
"0.53425467",
"0.53425467",
"0.5333202",
"0.52785635",
"0.527221",
"0.52689743",
"0.5243147",
"0.5237847",
"0.52344596",
"0.52251667",
"0.52251667",
"0.5177195",
"0.5139998"
]
| 0.64486474 | 0 |
DELETE /gltf_models/1 DELETE /gltf_models/1.json | def destroy
@gltf_model.destroy
respond_to do |format|
format.html { redirect_to gltf_models_url, notice: 'Gltf model was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @linear_model.destroy\n respond_to do |format|\n format.html { redirect_to linear_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auto_model.destroy\n respond_to do |format|\n format.html { redirect_to auto_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_model = MyModel.find(params[:id])\n @my_model.destroy\n \n respond_to do |format|\n format.html { redirect_to my_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oid_model.destroy\n respond_to do |format|\n format.html { redirect_to oid_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo_model = FooModel.find(params[:id])\n @foo_model.destroy\n\n respond_to do |format|\n format.html { redirect_to foo_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model.destroy\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to model_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 @onecolumnmodel = Onecolumnmodel.find(params[:id])\n @onecolumnmodel.destroy\n\n respond_to do |format|\n format.html { redirect_to onecolumnmodels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feature_model = FeatureModel.find(params[:id])\n @feature_model.destroy\n\n respond_to do |format|\n format.html { redirect_to feature_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @model.destroy\r\n respond_to do |format|\r\n format.html { redirect_to models_url, notice: 'Model was successfully deleted.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_models_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vehicle_model.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargapp_model.destroy\n respond_to do |format|\n format.html { redirect_to cargapp_models_url, notice: 'Cargapp model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_bridge_model(name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Bridge Model.\")\n delete(\"#{@api_url}/models/#{encode(name)}\", headers)\n end",
"def destroy\n @appraisal_model.destroy\n respond_to do |format|\n format.html { redirect_to appraisal_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_model dataset_id, model_id\n execute { service.delete_model @project, dataset_id, model_id }\n end",
"def delete(model)\n key.call(\"SREM\", model.id)\n end",
"def destroy\n @simple_model = SimpleModel.find(params[:id])\n @simple_model.destroy\n\n respond_to do |format|\n format.html { redirect_to(simple_models_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @model.destroy\n \n respond_to do |format|\n format.html { redirect_to(models_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @sivic_model.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_models_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to(models_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to(models_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end"
]
| [
"0.703142",
"0.70152724",
"0.7012977",
"0.7012977",
"0.7012977",
"0.69774354",
"0.695762",
"0.6933614",
"0.69286406",
"0.69202924",
"0.68830276",
"0.68643343",
"0.6862609",
"0.684401",
"0.6813616",
"0.67322826",
"0.6717871",
"0.6689857",
"0.6684332",
"0.6680368",
"0.66801465",
"0.6676436",
"0.66526514",
"0.6649006",
"0.6623824",
"0.6608632",
"0.66066766",
"0.6604607",
"0.65967435",
"0.65967435"
]
| 0.7454775 | 0 |
Format kyc Always receives [Hash] :NOTE Reading data to format from key:'user_kyc' Author: Tejas Date: 24/09/2018 Reviewed By: Sets result_type, user_kyc | def show(data_to_format)
formatted_data = {
result_type: 'user_kyc',
user_kyc: user_kyc_base(data_to_format[:user_kyc_detail], data_to_format[:admin])
}
formatted_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_kyc_data\n @user_kyc_detail.present? ?\n {\n kyc_status: kyc_status,\n admin_action_types: @user_kyc_detail.admin_action_types_array,\n whitelist_status: @user_kyc_detail.whitelist_status\n }\n :\n {}\n end",
"def user_kyc_base(user_kyc_detail, admin)\n {\n id: user_kyc_detail[:id],\n user_kyc_detail_id: user_kyc_detail[:user_extended_detail_id],\n user_id: user_kyc_detail[:user_id],\n kyc_status: user_kyc_detail[:kyc_status],\n admin_status: user_kyc_detail[:admin_status],\n aml_status: user_kyc_detail[:aml_status],\n whitelist_status: user_kyc_detail[:whitelist_status],\n admin_action_types: user_kyc_detail[:admin_action_types_array],\n submission_count: user_kyc_detail[:submission_count],\n last_acted_by: admin_name(user_kyc_detail[:last_acted_by], admin),\n created_at: user_kyc_detail[:created_at]\n }\n end",
"def format_data\n formatted_data = nil\n unless @raw_data.class == Hash # Webmock hack\n case options.format.to_sym\n when :json\n formatted_data = JSON.parse(@raw_data, symbolize_names: true)\n when :xml\n formatted_data = MultiXml.parse(@raw_data)['userinfo']\n end\n end\n\n formatted_data\n end",
"def formatData(data)\n data.keys.each{|key| data}\n end",
"def wkbk_info\n {\n \"ID\" => id,\n \"名前\" => name,\n \"メールアドレス\" => email,\n \"プロバイダ\" => auth_infos.collect(&:provider).join(\" \"),\n \"Twitterアカウント\" => twitter_key,\n \"最終ログイン日時\" => current_sign_in_at&.to_s(:distance),\n \"登録日時\" => created_at&.to_s(:distance),\n \"IP\" => current_sign_in_ip,\n \"タグ\" => permit_tag_list,\n # \"最新シーズン情報ID\" => wkbk_latest_xrecord.id,\n # \"永続的プロフ情報ID\" => wkbk_main_xrecord.id,\n # \"部屋入室数\" => wkbk_room_memberships.count,\n # \"対局数\" => wkbk_battle_memberships.count,\n \"問題履歴数\" => wkbk_answer_logs.count,\n # \"バトル中発言数\" => wkbk_room_messages.count,\n # \"ロビー発言数\" => wkbk_lobby_messages.count,\n # \"問題コメント数\" => wkbk_article_messages.count,\n\n \"作成問題数\" => wkbk_articles.count,\n # \"問題高評価率\" => wkbk_articles.average(:good_rate),\n # \"問題高評価数\" => wkbk_articles.sum(:good_marks_count),\n # \"問題低評価数\" => wkbk_articles.sum(:bad_marks_count),\n\n \"問題正解数\" => wkbk_total_o_count,\n \"問題不正解数\" => wkbk_total_x_count,\n\n \"問題正解数(本日)\" => wkbk_today_total_o_count,\n \"問題不正解数(本日)\" => wkbk_today_total_x_count,\n\n \"ユニーク問題正解数(本日)\" => today_total_o_ucount,\n \"ユニーク問題不正解数(本日)\" => today_total_x_ucount,\n }\n end",
"def parse_user_data_str(user_data_str)\n user_data = {}\n line_no = 0\n user_data_str.each_line do |line|\n line_no += 1\n line = line.strip\n next if line =~ /^#/ # skip comments\n next if line.empty? # skip blank lines\n parts = line.split(\"=\")\n if parts.length < 2\n warn \"user-data line #{line_no} does not conform to specification: '#{line}'\"\n else\n key = parts.first\n value = parts[1..-1].join('=') # in case there was an '=' in the value\n # already have a value, so make sure we have an array\n if user_data[key]\n if !user_data[key].is_a?(Array)\n user_data[key] = [user_data[key]]\n end\n user_data[key] << value\n else\n user_data[key] = value\n end\n end\n end\n\n return user_data\n end",
"def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end",
"def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end",
"def fetch_user_kyc_details\n ar_relation = UserKycDetail.using_client_shard(client: @client).\n where(client_id: @client_id, status: GlobalConstant::UserKycDetail.active_status)\n ar_relation = ar_relation.filter_by(@filters)\n ar_relation = ar_relation.sorting_by(@sortings)\n\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n @user_kycs = ar_relation.limit(@page_size).offset(offset).all\n @total_filtered_kycs = ar_relation.count\n end",
"def email_kyc_approve(data_to_format)\n {}\n end",
"def user_data_is_json_hash settings, debug=false\n user_data_hash = settings[:user_data]\n puts \"*****\\n\\n#{JSON.pretty_generate(user_data_hash)}\\n**********\\n\" if debug\n user_data user_data_hash.to_json\nend",
"def hash\n [language, user_defined_field1, user_defined_field2, user_defined_field3, user_defined_field4, user_defined_field5, card_token, ptlf, knet_payment_id, knet_result, inquiry_result, bank_reference, knet_transaction_id, auth_code, auth_response_code, post_date, avr, error, error_text].hash\n end",
"def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('https://api.trademe.co.nz/v1/MyTradeMe/Summary.json').body)\n end",
"def formatted_cache_data\n {\n id: id,\n client_id: client_id,\n name: name,\n symbol: symbol,\n conversion_factor: conversion_factor.present? ? conversion_factor.to_s : conversion_factor, # should be string as it goes to FE\n decimal: decimal,\n status: status,\n stake_currency_id: stake_currency_id,\n properties: properties.present? ? Token.get_bits_set_for_properties(properties) : [],\n }\n end",
"def get_keys\n access_key = USER_DATA[0].to_s.strip\n secret_access_key = USER_DATA[1].to_s.strip\n keys = { :access_key_id => access_key,\n :secret_access_key => secret_access_key}\nend",
"def map_to_row!(user_data)\n row_data = {}\n\n # Handle public_key vs. certificates\n if user_data.key?(:public_key)\n row_data[:pubkey_version] = 0\n row_data[:public_key] = user_data.delete(:public_key)\n else\n row_data[:pubkey_version] = 1\n row_data[:public_key] = user_data.delete(:certificate)\n end\n\n breakout_columns(user_data).each do |property_name|\n row_data[property_name] = user_data.delete(property_name) if user_data.key?(property_name)\n end\n\n row_data[:serialized_object] = as_json(user_data)\n row_data\n end",
"def email_kyc_deny(data_to_format)\n {}\n end",
"def format_data(data, private_allowed)\n # Store all formatted data in this array\n formatted_data = []\n\n # Format name with flags\n # Name Mark Diez (student, employee, staff)\n # IAM ID 1234566\n if !data[\"basic_info\"].empty?\n data[\"basic_info\"].each do |info|\n name = \"*Name* \" + info[\"dFullName\"]\n\n flags = []\n if info[\"isEmployee\"]\n flags.push \"employee\"\n end\n if info[\"isHSEmployee\"]\n flags.push \"hs employee\"\n end\n if info[\"isFaculty\"]\n flags.push \"faculty\"\n end\n if info[\"isStudent\"]\n flags.push \"student\"\n end\n if info[\"isStaff\"]\n flags.push \"staff\"\n end\n if info[\"isExternal\"]\n flags.push \"external\"\n end\n flags = \" _(\" + flags.join(\", \") + \")_\"\n name += flags\n\n formatted_data.push name\n formatted_data.push \"*IAM ID* #{info[\"iamId\"]}\"\n if private_allowed\n formatted_data.push \"*Student ID* #{info[\"studentId\"]}\" unless info[\"studentId\"] == nil\n formatted_data.push \"*PPS ID* #{info[\"ppsId\"]}\" unless info[\"ppsId\"] == nil\n end\n end\n end\n\n # Format Kerberos information\n # Login ID msdiez, anotherid, ...\n if !data[\"kerberos_info\"].empty?\n ids = []\n data[\"kerberos_info\"].each do |info|\n id = info[\"userId\"] == nil ? \"Not Listed\" : info[\"userId\"]\n ids.push id\n end\n\n formatted_data.push \"*Login ID* \" + ids.join(\", \")\n else\n login_id = \"*Login ID* Not Listed\"\n formatted_data.push login_id\n end\n\n\n # Format contact information\n # E-mail [email protected], [email protected]\n # Office kerr 186, social science 133, ...\n if !data[\"contact_info\"].empty?\n email = []\n office = []\n data[\"contact_info\"].each do |info|\n email.push info[\"email\"] unless info[\"email\"] == nil\n office.push info[\"addrStreet\"] unless info[\"addrStreet\"] == nil\n end\n formatted_data.push \"*E-mail* \" + email.join(\", \")\n formatted_data.push \"*Office* \" + office.join(\", \")\n else\n formatted_data.push \"*E-mail* Not Listed\"\n formatted_data.push \"*Office* Not Listed\"\n end\n\n # Format ODR information\n # ODR Affiliation DSSIT: STD4 (Casual)\n require 'pp'\n pp data\n if !data['odr_info'].empty?\n data['odr_info'].each do |info|\n odr = '*ODR Affiliation* '\n odr += info['deptDisplayName'] + ': ' unless info['deptDisplayName'].nil?\n odr += info['titleDisplayName'] unless info['titleDisplayName'].nil?\n\n formatted_data.push odr\n end\n end\n\n # Format PPS information\n # PPS Affiliation DSSIT: STD4\n if !data['pps_info'].empty?\n data['pps_info'].each do |info|\n dept_name = info['deptDisplayName'] || 'Unknown Department'\n dept_code = info['deptCode'] || 'Unknown Department Code'\n title_name = info['titleDisplayName'] || 'Unknown Title'\n title_code = info['titleCode'] || 'Unknown Title Code'\n position_type = info['positionType'] || 'Unknown Position Type'\n employee_class = info['emplClassDesc'] || 'Unknown Employee Class'\n\n formatted_data.push \"*PPS Affiliation*\"\n formatted_data.push \" Department: #{dept_name} (#{dept_code})\"\n formatted_data.push \" Title: #{title_name} (#{title_code}) (#{position_type})\"\n formatted_data.push \" Employee Class: #{employee_class}\"\n end\n end\n\n # Format student information\n # Student Affiliation Computer Science (Undergraduate, Junior)\n if !data['student_info'].empty?\n data['student_info'].each do |info|\n student = '*Student Affiliation* '\n student += info['majorName'] + ' ('\n student += info['levelName'].scan(/\\S+/)[0] # Only grab the first word\n student += ', ' + info['className'] + ')'\n\n formatted_data.push student\n end\n end\n\n return formatted_data.join(\"\\n\")\n end",
"def load_user_info\n\t\tif @user_info.has_key?(@@line_array[0].to_i)\n\t\t\t@user_info[@@line_array[0].to_i][@@line_array[1].to_i] = @@line_array[2].to_i\n\t\telse\n\t\t\t@user_info[@@line_array[0].to_i] = {@@line_array[1].to_i => @@line_array[2].to_i}\n\t\tend\n\tend",
"def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_identifier('resource_not_found',\n 'um_kd_g_fukd_1'\n ) if (@user_kyc_detail.blank? || (@user_kyc_detail.status != GlobalConstant::UserKycDetail.active_status) ||\n (@user_kyc_detail.client_id != @client_id))\n\n success\n end",
"def email_kyc_report_issue(data_to_format)\n {}\n end",
"def parse_user_data(user_data)\n parsed_user_data = user_data\n return parsed_user_data\n end",
"def get_user_extended_detail_data\n\n allowed_kyc_fields.each do |field_name|\n if GlobalConstant::ClientKycConfigDetail.unencrypted_fields.include?(field_name)\n @user_extended_detail[field_name.to_sym] = @user_extended_detail_obj[field_name]\n elsif GlobalConstant::ClientKycConfigDetail.encrypted_fields.include?(field_name)\n\n if GlobalConstant::ClientKycConfigDetail.non_mandatory_fields.include?(field_name) && @user_extended_detail_obj[field_name].blank?\n if field_name == GlobalConstant::ClientKycConfigDetail.investor_proof_files_path_kyc_field\n for i in 1..GlobalConstant::ClientKycConfigDetail.max_number_of_investor_proofs_allowed\n @user_extended_detail[field_name.to_sym] ||= []\n end\n else\n @user_extended_detail[field_name.to_sym] = nil\n end\n next\n end\n\n decrypted_data = local_cipher_obj.decrypt(@user_extended_detail_obj[field_name]).data[:plaintext]\n\n if GlobalConstant::ClientKycConfigDetail.image_url_fields.include?(field_name)\n if field_name == GlobalConstant::ClientKycConfigDetail.investor_proof_files_path_kyc_field\n for i in 1..GlobalConstant::ClientKycConfigDetail.max_number_of_investor_proofs_allowed\n @user_extended_detail[field_name.to_sym] ||= []\n @user_extended_detail[field_name.to_sym] << get_url(decrypted_data[i - 1])\n end\n else\n @user_extended_detail[field_name.to_sym] = get_url(decrypted_data)\n end\n else\n @user_extended_detail[field_name.to_sym] = decrypted_data\n end\n\n else\n throw \"invalid kyc field-#{field_name}\"\n end\n end\n\n extra_kyc_fields = {}\n\n if @user_extended_detail_obj[:extra_kyc_fields].present?\n extra_kyc_fields = local_cipher_obj.decrypt(@user_extended_detail_obj[:extra_kyc_fields]).data[:plaintext]\n end\n\n allowed_extra_kyc_fields.each do |field_name|\n @user_extended_detail[field_name.to_sym] = extra_kyc_fields[field_name.to_sym]\n end\n\n\n @user_extended_detail.merge!({id: @user_extended_detail_obj.id, created_at: @user_extended_detail_obj.created_at.to_i})\n end",
"def ec2_user_data(key = '', default = '')\n ec2_fetch_user_data_str\n @user_data = parse_user_data_str(@user_data_str) if !@user_data\n\n if @user_data[key]\n return @user_data[key]\n else\n return default\n end\n end",
"def fetch_and_validate_user_kyc_detail\n user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_identifier('kyc_not_denied',\n 'um_se_d_favukd_1'\n ) if (user_kyc_detail.blank? || (user_kyc_detail.client_id != @client_id)) || !(user_kyc_detail.kyc_denied?)\n\n success\n end",
"def print_hash_values hash\n puts hash unless hash.is_a? Hash\n hash.each do |k, v|\n if v.is_a? Hash\n puts \"User:\".yellow + \" #{k}\"\n print_hash_values v\n else\n if k == 'password'\n puts \"#{k.yellow}: ** HIDDEN **\"\n else\n puts \"#{k.yellow}: #{v}\\n\" unless v.nil?\n end\n end\n end\n end",
"def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end",
"def success_response_data_for_client\n {\n user: user_data,\n user_kyc_data: user_kyc_data\n }\n end",
"def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end",
"def getUserRateHash(userCustVals)\n\t\trateHash = Hash.new\n\t\tuserCustVals.each do |custVal|\n\t\t\tcase custVal.custom_field_id \n\t\t\t\twhen getSettingCfId('wktime_user_billing_rate_cf') \n\t\t\t\t\trateHash[\"rate\"] = custVal.value.to_f\n\t\t\t\twhen getSettingCfId('wktime_user_billing_currency_cf') \n\t\t\t\t\trateHash[\"currency\"] = custVal.value\n\t\t\t\twhen getSettingCfId('wktime_attn_designation_cf')\n\t\t\t\t\trateHash[\"designation\"] = custVal.value\n\t\t\tend\n\t\tend\n\t\trateHash\n\tend"
]
| [
"0.6807346",
"0.5872701",
"0.5729006",
"0.5681961",
"0.56758815",
"0.5665296",
"0.5606227",
"0.5606227",
"0.5600151",
"0.55636805",
"0.5479883",
"0.5454042",
"0.54291064",
"0.5420745",
"0.53460443",
"0.5343816",
"0.53428787",
"0.5298603",
"0.5291671",
"0.52900153",
"0.5271627",
"0.52483726",
"0.52410096",
"0.5237631",
"0.5225789",
"0.519601",
"0.51800126",
"0.5175129",
"0.5105834",
"0.5073803"
]
| 0.6669875 | 1 |
Format pre signed url for put Always receives [Hash] :NOTE Reading data to format from key:'file_upload_put' Author: Aniket Date: 20/09/2018 Reviewed By: | def get_pre_singed_url_for_put(data_to_format)
formatted_data = {
result_type: 'file_upload_put',
file_upload_put: data_to_format
}
formatted_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog::Storage.new(Rails.configuration.x.fog_configuration)\n \n # set request attributes\n headers = { \"Content-Type\" => upload.content_type }\n options = { \"path_style\" => \"true\" }\n \n # generate signed url\n return storage.put_object_url(\n ENV['S3_BUCKET_NAME'],\n upload.path,\n duration.from_now.to_time.to_i,\n headers,\n options\n )\n end",
"def get_presigned_url_put(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/pre-signed-urls/for-put\", params)\n end",
"def presignedurl_params\n params.permit(:filename, :username)\n end",
"def get_presigned_put_url_for(s3_name, bucket, content_type)\n params = {\n bucket: bucket,\n key: s3_name\n }\n\n options={\n content_type: content_type,\n server_side_encryption: 'aws:kms',\n ssekms_key_id: key_id\n }\n\n presigner = Aws::S3::Presigner.new({client: client})\n u = presigner.presigned_url(:put_object, params.merge(options))\n # uri = URI.parse(u)\n # uri\n # r = Net::HTTP.start(uri.host, :use_ssl => true) do |http|\n # http.send_request(\"PUT\", uri.request_uri, File.read(file_path), {\n # # This is required, or Net::HTTP will add a default unsigned content-type.\n # \"content-type\" => content_type\n # })\n #\n # end\n end",
"def s3_upload_signature\n\t signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), YOUR_SECRET_KEY, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n\t end",
"def upload_key(s3client,newkeyblob,filename,bucket)\r\n keyfile_name= filename+ \".key\"\r\n newkeyblob64 = Base64.encode64(newkeyblob)\r\n s3client.put_object({\r\n body: newkeyblob64,\r\n key: keyfile_name,\r\n bucket: bucket\r\n })\r\nend",
"def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), CONFIG['secret_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end",
"def s3_upload_signature\n Base64.encode64(OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n @current_shard.amazon_setting.secret_access_key,\n s3_upload_policy_document)\n ).gsub(/\\n|\\r/, \"\")\n end",
"def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), SITE['s3_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end",
"def s3_upload_signature\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n ENV[\"AWS_SECRET_ACCESS_KEY\"],\n s3_upload_policy_document\n )\n ).gsub(/\\n/, '')\n end",
"def upload_file(bucket, key, data)\n bucket.put(key, data)\nend",
"def presign_upload\n render plain: hmac_data, status: :ok\n end",
"def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Figaro.env.aws_secret_access_key, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end",
"def normalize_multipart_upload(params)\n fname = params[:key].split('/').last\n if fname == '${filename}'\n # Can't change original name. Just rename key\n params[:key].sub!('${filename}', params[:file].original_filename)\n # Rebuild s3_uri with new key\n rebuild_uri(params)\n else\n # Change stored filename for more flexibility\n params[:file].original_filename = fname\n end\n end",
"def presign(id, **options)\n url = storage.signed_url(@bucket, object_name(id), method: \"PUT\", **options)\n\n headers = {}\n headers[\"Content-Type\"] = options[:content_type] if options[:content_type]\n headers[\"Content-MD5\"] = options[:content_md5] if options[:content_md5]\n headers.merge!(options[:headers]) if options[:headers]\n\n { method: :put, url: url, headers: headers }\n end",
"def temp_upload_url(object_key, temp_url_key, expires_at = Time.now.to_i + 60)\n private_url(\"PUT\", object_key, temp_url_key, expires_at)\n end",
"def s3_upload_signature(s3_bucket)\r\n\t\tBase64.encode64(\r\n\t\t\t\tOpenSSL::HMAC.digest(\r\n\t\t\t\t\t\tOpenSSL::Digest::Digest.new('sha1'),\r\n\t\t\t\t\t\tS3_KEY,\r\n\t\t\t\t\t\ts3_upload_policy_document(s3_bucket)\r\n\t\t\t\t)\r\n\t\t).gsub(/\\n/, '')\r\n\tend",
"def get_pre_singed_url_for_post(data_to_format)\n formatted_data = {\n result_type: 'file_upload_post',\n file_upload_post: data_to_format\n\n }\n formatted_data\n end",
"def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:)\n instrument :url, key: key do |payload|\n verified_token_with_expiration = ActiveStorage.verifier.generate(\n {\n key: key,\n content_type: content_type,\n content_length: content_length,\n checksum: checksum\n },\n { expires_in: expires_in,\n purpose: :blob_token }\n )\n\n generated_url = url_helpers.update_rails_imgur_service_url(verified_token_with_expiration, host: current_host)\n\n payload[:url] = generated_url\n generated_url\n end\n end",
"def upload(bucket, file); end",
"def public_url(options = {})\n url = URI.parse(bucket.url(options))\n url.path += '/' unless url.path[-1] == '/'\n url.path += key.gsub(/[^\\/]+/) { |s| Seahorse::Util.uri_escape(s) }\n url.to_s\n end",
"def s3_upload_policy_document\n Base64.encode64(\n {\n expiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\n conditions: [\n { bucket: ENV[\"S3_BUCKET\"] },\n { acl: 'public-read' },\n [\"starts-with\", \"$key\", \"uploads/\"],\n { success_action_status: '201' }\n ]\n }.to_json\n ).gsub(/\\n|\\r/, '')\n end",
"def quick_s3_upload\n end",
"def upload_signature\n @upload_signature ||=\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n options[:secret_access_key],\n self.policy_document\n )\n ).gsub(/\\n/, '')\n end",
"def upload_file(file)\n key_name = @prefix.dup\n key_name << File.basename(file)\n @right_s3_interface.put(@bucket, key_name , File.read(file) ) \n end",
"def put(params)\n bucket = params[:bucket]\n object = params[:object]\n value = params[:value]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('PUT', 'private', bucket, object, content_type)\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_put_headers(date, auth, 'private', content_type, value.size)\n path = \"/\" << object\n\n @req_options = {:method => :put, :head => headers, :path => path, :body => value}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end",
"def store(data, headers = {})\n r = conn.put(escaped_path, data) do |req|\n req.headers = headers\n token = CarrierWave::UCloud::Digest.authorization(@uploader, req)\n req.headers['Authorization'] = token\n end\n r\n end",
"def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end",
"def generate_url(bucket, file)\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: file)\n\nend",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend"
]
| [
"0.67966163",
"0.6775661",
"0.6487616",
"0.6379967",
"0.63140744",
"0.62500286",
"0.62426245",
"0.6237337",
"0.61933255",
"0.6190393",
"0.6108691",
"0.60999954",
"0.60978055",
"0.609427",
"0.60238963",
"0.60124534",
"0.59918123",
"0.59866756",
"0.5971516",
"0.5941019",
"0.5930351",
"0.5928012",
"0.5903244",
"0.5895279",
"0.5887417",
"0.58743656",
"0.5848248",
"0.5836101",
"0.5829289",
"0.58245414"
]
| 0.8047017 | 0 |
Get Admin Name Author: Tejas Date: 24/09/2018 Reviewed By: | def admin_name(last_acted_by, admin)
last_acted_by = last_acted_by.to_i
if (last_acted_by > 0)
admin[:name]
elsif (last_acted_by == Admin::AUTO_APPROVE_ADMIN_ID)
GlobalConstant::Admin.auto_approved_admin_name
else
''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAuthorName\n\t\treturn User.find(self.user_id).username\n\tend",
"def attribution\n user = roles.creator.first&.user\n user = roles.administrator.not_creator.first&.user if user.blank?\n return [] if user.blank?\n\n text = user&.name(false)\n orcid = user.identifier_for_scheme(scheme: 'orcid')\n if orcid.present?\n text += format(' - <strong>ORCID:</strong> <a href=\"%{orcid_url}\" target=\"_blank\">%{orcid}</a>',\n orcid_url: orcid.value, orcid: orcid.value_without_scheme_prefix)\n end\n text\n end",
"def mods_display_name\n fetch(:author_struct, [])\n end",
"def author_name\n if author\n author.full_name\n else\n 'No Author Found'\n end\n end",
"def author_name\n h Settings.author_name\n end",
"def author\n return User.find(self.user_id).user_name\n end",
"def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end",
"def display_name\n [nomenclator_name, author_year].compact.join(\" \")\n end",
"def author_names\n names = []\n users.each do |user|\n names << user.fullname\n end\n names\n end",
"def author\n @info[:Author]\n end",
"def name\n author_hash[\"name\"]\n end",
"def name\n author_hash[\"name\"]\n end",
"def author \n user.firstname + ' ' + user.lastname\n end",
"def author_name\n \"#{author.first_name} #{author.last_name}\"\n end",
"def admin_name\n self.user.name\n end",
"def author\n if not user.present? or (user.first_name.blank? and user.last_name.blank?)\n \"Anonymous\"\n else\n [user.try(:first_name), user.try(:last_name)].reject(&:blank?).join(' ')\n end\n end",
"def author_name\n \"#{author.last_name}, #{author.first_name}\"\n end",
"def user_name\n reviewee.name\n end",
"def author_name\n author.full_name if author\n end",
"def author_name\n user_data.name || login\n end",
"def author\n ['@',self.user.id, self.user.name.split().join].join('-')\n end",
"def author\n \"#{user.firstname} #{user.lastname}\"\n end",
"def author\n \"#{user.name} (#{user.login})\"\n end",
"def author_full_name\n self.author.full_name\n end",
"def author_info\n self.authors.map(&:full_name).join(', ')\n end",
"def show\n @user_author = User.find_by_id(@materiallink.user_id)\n @user_author_name = @user_author.username\n end",
"def created_by\r\n\t\t\t \t\"Lachezar Kostov and Dimitar Bakardzhiev\"\r\n\t\t end",
"def author_name\n object.anonymous? ? '匿名用户' : object.author.name_or_login\n end",
"def to_s\n author_name\n end",
"def author\n name.split(/[\\/-]/).first\n end"
]
| [
"0.68571734",
"0.67655355",
"0.6757834",
"0.67468387",
"0.6733212",
"0.6718094",
"0.6714925",
"0.66346055",
"0.66316706",
"0.66230094",
"0.6576259",
"0.6576259",
"0.65704286",
"0.6569066",
"0.6560141",
"0.65553147",
"0.6551965",
"0.65485185",
"0.653709",
"0.6532437",
"0.6528219",
"0.6509866",
"0.65097",
"0.64726406",
"0.6472188",
"0.64680594",
"0.6467283",
"0.64601237",
"0.64511824",
"0.6396067"
]
| 0.7266418 | 0 |
Get response for sending KYC approve email Author: Mayur Date: 03/12/2018 Reviewed By: | def email_kyc_approve(data_to_format)
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_approve_email\n 'send_approve_email'\n end",
"def approved_notification\n @user = params[:user]\n mail(to: @user.email, subject: 'Library Card Request Approved')\n end",
"def approved\n @req = Request.last\n RequestMailer.approved(@req)\n end",
"def confirm(viper)\n @viper = viper\n if @viper.app_type == \"vip\"\n mail(to: @viper.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的买家:\n恭喜您!您所提交的资料已经审核通过,随后我们将会安排相关的工作人员与您联系,请您携带有效证件(身份证及名片)到展会现场VIP接待处领取VIP买家证。\n\n\n展览时间:\n2015-06-25 至 2015-06-28 \n\n展览地点: \n深圳会展中心(1、9号馆) \n\n参观规则: \n §Exhibit_Rule§ \n\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 \n\n主办信息:\n2015中国(深圳)国际钟表展览会 \n电话:0755-82945180\n传真:0755-82941162 \n通信地址:深圳市福田保税区市花路福年广场B栋302室\n邮箱:[email protected]\n\n\"\n )\n else\n mail( to: @viper.email,\n subject: \"您的申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的客户:\n恭喜您!您所提交的资料已经审核通过,随后我们将会安排相关的工作人员与您联系,请您携带有效证件(身份证、参展商证)到展会现场领取晶品荟招待卡。\n\n\n\n\n展览时间:\n2015-06-25 至 2015-06-28 \n\n展览地点: \n深圳会展中心(1、9号馆) \n\n参观规则: \n §Exhibit_Rule§ \n\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 \n\n主办信息:\n2015中国(深圳)国际钟表展览会 \n电话:0755-82945180\n传真:0755-82941162 \n通信地址:深圳市福田保税区市花路福年广场B栋302室\n邮箱:[email protected]\n\")\n end\n end",
"def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end",
"def approve\n email = Email.find(params[:id])\n email.state = \"Approved\"\n # Send email\n if email.save!\n email.send_email!\n head :no_content\n else\n respond_with email, status: :unprocessable_entity\n end\n end",
"def email_approve(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/approve\", params)\n end",
"def request_approval\n reservation = Reservation.first\n ReservationMailer.request_approval(reservation)\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 approval_user\n target_user = User.find(params[:user_id])\n approval_status = params[:approved].blank? ? User::ApprovalStatusReject : User::ApprovalStatusApproved\n comment = params[:comment]\n # unless target_user.approval_status == User::ApprovalStatusApproved\n target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n\n # if target_user.approval_status == User::ApprovalStatusApproved\n # if target_user.company_buyer_entities.any?{ |x| x.approval_status == CompanyBuyerEntity::ApprovalStatusPending}\n # target_user.update(comment: comment, approval_date_time: DateTime.current)\n # else\n # target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n # end\n\n if approval_status == User::ApprovalStatusApproved\n UserMailer.approval_email(target_user).deliver_later\n elsif approval_status == User::ApprovalStatusReject\n UserMailer.reject_email(target_user).deliver_later\n end\n result_json = {user_base_info: target_user}\n result_json\n end",
"def admin_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => \"[email protected]\", :subject => \"New Review on CONSIGN.NYC\")\n end",
"def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end",
"def project_approval(user)\n @user = user\n mail to: @user.email, subject: \"Approval of requested project at Freelancer.com\"\n end",
"def successful_preapproval_details_response_json\n <<-RESPONSE\n {\"responseEnvelope\":{\"timestamp\":\"2009-08-19T20:06:37.422-07:00\",\"ack\":\"Success\",\"correlationId\":\"4831666d56952\",\"build\":\"1011828\"},\"preapprovalKey\":\"PA-13R096665X681474E\", \"status\":\"ACTIVE\"}\n RESPONSE\n end",
"def request_approved(request)\n @request = request\n @email = @request.clid + '@louisiana.edu'\n mail to: @email, subject: \"Room Change Request Approved\"\n end",
"def approve\n respond_to do |format|\n if @version.approve!(current_user)\n UserMailer.approval_notification(current_user, @version.versionable.node, @version.editor, params[:comment], :host => request.host).deliver if @version.editor\n format.xml { head :ok }\n else\n format.xml { head :internal_server_error }\n end\n end\n end",
"def approve\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def auto_approve_type\n 'auto'\n end",
"def subscriber_notice_approval_alert\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'approval_alert'\n )\n end",
"def review_decision\n\t\tproject = @task.project\n\t\t@data[:decision_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:decision_title] = @task.title\n\t\t@data[:project_name] = project.title\n @data[:recipient_names] = recipient_names\n\t\t@data[:decision_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{project.id}/tasks\"\n\t\t@template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_decision]\n\t\ttrigger_mail\t\t\n\tend",
"def approval(user, company)\n @subject = \"#{user.name} is authorized to trade at Foodmoves.com\"\n @body = {:user => user,\n :company => company}\n @recipients = user.email\n @bcc = @@bcc\n @from = 'Foodmoves Support <[email protected]>'\n @sent_on = Time.now\n end",
"def post_approve_email\n NotificationMailer.post_approve_email('[email protected]')\n end",
"def send_outstanding_alert_to_approver(agency, user)\n setup_email\n body[:agency] = agency\n body[:user] = user\n recipients user.email\n subject \"Timesheet Approval Reminder\"\n end",
"def act_on_ok\n if body['message'] == 'Approval successful.'\n output(\n event: 'success',\n message: message_text,\n uuid: body['uuid'],\n accession: payloads.first[:output][:accession]\n )\n else\n Rails.logger.error(\"Approve transfer Job failed with: #{message_text}\")\n output(event: 'failed', message: message_text)\n fail!\n end\n end",
"def notify_status_approved(user, redemption)\n @redemption = redemption\n @reward = redemption.reward\n @approver = redemption.approver\n @user = user\n notify_redeemer_status_change(user, redemption, t(\"rewards.redemption_was_approved\", reward_title: redemption.reward.title))\n end",
"def recap_loan_confirm\n to = params['emailAddress']\n from = '[email protected]'\n confirm_bcc = APP_CONFIG[:recap_loan][:confirm_bcc]\n recap_subject = 'Offsite Pick-Up Confirmation'\n recap_subject += \" [#{params['titleIdentifier']}]\" if params['titleIdentifier']\n recap_subject += \" (#{Rails.env})\" if Rails.env != 'valet_prod'\n subject = recap_subject\n # Make params available within template by using an instance variable\n @params = params\n mail_params = {to: to, from: from, subject: subject}\n mail_params[:bcc] = confirm_bcc if confirm_bcc\n mail(mail_params)\n end",
"def emailapprover(miq_request, appliance, msg)\n $evm.log('info', \"Approver email logic starting\")\n\n # Get requester object\n requester = miq_request.requester\n\n # Get requester email else set to nil\n requester_email = requester.email || nil\n\n # Get Owner Email else set to nil\n owner_email = miq_request.options[:owner_email] || nil\n $evm.log('info', \"Requester email:<#{requester_email}> Owner Email:<#{owner_email}>\")\n\n # Override to email address below or get to_email_address from from model\n to = nil\n to ||= $evm.object['to_email_address']\n\n # Override from_email_address below or get from_email_address from model\n from = nil\n from ||= $evm.object['from_email_address']\n\n # Get signature from model unless specified below\n signature = nil\n signature ||= $evm.object['signature']\n\n # Set email subject\n subject = \"Request ID #{miq_request.id} - Automation request was not approved\"\n\n\n # Build email body\n body = \"Approver, \"\n body += \"<br>An automation request received from #{requester_email} is pending.\"\n body += \"<br><br>#{msg}.\"\n body += \"<br><br>For more information you can go to: <a href='https://#{appliance}/miq_request/show/#{miq_request.id}'>https://#{appliance}/miq_request/show/#{miq_request.id}</a>\"\n body += \"<br><br> Thank you,\"\n body += \"<br> #{signature}\"\n\n # Send email to approver\n $evm.log('info', \"Sending email to <#{to}> from <#{from}> subject: <#{subject}>\")\n $evm.execute(:send_email, to, from, subject, body)\nend",
"def donations_approved(user, project=nil)\n setup_email(user)\n @subject += head_encode(project ? (\"Contributions for %s have been activated\" / project.login) : 'Your contributions request has been approved'.t)\n @body[:project] = project\n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/money\"\n end",
"def confirm(blank)\n @blank = blank\n if @blank.apply_type == \"ex_apply\"\n mail(to: @blank.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的参展商朋友:<br/>\n 恭喜您,您所提交的参展申请已经审核通过,请携带个人名片、身份证及以下参展确认号至展会现场媒体接待处领取参展证。\n <ul>\n <li><a href='http://121.41.26.127/stores/1'>1号馆 左边部分</a></li>\n <li><a href='http://121.41.26.127/stores/3'>9号馆上半部分</a></li>\n <li><a href='http://121.41.26.127/stores/4'>1号馆 右边部分</a></li>\n <li><a href='http://121.41.26.127/stores/5'>9号馆下半部分</a></li>\n </ul>\n 展览时间:
2015-06-25 至 2015-06-28 <br/>\n 展览地点:
深圳会展中心(1、9号馆)
<br/>\n 如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。
主办信息:
2015中国(深圳)国际钟表展览会
电话:0755-82945180
传真:0755-82941162
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\"\n )\n else\n mail( to: @blank.email,\n subject: \"您的记者证申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的媒体朋友:\n恭喜您,您所提交的记者证申请已经审核通过,请携带个人名片、身份证及以下记者证确认号至展会现场媒体接待处领取记者证。\n\n展览时间:
2015-06-25 至 2015-06-28 \n
展览地点:
深圳会展中心(1、9号馆)
\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。
主办信息:
2015中国(深圳)国际钟表展览会
电话:0755-82945180
传真:0755-82941162
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\")\n end\n end",
"def approve\n approve_user\n return if notified?\n email_topic_subscribers\n end"
]
| [
"0.66857827",
"0.6537127",
"0.6378747",
"0.63589156",
"0.63566065",
"0.63520384",
"0.6348529",
"0.61139035",
"0.6097678",
"0.6060128",
"0.60555786",
"0.6052152",
"0.60403436",
"0.60151994",
"0.59832114",
"0.5970294",
"0.5968385",
"0.59408766",
"0.59185123",
"0.5907257",
"0.59065795",
"0.58910286",
"0.5880135",
"0.58669853",
"0.5863224",
"0.5862344",
"0.58570087",
"0.58569604",
"0.5852801",
"0.5836209"
]
| 0.74177253 | 0 |
Get response for sending KYC report issue email Author: Mayur Date: 14/12/2018 Reviewed By: | def email_kyc_report_issue(data_to_format)
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_kyc_approve(data_to_format)\n {}\n end",
"def email_report_issue(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/report-issue\", params)\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 holdtag_email(tbl_quality_issue)\n @tbl_quality_issue = tbl_quality_issue\n\n mlist1test = [ \n '[email protected]',\n ]\n \n mlist1 = [ \n '[email protected]',\n ]\n\n # mail(to: mlist1test , subject: 'CSD1-Sinter Shift Report Record Submitted')\n mail(to: mlist1test , subject: 'test holdtag mailer 06ht1')\n end",
"def get_Email()\n \t return @outputs[\"Email\"]\n \tend",
"def new_data_request_response(user_id, project_id)\n begin\n @project = Project.find(project_id)\n user = User.find(user_id)\n from DEFAULT_FROM\n reply_to DEFAULT_REPLY_TO\n subject \"SRDR - Update Regarding your Request for Data\"\n recipients user.email \n sent_on Time.now \n rescue Exception => e\n puts \"ERROR SENDING RESPONSE NOTICE: #{e.message}\\n#{e.backtrace}\\n\\n\"\n end\n end",
"def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end",
"def request_email ucr\n extract_variables ucr\n @url = accept_change_request_url(ucr.token)\n\n mail to: @user.email\n end",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def email_body\n sponsor_name = @config.plan.sponsor_name\n message = 'Hi there!'\\\n '<br />'\\\n '<br />'\\\n \"#{sponsor_name} has run their payroll. Please download the relevant reports below.\"\\\n '<br />'\\\n '<br />'\n message\n end",
"def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <[email protected]>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end",
"def emailResults()\n obj = EmailHelper.new()\n emailSubject = \"Illumina Capture Stats : Flowcell \" + @fcBarcode.to_s\n emailFrom = \"[email protected]\" \n emailText = @captureResults.formatForSTDOUT()\n emailTo = obj.getCaptureResultRecepientEmailList()\n\n begin\n obj.sendEmail(emailFrom, emailTo, emailSubject, emailText)\n rescue Exception => e\n puts e.message \n puts e.backtrace.inspect\n end\n end",
"def email_job_result(jlh)\n return unless email_result?(jlh)\n email_expression = Regexp.new('EMAIL_RESULT_BELOW:(.*)EMAIL_RESULT_ABOVE',Regexp::MULTILINE)\n match = email_expression.match(jlh[:job_result])\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n if (match.nil?)\n $logger.debug(\"The output for job_code #{jmd.job_code} does not have valid e-mail output!\")\n return\n end\n $logger.debug(\"The output for job_code #{jmd.job_code} does have valid e-mail output! See the rails log for details\")\n body = match[1]\n #get the subject from the body\n match = Regexp.new('SUBJECT:(.*)').match(body)\n subject = match[1] unless match.nil?\n body.sub!(\"SUBJECT:#{subject}\",'')#append on subject\n subject = $application_properties['service_subject'] + \" \" + subject if jlh.has_key?(:service)\n subject = subject + ' -- REMINDER ' + @reminder_hash[jmd.job_code].to_s if (jlh[:reminder_email])\n body.chomp!.reverse!.chomp!.reverse! unless jmd.email_content_type.eql?('text/html')\n from = $application_properties['PST_Team']\n content_type = jmd.email_content_type\n recipients = []\n cc = []# or should it be ''?\n #banana slug\n #integrate with escalation levels to get additional e-mails out of the escalation\n recipients = jlh[:email_to] if jlh.has_key?(:email_to)\n cc = jlh[:email_cc] if jlh.has_key?(:email_cc)\n\n if (jmd.track_status_change && jmd.email_on_status_change_only)\n esc = jle.get_escalation\n esc = JobLogEntry.before(jle).status_not(\"UNKNOWN\").limit(1).first.get_escalation if esc.nil? #if this is nil this jle is green\n\n if ! esc.nil? #this is added in the event that the alert has never been red and we are in this method because we are executing as a service\n esc_emails = esc.get_escalation_based_emails\n recipients = recipients | esc_emails[0]\n cc = cc | esc_emails[1]\n end\n end\n\n recipients = recipients.uniq.join(',')\n cc = cc.uniq.join(',')\n\n email_hash = {:request => jmd.job_code, :content_type => content_type, :subject=>subject,\n :recipients=>recipients, :from=>from, :cc=>cc,:body=>body,\n :incl_attachment=>jmd.incl_attachment,:attachment_path=>jmd.attachment_path,\n :jmd => jmd, :jle => jle}\n\n JobMailer.job_result(email_hash).deliver\n end",
"def confirm_booksbymail_email(user, bib, values)\n @to = \"[email protected]\"\n @from = \"#{user.name} <#{user.data['email']}>\"\n @subject = \"Books by Mail Request\"\n\n @title = values['title']\n @bibid = values['bibid']\n @author = values['author']\n @publication = values['publication']\n @callno = values['call_no']\n @volume = values['volume']\n @comments = values[:comments]\n @patronname = user.name \n @patronemail = values['email']\n @pennid = user.data['penn_id']\n\n if Rails.env.development?\n @subject = \"TEST \" + @subject + \" (to: #{@to}, from: #{@from})\"\n @to = ENV['DEVELOPMENT_EMAIL']\n @from = ENV['DEVELOPMENT_EMAIL']\n end\n\n mail(to: @to,\n from: @from,\n subject: @subject,\n template_name: 'confirm_booksbymail')\n end",
"def send_email(cab_request,pick_up_date,pick_up_time,requester,admin_emails,vendor_email)\n mail(reply_to:[requester,admin_emails,vendor_email], cc: [admin_emails,vendor_email,requester] , subject: \"[Cab Request]\", body:\n\n \"Name :\\t\" + cab_request.traveler_name+\n\n \"\\nContact_no :\\t\" + cab_request.contact_no+\n\n \"\\nFrom :\\t\" + cab_request.source+\n\n \"\\nTo :\\t\" + cab_request.destination+\n\n \"\\nOn :\\t\" + pick_up_date+\n\n \"\\nAt :\\t\" + pick_up_time+\n\n \"\\nVehicle Type :\\t\" + cab_request.vehicle_type+\n\n \"\\nOther Travellers :\\t\" + cab_request.other_travellers+\n\n \"\\nComments :\\t\" + cab_request.comments+\n\n \"\\nStatus :\\t\" + cab_request.status)\n\n end",
"def body_for_issue(issue)\n if issue[:site] == :github\n username = '@' + issue[:author]\n else\n username = issue[:author]\n end\n \n formatted_date = issue[:date].strftime(\"%Y-%m-%d at %H:%M (UTC)\")\n header = \"Issue originally opened by #{username} on #{formatted_date}, \"\\\n \"and migrated by the [Motherforker](https://github.com/ExplodingCabbage/motherforker).\\n\\n\"\\\n \"Original issue: #{issue[:url]}\\n\\n\"\\\n \"----------------------------------------------\\n\\n\"\n \n return header + issue[:body]\n end",
"def qc_revised\n SeriesMailer.qc_revised\n end",
"def response_request(leaveapplication)\n @leaveapplication = leaveapplication \n mail :to=> User.find(@leaveapplication.user_id).email.to_s,:cc=> \"[email protected]\",:subject=>\"Response\"\n end",
"def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end",
"def chore_notification_email(assignment)\n @user = assignment.user\n @chore = assignment.chore\n @due_date = assignment.due_date.to_formatted_s(:long_ordinal)\n @url = complete_chore_url(assignment)\n sendgrid_category \"Chore Notification\"\n # sendgrid_unique_args :key2 => \"newvalue2\", :key3 => \"value3\"\n mail :to => @user.email, :subject => \"#{@user.name}. You've got a chore!\"\n end",
"def donations_requested(user)\n setup_email_admin(user)\n @recipients = \"[email protected]\"\n @from = head_encode('\"Kroogi Contributions Request (system)\"'.t) + \" <[email protected]>\"\n @subject += head_encode(\"Contributions requested by %s\" / user.login)\n @content_type = \"text/html\" \n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/admin/donation_requests\"\n @body[:user] = user\n end",
"def report_request\n @subject = report_request_params[:subject]\n @requester = report_request_params[:requester]\n @message = report_request_params[:message]\n\n SingleCellMailer.admin_notification(@subject, @requestor, @message).deliver_now\n end",
"def send_recipt(ticket)\n @ticket = ticket\n\n mail to: ticket.email\n end",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def headers\n {\n :subject => Contact.first.response_subject,\n :to => %(\"#{email}\"),\n :from => Contact.first.name,\n :body => Contact.first.response_message.html_safe,\n content_type: \"text/html\"\n }\n end",
"def raf_submitted(study_subject)\n#\t\t@greeting = \"Hi\"\n\t\t@study_subject = study_subject\n\n\t\tmail to: \"[email protected]\"\n\t\tmail cc: [\"[email protected]\", \"[email protected]\"]\n\t\tmail subject: \"TEST [CCLS Patient Notification Received] Identifier: #{@study_subject.icf_master_id_to_s}\"\n\tend",
"def report_url\n report_url = \"mailto:\\\"#{translate 'admin.report_issue.name'}\\\"<#{translate 'admin.report_issue.email'}>\"\n report_url += \"?subject=#{CGI.escape translate('admin.report_issue.subject')}\"\n report_url += \"&body=#{CGI.escape translate('admin.report_issue.body')}\"\n report_url\n end",
"def email(defn, participant, assignment)\n defn[:body][:type] = \"Teammate Review\"\n participant = AssignmentParticipant.find(reviewee_id)\n topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)\n defn[:body][:obj_name] = assignment.name\n user = User.find(participant.user_id)\n defn[:body][:first_name] = user.fullname\n defn[:to] = user.email\n Mailer.sync_message(defn).deliver\n end",
"def receipt\n mail(\n to: \"[email protected]\",\n subject: \"New for review for your commute\"\n )\n end",
"def send_new_notifcation(server, metric, metric_details)\n servername = server.upcase\n #puts metric_details.class\n subject = \"[WATCHCAT] Issue on #{server}\"\n body = \"#{servername} has a problem with #{metric[server]}. \\n #{metric[server]} is \\n\"\n if (metric_details.class == Array)\n metric_details.each do |detail|\n detail.each do |k,v|\n body << \"#{k} - #{v} \\n\" \n end\n body << \"---------- \\n\"\n end\n else\n body << metric_details.to_s\n end\n \n #send email\n send_mail(subject, body)\n \nend"
]
| [
"0.62613153",
"0.60695267",
"0.5953663",
"0.5815612",
"0.58054847",
"0.57805985",
"0.5767882",
"0.57628787",
"0.575934",
"0.57584065",
"0.57250553",
"0.57060987",
"0.56945837",
"0.568172",
"0.5637443",
"0.5605159",
"0.5601538",
"0.55704343",
"0.55512136",
"0.55248755",
"0.55201185",
"0.55094343",
"0.5499727",
"0.54943126",
"0.5487548",
"0.5476459",
"0.54751",
"0.5465655",
"0.5459989",
"0.5459465"
]
| 0.68020076 | 0 |
GET /brite_td_aswaxman_rt_waxmen GET /brite_td_aswaxman_rt_waxmen.json | def index
@brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end",
"def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end",
"def set_brite_td_aswaxman_rt_waxman\n @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.find(params[:id])\n end",
"def set_brite_td_asbarabasi_rt_waxman\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.find(params[:id])\n end",
"def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end",
"def set_brite_rt_waxman\n @brite_rt_waxman = BriteRtWaxman.find(params[:id])\n end",
"def index\n @status_del_tramite_de_becas = StatusDelTramiteDeBeca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_tramite_de_becas }\n end\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end",
"def index\n @wombats = Wombat.all\n end",
"def index\n @wbr_data = WbrDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wbr_data }\n end\n end",
"def index\n @dteors = Dteor.all\n @thems = get_tem\n respond_to do |format|\n if get_tem\n format.html # index.html.erb\n format.json { render json: @dteors } \n else\n format.html { redirect_to new_student_path, notice: t(:vvedit_dani)}\n end\n \n end\n end",
"def index\n @bottlings = handle_sorting(:bottling, :sku, :wine, :bottle_size)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bottlings }\n end\n end",
"def weekIndex\n render json: Restaurant.restaurantsWeek\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def index\n @wods = Wod.order(\"created_at DESC\")\n\n render json: @wods\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end",
"def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end",
"def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end",
"def index\n @aboutshetuans = Aboutshetuan.order(\"created_at desc\").page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aboutshetuans }\n end\n end",
"def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\n end\n end",
"def show\n render json: @wellist\n end",
"def index\n @weddings = Wedding.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weddings }\n end\n end",
"def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end"
]
| [
"0.7266996",
"0.7229159",
"0.62999576",
"0.6242721",
"0.6136489",
"0.6088682",
"0.5998789",
"0.5962454",
"0.5942457",
"0.5917993",
"0.5908924",
"0.5906845",
"0.5883261",
"0.58676434",
"0.5851696",
"0.5821017",
"0.5816894",
"0.581649",
"0.58136463",
"0.5810217",
"0.58024997",
"0.58024603",
"0.5789938",
"0.5786862",
"0.57721627",
"0.575685",
"0.5748443",
"0.5740574",
"0.5733319",
"0.5723071"
]
| 0.73295295 | 0 |
POST /brite_td_aswaxman_rt_waxmen POST /brite_td_aswaxman_rt_waxmen.json | def create
@brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.new(brite_td_aswaxman_rt_waxman_params)
respond_to do |format|
if @brite_td_aswaxman_rt_waxman.save
format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully created.' }
format.json { render :show, status: :created, location: @brite_td_aswaxman_rt_waxman }
else
format.html { render :new }
format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.new(brite_td_asbarabasi_rt_waxman_params)\n\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.save\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brite_rt_waxman = BriteRtWaxman.new(brite_rt_waxman_params)\n\n respond_to do |format|\n if @brite_rt_waxman.save\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def brite_td_asbarabasi_rt_waxman_params\n params.require(:brite_td_asbarabasi_rt_waxman).permit(:name, :edgeconn, :k, :bwinter, :bwintermin, :bwintermax, :bwintra, :bwintramin, :bwintramax, :name, :description, :status, :generator_id, :type_id, :user_id)\n end",
"def brite_td_aswaxman_rt_waxman_params\n params.require(:brite_td_aswaxman_rt_waxman).permit(:name, :edgeconn, :k, :bwinter, :bwintermin, :bwintermax, :bwintra, :bwintramin, :bwintramax, :name, :n, :hs, :ls, :nodeplacement, :growthtype, :m, :alpha, :beta, :bwdist, :bwmin, :bwmax, :name_rtwaxman, :n_waxman, :hs_waxman, :ls_waxman, :nodeplacement, :growthtype_waxman, :m_waxman, :alpha_waxman, :beta_waxman, :bwdist_waxman, :bwmin_waxman, :bwmax_waxman)\n end",
"def brite_rt_waxman_params\n params.require(:brite_rt_waxman).permit(:name, :n, :hs, :ls, :nodeplacement, :growth_type, :alpha, :beta, :m, :bwdist, :bwmin, :bwmax, :name, :description, :status, :generator_id, :type_id, :user_id)\n end",
"def set_brite_td_aswaxman_rt_waxman\n @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.find(params[:id])\n end",
"def index\n @brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all\n end",
"def set_brite_td_asbarabasi_rt_waxman\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.find(params[:id])\n end",
"def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end",
"def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end",
"def update\n respond_to do |format|\n if @brite_td_aswaxman_rt_waxman.update(brite_td_aswaxman_rt_waxman_params)\n format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_aswaxman_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_brite_rt_waxman\n @brite_rt_waxman = BriteRtWaxman.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.update(brite_td_asbarabasi_rt_waxman_params)\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wombat = Wombat.new(wombat_params)\n\n respond_to do |format|\n if @wombat.save\n format.html { redirect_to @wombat, notice: 'Wombat was successfully created.' }\n format.json { render :show, status: :created, location: @wombat }\n else\n format.html { render :new }\n format.json { render json: @wombat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @thema = Thema.new(params[:thema])\n \n @themen = @thema.themengruppe.themen.order(:priority).reverse\n respond_to do |format|\n if @thema.save\n format.html { redirect_to @thema, notice: 'Thema was successfully created.' }\n format.json { render json: @thema, status: :created, location: @thema }\n format.js {render action: \"update\"}\n else\n format.html { render action: \"new\" }\n format.json { render json: @thema.errors, status: :unprocessable_entity }\n format.js { render action: \"edit\" }\n end\n end\n end",
"def destroy\n @brite_td_aswaxman_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_aswaxman_rt_waxmen_url, notice: 'Brite td aswaxman rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @wod = Wod.new(wod_params)\n\n if @wod.save\n render json: @wod, status: :created\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end",
"def create\n @wbr_datum = WbrDatum.new(params[:wbr_datum])\n\n respond_to do |format|\n if @wbr_datum.save\n format.html { redirect_to wbr_data_path, notice: 'Wbr datum was successfully created.' }\n format.json { render json: @wbr_datum, status: :created, location: @wbr_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wbr_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wizytum_params\n params.require(:wizytum).permit(:ID_wizyty, :ID_lekarza, :ID_pacjenta, :ID_recepcjonisty, :termin)\n end",
"def create\n @wizytum = Wizytum.new(wizytum_params)\n\n respond_to do |format|\n if @wizytum.save\n format.html { redirect_to @wizytum, notice: 'Wizytum was successfully created.' }\n format.json { render :show, status: :created, location: @wizytum }\n else\n format.html { render :new }\n format.json { render json: @wizytum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wager = Wager.new(params[:wager])\n\n if @wager.save\n render json: @wager, status: :created, location: @wager\n else\n render json: @wager.errors, status: :unprocessable_entity\n end\n end",
"def create\n # {\"id\":\"\",\"status_id\":\"1\",\"name\":\"aaaaa\",\"created_at\":\"\",\"updated_at\":\"\",\"tel_1\":\"34344545\",\"tel_2\":\"56676778\",\n # \"dop\":\"ddd\",\"info_type_id\":\"1\",\"info_source_id\":\"1\",\"contact_id\":\"0\",\"published\":\"1\",\n # \"haves\":[{\"obj_id\":\"2\",\"room\":\"1\",\"price_estimate\":\"\",\"price_want\":\"\",\n # \"torg\":0,\"floor\":\"2\",\"floor_house\":\"9\",\"rayon_id\":\"0\",\n # \"street_id\":\"\",\"house_n\":\"\",\"flat_n\":\"\",\"orientir\":\"\",\n # \"s_all\":\"\",\"s_live\":\"\",\"s_kux\":\"\",\"state_id\":\"0\",\n # \"year\":\"\",\"tel_1\":\"\",\"dop\":\"\",\"obmen_want\":1,\"sell_want\":0,\"rent_want\":0},\n # {\"obj_id\":\"2\",\"room\":\"1\",\"price_estimate\":\"\",\"price_want\":\"\",\"torg\":0,\n # \"floor\":\"1\",\"floor_house\":\"5\",\"rayon_id\":\"0\",\"street_id\":\"\",\"house_n\":\"\",\n # \"flat_n\":\"\",\"orientir\":\"\",\"s_all\":\"\",\"s_live\":\"\",\"s_kux\":\"\",\"state_id\":\"0\",\n # \"year\":\"\",\"tel_1\":\"\",\"dop\":\"\",\"obmen_want\":1,\"sell_want\":0,\"rent_want\":0}\n # ],\n # \"wants\":[{\"variant\":\"1\",\n # \"wishlist\":[\n # {\"field\":\"obj_id\",\"cond\":\"=\",\"value\":\"2\"},\n # {\"field\":\"room\",\"cond\":\"=\",\"value\":\"3\"}\n # ]\n # },\n # {\"variant\":\"1\",\n # \"wishlist\":[\n # {\"field\":\"obj_id\",\"cond\":\"=\",\"value\":\"2\"},\n # {\"field\":\"room\",\"cond\":\"=\",\"value\":\"1\"}\n # ]\n # }\n # ]\n # }\n\n @zayavka_params=params[\"zayavka\"]\n @haves=params[\"haves\"]\n @wants=params[\"wants\"]\n #render :text => \"out=\"[email protected]\n #return\n\n @zayavka = Zayavka.new(@zayavka_params)\n\n top_variant_id=0\n respond_to do |format|\n if @zayavka.save\n #---save have--------------\n if not @haves.empty?\n @haves.each_with_index do |item,index|\n ##item['id'] = 0\n item['room'] = item['room'] ==\"\"?0:item['room'] #---check room input\n item['tel_1'] = item['tel_1'].to_s+((@zayavka['tel_1'].blank?)?\"\":@zayavka['tel_1'].to_s)+((@zayavka['tel_2'].blank?)?\"\":@zayavka['tel_2'].to_s)\n item['zayavka_id'] = @zayavka.id\n item['top_variant_id']= top_variant_id\n item['variant'] = index+1\n item['variant_cnt'] = @haves.length\n @have_rec = Have.new (item)\n\n if @have_rec.save\n #render :text => \"have_rec out=\"+@have_rec.inspect\n #return\n top_variant_id=@have_rec.id if index==0\n if not @have_rec.update_attributes(:top_variant_id=>top_variant_id)\n format.json { render json: @have_rec.errors, status: :unprocessable_entity }\n end\n else\n format.json { render json: @have_rec.errors, status: :unprocessable_entity }\n end\n\n end\n end\n #---save want-----------------\n if @wants.empty?\n return\n end\n @wants.each_with_index do |item,index|\n #--get wants_params from POST\n ##render :text => \"want variant=\"+variant+\" wishlist= \"+item['wishlist']\n ##return\n want_obj_id,want_room ,want_rayon_id, want_price_want=0,0,0,0\n item['wishlist'].each_with_index do |wish_list_item,wi|\n want_obj_id = wish_list_item['value'] if wish_list_item['field']==\"obj_id\"\n want_room = wish_list_item['value'] if wish_list_item['field']==\"room\"\n want_rayon_id = wish_list_item['value'] if wish_list_item['field']==\"rayon_id\"\n want_price_want = wish_list_item['value'] if wish_list_item['field']==\"price_want\"\n\n end\n @want_rec=Want.new({:zayavka_id=>@zayavka.id,\n :obj_id=>want_obj_id,\n :room=>want_room,\n :rayon_id=>want_rayon_id,\n :price_want=>want_price_want,\n :tel_1=>@zayavka[\"tel_1\"],\n :tel_2=>@zayavka[\"tel_2\"]})\n if @want_rec.save\n #----wishlist uppend---\n variant=item['variant']\n w_list=item['wishlist']\n w_list.each do |row|\n @wish_list_rec=WishList.new({:want_id=>@want_rec.id,:field_name=>row['field'],:field_cond=>row['cond'],:field_value=>row['value'],:variant=>variant})\n if not @wish_list_rec.save\n format.json { render json: @wish_list_rec.errors, status: :unprocessable_entity }\n end\n end\n\n else\n format.json { render json: @want_rec.errors, status: :unprocessable_entity }\n end\n\n end\n # format.html { redirect_to @zayavka, notice: 'Zayavka was successfully created.' }\n format.json { render json: @zayavka, status: :created, location: @zayavka }\n else\n # format.html { render action: \"new\" }\n format.json { render json: @zayavka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trinh_do_can_bo = TrinhDoCanBo.new(trinh_do_can_bo_params)\n\n respond_to do |format|\n if @trinh_do_can_bo.save\n format.html { redirect_to @trinh_do_can_bo, notice: 'Trinh do can bo was successfully created.' }\n format.json { render :show, status: :created, location: @trinh_do_can_bo }\n else\n format.html { render :new }\n format.json { render json: @trinh_do_can_bo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.new(params[:status_del_tramite_de_beca])\n\n respond_to do |format|\n if @status_del_tramite_de_beca.save\n format.html { redirect_to @status_del_tramite_de_beca, notice: 'Status del tramite de beca was successfully created.' }\n format.json { render json: @status_del_tramite_de_beca, status: :created, location: @status_del_tramite_de_beca }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_del_tramite_de_beca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n respond_to do |format| \n @buchung = Buchung.new(params[:buchung]) \n if @buchung.save \n if @buchung.status==\"B\"\n format.html { redirect_to @buchung, notice: 'Buchung war erfolgreich.' }\n else\n format.html { redirect_to @buchung, notice: 'Reservierung war erfolgreich.' }\n end\n format.json { render json: @buchung, status: :created, location: @buchung }\n else \n format.html { render action: \"new\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end \n end \n end",
"def create\n @waldo = Waldo.new(waldo_params)\n\n respond_to do |format|\n if @waldo.save\n format.html { redirect_to @waldo, notice: 'Waldo was successfully created.' }\n format.json { render :show, status: :created, location: @waldo }\n else\n format.html { render :new }\n format.json { render json: @waldo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @brite_td_asbarabasi_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_asbarabasi_rt_waxmen_url, notice: 'Brite td asbarabasi rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @brend = Brend.new(params[:brend])\n\n respond_to do |format|\n if @brend.save\n format.html { redirect_to @brend, notice: 'Brend was successfully created.' }\n format.json { render json: @brend, status: :created, location: @brend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accept\n\t\t# byebug\n\t\t#Khi chap nhan 1 yeu cau thi:\n\t\t#B1: Gan role bussiness cho nguoi do\n\t\t#B2: Tao Bussiness cho nguoi do\n\t\t#B3: Tao ra chi nhanh dau tien cho nguoi do\n\t\tuser = @bussiness_request.user\n\t\tif user.is_bussiness_admin?\n\t\t\t#Neu da la bussiness_admin thi ko the nang cap, do do bo qua request do\n\t\t\t#bang cach gan no bang da duyet\n\t\t\t@bussiness_request.status_id = BussinessRequestStatus.da_duyet_status.id\n\t\t\t@bussiness_request.timeless.save\n\t\t\trender json: {message: 'Đã là tài khoản doanh nghiệp'}, status: :ok, content_type: 'application/json'\n\t\telse\n\n\t\t\t#B2: Tao Bussiness cho nguoi do\n\t\t\tbussiness = Bussiness.new\n\t\t\tbussiness.name = @bussiness_request.name\n\t\t\tbussiness.category = @bussiness_request.category\n\t\t\tbussiness.user_id = user.id\n\n\t\t\tif bussiness.save\n\t\t\t\tuser.roles ||=[]\n\t\t\t\tuser.roles << Role.bussiness_admin_role\n\t\t\t\t#B3: Tao ra chi nhanh dau tien cho nguoi do\n\t\t\t\tbranch = Branch.new\n\t\t\t\tbranch.name = @bussiness_request.name\n\t\t\t\tbranch.address = @bussiness_request.address\n\t\t\t\tbranch.phone = @bussiness_request.phone\n\t\t\t\tbranch.coordinates = [@bussiness_request.longitude, @bussiness_request.latitude]\n\t\t\t\tbranch.bussiness_id = bussiness.id\n\t\t\t\t#tao url_alias tam\n\t\t\t\tbranch.url_alias = RemoveAccent.remove_accent(@bussiness_request.name).gsub(/ /,\"\")\n\t\t\t\tbranch.begin_work_time = \"7:00\"\n\t\t\t\tbranch.end_work_time = \"24:00\"\n\n\t\t\t\tif branch.save\n\n\t\t\t\t\t@bussiness_request.status_id = BussinessRequestStatus.da_duyet_status.id\n\t\t\t\t\t@bussiness_request.timeless.save\n\t\t\t\t\t#Tao ra thong bao\n\t\t\t\t\t#Neu da lo deny va nguoi do chua xem thong bao deny thi xoa no\n\t\t\t\t\tNotificationChange.delete_notification_change user, @bussiness_request, current_user, @bussiness_request, NotificationCategory.tu_choi_cap_tai_khoan_doanh_nghiep\n\t\t\t\t\tNotificationChange.create_notification user, @bussiness_request, current_user, @bussiness_request, NotificationCategory.chap_nhan_yeu_cau_doanh_nghiep\n\t\t\t\t\t#Kich hoat thanh cong\n\t\t\t\t\trender json: {message: 'Kích hoạt thành công tài khoản doanh nghiệp'}, status: :created, content_type: 'application/json'\n\t\t\t\telse\n\t\t\t\t\trender json: {\n\t\t\t\t\t\tmessage: 'Lỗi xảy ra khi tạo branch',\n\t\t\t\t\t\terrors: branch.errors\n\t\t\t\t\t\t}, status: :bad_request\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trender json: {\n\t\t\t\t\t\tmessage: 'Lỗi xảy ra khi tạo bussiness',\n\t\t\t\t\t\terrors: bussiness.errors\n\t\t\t\t\t\t}, status: :bad_request\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend"
]
| [
"0.7143289",
"0.7027948",
"0.6670264",
"0.6601159",
"0.6490194",
"0.6452989",
"0.6346805",
"0.6303172",
"0.615388",
"0.6103412",
"0.6006599",
"0.5991535",
"0.58698064",
"0.5828309",
"0.58092797",
"0.58057415",
"0.5580395",
"0.5450999",
"0.5449492",
"0.543886",
"0.54376894",
"0.5434713",
"0.5414968",
"0.540061",
"0.5386401",
"0.5381813",
"0.5374318",
"0.53732294",
"0.53570116",
"0.5354514"
]
| 0.7195034 | 0 |
PATCH/PUT /brite_td_aswaxman_rt_waxmen/1 PATCH/PUT /brite_td_aswaxman_rt_waxmen/1.json | def update
respond_to do |format|
if @brite_td_aswaxman_rt_waxman.update(brite_td_aswaxman_rt_waxman_params)
format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully updated.' }
format.json { render :show, status: :ok, location: @brite_td_aswaxman_rt_waxman }
else
format.html { render :edit }
format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.update(brite_td_asbarabasi_rt_waxman_params)\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def update\n #@title = @header = \"Изменение торговой марки\"\n respond_to do |format|\n if @boat_series.update(boat_series_params)\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно изменена' }\n format.json { render json: @boat_series.to_json }\n else\n #format.html { render :edit }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @brend = Brend.find(params[:id])\n\n respond_to do |format|\n if @brend.update_attributes(params[:brend])\n format.html { redirect_to @brend, notice: 'Brend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bread.update(bread_params)\n format.html { redirect_to @bread, notice: 'パン情報を編集した.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bread.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @breet.update(breet_params)\n format.html { redirect_to @breet, notice: 'Breet was successfully updated.' }\n format.json { render :show, status: :ok, location: @breet }\n else\n format.html { render :edit }\n format.json { render json: @breet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n\n respond_to do |format|\n if @status_del_tramite_de_beca.update_attributes(params[:status_del_tramite_de_beca])\n format.html { redirect_to @status_del_tramite_de_beca, notice: 'Status del tramite de beca was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_del_tramite_de_beca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boat = Boat.find(params[:id], :include => [:members])\n @dockold = Dock.find(params[:Laituri]) unless params[:Laituri].blank?\n @berthold = @berth = Berth.where(:dock_id => @dockold.id, :number => params[:Laituripaikka]) unless params[:Laituri].blank?\n #@boat = Boat.find(params[:id])\n #changejnoToId\n parse_jno_from_omistajatxtbox\n change_jno_to_id_for_update\n if params[:boat][:BoatsMembers_attributes] == nil\n @onkoOk = false\n end\n\n @laituri_idt = Dock.all.map(&:id)\n @laituri_idt.insert(0,nil)\n\n @vapaat_laituripaikat = Berth.where(:dock_id => 1).all.map(&:number)\n @vapaat_laituripaikat.insert(0,nil)\n\n respond_to do |format|\n if @onkoOk && check_for_only_one_payer && @boat.update_attributes(params[:boat])\n check_dock_and_berth(format)\n format.html { redirect_to @boat, notice: 'Veneen muokkaus onnistui.' }\n format.json { head :no_content }\n else\n format.html {\n flash[:notice] = 'Virhe.'\n render action: \"edit\"\n }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @binh_bau = BinhBau.find(params[:id])\n respond_to do |format|\n if @binh_bau.update_attributes(params[:binh_bau])\n format.html { redirect_to @binh_bau, notice: 'Binh bau was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @binh_bau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bilhete = Bilhete.find(params[:id])\n\n respond_to do |format|\n if @bilhete.update_attributes(params[:bilhete])\n format.html { redirect_to @bilhete, notice: 'Bilhete was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bilhete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @brony.update(brony_params)\n format.html { redirect_to @brony, notice: 'Brony was successfully updated.' }\n format.json { render :show, status: :ok, location: @brony }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @brony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thema = Thema.find(params[:id])\n @themen = @thema.themengruppe.themen.order(:priority).reverse\n respond_to do |format|\n if @thema.update_attributes(params[:thema])\n format.html { redirect_to @thema, notice: 'Thema 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: @thema.errors, status: :unprocessable_entity }\n format.js { render action: \"edit\" }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bien.update(bien_params)\n format.html { redirect_to @bien, notice: 'Bien was successfully updated.' }\n format.json { render :show, status: :ok, location: @bien }\n else\n format.html { render :edit }\n format.json { render json: @bien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @makrana_marble.update(makrana_marble_params)\n format.html { redirect_to @makrana_marble, notice: 'Marble product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @makrana_marble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @britt.update(britt_params)\n format.html { redirect_to @britt, notice: 'Britt was successfully updated.' }\n format.json { render :show, status: :ok, location: @britt }\n else\n format.html { render :edit }\n format.json { render json: @britt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_file.update(budget_file_params)\n #if @revenue.update(revenue_params.merge({:tree_info => tree_info, :rows => rows}))\n # @budget_file.taxonomy.explanation = explanation\n # @budget_file.taxonomy.save\n\n format.html { redirect_to @budget_file, notice: t('budget_files_controller.save') }\n format.json { render :show, status: :ok, location: @budget_file }\n else\n format.html { render :edit }\n format.json { render json: @budget_file.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n if @brother.update_attributes(params[:brother])\n format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brother.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_bait = Bait.find(params[:id])\n\n respond_to do |format|\n if @admin_bait.update_attributes(params[:admin_bait])\n format.html { redirect_to @admin_bait, notice: 'Bait was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_bait.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @control_bay.update(control_bay_params)\n format.html { redirect_to ['control',@bay], notice: 'La bahía fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @bay }\n else\n format.html { render :edit }\n format.json { render json: @bay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @m_beli_nota_second_d = MBeliNotaSecondD.find(params[:id])\n\n respond_to do |format|\n if @m_beli_nota_second_d.update_attributes(params[:m_beli_nota_second_d])\n format.html { redirect_to @m_beli_nota_second_d, notice: 'M beli nota second d was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_beli_nota_second_d.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n if @razmer_go.update_attributes(params[:razmer_go])\n format.html { redirect_to @razmer_go, notice: 'Razmer go was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @razmer_go.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blar.update(blar_params)\n format.html { redirect_to @blar, notice: 'Blar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @blar.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.6856805",
"0.67771626",
"0.6650239",
"0.65176123",
"0.6372956",
"0.6281362",
"0.6272229",
"0.6253973",
"0.62455356",
"0.62190616",
"0.6189634",
"0.61780995",
"0.6168091",
"0.61661756",
"0.6151665",
"0.6149953",
"0.61417776",
"0.61407286",
"0.61232656",
"0.6098669",
"0.6096645",
"0.60960484",
"0.6094871",
"0.60781014",
"0.6072669",
"0.6050912",
"0.6030467",
"0.6030201",
"0.6018352",
"0.60126644"
]
| 0.6817557 | 1 |
DELETE /brite_td_aswaxman_rt_waxmen/1 DELETE /brite_td_aswaxman_rt_waxmen/1.json | def destroy
@brite_td_aswaxman_rt_waxman.destroy
respond_to do |format|
format.html { redirect_to brite_td_aswaxman_rt_waxmen_url, notice: 'Brite td aswaxman rt waxman was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @brite_td_asbarabasi_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_asbarabasi_rt_waxmen_url, notice: 'Brite td asbarabasi rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brite_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_rt_waxmen_url, notice: 'Brite rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @binh_bau = BinhBau.find(params[:id])\n @binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_binh_baus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bay.destroy\n respond_to do |format|\n format.html { redirect_to bays_url, notice: 'La bahía fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brend = Brend.find(params[:id])\n @brend.destroy\n\n respond_to do |format|\n format.html { redirect_to brends_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n @lich_su_binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_lich_su_binh_baus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.destroy\n\n respond_to do |format|\n format.html { redirect_to bruschetta_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.branches.each do |branch|\n branch.destroy\n end\n\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant eliminado correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @makrana_marble.destroy\n respond_to do |format|\n format.html { redirect_to makrana_marbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kishangarh_marble.destroy\n respond_to do |format|\n format.html { redirect_to kishangarh_marbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_bait = Bait.find(params[:id])\n @admin_bait.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_baits_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_city_hall_story.destroy\n respond_to do |format|\n format.html { redirect_to admin_city_hall_stories_url, notice: 'Dati Comune cancellata con successo!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rb.destroy\n respond_to do |format|\n format.html { redirect_to rbs_url, notice: 'Erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trinh_do_can_bo.destroy\n respond_to do |format|\n format.html { redirect_to trinh_do_can_bos_url, notice: 'Trinh do can bo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n @buchung = Buchung.find(params[:id])\n @buchung.destroy\n\n respond_to do |format|\n format.html { redirect_to buchungs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_menu.destroy\n respond_to do |format|\n format.html { redirect_to edit_cafeteria_menu_path(@dish_menu.menu.cafeteria, @dish_menu.menu), notice: 'El plato se eliminó del menú.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @men_fashion = MenFashion.find(params[:id])\n @men_fashion.destroy\n\n respond_to do |format|\n format.html { redirect_to men_fashions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n @diemtrentuyen.destroy\n\n respond_to do |format|\n format.html { redirect_to diemtrentuyens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @burrito.destroy\n respond_to do |format|\n format.html { redirect_to burritos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brand.destroy\n respond_to do |format|\n format.html { redirect_to cp_brands_url, notice: 'Бренд удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beast.destroy\n respond_to do |format|\n format.html { redirect_to beasts_url, notice: 'Bestia została usunięta' }\n format.json { head :no_content }\n end\n end"
]
| [
"0.723907",
"0.7148391",
"0.6709805",
"0.66736525",
"0.66564125",
"0.6645162",
"0.6642611",
"0.66244006",
"0.659273",
"0.65717876",
"0.65699446",
"0.65517086",
"0.6549124",
"0.6523843",
"0.65189874",
"0.6508655",
"0.6506563",
"0.65052927",
"0.65009266",
"0.6497982",
"0.64851284",
"0.6482506",
"0.6455156",
"0.6455034",
"0.645498",
"0.64466095",
"0.6444155",
"0.6433643",
"0.6431028",
"0.64297175"
]
| 0.7212478 | 1 |
with this Object method we can obtain a hash named "hashinfo" with the gene information (from de Gene Classe) corresponding to the idmutant_gene we have in the StockData Class. | def gene_information(i)
if $gene[i].geneid == $stockdata[i].idmutant_gene
$hashinfo["#{$stockdata[i].stock}"] = $gene[i]
end
return $hashinfo
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n\n self.h.fei.hash\n end",
"def hash\n data.hash\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def hash\r\n id.hash\r\n end",
"def hash_id\n @hid\n end",
"def hash\n self.atoms.hash\n end",
"def hash\n\t\t[@id].hash\n\tend",
"def hash\n value_id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n fullname.hash\n end",
"def hash\n @hash\n end",
"def hash\n @id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n name.hash ^ provider.hash\n end",
"def hash\n return @id.hash\n end",
"def hash\n guid.hash\n end",
"def hash\n [discriminator, name].hash\n end",
"def hash\n id\n end"
]
| [
"0.6465471",
"0.6442642",
"0.6309819",
"0.62425673",
"0.62281996",
"0.6226559",
"0.61924684",
"0.61439884",
"0.6132281",
"0.61163396",
"0.6110101",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.6106149",
"0.6090522",
"0.6064683",
"0.60637254",
"0.60626245",
"0.60535425",
"0.60397226",
"0.6036368",
"0.60247546",
"0.60117614"
]
| 0.81766635 | 0 |
Do we have all the information necessary to subscribe to the list? | def wants_to_subscribe?
source_is_ffcrm? && has_list?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribed; end",
"def suscription_on?\n is_subscribed == true\n end",
"def subscribe?\n self.type == :subscribe\n end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def subscribed?\n self.type == :subscribed\n end",
"def IsSubscribed=(arg0)",
"def IsSubscribed=(arg0)",
"def subscribed?\n status == 1 || status == 2\n end",
"def subscribed?(event)\n subscriptions.include?(event)\n end",
"def request?\n self.type == :subscribe\n end",
"def subscribed # :doc:\n # Override in subclasses\n end",
"def subscribed?\n self.subscription == :subscribed\n end",
"def subscribe\n self.subscribed = true\n end",
"def subscribe_notifications\n @subscribe_notifications ||= true\n end",
"def subscribed?(email)\n list.include? email\n end",
"def subscribed?\n !ended? && !unsubscribed?\n end",
"def can_subscribe?()\n \treturn !(self.phoneNumber.nil?)\n\tend",
"def subscribe!\n # TODO: Implement\n end",
"def IsSubscribed()\r\n ret = _getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def IsSubscribed()\r\n ret = _getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def subscribe\n \nend",
"def subscribes\n @subscribes ||= user_data_as_array('subscribe')\n @subscribes\n end",
"def subscribed()\n\t\t#add access token to header\n\t\theader = {\"Authorization\": \"Bearer #{@adal_response.access_token}\"}\n\t\t#poll to get available content\n\t\trequest_uri = \"https://manage.office.com/api/v1.0/#{@tenantid}/activity/feed/subscriptions/list\"\n response = Requests.request(\"GET\", request_uri, headers: header)\n @logger.info(\"[#{@content_type}] Subscription list: \\n#{response.json()}}\")\n\n\t\tresponse.json().each do |item|\n\t\t\tif item[\"contentType\"] == @content_type\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\tfalse\n\tend",
"def check_subscription\n !subscribed || subscription_present?\n end",
"def subscribing?(other_user)\n subscribing.include?(other_user)\n end",
"def subscribed?\n [email protected]? && @attributes.include?(:Subscribed)\n end",
"def no_subscriptions?\n subscribables.empty? && !toc\n end",
"def subscribed?\n managers.map(&:subscribed?).include?(true) ? true : false\n end"
]
| [
"0.7369187",
"0.70999265",
"0.7083483",
"0.7030307",
"0.7030307",
"0.7030307",
"0.69052047",
"0.69015425",
"0.69015425",
"0.6881362",
"0.68245757",
"0.6804293",
"0.67777437",
"0.6748859",
"0.67058784",
"0.66932976",
"0.6669622",
"0.66626",
"0.6660518",
"0.66113245",
"0.6580011",
"0.6580011",
"0.65718204",
"0.65589184",
"0.6545992",
"0.6500901",
"0.6420269",
"0.63941324",
"0.63931787",
"0.6357199"
]
| 0.7500854 | 0 |
Retrieves the cell information based on the parameters specified inside the `cell` object | def get_cell(cell)
query_cell_info '/cell/get', cell
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell(cell)\n @board[cell]\n end",
"def get_cell(row, column)\n @fields[row][column]\n end",
"def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end",
"def get_elem cell\n\t\treturn @elements[cell]\n\tend",
"def cell(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @cell[sheet].fetch(normalize(row, col).to_a, nil)\n end",
"def build_cell(cell)\n # implement in row class\n nil\n end",
"def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end",
"def get_cell(x, y)\n grid[x][y]\n end",
"def getCell(x, y)\n return @grid.getCell(x,y)\n end",
"def cell(row, column)\n row = row(row)\n cell_value( row.get_or_create_cell( column ) )\n end",
"def getCell(row, column)\n\n\t\treturn @grid.getElement(row, column)\n\tend",
"def get_cell(id, column_family_name, column_name)\n if cell = connection.get(name, id, \"#{column_family_name.to_s}:#{column_name.to_s}\", {}).first\n MassiveRecord::Wrapper::Cell.populate_from_tcell(cell)\n end\n end",
"def getCell(row, col)\n # Make sure the row/col combination is within the matrix.\n if row > @rows || col > @cols || row <= 0 || col <= 0\n return 0\n end\n return @info[row][col]\n end",
"def cell(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if celltype(row,col,sheet) == :date\n yyyy,mm,dd = @cell[sheet][[row,col]].split('-')\n return Date.new(yyyy.to_i,mm.to_i,dd.to_i)\n elsif celltype(row,col,sheet) == :datetime\n date_part,time_part = @cell[sheet][[row,col]].split(' ')\n yyyy,mm,dd = date_part.split('-')\n hh,mi,ss = time_part.split(':')\n return DateTime.civil(yyyy.to_i,mm.to_i,dd.to_i,hh.to_i,mi.to_i,ss.to_i)\n end\n @cell[sheet][[row,col]]\n end",
"def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n raise RangeError, \"illegal sheet <#{sheet}>\" unless sheets.index(sheet)\n sheet_no = sheets.index(sheet)+1\n xml = @gs.fulldoc(sheet_no).to_s\n doc = XML::Parser.string(xml).parse\n doc.find(\"//*[local-name()='cell']\").each do |item|\n row = item['row']\n col = item['col']\n key = \"#{row},#{col}\"\n string_value = item['inputvalue'] || item['inputValue'] \n numeric_value = item['numericvalue'] || item['numericValue'] \n (value, value_type) = determine_datatype(string_value, numeric_value)\n @cell[sheet][key] = value unless value == \"\" or value == nil\n @cell_type[sheet][key] = value_type \n @formula[sheet] = {} unless @formula[sheet]\n @formula[sheet][key] = string_value if value_type == :formula\n end\n @cells_read[sheet] = true\n end",
"def cell\n {\n # Use the model's properties to populate data in the hash\n title: name,\n # subtitle: {}\n }\n end",
"def data_at(sheet_index, record_index, cell_index)\n @sheets[sheet_index].records[record_index].cells[cell_index]\n end",
"def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n sheet_found = false\n raise ArgumentError, \"Error: sheet '#{sheet||'nil'}' not valid\" if @default_sheet == nil and sheet==nil\n raise RangeError unless self.sheets.include? sheet\n n = self.sheets.index(sheet)\n #TODO: @sheet_doc[n].find(\"//*[local-name()='c']\").each do |c|\n @sheet_doc[n].xpath(\"//*[local-name()='c']\").each do |c|\n #TODO: s_attribute = c.attributes.to_h['s'].to_i # should be here\n s_attribute = c['s'].to_i # should be here\n #TODO: if (c.attributes.to_h['t'] == 's')\n # c: <c r=\"A5\" s=\"2\">\n # <v>22606</v>\n # </c>, format: , tmp_type: float\n\n if c['t'] == 's'\n tmp_type = :shared\n #TODO: elsif (c.attributes.to_h['t'] == 'b')\n elsif c['t'] == 'b'\n tmp_type = :boolean\n else\n #s_attribute = c.attributes.to_h['s'].to_i # was here\n s_attribute = c['s'].to_i # was here\n format = attribute2format(s_attribute)\n tmp_type = format2type(format)\n end\n formula = nil\n #TODO: c.each_element do |cell|\n c.children.each do |cell|\n #TODO: if cell.name == 'f'\n if cell.name == 'f'\n formula = cell.content\n end\n #TODO: if cell.name == 'v'\n if cell.name == 'v'\n if tmp_type == :time or tmp_type == :datetime\n if cell.content.to_f >= 1.0 \n if (cell.content.to_f - cell.content.to_f.floor).abs > 0.000001 \n tmp_type = :datetime \n else\n tmp_type = :date\n end\n else\n end \n end\n excelx_type = [:numeric_or_formula,format.to_s]\n excelx_value = cell.content\n if tmp_type == :shared\n vt = :string\n str_v = @shared_table[cell.content.to_i]\n excelx_type = :string\n elsif tmp_type == :boolean\n vt = :boolean\n cell.content.to_i == 1 ? v = 'TRUE' : v = 'FALSE'\n elsif tmp_type == :date\n vt = :date\n v = cell.content\n elsif tmp_type == :time\n vt = :time\n v = cell.content\n elsif tmp_type == :datetime\n vt = :datetime\n v = cell.content\n elsif tmp_type == :formula\n vt = :formula\n v = cell.content.to_f #TODO: !!!!\n else\n vt = :float\n v = cell.content\n end\n #puts \"vt: #{vt}\" if cell.text.include? \"22606.5120\"\n #TODO: x,y = split_coordinate(c.attributes.to_h['r'])\n x,y = split_coordinate(c['r'])\n tr=nil #TODO: ???s\n set_cell_values(sheet,x,y,0,v,vt,formula,tr,str_v,excelx_type,excelx_value,s_attribute)\n end\n end\n end\n sheet_found = true #TODO:\n if !sheet_found\n raise RangeError\n end\n @cells_read[sheet] = true\n end",
"def [](cell_name)\n cell = Cell.select_or_create_cell(cell_name, self)\n \n end",
"def cells\n attributes.fetch(:cells)\n end",
"def give_cell_status\n cell = get_cell\n cell_status(cell)\n end",
"def cell(row_index, column_index)\n row(row_index).cell(column_index)\n end",
"def get(row, column)\n cell(normalize_key(row), normalize_key(column))\n end",
"def get(row, column)\n cell(normalize_key(row), normalize_key(column))\n end",
"def read_cell(row, idx)\n return read_cell_date_or_time(row, idx) if date_or_time?(row, idx)\n\n cell = read_cell_content(row, idx)\n case cell\n when Integer, Fixnum, Bignum\n value_type = :float\n value = cell.to_i\n when Float\n value_type = :float\n value = cell.to_f\n when String, TrueClass, FalseClass\n value_type = :string\n value = normalize_string(cell.to_s)\n when ::Spreadsheet::Link\n value_type = :link\n value = cell\n else\n value_type = cell.class.to_s.downcase.to_sym\n value = nil\n end # case\n\n [value_type, value]\n end",
"def cellAt(row, col)\n\t\treturn @rows[row][col]\n\tend",
"def celltype(row, col, sheet = default_sheet)\n read_cells(sheet)\n row, col = normalize(row, col)\n if @formula.size > 0 && @formula[sheet][\"#{row},#{col}\"]\n :formula\n else\n @cell_type[sheet][\"#{row},#{col}\"]\n end\n end",
"def cell(loc)\n @map[loc]\n end",
"def build_cell(cell)\n update_cell_value(cell)\n observe(self.row, \"value\") do |old_value, new_value|\n update_cell_value(cell)\n end\n nil\n end",
"def cell(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n check_default_sheet #TODO: 2007-12-16\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n value = @cell[sheet][\"#{row},#{col}\"]\n if celltype(row,col,sheet) == :date\n begin\n return Date.strptime(value, @date_format)\n rescue ArgumentError\n raise \"Invalid Date #{sheet}[#{row},#{col}] #{value} using format '{@date_format}'\"\n end\n elsif celltype(row,col,sheet) == :datetime\n begin\n return DateTime.strptime(value, @datetime_format)\n rescue ArgumentError\n raise \"Invalid DateTime #{sheet}[#{row},#{col}] #{value} using format '{@datetime_format}'\"\n end\n end \n return value\n end"
]
| [
"0.6700249",
"0.65839696",
"0.65731555",
"0.6518436",
"0.6300283",
"0.6229153",
"0.6165501",
"0.6158154",
"0.6138333",
"0.6138228",
"0.61308724",
"0.6109513",
"0.60202676",
"0.59902996",
"0.5939663",
"0.5932703",
"0.5928645",
"0.5925812",
"0.5908698",
"0.58960766",
"0.58673286",
"0.58447176",
"0.58431685",
"0.58431685",
"0.58286107",
"0.5818812",
"0.5809374",
"0.58082145",
"0.5802272",
"0.57382023"
]
| 0.8008553 | 0 |
Retrieves the cell information and the measures used to calculate its position based on the parameters specified in the cell object | def get_cell_measures(cell)
query_cell_info '/cell/getMeasures', cell
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end",
"def get_cell(cell)\n query_cell_info '/cell/get', cell\n end",
"def cells\n @cells\n end",
"def cells\n @cells\n end",
"def cells\n attributes.fetch(:cells)\n end",
"def _cell_zoom\r\n @x = params[:x]\r\n @y = params[:y]\r\n @otu = Otu.find(params[:otu_id])\r\n @chr = Chr.find(params[:chr_id])\r\n @confidences = @proj.confidences\r\n @mx = Mx.find(params[:mx_id])\r\n end",
"def calc_coordinate(cell_name)\n col = COLUMNS.index(cell_name.slice /[A-Z]+/)\n row = (cell_name.slice /\\d+/).to_i - 1 # rows in drawings start with 0\n [row, col]\n end",
"def get_elem cell\n\t\treturn @elements[cell]\n\tend",
"def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n sheet_found = false\n raise ArgumentError, \"Error: sheet '#{sheet||'nil'}' not valid\" if @default_sheet == nil and sheet==nil\n raise RangeError unless self.sheets.include? sheet\n n = self.sheets.index(sheet)\n #TODO: @sheet_doc[n].find(\"//*[local-name()='c']\").each do |c|\n @sheet_doc[n].xpath(\"//*[local-name()='c']\").each do |c|\n #TODO: s_attribute = c.attributes.to_h['s'].to_i # should be here\n s_attribute = c['s'].to_i # should be here\n #TODO: if (c.attributes.to_h['t'] == 's')\n # c: <c r=\"A5\" s=\"2\">\n # <v>22606</v>\n # </c>, format: , tmp_type: float\n\n if c['t'] == 's'\n tmp_type = :shared\n #TODO: elsif (c.attributes.to_h['t'] == 'b')\n elsif c['t'] == 'b'\n tmp_type = :boolean\n else\n #s_attribute = c.attributes.to_h['s'].to_i # was here\n s_attribute = c['s'].to_i # was here\n format = attribute2format(s_attribute)\n tmp_type = format2type(format)\n end\n formula = nil\n #TODO: c.each_element do |cell|\n c.children.each do |cell|\n #TODO: if cell.name == 'f'\n if cell.name == 'f'\n formula = cell.content\n end\n #TODO: if cell.name == 'v'\n if cell.name == 'v'\n if tmp_type == :time or tmp_type == :datetime\n if cell.content.to_f >= 1.0 \n if (cell.content.to_f - cell.content.to_f.floor).abs > 0.000001 \n tmp_type = :datetime \n else\n tmp_type = :date\n end\n else\n end \n end\n excelx_type = [:numeric_or_formula,format.to_s]\n excelx_value = cell.content\n if tmp_type == :shared\n vt = :string\n str_v = @shared_table[cell.content.to_i]\n excelx_type = :string\n elsif tmp_type == :boolean\n vt = :boolean\n cell.content.to_i == 1 ? v = 'TRUE' : v = 'FALSE'\n elsif tmp_type == :date\n vt = :date\n v = cell.content\n elsif tmp_type == :time\n vt = :time\n v = cell.content\n elsif tmp_type == :datetime\n vt = :datetime\n v = cell.content\n elsif tmp_type == :formula\n vt = :formula\n v = cell.content.to_f #TODO: !!!!\n else\n vt = :float\n v = cell.content\n end\n #puts \"vt: #{vt}\" if cell.text.include? \"22606.5120\"\n #TODO: x,y = split_coordinate(c.attributes.to_h['r'])\n x,y = split_coordinate(c['r'])\n tr=nil #TODO: ???s\n set_cell_values(sheet,x,y,0,v,vt,formula,tr,str_v,excelx_type,excelx_value,s_attribute)\n end\n end\n end\n sheet_found = true #TODO:\n if !sheet_found\n raise RangeError\n end\n @cells_read[sheet] = true\n end",
"def contents_of cell:\n\t\tif distances && distances[cell]\n\t\t\tdistances[cell].to_s(36)[-1]\n\t\telse\n\t\t\t\" \"\n\t\tend\n\tend",
"def actual_cells\n @cells.compact\n end",
"def cell(cell)\n @board[cell]\n end",
"def get_cell(row, column)\n @fields[row][column]\n end",
"def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n raise RangeError, \"illegal sheet <#{sheet}>\" unless sheets.index(sheet)\n sheet_no = sheets.index(sheet)+1\n xml = @gs.fulldoc(sheet_no).to_s\n doc = XML::Parser.string(xml).parse\n doc.find(\"//*[local-name()='cell']\").each do |item|\n row = item['row']\n col = item['col']\n key = \"#{row},#{col}\"\n string_value = item['inputvalue'] || item['inputValue'] \n numeric_value = item['numericvalue'] || item['numericValue'] \n (value, value_type) = determine_datatype(string_value, numeric_value)\n @cell[sheet][key] = value unless value == \"\" or value == nil\n @cell_type[sheet][key] = value_type \n @formula[sheet] = {} unless @formula[sheet]\n @formula[sheet][key] = string_value if value_type == :formula\n end\n @cells_read[sheet] = true\n end",
"def position(cell)\n index = cell.to_i - 1\n (index >= 0 && index <= 8) ? self.cells[index] : nil\n end",
"def top_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col, cell.row-1)}\n end",
"def position(input)\n cells[self.idx(input)]\n end",
"def cell(data)\n rw, col, ixfe = data.unpack('v3')\n\n {\n rw: rw, # rw (2 bytes): An Rw that specifies the row.\n col: col, # col (2 bytes): A Col that specifies the column.\n ixfe: ixfe # ixfe (2 bytes): An IXFCell that specifies the XF record.\n }\n end",
"def getCell(row, col)\n # Make sure the row/col combination is within the matrix.\n if row > @rows || col > @cols || row <= 0 || col <= 0\n return 0\n end\n return @info[row][col]\n end",
"def cal_pos\n x, y = map_location(@grid_x, @grid_y)\n x += @tile_size/2\n y += @tile_size/2\n [x,y]\n end",
"def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end",
"def cells\n @cells ||= []\n end",
"def get(row, col)\n validate_pos(row, col)\n @fm[row*@cols + col]\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 excel_calculated_cells\n @calculated_cells = {} unless defined? @calculated_cells\n @calculated_cells\n end",
"def get_value(row, col)\n @rectangle[row][col]\n end",
"def cell(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if celltype(row,col,sheet) == :date\n yyyy,mm,dd = @cell[sheet][[row,col]].split('-')\n return Date.new(yyyy.to_i,mm.to_i,dd.to_i)\n elsif celltype(row,col,sheet) == :datetime\n date_part,time_part = @cell[sheet][[row,col]].split(' ')\n yyyy,mm,dd = date_part.split('-')\n hh,mi,ss = time_part.split(':')\n return DateTime.civil(yyyy.to_i,mm.to_i,dd.to_i,hh.to_i,mi.to_i,ss.to_i)\n end\n @cell[sheet][[row,col]]\n end",
"def getCell(x, y)\n return @grid.getCell(x,y)\n end",
"def calc_position_emus(worksheet)\n c_start, r_start,\n xx1, yy1, c_end, r_end,\n xx2, yy2, x_abslt, y_abslt =\n worksheet.position_object_pixels(\n @column_start,\n @row_start,\n @x_offset,\n @y_offset,\n @width * @scale_x,\n @height * @scale_y\n )\n\n # Now that x2/y2 have been calculated with a potentially negative\n # width/height we use the absolute value and convert to EMUs.\n @width_emu = (@width * 9_525).abs.to_i\n @height_emu = (@height * 9_525).abs.to_i\n\n @column_start = c_start.to_i\n @row_start = r_start.to_i\n @column_end = c_end.to_i\n @row_end = r_end.to_i\n\n # Convert the pixel values to EMUs. See above.\n @x1 = (xx1 * 9_525).to_i\n @y1 = (yy1 * 9_525).to_i\n @x2 = (xx2 * 9_525).to_i\n @y2 = (yy2 * 9_525).to_i\n @x_abs = (x_abslt * 9_525).to_i\n @y_abs = (y_abslt * 9_525).to_i\n end",
"def get_cell_value(row = 1, column = 1)\n unless row.is_a?(Integer) && column.is_a?(Integer)\n raise IncorrectCellPosition, 'Incorrect cell position'.freeze\n end\n\n if row > 3 || column > 3 || row < 1 || column < 1\n raise OutOfCellError, 'No cell available in this zone'.freeze\n end\n\n return self.send cell_column(row, column)\n end"
]
| [
"0.62560666",
"0.6222559",
"0.62159985",
"0.62159985",
"0.60673016",
"0.5987495",
"0.5933318",
"0.58349663",
"0.5792557",
"0.57904845",
"0.5641396",
"0.56357855",
"0.56024545",
"0.5574954",
"0.5553867",
"0.5543224",
"0.5542443",
"0.55342656",
"0.55334157",
"0.55284816",
"0.55245286",
"0.5497564",
"0.5466105",
"0.5463202",
"0.5450129",
"0.544971",
"0.5371137",
"0.5362358",
"0.5360044",
"0.53448874"
]
| 0.6489639 | 0 |
Retrieves all the cells located inside the bounding box and whose parameters match the ones specified in the options | def get_cells_in_area(bbox, options = {})
raise ArgumentError, 'options must be a Hash' unless options.is_a? Hash
raise ArgumentError, 'bbox must be of type BBox' unless bbox.is_a? BBox
params = {bbox: bbox.to_s, fmt: 'xml'}
params.merge!(options.reject { |key| !GET_IN_AREA_ALLOWED_PARAMS.include? key})
exec_req_and_parse_response '/cell/getInArea', params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end",
"def cells(options = {}, &block)\n cell_regex = /^cell_([0-9]+)_/\n\n options ||= { }\n\n result = block_given? ? yield : (options[:values] || [''])\n\n cell_options = result.map { {} }\n common_options = {}\n\n options.each do |k,v|\n # if the option starts with 'cell_#_' then apply it accordingly.\n if (m = cell_regex.match(k.to_s))\n k = k.to_s[m[0].length..-1].to_sym\n cell_options[m[1].to_i - 1][k] = v\n\n # the 'column' option applies only to the first cell.\n elsif k == :column\n cell_options[0][k] = v\n\n # everything else applies to all cells, unless overridden explicitly.\n elsif k != :values\n common_options[k] = v\n end\n end\n\n cell_options.each_with_index do |opt,idx|\n cell common_options.merge(opt).merge( { value: result[idx] } )\n end\n end",
"def getInArea\n max=params[:max]||100\n\tlimit=params[:limit]||200\n\tif params[:mcc] then mcc=\" mcc=\"+params[:mcc]+\" AND \" else mcc=\"\" end\n\tif params[:mnc] then mnc=\" mnc=\"+params[:mnc]+\" AND \" else mnc=\"\" end\n if params[:BBOX]\n bbox=params[:BBOX].split(',')\n r=Rect.new bbox[0].to_f,bbox[1].to_f,bbox[2].to_f,bbox[3].to_f\n else\n r=Rect.new -180.to_f,-90.to_f,180.to_f,90.to_f\n end\n @cells=Cell.find_by_sql(\"SELECT * from cells where \"+mcc+mnc+\" lat>=\"+r.minLat.to_s+\" and lat<=\"+r.maxLat.to_s+\" and lon>=\"+r.minLon.to_s+\" and lon<=\"+r.maxLon.to_s+\" LIMIT \"+limit.to_s)\n if params[:fmt]==\"xml\"\n render(:action=>\"listXml\",:layout=>false)\n elsif params[:fmt]==\"txt\"\n\t\theaders['Content-Type'] = \"text/plain\" \n render(:action=>\"listCsv\",:layout=>false)\n else\n render(:action=>\"listKml\",:layout=>false)\n end\n end",
"def scan_cells(&block)\n scan_all(cells_criteria, &block)\n end",
"def get_cells(y_index, x_index, y_vector, x_vector, velocity)\n cells = []\n\n for i in 0 .. velocity\n x = (x_vector * i) + x_index\n y = (y_vector * i) + y_index\n if cell_in_grid(y, x)\n cells.push(OpenStruct.new(:x => x, :y => y, :val => $grid[y][x]))\n end\n\n end\n return cells\nend",
"def points(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all.\n map { |row| MapKit::Point.new(row[:lat], row[:lng]) }\n end",
"def intersect(boundingbox)\n end",
"def find_neighbors(cell)\n min_r = [0, cell.row - 1].max\n max_r = [cell.row + 1, rows - 1].min\n min_c = [0, cell.column - 1].max\n max_c = [cell.column + 1, columns - 1].min\n\n get_cells(min_r..max_r, min_c..max_c).select { |x| x unless x == cell }\n end",
"def getEntitySearchWhatByboundingbox( what, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['what'] = what\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/what/byboundingbox\",params)\n end",
"def within_gridcell(*arguments, **options, &block)\n within(:gridcell, *arguments, **options, &block)\n end",
"def cells\n @cells\n end",
"def cells\n @cells\n end",
"def bounding_box\r\n max_x, min_x, max_y, min_y = -Float::MAX, Float::MAX, -Float::MAX, Float::MAX, -Float::MAX, Float::MAX \r\n if with_z\r\n max_z, min_z = -Float::MAX, Float::MAX\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n max_z = ne.z if ne.z > max_z\r\n min_z = sw.z if sw.z < min_z \r\n end\r\n [Point.from_x_y_z(min_x,min_y,min_z),Point.from_x_y_z(max_x,max_y,max_z)]\r\n else\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n end\r\n [Point.from_x_y(min_x,min_y),Point.from_x_y(max_x,max_y)]\r\n end\r\n end",
"def subset_bounding_box *indices\n subset = @vbuffer.nget([*indices].flatten)\n Cuboid.new subset.min(1).to_a, subset.max(1).to_a\n end",
"def geo_within_box_query(box)\n {\n '$geoWithin' => {\n '$box' => [[box.w, box.s], [box.e, box.n]]\n }\n }\n end",
"def get_cells(rows, columns)\n cells = []\n rows.each do |r|\n columns.each do |c|\n cells << @fields[r][c]\n end\n end\n cells\n end",
"def cells_overlapping(x, y)\n cells_at_points(corner_points_of_entity(x, y)).collect {|cx, cy| at(cx, cy) }\n end",
"def find_cell(cells, x, y)\n cells.detect{|cell| cell.x == x && cell.y == y }\nend",
"def unblocked_cells(options = {})\n cells.select {|c, v| v.empty? || v.content == 'R' || v.content == 'C' }\n end",
"def search_within(bounding_box, query, offset = 0, limit = 5, language = 'english')\n if bounding_box[:sw][:latitude]\n many.search_within(query, language, limit, offset, bounding_box[:sw][:latitude], bounding_box[:sw][:longitude], bounding_box[:ne][:latitude], bounding_box[:ne][:longitude]).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n else\n many.search(query, language, limit, offset).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n end\n end",
"def available_cells\n cells = []\n rows.each_with_index do |row, ri|\n row.each_with_index do |cell, ci|\n cells << [ri, ci] if cell.nil?\n end\n end\n cells\n end",
"def cells(opts = {})\n CellCollection.new(self, opts)\n end",
"def getEntitySearchByboundingbox( latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/byboundingbox\",params)\n end",
"def cells\n @cells ||= coordinates.collect {|coordinate| Cell.new(coordinate: coordinate)}\n end",
"def bounds\n @bounding_box\n end",
"def cells\n @cells ||= []\n end",
"def bbox\n envelope = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(extent).envelope #TODO: replace with rgeo\n [envelope.lower_corner.x, envelope.lower_corner.y, envelope.upper_corner.x, envelope.upper_corner.y]\n end",
"def bounding_box\n north_east = @data['bounds']['northeast']\n south_west = @data['bounds']['southwest']\n \n [north_east['lat'], north_east['lng'], south_west['lat'], south_west['lng']]\n end",
"def find_all_options(num_index)\n square_options = get_group(@puzzle_grid_in_squares,num_index)\n\n column_options = get_group(@puzzle_grid_in_columns,num_index)\n\n row_options = get_group(@puzzle_grid_in_rows,num_index)\n\n all_options = square_options + column_options + row_options\n\n find_triplets(all_options)\n end",
"def sudoku_with_options(grid_lines, grid_columns, sudoku)\n sudoku_grids = sudoku_grids(grid_lines, grid_columns, sudoku)\n sudoku_flatten = sudoku.map { |element| element.flatten }\n sudoku_transpose_flatten = sudoku.transpose.map { |element| element.flatten }\n\n sudoku_with_options = []\n line_index = 0\n\n sudoku_with_options = sudoku.each_with_index do |line, line_index|\n cell_index = 0\n line.each_with_index do |cell, cell_index|\n sudoku_grids_index = (line_index / grid_lines) * grid_lines + (cell_index / grid_columns)\n unless cell.length == 1\n (1..grid_size(grid_lines, grid_columns)).to_a.each do |i|\n cell << i unless sudoku_flatten[line_index].include?(i) || sudoku_transpose_flatten[cell_index].include?(i) || sudoku_grids[sudoku_grids_index].include?(i)\n end\n end\n cell_index += 1\n end\n line_index += 1\n end\n return sudoku_with_options\nend"
]
| [
"0.62607753",
"0.6017512",
"0.58347434",
"0.58320624",
"0.57840544",
"0.54796183",
"0.5473193",
"0.5397516",
"0.5372596",
"0.535785",
"0.5335334",
"0.5335334",
"0.53150153",
"0.53017",
"0.5301368",
"0.5300782",
"0.52827024",
"0.5268867",
"0.52373934",
"0.52369547",
"0.5225494",
"0.51806724",
"0.51706606",
"0.5163916",
"0.5160266",
"0.5154497",
"0.5122829",
"0.5083829",
"0.5057842",
"0.50356644"
]
| 0.68340975 | 0 |
Adds a measure (specified by the measure object) to a given cell (specified by the cell object). In case of success the response object will also contain the cell_id and the measure_id of the newly created measure. Although the library does not check this, a valid APIkey must have been specified while initializing the this object | def add_measure(cell, measure)
raise ArgumentError, "cell must be of type Cell" unless cell.is_a? Cell
raise ArgumentError, "measure must be of type Measure" unless measure.is_a? Measure
params = cell.to_query_hash
params[:lat] = measure.lat
params[:lon] = measure.lon
params[:signal] = measure.signal if measure.signal
params[:measured_at] = measure.taken_on if measure.taken_on
exec_req_and_parse_response "/measure/add", params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_measure_from_excel(measure)\n hash = {}\n hash[:classname] = measure['measure_file_name']\n hash[:name] = measure['name']\n hash[:display_name] = measure['display_name']\n hash[:measure_type] = measure['measure_type']\n hash[:uid] = measure['uid'] ? measure['uid'] : SecureRandom.uuid\n hash[:version_id] = measure['version_id'] ? measure['version_id'] : SecureRandom.uuid\n\n # map the arguments - this can be a variable or argument, add them all as arguments first,\n # the make_variable will remove from arg and place into variables\n args = []\n\n measure['variables'].each do |variable|\n args << {\n local_variable: variable['name'],\n variable_type: variable['type'],\n name: variable['name'],\n display_name: variable['display_name'],\n display_name_short: variable['display_name_short'],\n units: variable['units'],\n default_value: variable['distribution']['static_value'],\n value: variable['distribution']['static_value']\n }\n end\n hash[:arguments] = args\n\n m = add_measure(measure['name'], measure['display_name'], measure['local_path_to_measure'], hash)\n\n measure['variables'].each do |variable|\n next unless ['variable', 'pivot'].include? variable['variable_type']\n\n dist = {\n type: variable['distribution']['type'],\n minimum: variable['distribution']['min'],\n maximum: variable['distribution']['max'],\n mean: variable['distribution']['mean'],\n standard_deviation: variable['distribution']['stddev'],\n values: variable['distribution']['discrete_values'],\n weights: variable['distribution']['discrete_weights'],\n step_size: variable['distribution']['delta_x']\n }\n opt = {\n variable_type: variable['variable_type'],\n variable_display_name_short: variable['display_name_short'],\n static_value: variable['distribution']['static_value']\n }\n\n m.make_variable(variable['name'], variable['display_name'], dist, opt)\n end\n end",
"def update\n if @measure.update(measure_params)\n head :no_content\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end",
"def create\n @measure = @attribute.attribute_measures.new(measure_params)\n if @measure.save\n render json: @measure, status: :created, location: entity_attribute_measure_url(@entity, @attribute, @measure)\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end",
"def add_measure_from_csv(measure)\n hash = {}\n hash[:classname] = measure[:measure_data][:classname]\n hash[:name] = measure[:measure_data][:name]\n hash[:display_name] = measure[:measure_data][:display_name]\n hash[:measure_type] = measure[:measure_data][:measure_type]\n hash[:uid] = measure[:measure_data][:uid] ? measure[:measure_data][:uid] : SecureRandom.uuid\n hash[:version_id] = measure[:measure_data][:version_id] ? measure[:measure_data][:version_id] : SecureRandom.uuid\n\n # map the arguments - this can be a variable or argument, add them all as arguments first,\n # the make_variable will remove from arg and place into variables\n hash[:arguments] = measure[:args]\n\n m = add_measure(measure[:measure_data][:name], measure[:measure_data][:display_name], measure[:measure_data][:local_path_to_measure], hash)\n\n measure[:vars].each do |variable|\n next unless ['variable', 'pivot'].include? variable[:variable_type]\n\n dist = variable[:distribution]\n opt = {\n variable_type: variable[:variable_type],\n variable_display_name_short: variable[:display_name_short],\n static_value: variable[:distribution][:mode]\n }\n\n m.make_variable(variable[:name], variable[:display_name], dist, opt)\n end\n end",
"def create\n @measure = Measure.new(params[:measure])\n\n respond_to do |format|\n if @measure.save\n format.html { redirect_to @measure, notice: 'Measure was successfully created.' }\n format.json { render json: @measure, status: :created, location: @measure }\n else\n format.html { render action: 'new' }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @measure = Measure.new(params[:measure])\n @measure.created_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @measure.save\n format.html { redirect_to @measure, notice: crud_notice('created', @measure) }\n format.json { render json: @measure, status: :created, location: @measure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @measure = Measure.new(measure_params)\n\n respond_to do |format|\n if @measure.save\n format.html { redirect_to @measure, notice: 'Measure was successfully created.' }\n format.json { render :show, status: :created, location: @measure }\n else\n format.html { render :new }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_measure(measure_id, importer)\n @measure_importers[measure_id] = importer\n end",
"def add_measure(measure_id, importer)\n @measure_importers[measure_id] = importer\n end",
"def add_measure(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n @items << OpenStudio::Analysis::WorkflowStep.from_measure_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n\n @items.last\n end",
"def set_measure\n @measure = Measure.find(params[:id])\n end",
"def set_measure\n @measure = Measure.find(params[:id])\n end",
"def set_measure\n @measure = Measure.find(params[:id])\n end",
"def create\n @measure = current_user.measures.build(measure_params)\n\n respond_to do |format|\n if @measure.save\n format.html { redirect_to action: :index, notice: 'Measure was successfully created.' }\n format.json { render :show, status: :created, location: @measure }\n else\n format.html { render :new }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @measure = Measure.find(params[:id])\n\n respond_to do |format|\n if @measure.update_attributes(params[:measure])\n format.html { redirect_to @measure, notice: 'Measure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @measure = current_user.account.measures.new(params[:measure])\n\n respond_to do |format|\n if @measure.save\n flash[:notice] = 'Measure was successfully created.'\n format.html { redirect_to(@measure) }\n format.xml { render :xml => @measure, :status => :created, :location => @measure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @measure.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @measure.update(measure_params)\n format.html { redirect_to @measure, notice: 'Measure was successfully updated.' }\n format.json { render :show, status: :ok, location: @measure }\n else\n format.html { render :edit }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @measure.update(measure_params)\n format.html { redirect_to @measure, notice: 'Measure was successfully updated.' }\n format.json { render :show, status: :ok, location: @measure }\n else\n format.html { render :edit }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def measure=(measure)\n if measure.nil?\n fail ArgumentError, 'invalid value for \"measure\", measure cannot be nil.'\n end\n @measure = measure\n end",
"def getMiniMeasurement\n#measurements\n\n\n @set= ChartItem.new(\"Total Inches\")\n\n for measurement in @measurement\n \n # id: integer, user_id: integer, chest: integer, belly_upper: integer, belly_lower: integer, hips: integer, thigh: integer, arm: integer, date: datetime, created_at: datetime, updated_at: datetime\n sum = measurement.chest + measurement.belly_upper + measurement.belly_lower + measurement.hips + measurement.thigh + measurement.arm\n \n @set.addPoint(measurement.date.to_time.to_i * 1000,sum)\n \n end \n# ----------------------------------\n# now start adding them to the chart\n# ---------------------------------- \n #if @chartoptions[:measurement][0]\n \n \n @miniMeasures.add(@set)\n\n\n#end # if @chartoptions[:measurments] \nend",
"def add_measure_from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n @items << OpenStudio::Analysis::WorkflowStep.from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n\n @items.last\n end",
"def create\n @measure = Measure.new(measure_params)\n logger.debug \"New Measure: #{@measure.attributes.inspect}\"\n respond_to do |format|\n if @measure.save\n format.html { redirect_to @measure, notice: 'Measure was successfully created.' }\n format.json { render :show, status: :created, location: @measure }\n MeasureCleanupJob.set(wait: 36.hours).perform_later @measure\n else\n format.html { render :new }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n @@pumpStatus = \"|\" + measure_params[:pump_status].to_s + \"|\"\n logger.debug \"@@pumpStatus has been set to: #{@@pumpStatus}\"\n end",
"def create\n @kr_measure = KrMeasure.new(kr_measure_params)\n\n respond_to do |format|\n if @kr_measure.save\n format.html { redirect_to @kr_measure, notice: 'Kr measure was successfully created.' }\n format.json { render :show, status: :created, location: @kr_measure }\n else\n format.html { render :new }\n format.json { render json: @kr_measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_cell_measures(cell)\n query_cell_info '/cell/getMeasures', cell\n end",
"def create\n @measure_instance = MeasureInstance.new(measure_instance_params)\n\n respond_to do |format|\n if @measure_instance.save\n format.html { redirect_to @measure_instance, notice: 'Measure instance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @measure_instance }\n else\n format.html { render action: 'new' }\n format.json { render json: @measure_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_measures(connection, food_record)\n results = connection.exec(\"SELECT amount, description, grams FROM weight WHERE id = '#{food_record['id']}' ORDER BY sequence\")\n list = []\n list.push( { 'measure' => '100 grams', 'kcals' => food_record['kcal'].to_i, 'grams' => 100 })\n # example record: { \"amount\": \"1\", \"description\": \"cup\", \"grams\": \"185\" }\n results.each do |rec|\n text = [ rec['amount'].to_s, rec['description'] ].join(' ')\n kcals = food_record['kcal'].to_f * rec['grams'].to_f / 100\n list.push( { 'measure' => text.strip, 'kcals' => kcals.to_i, 'grams' => rec['grams'].to_i })\n end\n food_record['measures'] = list\nrescue PG::Error => e\n STDERR.puts e\n exit -1\nend",
"def update\n @breadcrumb = 'update'\n @measure = Measure.find(params[:id])\n @measure.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @measure.update_attributes(params[:measure])\n format.html { redirect_to @measure,\n notice: (crud_notice('updated', @measure) + \"#{undo_link(@measure)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_measurement(key, options = {})\n if options.is_a?(Hash)\n self.measurements << Measurement.lookup(key).new(options)\n else\n self.measurements << options\n end\n end",
"def create\n @unit_measure = UnitMeasure.new(unit_measure_params)\n\n respond_to do |format|\n if @unit_measure.save\n format.html { redirect_to @unit_measure, notice: 'Unit measure was successfully created.' }\n format.json { render :show, status: :created, location: @unit_measure }\n else\n format.html { render :new }\n format.json { render json: @unit_measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @breadcrumb = 'create'\n @measure = Measure.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @measure }\n end\n end"
]
| [
"0.57950705",
"0.5664046",
"0.5627946",
"0.5536319",
"0.55269486",
"0.55268526",
"0.54663694",
"0.5388411",
"0.532066",
"0.523672",
"0.51744306",
"0.51744306",
"0.51744306",
"0.5152329",
"0.50993246",
"0.5095497",
"0.50752085",
"0.50752085",
"0.50652915",
"0.4980319",
"0.49411654",
"0.49408993",
"0.49377072",
"0.48917586",
"0.4846238",
"0.48241198",
"0.48196718",
"0.48104087",
"0.47989273",
"0.47762477"
]
| 0.78555423 | 0 |
List the measures added with a given API key. | def list_measures
exec_req_and_parse_response "/measure/list"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @kr_measures = KrMeasure.all\n end",
"def stats(api_key = nil)\n if api_key && (!api_key.is_a? String)\n error = InvalidOptions.new(['API key(String)'], ['API key(String)'])\n raise error\n end\n\n # Disable cache for API key status calls\n get_request('/stats/', {:key => api_key}, true)\n end",
"def index\n @apikeys = Apikey.all\n end",
"def index\n @apikeys = Apikey.all\n end",
"def get_metrics_list\n\t\ttest_file\n\t\t[@metric]\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def show\n keys = ApiKey.where(user_id: current_user.id)\n @apikeys = []\n keys.each do |key|\n @apikeys << {'access_token' => key.access_token, 'qr' => RQRCode::QRCode.new(key.access_token, :size => 4, :level => :h)}\n end\n end",
"def index\n @measures = current_user.measures\n end",
"def usage_measures\n request = get '/1/reporting/measures'\n convert_to_mashes request\n end",
"def measures\n return [] if !measure_ids\n self.bundle.measures.in(:hqmf_id => measure_ids).order_by([[:hqmf_id, :asc],[:sub_id, :asc]])\n end",
"def list(key, **options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list',\n\t\t\t\t\t\t\t\t\t\t\t\t :video_key => key))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend",
"def index\n @unit_measures = UnitMeasure.all\n end",
"def api_keys\n rest_query(:api_key)\n end",
"def index\n @api_keys = ApiKey.includes(:user)\n end",
"def list_measures(measures_dir)\n puts 'Listing measures'\n if measures_dir.nil? || measures_dir.empty?\n puts 'Measures dir is nil or empty'\n return true\n end\n\n puts \"measures path: #{measures_dir}\"\n\n # this is to accommodate a single measures dir (like most gems)\n # or a repo with multiple directories fo measures (like OpenStudio-measures)\n measures = Dir.glob(File.join(measures_dir, '**/measure.rb'))\n if measures.empty?\n # also try nested 2-deep to support openstudio-measures\n measures = Dir.glob(File.join(measures_dir, '**/**/measure.rb'))\n end\n puts \"#{measures.length} MEASURES FOUND\"\n measures.each do |measure|\n name = measure.split('/')[-2]\n puts name.to_s\n end\n end",
"def api_keys; rest_query(:api_key); end",
"def api_keys; rest_query(:api_key); end",
"def index\n @unit_of_measures = UnitOfMeasure.all\n end",
"def show_key_associated_data(collection, data_keys)\n show do\n title \"Measured Data\"\n note \"Listed below are the data collected\"\n note \"(Concentration (ng/ul), RIN Number)\"\n table display_data(collection, data_keys)\n # TODO add in feature for tech to change QC Status\n end\n end",
"def load_dashboard_from_api\n logger.info 'Loading dashboard...'\n max_elements = 5\n username = current_user.keytech_username\n ms_from_epoch = 7.day.ago.to_i * 1000\n from_date = \"/Date(#{ms_from_epoch})/\"\n options = { fields: \"created_by=#{username}:changed_at>#{from_date}\", size: max_elements, sortBy: 'changed_at,desc' }\n\n self_created = keytechAPI.search.query(options)\n\n options = { fields: \"created_by=#{username}:changed_at>#{from_date}\",\n size: max_elements,\n sortBy: 'changed_at,desc' }\n self_changed = keytechAPI.search.query(options)\n logger.debug \"Changed items: #{self_changed}\"\n logger.debug \"Created Items: #{self_created}\"\n element_list = (self_created.elementList + self_changed.elementList)\n logger.info 'Finished loading dashboard'\n element_list.sort_by!(&:changedAt)\n element_list.reverse\n end",
"def get_event_stats ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/stats\"\n end",
"def index\n @k_measurements = KMeasurement.all\n end",
"def index\n @admin_sub_metrics = Admin::SubMetric.all\n end",
"def collect_data(api_key, ids)\n data = []\n errors = []\n for id in ids\n puts \"collecting data for \" + id.to_s\n champ_url = \"https://na.api.pvp.net/api/lol/static-data/na/v1.2/champion/\" + id.to_s\n champ_url += \"/?api_key=\" + api_key\n response = HTTParty.get(champ_url)\n case response.code\n when 200\n response_hash = response.parsed_response\n name = response_hash[\"name\"]\n title = response_hash[\"title\"]\n data += [[id, name, title]]\n when 404\n puts \"error 404\"\n errors += [id]\n data += [[id, \"no_name\", \"no_title\"]]\n end\n end\n return data\nend",
"def list_alarms(cloudwatch_client)\n response = cloudwatch_client.describe_alarms\n if response.metric_alarms.count.positive?\n response.metric_alarms.each do |alarm|\n puts alarm.alarm_name\n end\n else\n puts \"No alarms found.\"\n end\nrescue StandardError => e\n puts \"Error getting information about alarms: #{e.message}\"\nend",
"def get_metrics_list\n\t\turi = \"#{@base_url}/data\"\n\t\tresults = json_metrics_list uri\n\t\tlist = []\n\t\tresults[:hosts][0..@hosts_limit].each {|h|\n\t\t\thost_results = json_metrics_list \"#{uri}/#{h}/\"\n\t\t\tlist << host_results[:metrics].map{|r| \"#{h}/#{r}\"}\n\t\t}\n\t\treturn list.flatten\n\tend",
"def get_champ_stats(api_key, id, attributes)\n url = \"https://na1.api.riotgames.com/lol/static-data/v3/champions\"\n url += \"/\" + id.to_s + \"?api_key=\" + api_key + \"&champData=stats\"\n response = HTTParty.get(url)\n stats = {}\n case response.code\n when 200\n stats = response[\"stats\"]\n when 404\n puts \"failed to find stats for the id \" + id.to_s\n return {}\n end\n ret_set = []\n attributes.each do |attr|\n ret_set.push(stats[attr])\n end\n puts ret_set\n return ret_set\nend",
"def all_metrics\n output = `cube_info #{@fname} -l`\n output.split(\"\\n\")\n end",
"def list_api_keys(opts = {})\n @transporter.read(:GET, '/1/keys', {}, opts)\n end"
]
| [
"0.6055472",
"0.5997235",
"0.5745264",
"0.5745264",
"0.57444793",
"0.57245135",
"0.57245135",
"0.56308895",
"0.5582681",
"0.5532264",
"0.5520591",
"0.55136263",
"0.54849344",
"0.54823804",
"0.5416524",
"0.5400436",
"0.5388314",
"0.5388314",
"0.5334119",
"0.53151244",
"0.5309724",
"0.52910054",
"0.52766156",
"0.52258736",
"0.5220556",
"0.5208722",
"0.5203606",
"0.51949936",
"0.5194551",
"0.5175993"
]
| 0.6961849 | 0 |
Deletes a measure previously added with the same API key. | def delete_measure(measure_id)
raise ArgumentError,"measure_id cannot be nil" unless measure_id
exec_req_and_parse_response "/measure/delete", {id: measure_id}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @measure = Measure.find(params[:id])\n\n respond_to do |format|\n if @measure.destroy\n format.html { redirect_to measures_url,\n notice: (crud_notice('destroyed', @measure) + \"#{undo_link(@measure)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to measures_url, alert: \"#{@measure.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @measure = Measure.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to measures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measure = current_user.account.measures.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to(measures_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @measure.destroy\n\n head :no_content\n end",
"def statsd_remove_measure(method, name)\n remove_from_method(method, name, :measure)\n end",
"def destroy\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n @unit_of_measure.destroy\n get_data\n end",
"def destroy\n @measure.destroy\n respond_to do |format|\n format.html { redirect_to measures_url, notice: 'Measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measure.destroy\n respond_to do |format|\n format.html { redirect_to measures_url, notice: 'Measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measure.destroy\n respond_to do |format|\n format.html { redirect_to measures_url, notice: 'Measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kr_measure.destroy\n respond_to do |format|\n format.html { redirect_to kr_measures_url, notice: 'Kr measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measure_group = MeasureGroup.find(params[:id])\n @measure_group.destroy\n\n respond_to do |format|\n format.html { redirect_to measure_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloth_measure = ClothMeasure.find(params[:id])\n @cloth_measure.destroy\n\n respond_to do |format|\n format.html { redirect_to cloth_measures_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @unit_measure.destroy\n respond_to do |format|\n format.html { redirect_to unit_measures_url, notice: 'Unit measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_measures(start, end_measure)\n start_index = (start.to_i * self.beats_per_measure.to_i)-self.beats_per_measure.to_i-1\n end_index = (end_measure.to_i * self.beats_per_measure.to_i)-1\n i = start_index\n while i < end_index\n self.chords.delete_at(start_index)\n i+=1\n end\n end",
"def delete\n ensure_service!\n service.delete_metric name\n true\n end",
"def destroy\n @measure_instance.destroy\n respond_to do |format|\n format.html { redirect_to measure_instances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @key_metric = KeyMetric.find(params[:id])\n @key_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to(key_metrics_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @goldmeasure.destroy\n respond_to do |format|\n format.html { redirect_to goldmeasures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unit_of_measure.destroy\n respond_to do |format|\n format.html { redirect_to unit_of_measures_url, notice: 'Unit of measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove(name)\n metric = @metrics.delete(name)\n metric != nil\n end",
"def destroy\n @ballot_measure.destroy\n respond_to do |format|\n format.html { redirect_to ballot_measures_url, notice: 'Ballot measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @irradiance_measure.destroy\n respond_to do |format|\n format.html { redirect_to irradiance_measures_url, notice: 'Irradiance measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_metric(_metric)\n raise \"Not implemented\"\n end",
"def delete(key)\n @data.delete(key)\n @key_size.delete(key)\n end",
"def destroy\n metric.destroy\n\n respond_with(metric)\n end",
"def measurements_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling measurements_id_delete\" if id.nil?\n \n # resource path\n path = \"/measurements/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\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 = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: MeasurementApi#measurements_id_delete. Result: #{result.inspect}\"\n end\n return result\n end",
"def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to body_measurements_url }\n format.json { head :no_content }\n end\n end",
"def delete(key)\n instrument :delete, key: key do\n map = find_map_by_key(key)\n if map\n client.image.image_delete(map.imgur_id)\n map.destroy!\n end\n end\n end",
"def delete(key)\n attribute = key.to_sym\n details.delete(attribute)\n messages.delete(attribute)\n end",
"def destroy\n @weather_measure.destroy\n respond_to do |format|\n format.html { redirect_to weather_measures_url, notice: 'Weather measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
]
| [
"0.70181394",
"0.6752842",
"0.6710834",
"0.65900517",
"0.65266734",
"0.64706707",
"0.6384439",
"0.6384439",
"0.6384439",
"0.63701534",
"0.62971586",
"0.6178128",
"0.61148435",
"0.6089075",
"0.599364",
"0.5984563",
"0.59323937",
"0.590877",
"0.58892596",
"0.5842503",
"0.58347416",
"0.5790153",
"0.57103455",
"0.57040066",
"0.5694126",
"0.5689547",
"0.56829196",
"0.5673495",
"0.5669029",
"0.56659555"
]
| 0.76766664 | 0 |
GET /admin/kpi_templates/1 GET /admin/kpi_templates/1.json | def show
@admin_kpi_template = Admin::KpiTemplate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @admin_kpi_template }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def index\n @admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_kpi_templates }\n end\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end",
"def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end",
"def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def show\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end",
"def show\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end",
"def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end",
"def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end",
"def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end",
"def index\n @templates = Spree::Template.all\n end",
"def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end",
"def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end",
"def config_templates\r\n ConfigTemplatesController.instance\r\n end",
"def index\n @templates = ::Template.all\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def get_templates(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end",
"def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def templates_path\n @templates_path\n end",
"def show\n respond_ok \"template\", @templates\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end"
]
| [
"0.7437772",
"0.72739434",
"0.7184176",
"0.7163274",
"0.7069067",
"0.70222825",
"0.69964737",
"0.6929837",
"0.6895858",
"0.68114465",
"0.6743925",
"0.6649605",
"0.6595382",
"0.6536871",
"0.6528256",
"0.6518652",
"0.6498555",
"0.6482097",
"0.6478377",
"0.64602774",
"0.6455248",
"0.6436984",
"0.64359057",
"0.64295536",
"0.6427304",
"0.64232546",
"0.64153594",
"0.6402594",
"0.6402594",
"0.6402594"
]
| 0.7289812 | 1 |
GET /admin/kpi_templates/new GET /admin/kpi_templates/new.json | def new
@admin_kpi_template = Admin::KpiTemplate.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @admin_kpi_template }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end",
"def new\n @admin_template_software = TemplateSoftware.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template_software }\n end\n end",
"def new\n @project_template = ProjectTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_template }\n end\n end",
"def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end",
"def new\n @_template = @site.templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @_template }\n end\n end",
"def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_task }\n end\n end",
"def new\n @module_template = ModuleTemplate.new\n\t@module_template.module_parameters.build\n\t@module_template.module_instances.build\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @module_template }\n end\n end",
"def create\n @admin_template = Template.new(params[:notice])\n @admin_template.user_id=current_user.id\n\n respond_to do |format|\n if @admin_template.save\n format.html { redirect_to admin_templates_url, notice: '공지사항이 작성되었습니다.' }\n format.json { render json: @admin_template, status: :created, location: @admin_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @page_template = PageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_template }\n end\n end",
"def new\n @node_template = NodeTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_template }\n end\n end",
"def new\n @question_template = QuestionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_template }\n end\n end",
"def create\n @cv_template = CvTemplate.new(cv_template_params)\n respond_to do |format|\n if @cv_template.save\n current_user.cv_templates << @cv_template\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @cv_template }\n else\n format.html { render :new }\n format.json { render json: @cv_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_template = ProjectTemplate.new(params[:project_template])\n\n respond_to do |format|\n if @project_template.save\n format.html { redirect_to @project_template, notice: 'Project template was successfully created.' }\n format.json { render json: @project_template, status: :created, location: @project_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :manage, :all\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: @question_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @template_shift = TemplateShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_shift }\n end\n end",
"def new\n @template_package = TemplateAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_package }\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def create\n @module_template = ModuleTemplate.new(params[:module_template])\n\n respond_to do |format|\n if @module_template.save\n format.html { redirect_to @module_template, notice: 'Module template was successfully created.' }\n format.json { render json: @module_template, status: :created, location: @module_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @module_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @newsletters_template = Newsletters::Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletters_template }\n end\n end",
"def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end",
"def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end",
"def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @host_tpl = HostTpl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host_tpl }\n end\n end",
"def new\n @config_template = ConfigTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @config_template }\n format.xml { render :xml => @config_template }\n end\n end",
"def create\n restricted\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.7628031",
"0.7491061",
"0.73979896",
"0.7318499",
"0.72550195",
"0.72364664",
"0.7184336",
"0.7154141",
"0.69101703",
"0.68970555",
"0.68610317",
"0.6832197",
"0.6823529",
"0.67503005",
"0.6732363",
"0.67298216",
"0.6721883",
"0.6720589",
"0.66778696",
"0.666765",
"0.66629994",
"0.66371",
"0.6614692",
"0.659859",
"0.65943867",
"0.65943867",
"0.6588325",
"0.65818226",
"0.6561674",
"0.6557278"
]
| 0.7802102 | 0 |
POST /admin/kpi_templates POST /admin/kpi_templates.json | def create
@admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])
respond_to do |format|
if @admin_kpi_template.save
format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }
format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }
else
format.html { render action: "new" }
format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end",
"def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def template_params\n params.require(:template).permit(:title, :desc, :creator, :templateVersion, :fields, :aprovable, :acknowledgeable, :defaultemail, :parent)\n end",
"def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end",
"def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def templates; end",
"def template_params\n params.require(:template).permit(:name, :content)\n end",
"def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end",
"def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end",
"def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end",
"def index\n @admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_kpi_templates }\n end\n end",
"def create\n @admin_template = Template.new(params[:notice])\n @admin_template.user_id=current_user.id\n\n respond_to do |format|\n if @admin_template.save\n format.html { redirect_to admin_templates_url, notice: '공지사항이 작성되었습니다.' }\n format.json { render json: @admin_template, status: :created, location: @admin_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def create\n @template = Template.new(template_params)\n current_user.templates << @template\n\n respond_to do |format|\n if current_user.save\n Field.all.each do |field|\n t_field = TemplateField.new(val: \"\")\n t_field.field = field\n t_field.template = @template \n t_field.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_added') }\n else\n format.html { redirect_to dashboard_path, notice: @template.errors.full_messages[0]}\n end\n end\n end",
"def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def template_params\n params.require(:template).permit(:file, :description, :name, :html_content)\n end",
"def add_templates(host_template)\n raise('wrong type: Centreon:HostTemplate required') unless host_template.is_a?(Centreon::HostTemplate)\n raise('wrong value: host template must be valid') unless !host_template.name.nil? && !host_template.name.empty?\n raise(\"wrong value: templates can't be empty\") if host_template.templates.empty?\n\n @client.post({\n 'action' => 'addtemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [host_template.name, host_template.templates_to_s],\n }.to_json)\n end",
"def template_params\n params.require(:template).permit(:content)\n end",
"def create\n data = ConfigurationTemplate.new(name: params[:name], description: params[:description],user: current_user)\n data.save\n render json: data\n\n end",
"def set_templates(name, templates)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required') unless templates.is_a?(String)\n raise('wrong value: templates must be valid') unless !templates.nil? && !templates.empty?\n\n @client.post({\n 'action' => 'settemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, templates],\n }.to_json)\n end",
"def template_params\n params.require(:template).permit(:name, :action)\n end"
]
| [
"0.6622259",
"0.6582469",
"0.6530488",
"0.64118797",
"0.6294986",
"0.62941164",
"0.62474686",
"0.617519",
"0.6167039",
"0.6138981",
"0.61165845",
"0.6113474",
"0.6102534",
"0.6098116",
"0.6085632",
"0.6077751",
"0.6077751",
"0.6077629",
"0.6065601",
"0.60522896",
"0.6044563",
"0.60416454",
"0.600008",
"0.5982024",
"0.5959103",
"0.59580845",
"0.59562624",
"0.5956124",
"0.59536874",
"0.5953673"
]
| 0.714878 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.