query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
reply no match message
def reply_no_match(event) return if bot_node.exception_text.blank? template = [] template << { "type": "text", "text": bot_node.exception_text.gsub(%r{</?[^>]+?>}, "") } template << site_search(event) if site_search? client.reply_message(event["replyToken"], template) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reply\n end", "def should_reply?(params)\n !$redis.exists?('snarkov:shush') &&\n (settings.ignore_regex.nil? || !params[:text].match(settings.ignore_regex)) &&\n (rand <= ENV['RESPONSE_CHANCE'].to_f || (!settings.reply_regex.nil? && params[:text].match(settings.reply_regex)))\nend", "def test_create_reply_to_reply_to_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:matt_reply_to__kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @matt, reply_to, about)\r\n end", "def waitForReplySearch(pattern)\r\n while true\r\n servermsg = $oculussock.gets.strip\r\n puts servermsg\r\n if servermsg =~ pattern then break end\r\n\tend\r\n return servermsg\r\nend", "def test_create_reply_to_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@matt, @kevin, reply_to, about)\r\n end", "def reply(lev, message)\n match = find_matches(lev, message).sample\n return nil unless match\n\n match[:reply] = split_and_replace_match_reply(match)\n expand_and_select_vocab!(match[:reply], @dictionary1)\n expand_name!(match[:reply], @context[:myname], @context[:usname])\n { reply: match[:reply], level: calc_reply_level(lev, match[:level]) }\n end", "def test_create_reply_to_up_in_chain_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @kevin, reply_to, about)\r\n end", "def test_create_reply_to_standalone_message_about_nothing\r\n reply_to = messages(:andy_to_kevin_about_nothing)\r\n about = nil\r\n send_message(@kevin, @andy, reply_to, about)\r\n end", "def reply(message)\n return @mouth.reply(message)\n end", "def process_response(command, text)\n message_id = command[1..99]\n message = Message.find_by_id(message_id)\n#puts \"**** command=#{command}, text=#{text}, @sender.id=#{@sender.id}, message=#{message.id}\"\n if message\n @possible_senders.each do |a_member|\n message.process_response(:member => a_member, :response => text, :mode => 'SMS')\n end\n return I18n.t(\"sms.thanks_for_response\") \n else\n return I18n.t(\"sms.thanks_but_not_found\", :id => message_id) \n end\n return ''\n end", "def not_found(h)\n return unless h[:message].command?\n\n dest = h[:message].source\n msg = t('not_found', body: h[:message].body)\n\n robot.send_message(dest, msg)\n end", "def reply\n @reply\n end", "def handle_list_reply( m, params )\n if @reply.length == 0\n m.reply( \"Nothing available.\" ); return\n end\n\n m.reply \"Custom replies: #{@reply.keys.sort.join(', ')}\"\n end", "def coach_answer(your_message)\n # TODO: return coach answer to your_message\n if your_message[-1] == \"?\" then puts \"Silly question, get dressed and go to work !\"\n else puts \"I don't care son, get dressed and go to work !\"\n end\nend", "def test_return_no_error\n response, error = resolver_returning_response.query_raw(Dnsruby::Message.new, :return)\n assert_nil error\n assert_equal :response_from_send_plain_message, response\n end", "def reply\n if acknowledged?\n replies.first\n else\n nil\n end\n end", "def reply\n message = self.message.class.new(:subject => \"Re: #{subject}\",\n :body => body.gsub(/^/, '> '))\n message.sender = receiver\n message.to(sender)\n message\n end", "def reply_without_prefix arg\n reply arg, false\n end", "def reply(of_msg, content, cookies = nil)\n begin\n PUNK.start('reply','replying msg ...')\n response = of_msg.clone\n response.parent_id = of_msg.id\n response.id = CC.indigen_next_id(response.asset)\n response.content = content\n response.meta['protogen_cookies'] = cookies\n response.sender = '@@server@@'\n response.recipient = of_msg.asset\n user_api.mdi.tools.protogen.protogen_encode(response).each {|message| message.push}\n # success !\n PUNK.end('reply','ok','out',\"SERVER -> MSG[#{crop_ref(response.id,4)}] [reply of #{crop_ref(of_msg.id,4)}]\")\n # stats:\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['reply_sent_to_device'] += 1\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['total_sent'] += 1\n return response\n rescue Exception => e\n user_api.mdi.tools.log.error(\"Error on reply\")\n user_api.mdi.tools.print_ruby_exception(e)\n PUNK.end('reply','ko','out',\"SERVER -> MSG (reply)\")\n # stats:\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['err_on_reply'] += 1\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['total_error'] += 1\n return false\n end\n end", "def process_message_response\n # Is this email confirming receipt of a previous message? \n msg_id = find_message_id_tag(:subject=>@subject, :body=>@body)\n#puts \"**** body=#{@body}, msg_id=#{msg_id}\"\n if msg_id \n # Does the \"confirmed message\" id actually match a message?\n message = Message.find_by_id(msg_id)\n if message\n msg_tag = message_id_tag(:id => msg_id, :action => :confirm_tag) # e.g. !2104\n search_target = Regexp.new('[\\'\\s\\(\\[]*' + \"#{Regexp.escape(msg_tag)}\" + '[\\'\\s\\.,\\)\\]]*')\n # The main reason to strip out the tag (like !2104) from the message is that it may be the\n # first part of the response, if there is one; e.g. \"!2104 Kafanchan\" replying to a message\n # requesting location. \n user_reply = first_nonblank_line(@body)\n#puts \"**** user_reply='#{user_reply}'\"\n user_reply = user_reply.sub(search_target, ' ').strip if user_reply\n # Mark all members with this email address as having responded to this message\n @possible_senders.each do |a_member|\n message.process_response(:member => a_member, :text => user_reply, :mode => 'email')\n end\n else\n msg_tag = message_id_tag(:id => msg_id, :action => :create, :location => :body)\n Notifier.send_generic(@from_address, I18n.t('error_msg.invalid_confirmation')).deliver\n end\n end\n end", "def receive_replies(connection); end", "def message(nickname: nil, message: nil, nicknames: nil)\n @responded = false\n\n answers = case message\n when /^!/\n return # Do not record this as a previous message\n\n when /^s\\/(.+)\\/(.*)\\/(i)?$/\n begin\n replacement = $2\n regexp = Regexp.new($1, $3)\n answer = @previous_message.to_s.gsub(regexp, replacement)\n if @previous_message && answer != @previous_message\n yield say answer\n end\n rescue RegexpError\n end\n\n\n when /^où\\b.*\\?$/i\n yield say \"dtc\"\n\n when /^qui\\b.*\\?$/i\n rand_nick = (nicknames - [botname]).sample\n yield say [\"C’est #{rand_nick} !\", \"c'est #{rand_nick}\"].sample\n\n when /\\b#{@botname}\\b.*\\?$/\n rand_nick = (nicknames - [botname]).sample\n yield say ['ouais', 'euh ouais', 'vi', 'affirmatif', 'sans doute',\n \"c'est possible\", \"j'en sais rien moi D:\", 'arf, non', 'non', 'nan',\n 'euh nan', 'negatif', 'euhh peut-être',\n \"demande à #{rand_nick}\"].sample\n\n when /\\b#{@botname}\\b/\n yield say ['3:-0', 'oui ?', '...', 'lol', 'mdr', \":')\",\n 'arf', 'shhh', ':)', '3:)', 'tg :k', \"moi aussi je t'aime\",\n \"oui oui #{nickname}\"].sample if rand(0..10) > 0\n\n when /^lu$/i\n yield say [\"tin\", \"stucru\", \"mière\"].sample\n\n when /^hein ?\\?$/i\n yield say [\"deux\", \"deux !!\"].sample\n\n when /^quoi ?\\?$/i\n yield say \"feur !\"\n\n when /^(lol|mdr|rofl|ptdr) ?!*$/i\n yield say ['lol', 'mdr', 'rofl', 'ptdr', 'haha'].sample\n\n else\n # Repeat\n if message == @previous_message and @previous_nickname != nickname \\\n and @previous_nickname != @botname\n yield say message\n else\n yield say [\":)\", \":p\", \"3:)\", \"lol\"].sample if rand(0..50).zero?\n end\n end\n\n # Remember what the person said\n if !@responded\n @previous_message = message\n @previous_nickname = nickname\n end\n end", "def check_for_winner(message)\n return unless @@direct_matches.length == 4\n puts message\n exit\n end", "def get_reply\n @reply\n end", "def matches_message?(message)\n match_message(message).any?\n end", "def unrecognizedResponse( text )\n print \"Unrecognized Response : #{text}\"\n #say(\"For help, simply type: help\")\n end", "def respond_with_success\n fail NebulousError, \"Don't know which queue to reply to\" unless reply_to\n respond_with_protocol('success')\n end", "def reply?\n !self.in_reply_to.nil?\n end", "def reply?\n !self.in_reply_to.nil?\n end", "def create_arp_reply message\nend", "def send_reply msg, str, prefix = true\n if str.empty?\n str = \"I tried to send you an empty message. Oops!\"\n end\n\n # TODO: Hold additional content for later sending or something.\n # Just don't try to send it all in multiple messages without\n # the user asking for it!\n unless msg.query?\n use_prefix = Bot::Conf[:core][:replyprefix] rescue true\n\n str = \"#{msg.nick}: #{str}\" if prefix and use_prefix\n\n send_privmsg msg.destination, str\n else\n send_notice msg.nick, str\n end\n end", "def reply msg\n\t\t# get message from user\n\t\trep = @@client.message(msg)\n\t\t# handle the message\n\t\tputs handle_message(rep)\n\t\t\n\t\t# interactive Wit\n\t\t#@@client.interactive(method(:handle_message))\n\tend", "def replyable?\n false\n end", "def reply(req, msg)\n self.send_resp(req.sender, req.conn_id, msg)\n end", "def ping_reply(timeout = 1.0)\n loop do\n st = Time.now.to_f\n act = select([@sock], [], [@sock], timeout)\n return nil if !act or act.first.empty?\n pkt = @sock.recv(1514)\n icmp = icmp_offset(pkt)\n return pkt if icmp and pkt[icmp] == \"\\x00\" # type = Echo Reply\n timeout = timeout - Time.now.to_f + st\n return nil if timeout <= 0\n end\n end", "def reply?\n self.operation == OP_REPLY\n end", "def message\n case @remove\n when 'one'\n puts \"There are no emails #{@search_direction} #{@email} found in the queue\"\n when 'all'\n puts \"There are no emails #{@search_direction} #{@domain} found in the queue\"\n end\n end", "def can_reply_to?(topic) false end", "def reply?\n !!in_reply_to_status_id\n end", "def answer(message)\n if message.text.start_with?(\"<@#{id}> please explain\")\n word = message.text.split(\"<@#{id}> please explain\")[1]\n msg = format(RI.find(word))\n elsif message.text.start_with?(\"<@#{id}>\")\n words = message.text.split\n msg = if words.length > 1\n format(RI.find(words[1]))\n else\n \"Hi <@#{message.user}>, how can I help you?\"\n end\n elsif message.text.include?('#')\n msg = format(RI.find(message.text))\n end\n\n msg = \"Sorry I couldn't find it.\" if msg.nil?\n\n mount_message(msg, message.channel)\n end", "def receive_reply(reply)\n FSR::Log.debug reply.inspect\n end", "def error\n return nil if reply_code == \"0000\" \n return \"#{reply_text}\"\n end", "def reply\n body_arr = params[:Body].split(' ')\n method = body_arr[0]\n if method.upcase == 'REGISTER'\n p \"Registering User #{body_arr[1]} from #{params[:From]}\"\n User.register(params[:From], body_arr[1])\n send_sms(params[:From], \"User registered. Hello #{body_arr[1]}!\")\n Thread.new(params[:From], &method(:send_question))\n head 201 && return # Response is given to Twilio server for possible future use. \n elsif User.get(params[:From], 'name').nil?\n p 'User does not exist!'\n\n send_sms(params[:From], \"Please register with the form 'REGISTER <name>'.\")\n head 404 && return\n else \n # process answer\n answer = method\n p \"Processing answer #{answer}\"\n #TODO-v1: critical section to prevent user from keeping hitting the endpoint \n if answer == Question.get(User.get(params[:From], 'curr_ques_id'), 'answer')\n prev_count = User.get(params[:From], 'count')\n User.update(params[:From], 'count', prev_count.to_i + 1)\n if User.get(params[:From], 'count') == '5' #TODO: dynamic number\n send_sms(params[:From], 'Congratulations, you hit 5 question! Reward is sent. Answered question is cleared to 0')\n User.update(params[:From], 'count', 0) \n else\n send_sms(params[:From], \"Answer recorded.\\nYou have answered #{User.get(params[:From], 'count')} questions correctly.\")\n end\n else \n send_sms(params[:From], \"Wrong answer.\\nDon't be upset. You still have answered #{User.get(params[:From], 'count')} questions correctly.\")\n end\n User.update(params[:From], 'curr_ques_id', '-1') # So that user cannot answer the same question again and again! Fixed the repeat msg problem \n Thread.new(params[:From], &method(:send_question))\n head 204 && return\n end\n end", "def not_spam\n errors.add(:base, \"invalid reply\") if check_field.present?\n end", "def handle_add_reply( m, params )\n # lame auth check\n # TODO: need to get a look into new auth system\n\n name = params[:name].downcase\n reply = params[:reply].to_s\n\n # check whether good is in database\n# status( name, @stock )\n# if @inreg == false\n# m.reply( \"#{name} does not exist.\" ); return\n# end\n\n # Put data into database, should be understandable ^^\n reply = Reply.new( @replyversion, reply )\n @reply[name] = reply\n\n # save dataset in case the bot crashes an got no chance to do so\n save\n\n m.reply( \"done\" )\n end", "def reply\n @options[:method] = 'getsmsreply'\n @options[:clientmessagereference] = clientmessagereference\n response = ta_response(status_params)\n return response\n end", "def markov_getreply(input='')\n if [email protected]?\n reply = @hal.getResponse(input)\n\n # We don't want to save every single time someone says something, so this is a hack.\n if (Time.now.sec % 2) == 0\n @hal.save\n end\n return reply\n end\n end", "def ping_reply(timeout = 1.0)\n\t\tloop do\n\t\t\tst = Time.now.to_f\n\t\t\tact = select([@sock], [], [@sock], timeout)\n\t\t\treturn nil if !act or act.first.empty?\n\t\t\tpkt = @sock.recv(1514)\n\t\t\ticmp = icmp_offset(pkt)\n\t\t\treturn pkt if icmp and pkt[icmp] == \"\\x00\"\n\t\t\ttimeout = timeout - Time.now.to_f + st\n\t\t\treturn nil if timeout <= 0\n\t\tend\n\tend", "def ping_reply(timeout = 1.0)\n\t\tloop do\n\t\t\tst = Time.now.to_f\n\t\t\tact = select([@sock], [], [@sock], timeout)\n\t\t\treturn nil if !act or act.first.empty?\n\t\t\tpkt = @sock.recv(1514)\n\t\t\ticmp = icmp_offset(pkt)\n\t\t\treturn pkt if icmp and pkt[icmp] == \"\\x00\"\n\t\t\ttimeout = timeout - Time.now.to_f + st\n\t\t\treturn nil if timeout <= 0\n\t\tend\n\tend", "def check_if_reply_and_not_already_read(tweet)\n\n puts tweet.text\n if tweet.text.match(/^@partyprinter.*/) && tweet.user.id != 1678701920 && Tweet.exists?(tweet.id.to_i) == nil\n puts \"new\"\n return true\n end\n\n end", "def reply_text\n return \"No response.\" if response.nil?\n return (not response.first.last.kind_of?(Hash) or response.first.last[\"reply_text\"].nil?) ? \"Unexpected response hash.\" : response.first.last[\"reply_text\"] if response.instance_of?(Hash)\n response_match = response.match(/\\<reply-text\\>(.+)\\<\\/reply-text\\>/) if response.instance_of?(String)\n return (response_match.nil?) ? \"Unexpected response string.\" : response_match[1] if response.instance_of?(String)\n return \"Unexpected response type.\"\n end", "def reply\n message_body = params[\"Body\"]\n from_number = params[\"From\"]\n @recent_msg = Message.where(number: from_number).last # Get the name of this user if possible\n\n # Some random schmoe not in our db is trying to text me.\n if @recent_msg.blank?\n head 200, \"content_type\" => 'text/html'\n return\n end\n\n user = @recent_msg.user\n\n # Store reply in db and send back a simple text.\n @message = Message.new(user: user, number: from_number, text: message_body, action: 'REPLY')\n if @message.save\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_number,\n to: from_number,\n body: \"Hello from the other side! Your number is #{from_number}.\"\n )\n end\n head 200, \"content_type\" => 'text/html'\n end", "def ok?\n first[OK] == 1 || reply.nil?\n end", "def reply(event)\n msg = event.message['text']\n mk_reply(msg)\nend", "def abort_on_bad_reply(reply)\n if reply != 'ready'\n $LOG.error \"Illegal reply from ready command\"\n exit\n end\nend", "def unrecognizedResponse( text )\n end", "def action_not_recognize(input)\n response = WxTextResponse.new\n set_common_response response\n response.Content = WxReplyMsg.get_msg_by_key 'help'\n response\n end", "def send_reply(message, envelope)\n send_message([*envelope, EMPTY, *message])\n end", "def test_bad_response\n assert_log_matches('Server error when requesting an association') {\n assert_equal(call_negotiate([mk_message({})]), nil)\n }\n end", "def handle_item(msg)\n return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack\n return nil if msg[:user_name] == 'slackbot' # do not reply to self\n return nil unless msg[:text].is_a?(String) # skip empty messages\n\n ## loop things to look for and collect immediate responses\n ## rescue everything here so the bot keeps running even with a broken script\n responses = @regexes.map do |regex, proc|\n if mdata = msg[:text].strip.match(regex)\n begin\n Slackbotsy::Message.new(self, msg).instance_exec(mdata, &proc)\n rescue => err\n err\n end\n end\n end\n\n ## format any replies for http response\n if responses\n { text: responses.compact.join(\"\\n\") }.to_json\n end\n end", "def test_raise_no_error\n response, _error = resolver_returning_response.query_raw(Dnsruby::Message.new, :raise)\n assert_equal :response_from_send_plain_message, response\n end", "def process_response!(response)\n\t\t\t\tfinish_request!\n\t\t\t\t\n\t\t\t\tif Exception === response\n\t\t\t\t\[email protected] \"[#{@message.id}] Failure while processing response #{response}!\" if @logger\n\t\t\t\t\tRubyDNS.log_exception(@logger, response) if @logger\n\t\t\t\t\t\n\t\t\t\t\ttry_next_server!\n\t\t\t\telsif response.tc != 0\n\t\t\t\t\[email protected] \"[#{@message.id}] Received truncated response!\" if @logger\n\t\t\t\t\t\n\t\t\t\t\ttry_next_server!\n\t\t\t\telsif response.id != @message.id\n\t\t\t\t\[email protected] \"[#{@message.id}] Received response with incorrect message id: #{response.id}\" if @logger\n\t\t\t\t\t\n\t\t\t\t\ttry_next_server!\n\t\t\t\telse\n\t\t\t\t\[email protected] \"[#{@message.id}] Received valid response #{response.inspect}\" if @logger\n\t\t\t\t\t\n\t\t\t\t\tsucceed response\n\t\t\t\tend\n\t\t\tend", "def refute_told_to(message)\n return unless messages.map(&:first).include? message\n raise \"Was told to #{message.inspect}, but should not have been!\"\n end", "def find_reply\n @reply = Comment.find_by_id(params[:comment_id]) if params[:comment_id]\n #@reply = Subject.find_by_id(params[:subject_id]) if params[:subject_id]\n @reply = Person.find_by_id(params[:person_id]) if params[:person_id]\n @reply = Listing.find_by_id(params[:listing_id]) if params[:listing_id]\n end", "def what_is_ur_objective(sender_id)\n Bot.on :message do |message|\n answer = message.text.downcase\n if answer.include?(\"non\")\n say(sender_id, \"Okay ! N'hésite pas à revenir si tu as besoin d'aide !\")\n else\n say(sender_id, IDIOMS[:objectives], OBJECTIVES)\n handle_objective(sender_id)\n end\n end\nend", "def reply(response)\n if @_event == :receive && message.command == :privmsg\n privmsg message.params[0], response\n end\n end", "def address(m)\n replies = [\"#{m.user.nick}?\",'yes?','you called?','what?']\n my_reply = replies[rand(replies.size)]\n m.reply my_reply\n end", "def handle(time, sender_nick, message)\n if matchers.empty?\n raise NotImplementedError, \"Implement me in #{self.class.name}!\"\n else\n find_match(message)\n end\n end", "def test_create_reply_to_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:matt_reply_to__tim_reply_to__andy_to_kevin_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n notified_users = send_message(@kevin, @matt, reply_to, about)\r\n assert !notified_users.include?(@kevin),\r\n \"Owner of the review should not receive their own comments on the review.\"\r\n end", "def recv_reply\n @msg.recv_reply(stream)\n end", "def reply_neg\n puts 'AWW BOO'\n # byebug\n friend_deny=Follow.find_by(follower_id: follow_params[:user2], followee_id: decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n if friend_deny.destroy\n render json: {friend_deny: 'success'}\n else\n render json: {friend_deny: 'failure'}\n end\n end", "def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n when :ACK\n when :CANCEL\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response_to_cancel(@msg)\n return\n end\n else\n if client_transaction = @msg.connection.class.non_invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n end\n log_system_debug \"ignoring a response non matching a client transaction (#{@msg.sip_method} #{@msg.status_code})\" if $oversip_debug\n end", "def cancel_reply\n render :text => ''\n end", "def unanswered\n request('unanswered')\n end", "def reply(word: :message)\n # DelayInfomationExtractor\n if word.include?('電車')\n DelayInfomationExtractor.new.search_for_delaying_railway(word)\n\n # elsif\n\n # UserLocalAPI\n else\n word = refine_msg(msg: word)\n call_user_local_api(msg: word)\n end\n end", "def check_ok_response( socket, msg )\n result = socket.recv( 100 )\n logger.debug( \"Result for #{msg} : #{result}\" )\n raise \"Invalid response for #{msg}\" unless result == \"OK\\n\"\n end", "def notify_subscribers_about_new_response(reply)\n subscribers.each do |user|\n user.with_user_locale do\n UserMailer.reply_notification(user.id, reply.id).deliver!\n end unless user == reply.user\n end\n end", "def reply(query)\n return false unless awaiting_dialog_response?\n dialog.reply(query)\n end", "def replymsg\n @dirreply_msg = HDirmessageReply.select(\"m_users.user_name,h_dirmessage_replies.dirmsg_id,h_dirmessage_replies.dirthread_msg,h_dirmessage_replies.created_at\")\n .joins(\"join m_users on m_users.user_id=h_dirmessage_replies.reply_user_id\")\n .where(\"h_dirmessage_replies.dirmsg_id=?\", params[:clickid]).order(\"h_dirmessage_replies.created_at ASC\")\n #TChunreadMessage.joins(\"join t_channel_messages on t_channel_messages.chmsg_id=t_chunread_messages.chmsg_id\")\n #.where(\"chuser_id=? and t_channel_messages.channel_id =? \", session[:user_id], session[:clickchannel_id]).update_all(is_read: 0)\n main\n end", "def handle_response(guessers_guess, matching_indices)\n\t\tif(matching_indices.empty?)\n\t\t\t@candidate_words.delete_if {|word| word.include?(guessers_guess)}\n\t\telse\n\t\t\t@candidate_words = @candidate_words.select do |word| \n\t\t\t\tcontain_match_at_indices(word, matching_indices, guessers_guess)\n\t\t\tend\n\t\tend\n\tend", "def deaf_grandma\n puts \"HI SONNY\"\n reply=gets.chomp\n exit= \"I love ya, Grandma, but I've got to go.\"\n while reply!= exit\n if reply == reply.upcase\n puts \"NO NOT SINCE 1983\"\n else\n puts \"HUH? SPEAK UP SONNY\"\n end\n reply = gets.chomp\n end\nend", "def reply( r )\n @main << r\n end", "def triggered?(msg)\n if understood?(msg)\n return reply\n end\n nil\n end", "def on_matched_reply(regexp, &block)\n @matched_reply_actions ||= {}\n @matched_reply_actions[regexp] = block\n end", "def reply_card(response)\n target_word = response.matches[0][0]\n card = create_card(target_word)\n response.reply(card)\n end", "def members_not_responding\n memb = sent_messages.map { |sm| (sm.msg_status || -1) < MessagesHelper::MsgDelivered ? sm.member : nil }.compact\n end", "def parse_message(msg, user, room)\n if msg =~ REGEX\n execute_command(msg, user, room)\n elsif @afk_users.any?{ |i| msg =~ /#{i}/ }\n room.speak(\"[Status] #{user}: user #{@afk_users.select{ |i| msg =~ /#{i}/ }.first} is afk.\")\n end\n end", "def process_unknown_reply_command(line, check, severity, cmd_string)\n @@log.warn {\"Command not found: '#{line}'.\"}\n end", "def irc_err_nicknameinuse_response(stem, sender, recipient, arguments, msg) # :nodoc:\n return unless nick_generator\n newnick = nick_generator.call(arguments[0])\n nick newnick if newnick\n end", "def reply(statement, length)\n end", "def reply(statement, length)\n end", "def _on_reply(wi)\n Ruote.participant_send(self, :on_reply, 'workitem' => wi)\n end", "def resp(data)\n REPLIES\n .lazy\n .map { |reply| reply.new(data.text) }\n .find(&:apply?)\n .call { client.typing(channel: data.channel) }\n end", "def do_reply(msg)\n\n workitem = msg['workitem']\n fei = workitem['fei']\n\n removed = h.children.delete(fei)\n # accept without any check ?\n\n if msg['flanking']\n\n (h.flanks ||= []) << fei\n\n if (not removed) # then it's a timer\n\n do_persist\n return\n end\n end\n\n if ut = msg['updated_tree']\n\n ct = tree.dup\n ct.last[Ruote::FlowExpressionId.child_id(fei)] = ut\n update_tree(ct)\n end\n\n if h.state == 'paused'\n\n (h.paused_replies ||= []) << msg\n\n do_persist\n\n elsif h.state != nil # failing or timing out ...\n\n if h.children.size < 1\n reply_to_parent(workitem)\n else\n #persist_or_raise # for the updated h.children\n do_persist\n end\n\n else # vanilla reply\n\n reply(workitem)\n end\n end", "def increment_both_no_reply_count\n return true if seen_second_both_no_reply?\n if seen_first_both_no_reply\n self.seen_second_both_no_reply = true\n else\n self.seen_first_both_no_reply = true\n end\n end", "def reply_to_message\r\n @message = Message.find_by_id(params[:id])\r\n \r\n if [email protected]? && can_view(@message) \r\n @message.recipient = @message.sender_name\r\n @message.subject = \"Re: \" + @message.subject \r\n @message.body = \"\\n\\n___________________________\\n\" + @message.sender_name + \" wrote:\\n\\n\" + @message.body\r\n render :action => \"send_message\" \r\n else\r\n flash[:notice] = \"Please keep your eyes on your own messages.\"\r\n redirect_to :action => \"inbox\"\r\n end \r\n end", "def on_message_return(return_info, properties, message)\n message_options = properties.to_h.merge(routing_key: return_info.routing_key).compact\n\n if return_info.reply_text == 'NO_ROUTE'\n returned_messages << [message, message_options]\n\n Thread.new { process_returned_message }.tap do |thread|\n thread.abort_on_exception = false\n thread.report_on_exception = true\n end\n else\n # Do not raise error here!\n # The best we can do here is to log to STDERR\n warn 'BunnyPublisher::UnsupportedReplyText: '\\\n 'Broker has returned the message with reply_text other than NO_ROUTE '\\\n \"#{[return_info, properties, message]}\"\n end\n end", "def on_discussion_roll_reply(opts)\n discussion_roll_mail_setup(opts)\n \n if @last_post_video_only\n verb, suffix = \"sent\", \"video\"\n else\n verb, suffix = \"replied to\", nil\n end\n @subject = subject_for(@poster_string_name, opts[:all_participants] - [opts[:posting_participant], opts[:receiving_participant]], verb, suffix)\n \n mail :from => \"\\\"Shelby Mail\\\" <#{Settings::Email.discussion_roll['from_email']}>\",\n :reply_to => \"\\\"No Reply\\\" <#{Settings::Email.discussion_roll['from_email']}>\",\n :to => opts[:receiving_participant_email_address], \n :subject => @subject\n end", "def increment_doer_no_reply_count\n return true if seen_second_doer_no_reply?\n if seen_first_doer_no_reply\n self.seen_second_doer_no_reply = true\n else\n self.seen_first_doer_no_reply = true\n end\n end", "def perform_match message\n return false if reject_not_ack(message)\n return false unless type_match?(message)\n #@notifier.log \"#{identifier}: Looking at #{message.type} #{message.m_id_short}\", level: :collect\n if @block\n status = [@block.call(message)].flatten\n return unless collecting?\n keep message if status.include?(:keep)\n else\n keep message\n end\n end" ]
[ "0.6704406", "0.66692793", "0.64100426", "0.6394903", "0.6357938", "0.6322856", "0.62398183", "0.62103385", "0.6187165", "0.6173946", "0.6144172", "0.6086556", "0.6071918", "0.60665345", "0.60661805", "0.60422885", "0.6027966", "0.60227364", "0.60029376", "0.59898376", "0.5964927", "0.5951914", "0.591308", "0.58693707", "0.5861655", "0.5858934", "0.58337164", "0.58196473", "0.58196473", "0.5809026", "0.5796651", "0.57936645", "0.57865524", "0.5783726", "0.57768166", "0.5774841", "0.57714015", "0.57543886", "0.5744652", "0.5736689", "0.57324064", "0.5713973", "0.5709617", "0.5706172", "0.56950825", "0.56735396", "0.56562054", "0.5648143", "0.5648143", "0.5647799", "0.5638046", "0.5636654", "0.5627423", "0.5622281", "0.5619441", "0.5578854", "0.5571919", "0.5569177", "0.55640084", "0.5550589", "0.55444807", "0.5539571", "0.5537214", "0.55369854", "0.55342525", "0.5528561", "0.5522628", "0.55167824", "0.55079716", "0.55079293", "0.5507054", "0.5500156", "0.5491805", "0.5489777", "0.5488854", "0.5481172", "0.5464658", "0.5454805", "0.54539376", "0.54494697", "0.54449445", "0.5432125", "0.5428949", "0.5424374", "0.5417808", "0.5416771", "0.54154974", "0.5409043", "0.5405538", "0.54014635", "0.54014635", "0.54005826", "0.53954905", "0.53911865", "0.53892636", "0.53878444", "0.53863776", "0.5384781", "0.5373126", "0.5373012" ]
0.6945222
0
Logs the request if needed.
def call(env) if WialonApi.log_requests? @logger.debug "#{env[:method].to_s.upcase} #{env[:url]}" @logger.debug "body: #{env[:body].inspect}" unless env[:method] == :get end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_log(request); end", "def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end", "def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end", "def log_request\n result = super\n push_outstanding_request\n result\n end", "def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end", "def log_request\n ServerRequestLog.create! default_log_hash\n end", "def log_http_request(request)\n log :info, \"Starting request: #{request.method} #{request.path}\"\n\n return unless log_debug?\n\n log :debug, \" body : #{request.body}\"\n log :debug, \" headers :\"\n request.each_header do |name, value|\n log :debug, \" #{name}: #{value}\"\n end\n end", "def global_request_logging \n http_request_header_keys = request.headers.keys.select{|header_name| header_name.match(\"^HTTP.*\")}\n http_request_headers = request.headers.select{|header_name, header_value| http_request_header_keys.index(header_name)}\n logger.info \"Received #{request.method.inspect} to #{request.url.inspect} from #{request.remote_ip.inspect}. Processing with headers #{http_request_headers.inspect} and params #{params.inspect}\"\n begin \n yield \n ensure \n logger.info \"Responding with #{response.status.inspect} => #{response.body.inspect}\"\n end \n end", "def global_request_logging\n http_request_header_keys = request.headers.env.keys.select { |header_name| header_name.match('^HTTP.*') }\n http_request_headers = request.headers.select { |header_name, header_value| http_request_header_keys.index(header_name) }\n\n logger.debug \"[ApplicationController] Processing with params #{params.inspect}\"\n if request.body.respond_to?(:string)\n logger.debug \"[ApplicationController] Processing with body #{request.body.string.inspect}\" unless request.body.string.blank?\n elsif request.body.respond_to?(:read) && request.body.respond_to?(:rewind)\n request.body.rewind\n logger.debug \"[ApplicationController] Processing with body #{request.body.read.inspect}\"\n end\n\n # Run Warden if not already done, to avoid incomplete log entries after authN fail\n authenticate!\n\n begin\n yield\n ensure\n logger.debug \"[ApplicationController] Responding with headers #{response.headers.inspect}\"\n logger.debug \"[ApplicationController] Responding with body #{response.body.inspect}\" unless response.body.blank?\n end\n end", "def access_logger\n Rails.application.config.another_logger.info(\"#{request.method} '#{request.path}' #{request.version} from: #{request.remote_ip}\")\n end", "def on_request(env)\n env['sinatra.commonlogger'] = true\n super\n end", "def log_request(request)\n access = Access.new\n access.host = request.ip\n access.referrer = request.referer\n access.timestamp = DateTime.now\n\n access.method = request.request_method\n \n (request.get? ? request.GET : request.POST).each_pair do |key, value|\n pair = FormDataPair.new\n pair.name = key\n pair.value = value\n access.form_data_pairs << pair\n end\n\n access.save\n\n status 404\n 'No one here but us chickens.'\nend", "def log(path)\n case path\n when *Global.boring\n else\n Log.info(\"Dynamic request from #{request.ip}: #{request.request_uri}\")\n end\n end", "def log_request_response(exception = nil)\n super(exception) if exception.present?\n end", "def log_request(request, type, current_user, logger = Gitlab::AuthLogger)\n request_information = {\n message: 'Application_Rate_Limiter_Request',\n env: type,\n remote_ip: request.ip,\n request_method: request.request_method,\n path: request.fullpath\n }\n\n if current_user\n request_information.merge!({\n user_id: current_user.id,\n username: current_user.username\n })\n end\n\n logger.error(request_information)\n end", "def log_request_begin(logger, env)\n # Assuming remote addresses are IPv4, make them all align to the same width\n remote_addr = env['HTTP_X_FORWARDED_FOR'] || env[\"REMOTE_ADDR\"] || \"-\"\n remote_addr = remote_addr.ljust(15)\n\n # Log the fact that a query string was present, but do not log its contents\n # because it may have sensitive data.\n if (query = env[\"QUERY_STRING\"]) && !query.empty?\n query_info = '?...'\n else\n query_info = ''\n end\n\n # Session\n if env['global_session']\n cookie = env['global_session']\n info = [ env['global_session'].id,\n cookie.keys.map{|k| %{\"#{k}\"=>\"#{cookie[k]}\"} }.join(', ') ]\n sess = %Q{Session ID: %s Session Data: {%s}} % info\n else\n sess = \"\"\n end\n\n shard_info = 'Shard: ' + (env['HTTP_X_SHARD'] || 'default').to_s + ';'\n\n params = [\n env[\"REQUEST_METHOD\"],\n env[\"PATH_INFO\"],\n query_info,\n remote_addr,\n sess,\n shard_info,\n env[\"rack.request_uuid\"] || ''\n ]\n\n logger.info %Q{Processing %s \"%s%s\" (for %s) %s %s Request ID: %s} % params\n end", "def __log(method, path, params, body, url, response, json, took, duration)\n logger.info \"#{method.to_s.upcase} #{url} \" +\n \"[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]\"\n logger.debug \"> #{__convert_to_json(body)}\" if body\n logger.debug \"< #{response.body}\"\n end", "def log_request(url, headers, body)\n logger = @api.logger\n logger.debug(\"Report request to: '%s'\" % url)\n logger.debug('HTTP headers: [%s]' %\n (headers.map { |k, v| [k, v].join(': ') }.join(', ')))\n logger.debug(body)\n end", "def log_request(req)\n message = [req.remote_ip, req.command, req.args.join(' ')].join(' ')\n log.info(message)\n end", "def on_request(env)\n logger.tagged(*tags) do\n logger.info { formatter.request(env) }\n logger.debug { formatter.request_body(env) }\n end\n end", "def log(request, response)\n time = Time.new.strftime(\"%Y-%m-%d %H-%M-%S\")\n http_request = \"#{request.http_method} #{request.uri}\"\n http_response = \"#{response.code}\"\n @log_file.puts \"#{++@log_no} -- [#{time}] #{http_request} #{http_response}\"\n end", "def request(event)\n log_action_summary(event)\n log_request_details(event)\n log_response_details(event)\n end", "def log\n end", "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "def logme\n\t\tlogger.debug \"============Main ApplicationController get calls at #{Time.now}\"\n\tend", "def log_request\n log \"SOAP request: #{@soap.endpoint}\"\n log soap_headers.merge(headers).map { |key, value| \"#{key}: #{value}\" }.join(\", \")\n log @soap.to_xml\n end", "def log_request_info(env, req_id)\n query_string = \"?#{env.url.query}\" if env.url.query\n size = env.body.respond_to?(:size) ? env.body.size : env.request_headers['Content-Length']\n info { \"{#{req_id}} [OUT] #{env.method} #{env.url.path}#{query_string} (#{size || 0})\" }\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def do_GET(request, _response)\n log_request(request)\n end", "def log_request(request, response)\n puts \"\\nRequest Headers\"\n request.each {|head,val| puts \"#{head}: #{val}\"}\n puts \"\\nResponse Headers\"\n response.each {|head,val| puts \"#{head}: #{val}\"}\n puts \"\\nResponse Body\"\n puts response.body\n puts \"\\nResponse Type\"\n puts \"#{response.class} (#{response.code})\"\nend", "def logs\n end", "def log_submission_access(request)\n request_headers = request.headers.env.select do |k, _|\n k.in?(ActionDispatch::Http::Headers::CGI_VARIABLES) || k =~ /^HTTP_/\n end\n\n request_headers['USER_SESSION_ID'] = current_authentication_token\n request_headers['SUBMISSION_SESSION_ID'] = @submission.session_id\n\n @submission.logs.create(request: request_headers)\n end", "def logged?; false end", "def logged?; false end", "def log_requests(which = T.unsafe(nil)); end", "def attach_log_to_request\n # First we attempt to load an existing log from the request params\n @log = SystemLog.find(params[:log_id]) if params[:log_id]\n\n # Otherwise, we start a brand new log chain here\n @log = SystemLog.create( log_type: params[:action],\n from: params['From'],\n to: params['To'],\n meta: params.to_json ) unless @log.present?\n\n # Attach this log to this request cycle\n RequestStore.store[:log] = @log\n # Stash params for this request as well— for debugging\n RequestStore.store[:params] = params.dup\n RequestStore.store[:params_original] = params.dup\n end", "def log\n @log\n end", "def _roda_after_90__common_logger(result)\n super if result && _common_log_request?(result)\n end", "def set_thread_request\n LogUtils.request = request\n end", "def log()\n @log\n end", "def update!(**args)\n @request_logging = args[:request_logging] if args.key?(:request_logging)\n end", "def logs\n\n end", "def log_registration\n if request.post? # === POST: ===\n log_action(\n \"new User signed-up!\",\n \"Params: #{remove_passwords( params ).inspect}\\r\\n\\r\\nUpdated users total: #{User.count}\\r\\n\\r\\nCurrent user instance: #{current_user.inspect}\"\n )\n elsif request.delete? # === DELETE: ===\n log_action(\n \"existing User deleted!\",\n \"Params: #{remove_passwords( params ).inspect}\\r\\n\\r\\nUpdated users total: #{User.count}\\r\\n\\r\\nCurrent user instance: #{current_user.inspect}\"\n )\n end\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end", "def log_request\n bin = Bin.find_by({ url: request.params['bin_url'] })\n @incoming_request = Request.new({\n payload: request.raw_post,\n bin_id: bin.id,\n http_method: request.method\n })\n\n respond_to do |format|\n if @incoming_request.save!\n if !@incoming_request.bin.webhook_url.blank? # TODO: clean up this logic a bit\n RequestForwardingJob.perform_later @incoming_request, bin.webhook_url\n end\n\n ActionCable.server.broadcast(\n \"request_channel_#{bin.url}\", @incoming_request\n )\n\n format.json { render json: {}, status: :created }\n else\n format.json { render json: @bin.errors, status: :unprocessable_entity }\n end\n end\n end", "def internal_send_request(request, options)\n log_method = request == 'append_error' ? :error : :info\n log_text = AuditFormatter.send(format_method(request), options[:text])[:detail]\n log_text.chomp.split(\"\\n\").each { |l| RightLinkLog.__send__(log_method, l) }\n options[:audit_id] = @audit_id\n RightScale::RequestForwarder.push(\"/auditor/#{request}\", options)\n true\n end", "def log_request_debug(env, req_id)\n debug { \"{#{req_id}} [OUT] #{env.body}\" }\n end", "def log_http_call(payload); end", "def log_http_call(payload); end", "def log_request(activity=nil)\n return if ! @logged.nil?\n @logged=true \n if current_user_model.blank? or current_user_model.id.blank? then\n the_id = -1\n else\n the_id = current_user_model.id\n end\n log_entry = Log.create( \n :investigator_id => the_id,\n :activity => activity || self.controller_name + \":\" + self.action_name,\n :controller_name => self.controller_name,\n :action_name => self.action_name,\n :created_ip => request.remote_ip,\n :params => params.inspect)\n log_entry.save\n end", "def make_verbose(request)\n request.options[:verbose] = true\n\n request.on_complete do |response|\n puts\n puts 'Request body:'\n puts request.options[:body]\n puts\n puts 'Response body:'\n puts response.body\n puts\n end\n end", "def log_http(response)\n resp_template = '[http] Response: %s (%s bytes in %s seconds)'\n log_status = (response.status || 0)\n log_total_time = response.total_time.truncate(3)\n\n Wgit.logger.debug(\"[http] Request: #{response.url}\")\n Wgit.logger.debug(\n format(resp_template, log_status, response.size, log_total_time)\n )\n end", "def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end", "def error_log\n end", "def error_log\n end", "def error_log\n end", "def logger ; @log end", "def log_with_benchmark(request, action)\n msg = [ ]\n msg << \"#{request.env['REQUEST_METHOD']} #{request.env['PATH_INFO']}\"\n msg << \"Params: #{request.params.inspect}\"\n msg << \"Action: #{action.to_s.upcase}\"\n \n logger.info \"[sinatras-hat] \" + msg.join(' | ')\n \n result = nil\n \n t = Benchmark.realtime { result = yield }\n \n logger.info \" Request finished in #{t} sec.\"\n \n result\n end", "def log_request_details(event)\n env = event.payload\n debug do\n \"[#{req_id(env)}] #{req_dest(env)} > \" \\\n \"#{env.request_headers.sort.to_h.to_json}\"\n end\n end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def log(*args)\n\t\t\trouter.log(*args)\n\t\tend", "def log_request\n expiring_timestamp = current_timestamp + expires_in\n client.zadd(cache_key, expiring_timestamp, current_timestamp)\n end", "def autoflush_log; end", "def autoflush_log; end", "def _roda_after_90__common_logger(result)\n return unless result && result[0] && result[1]\n\n env = @_request.env\n\n qs = env[\"QUERY_STRING\"]\n query_string = \"?#{ qs }\" unless qs.empty?\n\n length = result[1][\"Content-Length\"]\n length = \"\" if length == \"0\"\n\n LOGGER.request \"#{ env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_ADDR'] || '-' } - \\\"#{ env['REQUEST_METHOD'] } #{ env['SCRIPT_NAME'] }#{ env['PATH_INFO'] }#{ query_string } #{ env['HTTP_VERSION'] }\\\" #{ result[0] } #{ length }\\n\"\n end", "def log_request_errors(page)\n return if QA::Runtime::Browser.blank_page?\n\n url = page.driver.browser.current_url\n QA::Runtime::Logger.debug \"Fetching API error cache for #{url}\"\n\n cache = page.execute_script <<~JS\n return !(typeof(Interceptor)===\"undefined\") ? Interceptor.getCache() : null;\n JS\n\n return unless cache&.dig('errors')\n\n grouped_errors = group_errors(cache['errors'])\n\n errors = grouped_errors.map do |error_metadata, request_id_string|\n \"#{error_metadata} -- #{request_id_string}\"\n end\n\n unless errors.nil? || errors.empty?\n QA::Runtime::Logger.error \"Interceptor Api Errors\\n#{errors.join(\"\\n\")}\"\n end\n\n # clear the cache after logging the errors\n page.execute_script <<~JS\n Interceptor && Interceptor.saveCache({});\n JS\n end", "def install\n Rack::CommonLogger.class_eval do\n\n alias_method :original_log, :log\n\n def log(env, status, header, began_at)\n logger = @logger || env['rack.errors']\n\n blob = {\n :length => header['Content-Length'] || 0,\n :code => status.to_s[0 .. 3],\n :version => env['HTTP_VERSION'],\n :method => env['REQUEST_METHOD'],\n :duration => (Time.now - began_at),\n :query => env[\"QUERY_STRING\"],\n :path => env['PATH_INFO'],\n :remote_addr => env['REMOTE_ADDR'],\n :user => env['REMOTE_USER'],\n :user_agent => env['HTTP_USER_AGENT'],\n :timestamp => Time.now.utc.iso8601\n }\n\n # If there's an X-Forwarded-For header split it up into a\n # list of machine-readable IPs.\n blob[:forwarded_for] = env['HTTP_X_FORWARDED_FOR'].split(',') if env['HTTP_X_FORWARDED_FOR']\n\n if logger\n logger.write({:type => 'request',\n :event => blob}.to_json)\n logger.write(\"\\n\")\n end\n end\n end\n end", "def logger\n @logger ||= Logger.new(File.join(Rails.root, 'log', 'meta_request.log'))\n end", "def log_http_call(payload)\n logger.info \"Request[#{payload[:method]}]: #{payload[:uri].to_s}\"\n start_time = Time.now\n response = yield\n logger.info sprintf(\"Response[%s]: %s, Duration: %.3fs\", response.code,\n response.message, Time.now - start_time)\n response\n end", "def log\n Lita.logger\n end", "def call!(env)\n log \"===== Received request =====\"\n Rack::Request.new(env).tap do |request|\n log \" Method: #{request.request_method.inspect}\"\n log \" Path: #{request.path.inspect}\"\n end\n env['deas.logging'] = Proc.new{ |msg| log(msg) }\n status, headers, body = super(env)\n log \" Redir: #{headers['Location']}\" if headers.key?('Location')\n log \"===== Completed in #{env['deas.time_taken']}ms (#{response_display(status)}) =====\"\n [status, headers, body]\n end", "def log\n advanced[:log]\n end", "def log\r\n false\r\n end", "def trace!\n request! :trace\n end", "def grid_rest_log(method, url, rparams = {}, emsg = \"\")\n if current_namespace\n return unless GridRest.grid_config.namespaces[current_namespace]['logging']\n else\n return unless GridRest.grid_config['logging']\n end\n grid_rest_log_message(rparams.any? ? \"#{Time.now.to_s(:db)} #{method.to_s.upcase} #{url} with #{rparams.inspect} #{emsg}\" : \"#{Time.now.to_s(:db)} #{method.to_s.upcase} #{url} #{emsg}\")\n end" ]
[ "0.8101725", "0.7743363", "0.7448667", "0.74329317", "0.7344709", "0.7340635", "0.73355925", "0.73193973", "0.7128285", "0.71130466", "0.70587224", "0.6952697", "0.68859017", "0.68692523", "0.6866476", "0.6769208", "0.675615", "0.6749367", "0.6731268", "0.66947377", "0.6683619", "0.6677982", "0.6653495", "0.66379154", "0.6585223", "0.65807015", "0.6556131", "0.65288895", "0.65288895", "0.65288895", "0.65288895", "0.65288895", "0.65288895", "0.65288895", "0.65288895", "0.6487175", "0.6342561", "0.6301122", "0.6285303", "0.6272126", "0.6272126", "0.62676287", "0.6246465", "0.6244502", "0.6239814", "0.620219", "0.61811155", "0.617841", "0.6177782", "0.61627007", "0.61531425", "0.61477476", "0.6147157", "0.6146213", "0.61332935", "0.60980874", "0.60980874", "0.60832083", "0.6080974", "0.60636795", "0.6028805", "0.60264283", "0.60264283", "0.60264283", "0.6009585", "0.60024464", "0.59983546", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.5984782", "0.59819275", "0.59708935", "0.5964796", "0.5964796", "0.59627235", "0.5951985", "0.59422576", "0.59408104", "0.5931407", "0.59299874", "0.5924324", "0.5896161", "0.5879938", "0.5868661", "0.58576405" ]
0.0
-1
Logs the response (successful or not) if needed.
def on_complete(env) if env[:body].respond_to?(:error) && env[:body].error? @logger.warn env[:raw_body] if WialonApi.log_errors? else @logger.debug env[:raw_body] if WialonApi.log_responses? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_response\n log \"SOAP response (status #{@response.code}):\"\n log @response.body\n end", "def log_response response\n if config.logger\n message = config.log_formatter.format(response)\n config.logger.send(config.log_level, message)\n end\n nil\n end", "def __log(method, path, params, body, url, response, json, took, duration)\n logger.info \"#{method.to_s.upcase} #{url} \" +\n \"[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]\"\n logger.debug \"> #{__convert_to_json(body)}\" if body\n logger.debug \"< #{response.body}\"\n end", "def log_response_info(env, resp, req_id)\n info { \"{#{req_id}} [IN] #{resp.status} #{env.url.path} (#{resp.body&.size || 0})\" }\n end", "def request_successful(response)\n\t\tresponse.code == \"200\"\n\tend", "def log(request, response)\n time = Time.new.strftime(\"%Y-%m-%d %H-%M-%S\")\n http_request = \"#{request.http_method} #{request.uri}\"\n http_response = \"#{response.code}\"\n @log_file.puts \"#{++@log_no} -- [#{time}] #{http_request} #{http_response}\"\n end", "def log_http(response)\n resp_template = '[http] Response: %s (%s bytes in %s seconds)'\n log_status = (response.status || 0)\n log_total_time = response.total_time.truncate(3)\n\n Wgit.logger.debug(\"[http] Request: #{response.url}\")\n Wgit.logger.debug(\n format(resp_template, log_status, response.size, log_total_time)\n )\n end", "def log_request_response(exception = nil)\n super(exception) if exception.present?\n end", "def log_response(response)\n pop_outstanding_request\n super\n end", "def log_response_details(event)\n env = event.payload\n\n if env.response.nil?\n return error do\n \"[#{req_id(env)}] #{req_dest(env)} < #{res_result(env)}\"\n end\n end\n\n debug do\n \"[#{req_id(env)}] #{req_dest(env)} < \" \\\n \"#{env.response_headers.sort.to_h.to_json}\"\n end\n end", "def success(log_data = nil)\n results true, log_data\n end", "def filter_response(request, response)\n finished = \"======= [WebFinger] HTTP REQUEST FINISHED =======\"\n WebFinger.logger.info ['-' * 50, response.dump, finished].join(\"\\n\")\n end", "def handle_response(response)\n case response[:status]\n when :success, :created\n self.instance_variable_set('@notsaved', false)\n true\n when :errors\n Amfetamine.logger.warn \"Errors from response\\n #{response[:body]}\"\n response[:body].each do |attr, error_messages|\n error_messages.each do |msg|\n errors.add(attr.to_sym, msg)\n end\n end\n false\n when :server_error\n Amfetamine.logger.warn \"Something went wrong at the remote end.\"\n false\n end\n end", "def process_response\n LOGGER.debug \"WORLDCAT DISCOVERY - Response from target: #{@response_status}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Headers: #{@response_headers.collect{ |k,v| \"#{k} = #{v}\" }.join(', ')}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Body: uncomment line!\"\n LOGGER.debug @response_body\n \n @response_body\n end", "def check_response\n if @res.blank? || @res.error\n flash[:error] = t \"errors.api\"\n end\n end", "def on_complete(env)\n status = env[:status]\n\n logger.tagged(*tags) do\n log_response_status(status) { formatter.response(env) }\n logger.debug { formatter.response_body(env) }\n end\n end", "def log_http_call(payload)\n logger.info \"Request[#{payload[:method]}]: #{payload[:uri].to_s}\"\n start_time = Time.now\n response = yield\n logger.info sprintf(\"Response[%s]: %s, Duration: %.3fs\", response.code,\n response.message, Time.now - start_time)\n response\n end", "def report_response_body(response)\n write_verbose_log(\"Response from Honeybadger: \\n#{response}\")\n end", "def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end", "def call(params)\n log_email(params[:logger], \"RESPONSE\", params[:response])\n end", "def log_response(receiver, response)\n unless response.instance_of? Net::HTTPOK\n LogPoint::write 'Cannot deliver to ' + receiver, 'slack_messages', Logger::WARN\n end\n LogPoint::write(\n sprintf('Processed %s with status %s.', receiver, response.to_s),\n 'inbound',\n Logger::INFO\n )\n\n self\n end", "def on_success(_request, response)\n response\n end", "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "def success!(info = nil)\n @logger.error { info } if info\n @successes += 1\n end", "def logged?; false end", "def logged?; false end", "def log_error(response)\n if response.code.to_i >= 500\n @logger.error \"Request #{@uri} failed: #{response.code}\"\n end\n response\n end", "def log_request(request, response)\n puts \"\\nRequest Headers\"\n request.each {|head,val| puts \"#{head}: #{val}\"}\n puts \"\\nResponse Headers\"\n response.each {|head,val| puts \"#{head}: #{val}\"}\n puts \"\\nResponse Body\"\n puts response.body\n puts \"\\nResponse Type\"\n puts \"#{response.class} (#{response.code})\"\nend", "def log_response_debug(_env, resp, req_id)\n debug { \"{#{req_id}} [IN] #{resp.body}\" }\n end", "def on_response( event )\n # You can access the response data being received using the event object:\n #\n # event.data.gsub!( 'SOMETHING', 'ELSE' )\n #\n #BetterCap::Logger.raw \"\\n#{BetterCap::StreamLogger.hexdump( event.data )}\\n\"\n BetterCap::Logger.info \"No response is working fine!\"\n end", "def set_response!\n get_responding_methods\n self.responding_object = @responding_object\n if successful?\n self.status_message ||= (@success_message || \"Status: successful\")\n else\n self.status_message ||= (@failure_message || \"Status: unsuccessful\")\n end\n return true\n end", "def successfully_authenticated\n unless self.ok == true\n self.errors.add(:ok, \"Response must include ok true!\")\n end\n end", "def log_output()\n prefix = @global_opts[:prefix] ? (@global_opts[:prefix] + \"-\") : \"\"\n t = Time.now.strftime(\"%Y%m%d%H%M%S\")\n\n # Check for any returned records\n if (@successes > 0 and not [\"set\", \"unset\", \"check\"].include?(@cmd))\n any_records = true\n else\n any_records = false\n end\n\n # Data\n if any_records\n data_filename = prefix + \"wc-\" + @cmd + \"-\" + t + \".xml\"\n data = File.new(data_filename, \"w+:UTF-8\")\n data.write(@response_data)\n data.close\n end\n\n status_extension = @global_opts[:csv] ? \".csv\" : \".txt\"\n status_filename = prefix + \"wc-\" + @cmd + \"-\" + t + \"-log\" + status_extension\n\n # Summary\n summary = \"\"\n summary << <<~SUMMARY\n OCLC WorldCat Metadata API: #{@cmd.capitalize} operation\n #{PAST_TENSE[@cmd].capitalize} #{@successes.to_s} #{@successes != 1 ? \"records\" : \"record\"} and #{@failures.to_s} failed\n #{\"Records written to \" + data_filename if any_records}\n Log written to #{status_filename}\n SUMMARY\n\n # Status log\n status = File.new(status_filename, \"w+:UTF-8\")\n status.write(@debug_info) if @global_opts[:debug]\n status.write(summary + \"\\n\")\n status.write(@response_status)\n status.close\n\n puts summary\n end", "def log_request_end(logger, status, headers, began_at)\n duration = (Time.now - began_at) * 1000\n\n content_length = if headers['Content-Length']\n headers['Content-Length'].to_s\n else\n '-'\n end\n\n params = [\n duration,\n status,\n content_length,\n ]\n\n logger.info %Q{Completed in %dms | %d | %s bytes} % params\n end", "def _send_response resp\n Handler.log.debug \"Sending response : #{resp}\"\n send_data resp.to_s + \"\\n\"\n resp\n end", "def got_response(response)\n end", "def _roda_after_90__common_logger(result)\n super if result && _common_log_request?(result)\n end", "def handle_response(response)\n begin\n if ok?(response.code)\n if response.body.present?\n parse_response_body(response.body)\n else\n true # blank body\n end\n else\n Rails.logger.error \"Unexpected response #{response.code}, not sure what to do here...\"\n response.message\n end\n rescue => e\n # don't report, just return\n response.message\n end\n end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def request_log(request); end", "def response_successful?(response)\n return false if response.body[\"errors\"]\n response.success?\n end", "def mock_success\n head :ok\n end", "def on_success(request, result)\n request.success(output(request, result))\n end", "def send_response(api_response, errors)\n api_response = create_response(api_response, errors)\n\n respond_to do |format|\n @logger.info \"#{Time.now} INFO ### #{request.path} ###\"\n if errors.length > 0\n @logger.info \"#{Time.now} EXCEPTION is: #{errors}\"\n end\n if request.host == 'localhost'\n @logger.info \"#{Time.now} response:#{api_response}\"\n end\n #TODO: Disable it later, enabled for now only\n if Rails.env == \"production\"\n @logger.info \"#{Time.now} INFO ### #{api_response} ###\"\n end\n format.html {\n \n }\n format.json { \n render :json => api_response.to_json, :callback => params[:callback], :content_type => \"text/html\"\n }\n format.js {\n \n }\n format.xml { \n @logger.info \"#{Time.now} #{api_response}\"\n render :xml => api_response\n }\n end\n end", "def logs\n ret = @uri.logs\n render plain: ret[:message], status: ret[:status]\n end", "def response_message(response)\n @last_response = response\n \"HTTP Response status: [#{response.code.to_s}] #{reason_phrase(response.code)}\"\n end", "def log_http_call(payload); end", "def log_http_call(payload); end", "def log(message)\n @__result.add_log(message)\n true\n end", "def success(message)\n log.info(message.to_s.green)\n end", "def do_GET(request, _response)\n log_request(request)\n end", "def handle_response(response); end", "def handle_response(response); end", "def log\n @client.get(\"#{path}/log\")\n end", "def response_message(response)\n @last_response = response\n 'HTTP Response status: [' + response.code.to_s + '] ' + reason_phrase(response.code)\n end", "def response_message(response)\n @last_response = response\n 'HTTP Response status: [' + response.code.to_s + '] ' + reason_phrase(response.code)\n end", "def rsuccess(response)\n response[:body][:statuscode].to_i == 0\n end", "def payment_succeeded\n # log_hook_notification\n order_state_changed_to_paid\n\n render nothing: true, status: 200 # answer to API\n rescue MangoPay::ResponseError => ex\n log_error = ex.message\n rescue => ex\n log_error = ex.message\n ensure\n MangopayLog.create(event: \"payment_succeeded\",\n mangopay_answer: \"Mangopay HOOK - EventType: #{params['EventType']},\n RessourceId: #{params['RessourceId']},\n Date: #{params['Date']}\",\n user_id: @user.id.to_i,\n error_logs: log_error)\n end", "def success?\n @response.success?\n end", "def result_log\n end", "def result_log\n end", "def result_log\n end", "def respond(response)\n unless response.committed?\n write_status(response)\n write_headers(response)\n write_body(response)\n end\n end", "def printResult(result)\n\t\tif result.has_key?('status') and result['status'] == 'success'\n\t\t\tputs \"Success, response contains:\"\n\t\t\tresult.each do |key,value|\n\t\t\t\tputs \"\\t#{key} => #{CGI::unescape(value)}\"\n\t\t\tend\n\t\t\ttrue\n\t\telse \n\t\t\tputs \"Error, trace is:\"\n\t\t\tresult.each do |key,value|\n\t\t\t\tputs \"\\t#{key} => #{CGI::unescape(value)}\"\n\t\t\tend\n\t\t\tfalse\n\t\tend\n\tend", "def success?\n response.status == 200\n end", "def log\r\n false\r\n end", "def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end", "def log_response(request_id, status_code, start_time, args = {})\n return unless @communicator_logger\n\n duration = (Time.now - start_time) * 1000 # in milliseconds\n headers = args[:headers]\n body = args[:body] unless args[:body].nil?\n content_type = args[:content_type]\n\n log_msg_builder = Ingenico::Connect::SDK::Logging::ResponseLogMessageBuilder.new(request_id, status_code, duration,\n @body_obfuscator,\n @header_obfuscator)\n unless headers.nil?\n headers = convert_from_sdk_headers(headers)\n headers.each do |key, value|\n log_msg_builder.add_headers(key, value)\n end\n end\n\n if binary_content_type?(content_type)\n log_msg_builder.set_body('<binary content>', content_type)\n else\n log_msg_builder.set_body(body, content_type)\n end\n\n begin\n @communicator_logger.log(log_msg_builder.get_message)\n rescue StandardError => e\n @communicator_logger.log(\"An error occurred trying to log response #{request_id}\", e)\n end\n end", "def do_request_and_write_response(times)\n File.open('response_log.txt', 'a+') do |file|\n (1..times).each do |iteration|\n response = do_request_to_slowapi\n file.puts(\"response_#{iteration}: \" + response.body)\n end\n puts 'Done!'\n return true\n end\n end", "def process_response(response)\n @last_response = response.body\n\n logger.debug @last_response if logger.present?\n\n if response.body =~ /:Fault>/ then\n handle_error(response)\n else\n response.body\n end\n end", "def check_logged_in\n service_response = success\n render_api_response(service_response)\n end", "def response_to_status(response)\n response ? :success : :error\n end", "def log(env, status, header, began_at)\n now = Time.now\n length = extract_content_length(header)\n\n data =\n {\n :remote_ip => env['HTTP_X_FORWARDED_FOR'] || env[\"REMOTE_ADDR\"] || \"?\",\n :remote_user => env[\"REMOTE_USER\"] || \"\",\n :http_method => env[\"REQUEST_METHOD\"],\n :path => env[\"PATH_INFO\"],\n :query => env[\"QUERY_STRING\"].empty? ? \"\" : \"?\"+env[\"QUERY_STRING\"],\n :http_version => env[\"HTTP_VERSION\"],\n :http_status => status.to_s[0..3],\n :content_length => length,\n :duration => now - began_at\n }\n\n logger = @logger || env['rack.errors']\n #logger.write data\n end", "def log_success(env, oauth_request)\n log :info, \"OAuthenticator authenticated an authentic request with Authorization: #{env['HTTP_AUTHORIZATION']}\"\n end", "def not_final\n @resp[:expectUserResponse] = true\n end", "def global_request_logging \n http_request_header_keys = request.headers.keys.select{|header_name| header_name.match(\"^HTTP.*\")}\n http_request_headers = request.headers.select{|header_name, header_value| http_request_header_keys.index(header_name)}\n logger.info \"Received #{request.method.inspect} to #{request.url.inspect} from #{request.remote_ip.inspect}. Processing with headers #{http_request_headers.inspect} and params #{params.inspect}\"\n begin \n yield \n ensure \n logger.info \"Responding with #{response.status.inspect} => #{response.body.inspect}\"\n end \n end", "def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end", "def log_invalid_response message\n error = ftp_get_error\n unless error.nil?\n log_server_error \"#{message} (FTP Error: #{error[0]})\"\n @log.debug_message += \"\\nInvalid Response: #{error[1]}\\n\"\n return false\n end\n true\n end", "def new_response\n {:success => true}\n end", "def success?(response)\n response[:response_code] == 0\n end", "def succeeded(account, message, csrf_safe: false)\n @account = account\n @csrf_safe ||= csrf_safe\n log << \"[SUCCESS] #{message}\"\n true\n end", "def success?\n !raw_response.nil?\n end", "def success(*msg, &block)\n log(:info, *msg, &block)\n end", "def check_response(response)\n case response\n when Net::HTTPSuccess then\n #puts response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n puts response.value\n end\nend", "def log\n end", "def success\n [200, { 'Content-Type' => 'text/plain'}, ['OK']]\n end", "def dump_json_object(json_response, response)\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: after initial parse\"\n logger.info \"#{self.class.to_s}:#{__method__}:#{__LINE__}: response.code: \"+json_response[response.code].to_s\n end", "def login_check(response)\n\t\t\tif response.code == '200'\n\t\t\t\tputs \"#{response.code} - #{response.message}: Logged in\"\n\t\t\t\tputs \"site: #{api_location}\"\n\t\t\t\tputs \"with: #{username}\"\n\t\t\telse\n\t\t\t\tputs \"#{response.code} - #{response.body}: Failed to log in\"\n\t\t\t\tif @test_login == false\n\t\t\t\t\tabort #if login fails, then abort\n\t\t\t\tend\n\t\t\tend\n\t\tend" ]
[ "0.75211626", "0.7188595", "0.70126253", "0.6682813", "0.6643926", "0.65983593", "0.65465885", "0.64669555", "0.63845766", "0.634385", "0.6289718", "0.62635607", "0.62550133", "0.6231753", "0.6149692", "0.6140979", "0.6139869", "0.61225337", "0.6118132", "0.61022526", "0.60910463", "0.6084165", "0.6076192", "0.6067707", "0.60627526", "0.60627526", "0.6039738", "0.60384214", "0.6037829", "0.60012186", "0.5972489", "0.5940705", "0.5924436", "0.5924169", "0.5896564", "0.5892014", "0.5884451", "0.5864387", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.5856499", "0.58348924", "0.58266884", "0.58248144", "0.58157194", "0.5813775", "0.5813116", "0.5779943", "0.57794464", "0.57794464", "0.57646054", "0.57629615", "0.57568496", "0.57441264", "0.57441264", "0.5717906", "0.5717346", "0.5717346", "0.5716774", "0.57134795", "0.57096297", "0.57083404", "0.57083404", "0.57083404", "0.5704516", "0.56988984", "0.56942356", "0.5683796", "0.5674443", "0.5672549", "0.56681174", "0.56680137", "0.56675804", "0.5666303", "0.56633854", "0.56566644", "0.5655694", "0.5645334", "0.5641677", "0.563932", "0.5638088", "0.56349474", "0.56218654", "0.5620875", "0.5619305", "0.5617836", "0.5613427", "0.56129074", "0.5612349", "0.5599349" ]
0.57147294
69
This patch is provided by the original authors of this software
def patches { :p0 => "http://www.thc.org/thc-hydra/hydra-6.5-fix.diff" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch; end", "def patch; end", "def private; end", "def patch_version; end", "def patch=(_arg0); end", "def patches\n \"https://gist.github.com/fredrikw/5858168/raw\"\n end", "def original; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def probers; end", "def bump_patch_version; end", "def patch\n end", "def spec; end", "def spec; end", "def implementation; end", "def implementation; end", "def weber; end", "def internal; end", "def schubert; end", "def modified?; end", "def extra; end", "def wrapper; end", "def overrides; end", "def process_fix\n super\n end", "def custom; end", "def custom; end", "def patch(*args, &block); end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def shadow_info\n end", "def refork; end", "def bug\n end", "def patches\n \"https://github.com/tatsuhiro-t/aria2/commit/6bcf33a69e1bfa9f7679b78f9f287d84798015aa.patch\"\n end", "def verdi; end", "def private_method\n end", "def patch_names\n raise NotImplementedError\n end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def mitch_hedberg; end", "def preflight; end", "def def_version; end", "def version_mismatch_detected\n end", "def original_result; end", "def dev_minor() end", "def extended(*) end", "def ext; end", "def ext; end", "def test_patch\n checkout_dir =File.expand_path(File.join('..','..','..','sequence', 'repository', 'Unidata@thredds'),File.dirname(__FILE__))\n repos = Rugged::Repository.new(checkout_dir)\n from = repos.lookup('49429686c3be8c3cb0aea17fca3e6684706d5fa1')\n to = repos.lookup('f63544cc69b49664a0487bf064ce0c7f64b40641')\n puts \"from #{from}\"\n puts \"to #{to}\"\n diff = to.patch(from)\n puts diff.content\n puts \"patch\"\n diff.patch.lines do |line|\n puts line\n end\n \n #.lines.each do |line|\nend", "def patches\n 'https://github.com/bmiklautz/FreeRDP/commit/1d32894775edd1bacdbcb4b6c3e129841b637374.patch'\n end", "def berlioz; end", "def original_name; end", "def specialty; end", "def anchored; end", "def origin; end", "def origin; end", "def origin; end", "def old_sync; end", "def ibu; end", "def version_helper=(_arg0); end", "def version_helper=(_arg0); end", "def version_helper=(_arg0); end", "def internship_passed; end", "def patches\n # Some Qt includes on vrpn_QTrackerRemote are not standard\n \"https://raw.github.com/gist/1431746/vrpn_QTrackerRemote.h.diff\" \n end", "def standalone; end", "def culprit\n @culprit\n end", "def blg; end", "def support\n raise \"Not implemented\"\n end", "def before; end", "def original_error; end", "def original_error; end", "def terpene; end", "def conscientious_require; end", "def prerelease_specs; end", "def hijacked; end", "def original_method; end", "def with_repl_like_sigint; end", "def hook_owner; end", "def reflector; end" ]
[ "0.7495742", "0.7495742", "0.74207604", "0.701181", "0.67523146", "0.66403925", "0.6562028", "0.6455914", "0.6455914", "0.6455914", "0.6455914", "0.63792384", "0.63757914", "0.63722456", "0.63258886", "0.6325326", "0.6325326", "0.62070006", "0.62070006", "0.6168028", "0.61443377", "0.61183894", "0.6072595", "0.60400033", "0.60127544", "0.5995077", "0.5962217", "0.59543324", "0.59543324", "0.5931746", "0.5924453", "0.592331", "0.5921339", "0.5879277", "0.5860223", "0.58463675", "0.5814568", "0.5812134", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57872593", "0.57835925", "0.57817894", "0.57778525", "0.5776917", "0.57655627", "0.5755207", "0.5749282", "0.57489705", "0.57489705", "0.57474494", "0.5744637", "0.57351816", "0.57208073", "0.5716517", "0.5715633", "0.56869596", "0.56869596", "0.56869596", "0.5686317", "0.5682466", "0.56795865", "0.56795865", "0.56795865", "0.5675639", "0.5669344", "0.5665705", "0.56529486", "0.56497055", "0.56449366", "0.5637022", "0.56366503", "0.56366503", "0.5634011", "0.56330806", "0.5632083", "0.5626652", "0.5622851", "0.5615942", "0.5611522", "0.56069535" ]
0.0
-1
Merge changes from the client into the target has_many relation
def merge_many_changes( target_class, foreign_key, original_list, proposed_list ) proposed_list = [] if proposed_list.nil? deleted_items = original_list.map { |item| item.id } proposed_list.each { |proposed_item| if proposed_item[:id].nil? # add place proposed_item[foreign_key] = self.id item = target_class.new(proposed_item) item.save else # update place item = target_class.where("id = ? and #{foreign_key} = ?", proposed_item[:id], self.id ).first unless item.nil? item.update(proposed_item) deleted_items.delete(item.id) item.save end end } # delete items not found in the proposed list target_class.destroy(deleted_items) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_into(target)\n target_id = target.id\n # Find all the Entries attached to this name, that will need to be\n # reindexed after the merge\n entry_ids = entry_ids_to_index_on_update\n\n ids = EntryArtist.where(artist_id: self.id).pluck(:id)\n EntryArtist.where(artist_id: self.id).update_all({ artist_id: target_id })\n EntryArtist.where( id: ids ).each(&:update_bunny)\n\n ids = EntryAuthor.where(author_id: self.id).pluck(:id)\n EntryAuthor.where(author_id: self.id).update_all({ author_id: target_id })\n EntryAuthor.where( id: ids ).each(&:update_bunny)\n\n ids = EntryScribe.where(scribe_id: self.id).pluck(:id)\n EntryScribe.where(scribe_id: self.id).update_all({ scribe_id: target_id })\n EntryScribe.where( id: ids ).each(&:update_bunny)\n\n ids = SaleAgent.where(agent_id: self.id).pluck(:id)\n SaleAgent.where(agent_id: self.id).update_all({ agent_id: target_id })\n SaleAgent.where( id: ids ).each(&:update_bunny)\n\n ids = SourceAgent.where(agent_id: self.id).pluck(:id)\n SourceAgent.where(agent_id: self.id).update_all({ agent_id: target_id })\n SourceAgent.where( id: ids ).each(&:update_bunny)\n\n ids = Provenance.where(provenance_agent_id: self.id).pluck(:id)\n Provenance.where(provenance_agent_id: self.id).update_all({ provenance_agent_id: target_id })\n Provenance.where( id: ids ).each(&:update_bunny)\n\n ids = DericciLink.where(name_id: self.id).pluck(:id)\n DericciLink.where(name_id: self.id).update_all({ name_id: target_id })\n DericciLink.where( id: ids ).each(&:update_bunny)\n\n ids = DericciRecord.where(verified_id: self.id).pluck(:id)\n DericciRecord.where(verified_id: self.id).update_all({verified_id: target_id})\n DericciRecord.where( id: ids ).each(&:update_bunny)\n\n # update flags on the target\n target.is_artist ||= self.is_artist\n target.is_author ||= self.is_author\n target.is_scribe ||= self.is_scribe\n target.is_provenance_agent ||= self.is_provenance_agent\n\n target.save\n\n # but ... CAN't SAVE when name is BLANK (nil)\n # self.name = nil\n self.viaf_id = nil\n self.deleted = true\n self.save!\n\n # slice into managable chunks to avoid running out of space in mysql\n entry_ids.each_slice(200) do |slice|\n SDBMSS::IndexJob.perform_later(Entry.to_s, slice)\n end\n\n Name.update_counters(target.id,\n :authors_count => target.author_entries.where(deprecated: false, draft: false).count - target.authors_count,\n :artists_count => target.artist_entries.where(deprecated: false, draft: false).count - target.artists_count,\n :scribes_count => target.scribe_entries.where(deprecated: false, draft: false).count - target.scribes_count,\n :sale_agents_count => target.sale_entries.where(deprecated: false, draft: false).count - target.sale_agents_count,\n :provenance_count => target.provenance_entries.where(deprecated: false, draft: false).count - target.provenance_count,\n :source_agents_count => target.agent_sources.count - target.source_agents_count\n )\n end", "def assimilate(victims)\n victims = victims.reject {|v| (v.class == self.class) && (v.id == self.id)}\n\n self.class.relationship_dependencies.each do |relationship, models|\n models.each do |model|\n model.transfer(relationship, self, victims)\n end\n end\n\n DB.attempt {\n victims.each(&:delete)\n }.and_if_constraint_fails {\n raise MergeRequestFailed.new(\"Can't complete merge: record still in use\")\n }\n\n trigger_reindex_of_dependants\n end", "def merge\n @primary = Client.find(params[:primary_id])\n @secondary = Client.find(params[:secondary_id])\n \n #merge primary_backup and secondary_backup\n @primary.attributes = @secondary.attributes.except(\"id\", \"created_at\", \"updated_at\")\n .delete_if { |k, v| v.blank? }\n #merge tickets\n @secondary.tickets.update_all(client_id: @primary.id)\n #merge backups\n @secondary.backups.update_all(client_id: @primary.id)\n #merge computers\n @secondary.computers.update_all(client_id: @primary.id)\n #merge parts\n @secondary.parts.update_all(client_id: @primary.id)\n #merge dispatches\n @secondary.dispatches.update_all(client_id: @primary.id)\n #merge items\n @secondary.items.update_all(client_id: @primary.id)\n #merge dispatches\n @secondary.anti_viri.update_all(client_id: @primary.id)\n #merge Contract_services\n @secondary.contract_services.update_all(client_id: @primary.id)\n #merge Contract_service_lines\n @secondary.contract_service_lines.update_all(client_id: @primary.id)\n #save backup merge\n @primary.save\n #remove secondary_backup\n @secondary.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully Merged then destroyed.' }\n format.json { head :no_content }\n \n end\n end", "def after_update\n super\n touch_associations\n end", "def update_links\n return if self.suppress_recreate_trigger == true\n \n marc_foreign_objects = Hash.new\n \n # All the allowed relation types *must* be in this array or they will be dropped\n allowed_relations = [\"people\", \"standard_titles\", \"standard_terms\", \"institutions\", \"catalogues\", \"liturgical_feasts\", \"places\"]\n \n # Group all the foreign associations by class, get_all_foreign_associations will just return\n # a flat list of objects\n marc.get_all_foreign_associations.each do |object_id, object|\n next if object.is_a? Source\n \n foreign_class = object.class.name.pluralize.underscore\n marc_foreign_objects[foreign_class] = [] if !marc_foreign_objects.include? (foreign_class)\n \n marc_foreign_objects[foreign_class] << object\n \n end\n \n # allowed_relations explicitly needs to contain the classes we will repond to\n # Log if in the Marc there are \"unknown\" classes, should never happen\n unknown_classes = marc_foreign_objects.keys - allowed_relations\n # If there are unknown classes purge them\n related_classes = marc_foreign_objects.keys - unknown_classes\n \n if !unknown_classes.empty?\n puts \"Tried to relate with the following unknown classes: #{unknown_classes.join(',')}\"\n end\n \n related_classes.each do |foreign_class|\n relation = self.send(foreign_class)\n \n # The foreign class array holds the correct number of object\n # We want to delete or add only the difference betweend\n # what is in marc and what is in the DB relations\n new_items = marc_foreign_objects[foreign_class] - relation.to_a\n remove_items = relation.to_a - marc_foreign_objects[foreign_class]\n \n # Delete or add to the DB relation\n relation.delete(remove_items)\n relation << new_items\n\n # If this item was manipulated, update also the src count\n # Unless the suppress_update_count is set\n if !self.suppress_update_count_trigger\n (new_items + remove_items).each do |o|\n o.update_attribute( :src_count, o.sources.count )\n end\n end\n \n end\n \n # update the parent manuscript when having 773/772 relationships\n update_77x unless self.suppress_update_77x_trigger == true \n end", "def merge!(other)\n update_attributes items: items + other.items\n other.destroy! and self\n end", "def merge_hook(duplicate)\n # Example code:\n # duplicate.custom_association.each do |ca|\n # ca.contact = self; ca.save!\n # end\n end", "def update_has_many_through_associations(assoc, orig, value, method)\n return if value.nil?\n assoc.through_associations(value).each do |ta|\n next if orig == ta\n source_value = @attributes[ta.source]\n # skip if source value is nil or if type of the association does not match type of source\n next unless source_value.class.to_s == ta.source_type\n ta.send method, source_value, value\n ta.source_associations(source_value).each do |sa|\n sa.send method, value, source_value\n end\n end\n end", "def merge_target_lists(persisted, memory)\n return persisted if memory.empty?\n\n persisted.map! do |record|\n if mem_record = memory.delete(record)\n\n ((record.attribute_names & mem_record.attribute_names) - mem_record.changed_attribute_names_to_save - mem_record.class._attr_readonly).each do |name|\n mem_record._write_attribute(name, record[name])\n end\n\n mem_record\n else\n record\n end\n end\n\n persisted + memory.reject(&:persisted?)\n end", "def merge(client_id)\n\n client = Client.find(client_id)\n\n #Transfer all client's elements to self, except for personal data and custom_attributes\n client.bookings.update_all(client_id: self.id)\n client.client_comments.update_all(client_id: self.id)\n client.client_email_logs.update_all(client_id: self.id)\n client.mock_bookings.update_all(client_id: self.id)\n client.payments.update_all(client_id: self.id)\n client.product_logs.update_all(client_id: self.id)\n client.ratings.update_all(client_id: self.id)\n client.session_bookings.update_all(client_id: self.id)\n client.treatment_logs.update_all(client_id: self.id)\n client.charts.update_all(client_id: self.id)\n\n s3_bucket = Aws::S3::Resource.new.bucket(ENV['S3_BUCKET'])\n\n new_path = 'companies/' + self.company.id.to_s + '/clients/' + self.id.to_s + '/'\n old_path = 'companies/' + client.company.id.to_s + '/clients/' + client.id.to_s + '/'\n\n puts \"Old path: \" + old_path\n puts \"New path: \" + new_path\n\n client.client_files.each do |client_file|\n\n obj = s3_bucket.object(client_file.full_path)\n\n if obj.exists?\n content_type = obj.content_type\n\n obj_name = obj.key.gsub(old_path, new_path)\n\n puts \"Old key: \" + obj.key\n puts \"New key: \" + obj_name\n\n obj.move_to({bucket: ENV['S3_BUCKET'], key: obj_name}, {acl: 'public-read', content_type: content_type})\n\n new_obj = s3_bucket.object(obj_name)\n\n client_file.update_columns(client_id: self.id, full_path: obj_name, public_url: new_obj.public_url)\n else\n client_file.delete\n end\n\n end\n\n client.delete\n\n\n end", "def update_services_ids_in_garage\n creator.services_ids << self.id\n creator.save\n end", "def def_one_to_many(opts)\n super\n def_bulk_setter(opts) do |list|\n cur = send(opts[:name])\n instance_variable_set(\"@_#{opts[:name]}_add\", list.reject{ |v| cur.detect{ |v1| v.to_i == v1.pk } })\n instance_variable_set(\"@_#{opts[:name]}_remove\", cur.reject{ |v| list.detect{ |v1| v.pk == v1.to_i } })\n cur.replace(list)\n\n name = \"#{opts[:name]}\".singularize\n\n after_save_hook do\n instance_variable_get(\"@_#{opts[:name]}_remove\").each do |record|\n send(\"remove_#{name}\", record) if record\n end\n\n instance_variable_get(\"@_#{opts[:name]}_add\").each do |record|\n send(\"add_#{name}\", record) if record && !record.empty?\n end\n end\n end\n end", "def persist_merge\n updater.update\n end", "def merge_original_attributes_to_target(original, target)\n # memoize to save SQL calls\n assigned_to = fetch_assigned_to(original)\n assigned_by = user_cache(original.assigned_by_id)\n\n target.appeal_id = original.appeal_id\n target.appeal_type = original.appeal_type\n target.assigned_at = original.assigned_at\n target.assigned_by_id = assigned_by&.id\n target.assigned_by_user_css_id = assigned_by&.css_id\n target.assigned_by_user_full_name = assigned_by&.full_name\n target.assigned_by_user_sattyid = assigned_by&.vacols_user&.sattyid\n target.assigned_to_id = assigned_to.id\n target.assigned_to_org_name = assigned_to.is_a?(Organization) ? assigned_to.name : nil\n target.assigned_to_org_type = assigned_to.is_a?(Organization) ? assigned_to.type : nil\n target.assigned_to_type = original.assigned_to_type\n target.assigned_to_user_css_id = assigned_to.is_a?(User) ? assigned_to.css_id : nil\n target.assigned_to_user_full_name = assigned_to.is_a?(User) ? assigned_to.full_name : nil\n target.assigned_to_user_sattyid = assigned_to.is_a?(User) ? assigned_to.vacols_user&.sattyid : nil\n target.closed_at = original.closed_at\n target.instructions = original.instructions\n target.parent_id = original.parent_id\n target.placed_on_hold_at = original.placed_on_hold_at\n target.started_at = original.started_at\n target.task_created_at = original.created_at\n target.task_id = original.id\n target.task_status = original.status\n target.task_type = original.type\n target.task_updated_at = original.updated_at\n\n target\n end", "def def_many_to_many(opts)\n super\n def_association_pks_getter(opts) do\n _join_table_dataset(opts).filter(opts[:left_key]=>send(opts[:left_primary_key])).select_map(opts[:right_key])\n end\n def_association_pks_setter(opts) do |pks|\n checked_transaction do\n ds = _join_table_dataset(opts).filter(opts[:left_key]=>send(opts[:left_primary_key]))\n ds.exclude(opts[:right_key]=>pks).delete\n pks -= ds.select_map(opts[:right_key])\n pks.each{|pk| ds.insert(opts[:left_key]=>send(opts[:left_primary_key]), opts[:right_key]=>pk)}\n end\n end\n end", "def def_many_to_many(opts)\n super\n def_bulk_setter(opts) do |list|\n cur = send(opts[:name])\n if cur\n cur.reject{ |v| v == \"\" }\n end\n instance_variable_set(\"@_#{opts[:name]}_add\", list.reject{ |v| cur.detect{ |v1| v.to_i == v1.pk } }) if cur and list\n instance_variable_set(\"@_#{opts[:name]}_remove\", cur.reject{ |v| list.detect{ |v1| v.pk == v1.to_i } }) if cur and list\n cur.replace(list)\n\n name = \"#{opts[:name]}\".singularize\n\n after_save_hook do\n instance_variable_get(\"@_#{opts[:name]}_remove\").each do |record|\n send(\"remove_#{name}\", record) if record\n end\n\n instance_variable_get(\"@_#{opts[:name]}_add\").each do |record|\n send(\"add_#{name}\", record) if record && !record.empty?\n end\n end\n end\n end", "def merge_records(from, to)\n return false if from == to\n transaction do\n reflect_on_all_associations.each{|reflection| reflection_merge(reflection, from, to)}\n destroy(from)\n end\n true\n end", "def changed_associated_objects\n cao = []\n changed_associations.each do |ca|\n __send__(ca).select{|obj| !obj.destroyed? }.each do |obj|\n\n # If the persisted object is not a subresource of the current resource, we'll create a new resource for it\n if obj.persisted? && !obj.ResourceUri.include?(__send__(:Id))\n obj.attributes.delete(\"Id\")\n obj.attributes.delete(\"ResourceUri\")\n end\n cao << obj if obj.changed? || obj.new?\n end\n end\n cao\n end", "def write_association_bulk(serialize_context: new_serialize_context, deserialize_context: new_deserialize_context, lock_owner: nil)\n require_external_referenced_association!\n\n updated_by_parent_viewmodel = nil\n\n pre_rendered = owner_viewmodel.transaction do\n updates_by_parent_id, references = parse_bulk_update\n\n if association_data.owned?\n updates_by_parent_id.transform_values!.with_index do |update_hash, index|\n ViewModel::ActiveRecord.add_reference_indirection(\n update_hash,\n association_data: association_data,\n references: references,\n key: \"write-association-bulk-#{index}\",\n )\n end\n end\n\n updated_by_parent_viewmodel =\n owner_viewmodel.replace_associated_bulk(\n association_name,\n updates_by_parent_id,\n references: references,\n deserialize_context: deserialize_context,\n )\n\n views = updated_by_parent_viewmodel.flat_map { |_parent_viewmodel, updated_views| Array.wrap(updated_views) }\n\n ViewModel.preload_for_serialization(views)\n\n updated_by_parent_viewmodel = yield(updated_by_parent_viewmodel) if block_given?\n\n return_updates = updated_by_parent_viewmodel.map do |owner_view, updated_views|\n ParentProxyModel.new(owner_view, association_data, updated_views)\n end\n\n return_structure = {\n ViewModel::TYPE_ATTRIBUTE => ViewModel::BULK_UPDATE_TYPE,\n ViewModel::BULK_UPDATES_ATTRIBUTE => return_updates,\n }\n\n prerender_viewmodel(return_structure, serialize_context: serialize_context)\n end\n\n render_json_string(pre_rendered)\n updated_by_parent_viewmodel\n end", "def propagate_to_existing_lists\n return @propagate_to_existing_lists\n end", "def reflection_merge(reflection, from, to)\n foreign_key = reflection.options[:foreign_key] || table_name.classify.foreign_key\n sql = case reflection.macro\n when :has_one, :has_many\n \"UPDATE #{reflection.klass.table_name} SET #{foreign_key} = #{to} WHERE #{foreign_key} = #{from}\\n\" \n when :has_and_belongs_to_many\n join_table = reflection.options[:join_table] || ( table_name < reflection.klass.table_name ? '#{table_name}_#{reflection.klass.table_name}' : '#{reflection.klass.table_name}_#{table_name}')\n \"UPDATE #{join_table} SET #{foreign_key} = #{to} WHERE #{foreign_key} = #{from}\\n\" \n else return\n end\n connection.update(sql)\n end", "def get_has_many_ids_changes(obj, previous_h_m_ids)\n changes = {}\n # reload the object for the deleting case\n obj.reload\n obj.class.reflect_on_all_associations(:has_many).each do |reflect|\n reflect_ids = obj.send reflect.name\n # Don't save if the relation m_to_m not changed\n changes[reflect.name] = [previous_h_m_ids, reflect_ids.map(&:id)] unless previous_h_m_ids.sort == reflect_ids.map(&:id).sort\n end\n changes\n end", "def scaffold_reflection_merge(reflection, from, to)\n if reflection.class == DataMapper::Associations::OneToMany::Relationship\n foreign_key = get_key_array_safe(reflection.target_key).name\n table = reflection.target_model\n elsif reflection.class == DataMapper::Associations::ManyToMany::Relationship\n foreign_key = get_key_array_safe(reflection.through.child_key).name\n table = reflection.send(:through_model)\n else\n return\n end\n table.all(foreign_key => from).update(foreign_key => to)\n end", "def merge_original_attributes_to_target(original, target)\n # memoize to save SQL calls\n veteran = original.veteran\n claimant = original.claimants.last\n person = claimant&.person\n aod = person&.advance_on_docket_motions&.last\n\n # avoid BGS call on sync for nil values\n person_attributes = (person&.attributes || {}).symbolize_keys\n veteran_person_attributes = (veteran&.person&.attributes || {}).symbolize_keys\n\n target.appeal_id = original.id\n target.active_appeal = original.active?\n target.aod_due_to_dob = person&.advanced_on_docket_based_on_age? || false\n target.aod_granted = aod&.granted? || false\n target.aod_reason = aod&.reason\n target.aod_user_id = aod&.user_id\n target.claimant_dob = person_attributes[:date_of_birth]\n target.claimant_first_name = person_attributes[:first_name]\n target.claimant_id = claimant&.id\n target.claimant_last_name = person_attributes[:last_name]\n target.claimant_name_suffix = person_attributes[:name_suffix]\n target.claimant_participant_id = claimant&.participant_id\n target.claimant_payee_code = claimant&.payee_code\n target.claimant_person_id = person&.id\n target.closest_regional_office = original.closest_regional_office\n target.decision_status_sort_key = original.status.to_i\n target.docket_number = original.docket_number\n target.docket_range_date = original.docket_range_date\n target.docket_type = original.docket_type\n target.established_at = original.established_at\n target.legacy_opt_in_approved = original.legacy_opt_in_approved\n target.poa_participant_id = original.poa_participant_id\n target.receipt_date = original.receipt_date\n target.status = original.status.to_s\n target.target_decision_date = original.target_decision_date\n target.uuid = original.uuid\n target.veteran_dob = veteran_person_attributes[:date_of_birth]\n target.veteran_file_number = original.veteran_file_number\n target.veteran_first_name = veteran&.first_name\n target.veteran_id = veteran&.id\n target.veteran_is_not_claimant = original.veteran_is_not_claimant\n target.veteran_last_name = veteran&.last_name\n target.veteran_middle_name = veteran&.middle_name\n target.veteran_name_suffix = veteran&.name_suffix\n target.veteran_participant_id = veteran&.participant_id\n\n target.appeal_created_at = original.created_at || Time.zone.now\n target.appeal_updated_at = original.updated_at || Time.zone.now\n\n target\n end", "def associate_target(object)\n case target_class.associations[target_association][:type]\n when :has_one, :belongs_to\n object.update_attribute(target_attribute, source.id)\n when :has_many, :has_and_belongs_to_many\n object.update_attribute(target_attribute, target_ids.merge(Array(source.id)))\n end\n end", "def merge(attributes)\n @service.merge_entity(self, attributes)\n end", "def changes_applied!\n # find all fields that are of type :array\n fields(:array) do |key, v|\n proxy = send(key)\n # clear changes\n proxy.changes_applied! if proxy.respond_to?(:changes_applied!)\n end\n\n # for all relational fields,\n relations.each do |key, v|\n proxy = send(key)\n # clear changes if they support the method.\n proxy.changes_applied! if proxy.respond_to?(:changes_applied!)\n end\n changes_applied\n end", "def persist_collection_relationships(record)\n record.class.reflect_on_all_associations\n .select { |ref| ref.collection? && !ref.through_reflection && record.association(ref.name).any? }\n .map do |ref|\n [\n ref.has_inverse? ? ref.inverse_of.name : ref.options[:as],\n record.association(ref.name).target\n ]\n end\n .to_h.each do |name, targets|\n targets.each { |t| t.update name => record }\n end\n end", "def associations\n @associations.dup\n end", "def merge\n return if old_user.nil? || new_user.nil? || old_user.id == new_user.id\n\n copy_missing_one_to_ones\n replace_old_with_new_in_groups\n set_replacement_references\n deactivate_old_user\n faye_publisher.broadcast_to_contacts\n old_faye_publisher.broadcast_to_contacts\n end", "def set(source, targets, loading=false)\n assert_kind_of 'source', source, source_model\n assert_kind_of 'targets', targets, Array\n\n targets = targets.map do |target|\n case target\n when Hash\n load_target(source, target)\n when DataMapper::Mongo::EmbeddedResource\n target.parent = source\n target\n else\n raise ArgumentError, 'one-to-many embedment requires an ' \\\n 'EmbeddedResource or a hash'\n end\n end\n\n set_original_attributes(source, targets) unless loading\n\n unless loaded?(source)\n set!(source, collection_for(source))\n end\n\n get!(source).replace(targets)\n end", "def associations\n @_associations.dup\n end", "def associated_with_client\n self.contact_types = [ContactType.cliente.id]\n end", "def updateClients diff\n req = diff.to_request @id\n @workingUsers.each do |user|\n user.updateClients req\n end\n end", "def adopt(master)\n\n volatiles.merge!(master.volatiles)\n\n source_end.volatiles.merge!(master.source_end.volatiles)\n target_end.volatiles.merge!(master.target_end.volatiles)\n\n self.qualified_id = object_id\n\n self.name = master.name\n\n # edge override\n\n self.origin = master\n\n self.source_role_name = master.source_end.role_name\n self.target_role_name = master.target_end.role_name\n\n self.source_browse = master.source_browse\n self.target_browse = master.target_browse\n\n self.source_multiplicity = master.source_multiplicity\n self.target_multiplicity = master.target_multiplicity\n\n self.polymorphic_source_group_name = master.polymorphic_source_group_name\n self.polymorphic_target_group_name = master.polymorphic_target_group_name\n\n self.source_navigable = master.source_navigable\n self.target_navigable = master.target_navigable\n\n self.source_inhibitive = master.source_inhibitive\n self.target_inhibitive = master.target_inhibitive\n\n self.source_transitive = master.source_transitive\n self.target_transitive = master.target_transitive\n\n self.source_functional = master.source_functional\n self.target_functional = master.target_functional\n\n self.source_multiplicity = master.source_multiplicity\n self.target_multiplicity = master.target_multiplicity\n\n self.source_links_associated = master.source_links_associated\n self.target_links_associated = master.target_links_associated\n\n self.source_builds_associated = master.source_builds_associated\n self.target_builds_associated = master.target_builds_associated\n\n self.source_index = master.source_index\n self.target_index = master.target_index\n\n self.source_internal = master.source_internal\n self.target_internal = master.target_internal\n\n self.source_secure = master.source_secure\n self.target_secure = master.target_secure\n\n self.source_nesting = master.source_nesting\n self.target_nesting = master.target_nesting\n\n self.source_non_nesting = master.source_non_nesting\n self.target_non_nesting = master.target_non_nesting\n\n self.source_final = master.source_final\n self.target_final = master.target_final\n\n self.source_owner_property = master.source_owner_property\n self.target_owner_property = master.target_owner_property\n\n self.source_unique = master.source_unique\n self.target_unique = master.target_unique\n\n self.source_ordered = master.source_ordered\n self.target_ordered = master.target_ordered\n\n self.edge_connectors = master.edge_connectors\n\n self.source_pierced = master.source_pierced\n self.target_pierced = master.target_pierced\n\n self.source_participant = master.source_participant\n self.target_participant = master.target_participant\n\n # *-association override\n\n self.source_required = master.source_required\n self.target_required = master.target_required\n\n end", "def merge(to_be_merged)\n scheme_ids = identifiers.pluck(:identifier_scheme_id)\n # merge logic\n # => answers -> map id\n to_be_merged.answers.update_all(user_id: id)\n # => notes -> map id\n to_be_merged.notes.update_all(user_id: id)\n # => plans -> map on id roles\n to_be_merged.roles.update_all(user_id: id)\n # => prefs -> Keep's from self\n # => auths -> map onto keep id only if keep does not have the identifier\n to_be_merged.identifiers\n .where.not(identifier_scheme_id: scheme_ids)\n .update_all(identifiable_id: id)\n # => ignore any perms the deleted user has\n to_be_merged.destroy\n end", "def revision_cloned_associations #:nodoc:\n clone_associations = self.revisable_options.clone_associations\n \n self.revisable_cloned_associations ||= if clone_associations.blank?\n []\n elsif clone_associations.eql? :all\n revisable_class.reflect_on_all_associations.map(&:name)\n elsif clone_associations.is_a? [].class\n clone_associations\n elsif clone_associations[:only]\n [clone_associations[:only]].flatten\n elsif clone_associations[:except]\n revisable_class.reflect_on_all_associations.map(&:name) - [clone_associations[:except]].flatten\n end \n end", "def dup_entity(options = {})\n entity = super(options)\n entity.source = self.source.dup_entity(options) if source\n entity.target = self.target.dup_entity(options) if target\n successors.each {|s| entity.successors << s.dup_entity(options) if s}\n entity.save\n return entity\n end", "def update_sync_targets old_campaign_id, new_campaign_id\n sync_with_campaigns = sync_targets\n return if sync_with_campaigns.blank?\n\n target_craft = Craft.where(:campaign_id => sync_with_campaigns, :name => self.name)\n target_craft.each do |c|\n next if c.sync[:with].blank? \n c.sync = {:with => c.sync[:with].map{|id| id.eql?(old_campaign_id) ? new_campaign_id : id } }\n c.save\n end\n end", "def preserve_has_one_associations_to(new_version)\n # Preserve simple has_one reflections\n self.class.reflections.select { |_, reflection|\n reflection.macro == :has_one\n }.each do |key, reflection|\n if !reflection.foreign_key.kind_of?(Array)\n new_version.send(\"#{key}=\", self.send(key))\n end\n end\n end", "def merge!(assoc_rows, rows)\n Merge.new(rows, name).\n many!(assoc_rows, @ref.active_record_primary_key, @ref.foreign_key)\n end", "def merge!(b)\n b.items.each do |i|\n self.items << i\n self.save!\n end\n AttributesForMerging.each do |k|\n if (self[k].nil? || self[k].empty?) && !(b[k].nil? || b[k].empty?)\n self[k]=b[k]\n end\n end\n self.save!\n b.destroy\n true\n end", "def <<(object)\n source.update_attribute(source_attribute, source_ids.merge(Array(object).collect(&:id)))\n Array(object).each {|o| self.send(:associate_target, o)} if target_association\n object\n end", "def merge(other_entry)\n @references += other_entry.references\n self\n end", "def map_association(target, name, rows, session)\n singular_name = name.to_s.singularize.to_sym\n entity_mapping = @mapping.get(singular_name)\n\n if target.is_a? Array\n relations = {}\n target_name = target[0].class.name.underscore\n back_relations = {}\n\n if rows.length > 0\n target_id_name = \"#{target_name.underscore}_id\"\n target_reference = entity_mapping.references[target_name.to_sym]\n\n rows.each do |row|\n relation = map(entity_mapping.type, row, session, singular_name.to_s)\n target_id = row[target_id_name.to_sym]\n\n if target_id.nil?\n raise MapperError, \"Field \\\"#{target_id_name}\\\" is not defined in the query but it's required to construct \\\"#{name} to #{target_name}\\\" association. Just add it to SELECT clause.\"\n end\n\n relations[target_id] ||= []\n relations[target_id] << relation\n back_relations[relation.id] = target.select{|t| t.id == target_id}\n end\n\n target.each do |entry|\n target_id = entry.id\n relation_objects = relations[target_id]\n\n if relation_objects\n if target_reference\n relation_objects.each {|obj| obj.set_reference!(target_reference.name, entry)}\n end\n\n # set forward collection relation\n entry.set_collection!(name, relations[target_id])\n\n # set reverse collection relation if it's present\n if entity_mapping.collections[target_name.pluralize.to_sym]\n relation_objects.each{|obj| obj.set_collection!(target_name.pluralize.to_sym, back_relations[obj.id])}\n end\n end\n end\n end\n\n ids = []\n relations.values.each do |associations|\n ids << associations.map{|a| a.id}\n end\n\n {result: relations, ids: ids.flatten.uniq}\n else\n result = rows.map do |row|\n map(entity_mapping.type, row, session, singular_name.to_s)\n end\n\n target.set_collection!(name, result)\n\n {result: result, ids: result.map {|i| i.id}}\n end\n\n end", "def copy_series\n target = TournamentDay.find(params[:target_id])\n source = TournamentDay.find(params[:source_id])\n source.series.each do |serie|\n copy = serie.dup\n copy.tournament_day_id = target.id\n copy.save\n end\n\n @tournament_day = TournamentDay.find(target.id, :include => :tournament)\n respond_to do |format|\n flash[:notice] = 'Serien erfolgreich kopiert'\n format.html { redirect_to(@tournament_day) }\n format.xml { head :ok }\n end\n end", "def merge_details_replace_field(target, victim, selections, values)\n selections.each do |path_fix|\n subrec_name = path_fix[0]\n # this is the index of the order the user arranged the subrecs in the form, not the order of the subrecords in the DB.\n ind = path_fix[1]\n field = path_fix[2]\n position = path_fix[3]\n\n subrec_index = find_subrec_index_in_victim(victim, subrec_name, position)\n\n target[subrec_name][ind][field] = victim[subrec_name][subrec_index][field]\n end\n end", "def from_obj_to_obj_provenance(to_obj, from_obj)\n raise \"Object #{to_obj.id} is not an item\" unless to_obj.is_a? Item\n raise \"Object #{from_obj.id} is not an item\" unless from_obj.is_a? Item\n\n from_obj_map = AssociationMap.new(from_obj)\n to_obj_map = AssociationMap.new(to_obj)\n add_provenance(from: from_obj, from_map: from_obj_map,\n to: to_obj, to_map: to_obj_map)\n from_obj_map.save\n to_obj_map.save\n end", "def affect_relation_values!\n Relations.new(@klass).affect_relation_values!\n end", "def collection_ids=(new_ids)\n # This is slightly crude, but lets just delete the join models that we\n # don't need anymore.\n\n # NOTE: Datamapper will try to insert rows into the join table on a Many to Many\n # even if the relationship is already defined.\n # You need to clear the relationships and reinsert them to prevent composite key\n # violation errors\n\n #self.gluttonberg_asset_gluttonberg_asset_collections.all(:asset_collection_id.not => new_ids).destroy!\n clear_all_collections\n self.collections = Gluttonberg::AssetCollection.all(:id => new_ids)\n end", "def update!(**args)\n @agency_associations = args[:agency_associations] if args.key?(:agency_associations)\n end", "def freeze\n associations\n super\n associations.freeze\n self\n end", "def merge(other_user)\n return unless other_user.instance_of? User\n return if !self.auth_token.blank? and other_user.auth_token.blank? and self.auth_token != other_user.auth_token\n\n attribute_set('auth_token', auth_token || other_user.auth_token)\n\n reservations_to_move = other_user.reservations\n reservations_to_move.update({:user_id => id})\n reservations.concat(reservations_to_move).save\n reservations.reload\n reservations_to_move.reload\n\n participations_to_move = other_user.participations\n participations_to_move.update({:user_id => id})\n participations.concat(participations_to_move).save\n participations.reload\n participations_to_move.reload\n self\n end", "def merge; end", "def associations_for_update\n if respond_to?(:scaffold_update_nofollow)\n self.class.reflect_on_all_associations.reject { |association| scaffold_update_nofollow.include?(association.name) }\n elsif respond_to?(:scaffold_update_follow)\n self.class.reflect_on_all_associations.select { |association| scaffold_update_follow.include?(association.name) }\n else\n self.class.reflect_on_all_associations\n end\n end", "def serialize_new_records(serialized, collection_proxy)\n new_records = collection_proxy.reject(&:persisted?)\n return unless new_records.any?\n\n parent_key = collection_proxy.parent.class.demodulized_name.foreign_key.to_sym\n\n serialized[collection_proxy.association_name] = new_records.map do |record|\n record.serializable_hash.except(parent_key)\n end\n end", "def _refresh_set_values(hash)\n @associations.clear if @associations\n super\n end", "def update_removed_from_list \n if @removed_from_sync_list && !@removed_from_sync_list.blank?\n rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)\n rem_craft.each do |c|\n c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flatten.include?(id) } }\n c.save\n end\n end\n end", "def update_in_index\n __elasticsearch__.index_document\n\n index_dependent_models.map(&:update_in_index)\n end", "def clone\n copy = super\n transaction do\n copy.save!\n\n %w[\n registration_information support information_source advance_directive\n ].each do |assoc|\n copy.send(\"#{assoc}\\=\", send(assoc).clone) if send(assoc)\n end\n\n %w[\n patient_identifiers languages providers medications allergies conditions\n all_results immunizations encounters procedures medical_equipments social_history insurance_providers\n ].each do |assoc|\n send(assoc).each do |item|\n copy.send(assoc) << item.clone\n end\n end\n\n end\n copy\n end", "def merge_inheritance\n relation.itself_only_value = true if other.itself_only_value.present?\n\n if other.cast_records_value.present?\n relation.cast_records_value += other.cast_records_value\n relation.cast_records_value.uniq!\n end\n end", "def dup_entity (options = {})\n entity = super(options)\n entity.update_attributes(:start => self.send(:start))\n entity.update_attributes(:end => self.send(:end))\n \n entity.logged_asset = self.logged_asset if logged_asset\n assets.each{ |a| entity.assets << a if a}\n entity.save\n return entity\n end", "def <<(*records)\n save_records = proxy_owner.persisted?\n\n if records.flatten.all? &:valid?\n records.flatten.each do |record|\n unless include? record\n raise_if_type_mismatch(record)\n add_foreign_key_in_proxy_owner(record.id)\n proxy_target << record\n record.save if save_records\n end\n end\n\n proxy_owner.save if save_records\n\n self\n end\n end", "def freeze\n @touched_associations.freeze\n\n super\n end", "def merge(other)\n result = super\n\n result.sources = other.sources + self.sources\n result\n end", "def revision_cloned_associations #:nodoc:\n clone_associations = self.revisable_options.clone_associations\n\n self.revisable_cloned_associations ||= \\\n if clone_associations.blank?\n []\n elsif clone_associations.eql? :all\n revisable_class.reflect_on_all_associations.map(&:name)\n elsif clone_associations.is_a? [].class\n clone_associations\n elsif clone_associations[:only]\n [clone_associations[:only]].flatten\n elsif clone_associations[:except]\n revisable_class.reflect_on_all_associations.map(&:name) - [clone_associations[:except]].flatten\n end\n end", "def touch_associations\n model.touched_associations.each do |assoc, column|\n r = model.association_reflection(assoc)\n next unless r.can_have_associated_objects?(self)\n ds = send(r.dataset_method)\n\n if ds.send(:joined_dataset?)\n # Can't update all values at once, so update each instance individually.\n # Instead if doing a simple save, update via the instance's dataset,\n # to avoid going into an infinite loop in some cases.\n send(assoc).each{|x| x.this.update(column=>touch_association_value)}\n else\n # Update all values at once for performance reasons.\n ds.update(column=>touch_association_value)\n associations.delete(assoc)\n end\n end\n end", "def cascade_preservation\n self.reload\n if self.can_perform_cascading?\n self.cascading_elements.each do |pib|\n pib.preservation_profile = self.preservation_profile\n pib.save\n end\n end\n end", "def propagate_changes\n if !(changed_attributes.keys & %w(winner winner_id)).empty?\n parent.reset_results if parent.present?\n self.reload\n end\n end", "def propagate_to_existing_lists=(value)\n @propagate_to_existing_lists = value\n end", "def change_client_related_flags\n fail if @client_ids_array.blank?\n clients = Client.where(id: @client_ids_array).all\n clients.each do |client|\n if GlobalConstant::Base.main_sub_environment?\n client.send(\"unset_#{GlobalConstant::Client.mainnet_test_economy_qr_code_uploaded_status}\")\n client.send(\"unset_#{GlobalConstant::Client.mainnet_registered_in_mappy_server_status}\")\n else\n client.send(\"unset_#{GlobalConstant::Client.sandbox_test_economy_qr_code_uploaded_status}\")\n client.send(\"unset_#{GlobalConstant::Client.sandbox_registered_in_mappy_server_status}\")\n end\n client.save!\n end\n end", "def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update_relations\n # relational saves require an id\n return false unless @id.present?\n # verify we have relational changes before we do work.\n return true unless relation_changes?\n raise \"Unable to update relations for a new object.\" if new?\n # get all the relational changes (both additions and removals)\n additions, removals = relation_change_operations\n\n responses = []\n # Send parallel Parse requests for each of the items to update.\n # since we will have multiple responses, we will track it in array\n [removals, additions].threaded_each do |ops|\n next if ops.empty? #if no operations to be performed, then we are done\n responses << client.update_object(parse_class, @id, ops, session_token: _session_token)\n end\n # check if any of them ended up in error\n has_error = responses.any? { |response| response.error? }\n # if everything was ok, find the last response to be returned and update\n #their fields in case beforeSave made any changes.\n unless has_error || responses.empty?\n result = responses.last.result #last result to come back\n set_attributes!(result)\n end #unless\n has_error == false\n end", "def merge!; end", "def eager_load_targets(source, targets, query)\n # TODO: figure out an alternative approach to using a\n # private method call collection_replace\n association = collection_for(source, query)\n association.send(:collection_replace, targets)\n set!(source, association)\n end", "def load_target_with_scrooge\n scrooge_seen_association!(@reflection)\n load_target_without_scrooge\n end", "def sync_with campaign\n campaign_id = campaign.id if campaign.is_a?(Campaign) \n campaign_id ||= campaign\n\n sync_list = self.sync\n sync_list[:with] ||= []\n sync_list[:with] << campaign_id\n self.sync = sync_list\n self.save\n end", "def inherited(klass)\n klass.instance_variable_set(:@associations, associations.clone)\n super\n end", "def complete_weak_set\n relation.weaker.each do |r|\n if relation_set(r).blank?\n t = relation_set.build :relation => r\n t._without_inverse = true\n t.save!\n end\n end\n end", "def merge_distinct_on\n return if other.distinct_on_values.blank?\n relation.distinct_on_values += other.distinct_on_values\n end", "def merge(...)\n self.clone.merge!(...)\n end", "def process\n Trade::Shipment.where(taxon_concept_id: @old_taxon_relationship.taxon_concept_id,\n reported_taxon_concept_id: @taxon_relationship.other_taxon_concept_id)\n .update_all(taxon_concept_id: @taxon_relationship.taxon_concept_id)\n end", "def merge!(other_order, user = nil)\n if other_order.currency == order.currency\n other_order.line_items.each do |other_order_line_item|\n current_line_item = find_matching_line_item(other_order_line_item)\n handle_merge(current_line_item, other_order_line_item)\n end\n end\n\n set_user(user)\n persist_merge\n\n # So that the destroy doesn't take out line items which may have been re-assigned\n other_order.line_items.reload\n other_order.destroy\n end", "def save\n unless @added.empty? && @deleted.empty?\n # We cannot reuse the allocated space, since the data\n # that is copied would be destroyed.\n if polymorphic?\n offset = @database.allocate_polymorphic_join_elements(@size)\n else\n offset = @database.allocate_join_elements(@size)\n end\n pairs =\n @size.times.map do |index|\n rod_id = id_for(index)\n if rod_id.is_a?(Model)\n object = rod_id\n if object.new?\n if polymorphic?\n object.reference_updaters <<\n ReferenceUpdater.for_plural(self,index,@database)\n else\n object.reference_updaters <<\n ReferenceUpdater.for_plural(self,index,@database)\n end\n next\n else\n rod_id = object.rod_id\n end\n end\n [rod_id,index]\n end.compact\n if polymorphic?\n pairs.each do |rod_id,index|\n class_id = (rod_id == 0 ? 0 : class_for(index).name_hash)\n @database.set_polymorphic_join_element_id(offset,index,rod_id,class_id)\n end\n else\n pairs.each do |rod_id,index|\n @database.set_join_element_id(offset,index,rod_id)\n end\n end\n @offset = offset\n @added.clear\n @deleted.clear\n @map.clear\n @original_size = @size\n end\n @offset\n end", "def handle_merge(current_line_item, other_order_line_item)\n if current_line_item\n current_line_item.quantity += other_order_line_item.quantity\n handle_error(current_line_item) unless current_line_item.save\n else\n order.line_items << other_order_line_item\n handle_error(other_order_line_item) unless other_order_line_item.save\n end\n end", "def default_attributes\n target_key = relationship.target_key.map { |property| property.name }\n source_scope = relationship.source_scope(source)\n super.except(*target_key).update(source_scope).freeze\n end", "def copy_wells(from_collection:, to_collection:, association_map:)\n association_map.each do |map|\n to_loc = map[:to_loc]\n from_loc = map[:from_loc]\n item = from_collection.part(from_loc[0], from_loc[1])\n to_collection.set(to_loc[0], to_loc[1], item)\n end\n end", "def relation_change_operations\n return [{}, {}] unless relation_changes?\n\n additions = []\n removals = []\n # go through all the additions of a collection and generate an action to add.\n relation_updates.each do |field, collection|\n if collection.additions.count > 0\n additions.push Parse::RelationAction.new(field, objects: collection.additions, polarity: true)\n end\n # go through all the additions of a collection and generate an action to remove.\n if collection.removals.count > 0\n removals.push Parse::RelationAction.new(field, objects: collection.removals, polarity: false)\n end\n end\n # merge all additions and removals into one large hash\n additions = additions.reduce({}) { |m, v| m.merge! v.as_json }\n removals = removals.reduce({}) { |m, v| m.merge! v.as_json }\n [additions, removals]\n end", "def perform_additional_merge_operations!(other)\n end", "def merge(other)\n other.items.each do |item, record|\n @items[item] ||= {observed: [], removed: []}\n @items[item][:observed] |= record[:observed]\n @items[item][:removed] |= record[:removed]\n @items[item][:observed] -= @items[item][:removed]\n end\n end", "def process\n Trade::Shipment.update_all(\n { taxon_concept_id: @taxon_relationship.taxon_concept_id },\n {\n taxon_concept_id: @old_taxon_relationship.taxon_concept_id,\n reported_taxon_concept_id: @taxon_relationship.other_taxon_concept_id\n }\n )\n end", "def process_relations\n pending_relations.each_pair do |name, value|\n association = relations[name]\n if value.is_a?(Hash)\n association.nested_builder(value, {}).build(self)\n else\n send(\"#{name}=\", value)\n end\n end\n end", "def merge_select_extra\n relation.select_extra_values.concat(other.select_extra_values).uniq! \\\n if other.select_extra_values.present?\n end", "def changed_associations\n @changed_associations ||= []\n end", "def merge_into(another_station)\n self.lifts.each do |lift|\n lift.station = another_station\n lift.save!\n end\n\n self.lines_stations.each do |line_station|\n line_station.station_id = another_station.id\n line_station.save!\n end\n\n another_station.location = self.location if self.location\n self.delete\n end", "def un_merge\n Contact.transaction do\n self.parents.each do |contact|\n contact.update_attribute('merged_to_form_contact_id', 0)\n if contact.contact_type == Constants::CONTACT_TYPE::PROSPECT\n ContactProspect.update_all(\"prospect_old_id = NULL, prospect_id = #{contact.id}\", \"prospect_old_id = #{contact.id}\")\n else\n ContactProspect.update_all(\"contact_old_id = NULL, contact_id = #{contact.id}\", \"contact_old_id = #{contact.id}\")\n end\n end\n self.emails.clear\n self.sources.clear\n self.contact_metas.clear\n self.destroy_shares\n self.destroy\n\n end\n end", "def remote_has_many(*args)\n options = args.extract_options!\n\n args.each do |arg|\n association_hash = {:name => arg, :association_type => :has_many, :options => options}\n self.remote_associations << association_hash\n build_remote_has_many_association(association_hash)\n end\n end", "def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end", "def merge_with(master, ignored_attr = [])\n # Just in case a user tries to merge a contact with itself,\n # even though the interface prevents this from happening.\n return false if master == self\n\n merge_attr = self.merge_attributes\n # ------ Remove ignored attributes from this contact\n ignored_attr.each { |attr| merge_attr.delete(attr) }\n\n # Perform all actions in an atomic transaction, so that if one part of the process fails,\n # the whole merge can be rolled back.\n Contact.transaction do\n\n # ------ Merge attributes: ensure only model attributes are updated.\n model_attributes = merge_attr.dup.reject{ |k,v| !master.attributes.keys.include?(k) }\n master.update_attributes(model_attributes)\n\n # ------ Merge 'belongs_to' and 'has_one' associations\n {'user_id' => 'user', 'lead_id' => 'lead', 'assigned_to' => 'assignee'}.each do |attr, method|\n unless ignored_attr.include?(attr)\n master.send(method + \"=\", self.send(method))\n end\n end\n \n # ------ Merge address associations\n master.address_attributes.keys.each do |attr|\n unless ignored_attr.include?(attr)\n master.send(attr + \"=\", self.send(attr))\n end\n end\n\n # ------ Merge 'has_many' associations\n self.tasks.each { |t| t.asset = master; t.save! }\n self.emails.each { |e| e.mediator = master; e.save! }\n self.comments.each { |c| c.commentable = master; c.save! }\n\n # Find all AccountContact records with the duplicate contact,\n # and only add the master contact if it is not already added to the account.\n AccountContact.find_all_by_contact_id(self.id).each do |ac|\n unless ac.account.contacts.include?(master)\n ac.contact_id = master.id; ac.save!\n end\n end\n \n # Find all ContactOpportunity records with the duplicate contact,\n # and only add the master contact if it is not already added to the opportunity.\n ContactOpportunity.find_all_by_contact_id(self.id).each do |co|\n unless co.opportunity.contacts.include?(master)\n co.contact_id = master.id; co.save!\n end\n end\n\n # Merge tags\n all_tags = (self.tags + master.tags).uniq\n master.tag_list = all_tags.map(&:name).join(\", \")\n \n # Call the merge_hook - useful if you have custom actions that need to happen during a merge\n master.merge_hook(self)\n\n if master.save!\n # Update any existing aliases that were pointing to the duplicate record\n ContactAlias.find_all_by_contact_id(self.id).each do |ca|\n ca.update_attribute(:contact, master)\n end\n\n # Create the contact alias and destroy the merged contact.\n if ContactAlias.create(:contact => master,\n :destroyed_contact_id => self.id)\n # Must force a reload of the contact, and shake off all migrated assets.\n self.reload\n self.destroy\n end\n end\n end # transaction\n end" ]
[ "0.6279769", "0.604382", "0.5891735", "0.582994", "0.58014786", "0.57531184", "0.57325864", "0.56632537", "0.5641926", "0.56298", "0.5607323", "0.55446535", "0.5533901", "0.5524569", "0.5494175", "0.5429972", "0.5389573", "0.53818464", "0.53704613", "0.5345588", "0.53173304", "0.5302854", "0.52856666", "0.52792", "0.52534944", "0.5244538", "0.52378005", "0.5230515", "0.5228717", "0.5217588", "0.520526", "0.51853496", "0.5164564", "0.51592594", "0.51529056", "0.51387465", "0.5136982", "0.51248795", "0.5123738", "0.5117603", "0.51051456", "0.5100085", "0.50978386", "0.50945705", "0.5091934", "0.5091363", "0.50871646", "0.5081036", "0.5070606", "0.50694436", "0.50637186", "0.5058973", "0.5050549", "0.5048999", "0.5048834", "0.5047106", "0.5040424", "0.50377804", "0.50338376", "0.50270015", "0.5025397", "0.5021446", "0.5015365", "0.5013179", "0.5012329", "0.5004183", "0.4999981", "0.49921265", "0.4992021", "0.4984227", "0.49821553", "0.4979751", "0.4979751", "0.4971197", "0.49698627", "0.49679083", "0.49653026", "0.49601978", "0.49497288", "0.49457663", "0.49456167", "0.49405497", "0.4939827", "0.49344206", "0.49342573", "0.49294442", "0.49287173", "0.49257135", "0.49245945", "0.49207026", "0.49111453", "0.49063194", "0.49013883", "0.49009383", "0.48928428", "0.48896664", "0.488684", "0.48857623", "0.4883494", "0.48826477" ]
0.680091
0
GET /receipt_states GET /receipt_states.json
def index @receipt_states = ReceiptState.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_states\n perform(:get, 'enum/states', nil, nonauth_headers).body\n end", "def get_state\n @states = State.find_state(params[:id])\n respond_to do |format|\n format.json { render :json => @states }\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 @states = State.all\n \n render json: @states\n end", "def _region_states(region_id)\n get('region/states', region_id)\n end", "def index\n @states = State.all\n respond_with(@states)\n end", "def index\n @api_states = Api::State.all\n end", "def us_states\n response = get('AllUSStates')\n StoreStatesSerializer.new([]).from_xml(response) #.map(&:state)\n end", "def index\n @states = State.all\n end", "def index\n @states = State.all\n end", "def index\n @states = State.all\n end", "def index\n @states = State.all\n end", "def index\n @states = State.all\n end", "def pull_states\n render template: 'responses/pull_states.xml.builder', layout: false\n end", "def create\n @receipt_state = ReceiptState.new(receipt_state_params)\n\n respond_to do |format|\n if @receipt_state.save\n format.html { redirect_to @receipt_state, notice: 'Receipt state was successfully created.' }\n format.json { render :show, status: :created, location: @receipt_state }\n else\n format.html { render :new }\n format.json { render json: @receipt_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def _state_deals(state_id)\n get('state/deals', state_id, options: { type: :array })\n end", "def device_states_list\n get \"deviceStates\"\n end", "def state_events(state)\n api_return = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?stateCode=' + state + '&apikey=' + $ticket_master_api_key)\n JSON.parse(api_return)\nend", "def set_receipt_state\n @receipt_state = ReceiptState.find(params[:id])\n end", "def index\n @states = State.order(\"name\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @states }\n end\n end", "def index\n @sprint_states = SprintState.all\n end", "def index\n @user_states = UserState.all\n end", "def index\n @user_states = UserState.all\n end", "def index\n @states = @country.states.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @states }\n end\n end", "def states\n @attributes[\"data\"][\"states\"]\n end", "def show\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state }\n end\n end", "def show\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state }\n end\n end", "def show\n render json: @state\n end", "def orderStates\n @states = Hash.new\n @states[0] = \"Processing\"\n @states[1] = \"Shipped\"\n @states[2] = \"Delivered\"\n @states[3] = \"Cancelled\"\n end", "def sell_shop_orders_states (params={})\r\n url = api_url \"/sell/shop/orders/states\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end", "def states\n []\n end", "def states\n []\n end", "def states\r\n @states.collect {|id| $data_states[id] }\r\n end", "def get_state\n \"Treasury state: #{@resources}\"\n end", "def index\n @realestates = Realestate.all\n end", "def index\n @realestates = Realestate.all\n end", "def get_state\n send_request(FUNCTION_GET_STATE, [], '', 2, '? ?')\n end", "def index\n @action_states = ActionState.all\n end", "def index\n @ticketstates = Ticketstate.all\n end", "def index\n @event_states = EventState.all\n end", "def index\n @receipts = Receipt.status_based_receipts(params[:receipt_status] || \"open\")\n\n respond_to do |format|\n format.html # index.html.erb\n @recipts = Array.new\n format.json {\n @receipts = @receipts.select{|receipt|\n recipt = Hash.new\n receipt.attributes.each do |key, value|\n recipt[key] = value\n end\n recipt[:receipt_identifier] = CommonActions.linkable(receipt_path(receipt), receipt.receipt_identifier)\n recipt[:customer_name] = receipt.organization.present? ? CommonActions.linkable(organization_path(receipt.organization), receipt.organization.organization_name) : \"-\"\n recipt[:receipt_type_name] = receipt.receipt_type.present? ? receipt.receipt_type.type_name : \"\"\n recipt[:check_code] = ( receipt.receipt_type.present? && receipt.receipt_type.type_value == 'check' && receipt.deposit_check.present? ) ? receipt.deposit_check.check_identifier : \"-\"\n if can? :edit, Receipt\n recipt[:links] = CommonActions.object_crud_paths(nil, edit_receipt_path(receipt), nil)\n else\n recipt[:links] = \"\"\n end\n @recipts.push(recipt)\n }\n render json: {:aaData => @recipts}\n }\n end\n end", "def issuing_states\n IssuingStateData.issuing_states(area, date_issued)\n end", "def index\n @project_states = ProjectState.all\n json_response(@project_states)\n end", "def update\n respond_to do |format|\n if @receipt_state.update(receipt_state_params)\n format.html { redirect_to @receipt_state, notice: 'Receipt state was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_state }\n else\n format.html { render :edit }\n format.json { render json: @receipt_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def states\n @states ||= {}\n end", "def index\n @page_title = 'States'\n @states = State.all\n end", "def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end", "def index\n @program_states = ProgramState.all\n end", "def getProductStates\n ProductState.all.collect{|ps|[ps.state_name, ps.id]}\n end", "def show\n @map_state = MapState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @map_state }\n end\n end", "def index\n @surgery_states = SurgeryState.all\n end", "def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend", "def show\n @state = @country.states.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @state }\n end\n end", "def show\n @state = State.find(params[:id])\n end", "def show\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_state }\n end\n end", "def show\n @unemployment_form = UnemploymentForm.find(params[:id])\n @states = State.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unemployment_form }\n end\n end", "def index\n @federal_states = FederalState.all\n end", "def index\n @state_types = StateType.all\n end", "def show\n @psa_state = PsaState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa_state }\n end\n end", "def device_states_get(device_name)\n get \"deviceStates/#{device_name}\"\n end", "def show\n @sectioneight_form = SectioneightForm.find(params[:id])\n @states = State.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sectioneight_form }\n end\n end", "def index\n @asset_states = AssetState.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asset_states }\n end\n end", "def get_states(user, ids)\n _coordinator.get_states(user, ids)\n end", "def show\n @tender_state = TenderState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tender_state }\n end\n end", "def get_receipt_json(receipt_id)\n # Check Receipt using Get Receipt Service\n # https://github.com/CloudCoinConsortium/CloudBank-V2#get-receipt-service\n uri = URI(\"https://bank.cloudcoin.global/service/get_receipt\")\n params = { :rn => receipt_id, :account => Rails.application.credentials.cloudcoin[:account] }\n uri.query = URI.encode_www_form(params)\n\n # Response\n res = \"\"\n Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # Net::HTTPResponse object\n # res.code should be 200\n end\n\n # res.code should be 200\n if (res.is_a?(Net::HTTPSuccess))\n # Receive the JSON response and parse it\n response_json = JSON.parse(res.body)\n return response_json\n else\n # TODO redirect to deposit index\n redirect_to deposit_index_url, alert: \"Did not get a valid response from the get receipt service.\"\n return nil\n end\n end", "def query_contact_states(options = nil)\n require_relative 'contactservicestate'\n @api.cursor(ContactServiceState, get_base_api_path() + \"/states\", options)\n end", "def state\n [\n [\"AC\",\"Acre\"],\n [\"AL\",\"Alagoas\"],\n [\"AP\",\"Amapa\"],\n [\"AM\",\"Amazonas\"],\n [\"BA\",\"Bahia\"],\n [\"CE\",\"Ceara\"],\n [\"DF\",\"Distrito Federal\"],\n [\"ES\",\"Espirito Santo\"],\n [\"GO\",\"Goias\"],\n [\"MA\",\"Maranhao\"],\n [\"MT\",\"Mato Grosso\"],\n [\"MS\",\"Mato Grosso do Sul\"],\n [\"MG\",\"Minas Gerais\"],\n [\"PA\",\"Para\"],\n [\"PB\",\"Paraiba\"],\n [\"PR\",\"Parana\"],\n [\"PE\",\"Pernambuco\"],\n [\"PI\",\"Piaui\"],\n [\"RJ\",\"Rio de Janeiro\"],\n [\"RN\",\"Rio Grande do Norte\"],\n [\"RS\",\"Rio Grande do Sul\"],\n [\"RO\",\"Rondonia\"],\n [\"RR\",\"Roraima\"],\n [\"SC\",\"Santa Catarina\"],\n [\"SP\",\"Sao Paulo\"],\n [\"SE\",\"Sergipe\"],\n [\"TO\",\"Tocantins\"],\n ]\n end", "def receipt_state_params\n params.require(:receipt_state).permit(:nombre_stado)\n end", "def all_state(id)\n $app_sessions[id][:state]\nend", "def states\n @finity.states.map { |name, _| name }\n end", "def show\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @state }\n end\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 set_draft_all\n @states.set_draft_all\n\n respond_to do |format|\n format.json {\n render json: {\n 'message': t('.success'),\n 'type': 'success'\n }\n }\n end\n end", "def index\n @task_states = TaskState.all\n end", "def get_state\n @client.get_state\n end", "def display_all_waiaria_states\n # Interface method\n end", "def index\n @process_states = ProcessState.all\n end", "def states; @_hegemon_states.keys; end", "def index\n# @states = State.all\n#pagination:\n\t@states = State.all.paginate :per_page => 5, :page => params[:page]\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @states }\n end\n end", "def show\n @prob = Prob.find(params[:id])\n @states = State.find_all_by_prob_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prob }\n end\n end", "def index\n @modelstates = Modelstate.all\n end", "def index\n @back_link = admin_path\n #@state_provs = StateProv.all\n respond_to do |format|\n format.html { @state_provs = StateProv.all }\n format.json { @state_provs = StateProv.search(params[:term]) }\n end\n end", "def show\n @state_cadre = StateCadre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state_cadre }\n end\n end", "def list_alert_state(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts_state'\n\t\targs[:query]['Action'] = 'ListAlertState'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :alert_name\n\t\t\targs[:query]['AlertName'] = optional[:alert_name]\n\t\tend\n\t\tif optional.key? :dimensions\n\t\t\targs[:query]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tif optional.key? :end_time\n\t\t\targs[:query]['EndTime'] = optional[:end_time]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :start_time\n\t\t\targs[:query]['StartTime'] = optional[:start_time]\n\t\tend\n\t\tself.run(args)\n\tend", "def state\n [\n [\"AC\", \"Acre\"],\n [\"AL\", \"Alagoas\"],\n [\"AP\", \"Amapa\"],\n [\"AM\", \"Amazonas\"],\n [\"BA\", \"Bahia\"],\n [\"CE\", \"Ceara\"],\n [\"DF\", \"Distrito Federal\"],\n [\"ES\", \"Espirito Santo\"],\n [\"GO\", \"Goias\"],\n [\"MA\", \"Maranhao\"],\n [\"MT\", \"Mato Grosso\"],\n [\"MS\", \"Mato Grosso do Sul\"],\n [\"MG\", \"Minas Gerais\"],\n [\"PA\", \"Para\"],\n [\"PB\", \"Paraiba\"],\n [\"PR\", \"Parana\"],\n [\"PE\", \"Pernambuco\"],\n [\"PI\", \"Piaui\"],\n [\"RJ\", \"Rio de Janeiro\"],\n [\"RN\", \"Rio Grande do Norte\"],\n [\"RS\", \"Rio Grande do Sul\"],\n [\"RO\", \"Rondonia\"],\n [\"RR\", \"Roraima\"],\n [\"SC\", \"Santa Catarina\"],\n [\"SP\", \"Sao Paulo\"],\n [\"SE\", \"Sergipe\"],\n [\"TO\", \"Tocantins\"],\n ]\n end", "def show\n @invoice_status = InvoiceStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_status }\n end\n end", "def search\n @states = State::ALL_STATES\n end", "def index\n @united_states = UnitedState.all\n end", "def get_state\[email protected]\nend", "def show\n @state = @contact.support_state\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "def find_kanban_state_id\n issues_status_id = params[:issue_status_id]\n issue_states = IssueStatusKanbanState.where(:issue_status_id=>issues_status_id)\n if issue_states.present?\n kanban_state_id = issue_states.map(&:kanban_state_id).first\n end\n\n if request.xhr?\n render :json => {\n :kanban_state_id=> kanban_state_id\n }\n end\n\n end", "def view\n\t@country = Country.all\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @state }\n end\n end", "def state\n status[\"state\"]\n end", "def index\n if receipt_type\n @receipts = receipt_type.includes(:representative).all\n else\n redirect_to root_url\n end\n end", "def _state_news(state_id)\n get('state/news', state_id, options: { type: :array })\n end", "def show\n #@leader = Leader.find_by_slug(params[:id])\n #@state = State.find_by_slug(params[:id])\n #debugger\n render json: @state\n #render json: @state\n #debugger\n #raise @state.inspect\n #@state = @leader.state\n end", "def select_state state\r\n select state, :from => \"client_state_phys\"\r\n end", "def index\n @receipt_entries = ReceiptEntry.all\n end", "def show\n json_response(@project_state)\n end", "def states; end" ]
[ "0.69379455", "0.6857879", "0.65066457", "0.648242", "0.64304185", "0.632138", "0.62439007", "0.6206591", "0.61973417", "0.61973417", "0.61973417", "0.61973417", "0.61973417", "0.6164506", "0.6146889", "0.60967326", "0.6074763", "0.60676855", "0.6046754", "0.6041937", "0.6041604", "0.6024516", "0.6024516", "0.6022818", "0.60191584", "0.60075474", "0.60075474", "0.599627", "0.5959479", "0.59545404", "0.5950543", "0.5950543", "0.5949422", "0.5942367", "0.59410626", "0.59410626", "0.59409016", "0.5898451", "0.5890812", "0.5882764", "0.5847277", "0.5837559", "0.5828059", "0.581743", "0.5794261", "0.57941973", "0.5782705", "0.57442737", "0.57440275", "0.5741599", "0.57242763", "0.5705407", "0.5696195", "0.568952", "0.56806546", "0.564752", "0.5644291", "0.5604412", "0.5588327", "0.558047", "0.5573056", "0.55720377", "0.5570751", "0.5565647", "0.55390114", "0.55283666", "0.551951", "0.5516679", "0.54997116", "0.5489148", "0.54835236", "0.5483433", "0.5480074", "0.54788", "0.54636604", "0.5439276", "0.5431456", "0.5431439", "0.54261273", "0.5417606", "0.5409243", "0.54021937", "0.539357", "0.5389726", "0.5383094", "0.53761685", "0.53664047", "0.5359533", "0.53546154", "0.535105", "0.5350002", "0.5347882", "0.53466", "0.5330248", "0.5327305", "0.53187466", "0.5315035", "0.5313541", "0.5307264", "0.53030014" ]
0.78011894
0
GET /receipt_states/1 GET /receipt_states/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @receipt_states = ReceiptState.all\n end", "def get_state\n @states = State.find_state(params[:id])\n respond_to do |format|\n format.json { render :json => @states }\n end\n end", "def index\n @states = State.all\n \n render json: @states\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 show\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state }\n end\n end", "def show\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state }\n end\n end", "def get_states\n perform(:get, 'enum/states', nil, nonauth_headers).body\n end", "def create\n @receipt_state = ReceiptState.new(receipt_state_params)\n\n respond_to do |format|\n if @receipt_state.save\n format.html { redirect_to @receipt_state, notice: 'Receipt state was successfully created.' }\n format.json { render :show, status: :created, location: @receipt_state }\n else\n format.html { render :new }\n format.json { render json: @receipt_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_receipt_state\n @receipt_state = ReceiptState.find(params[:id])\n end", "def show\n render json: @state\n end", "def index\n @api_states = Api::State.all\n end", "def index\n @states = State.all\n respond_with(@states)\n end", "def show\n @state = State.find(params[:id])\n end", "def show\n @map_state = MapState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @map_state }\n end\n end", "def show\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_state }\n end\n end", "def index\n @states = State.order(\"name\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @states }\n end\n end", "def index\n @states = State.all\n end", "def index\n @states = State.all\n end", "def index\n @states = State.all\n end", "def index\n @states = State.all\n end", "def index\n @states = State.all\n end", "def _region_states(region_id)\n get('region/states', region_id)\n end", "def show\n @state = @country.states.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @state }\n end\n end", "def show\n @psa_state = PsaState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa_state }\n end\n end", "def _state_deals(state_id)\n get('state/deals', state_id, options: { type: :array })\n end", "def index\n @receipts = Receipt.status_based_receipts(params[:receipt_status] || \"open\")\n\n respond_to do |format|\n format.html # index.html.erb\n @recipts = Array.new\n format.json {\n @receipts = @receipts.select{|receipt|\n recipt = Hash.new\n receipt.attributes.each do |key, value|\n recipt[key] = value\n end\n recipt[:receipt_identifier] = CommonActions.linkable(receipt_path(receipt), receipt.receipt_identifier)\n recipt[:customer_name] = receipt.organization.present? ? CommonActions.linkable(organization_path(receipt.organization), receipt.organization.organization_name) : \"-\"\n recipt[:receipt_type_name] = receipt.receipt_type.present? ? receipt.receipt_type.type_name : \"\"\n recipt[:check_code] = ( receipt.receipt_type.present? && receipt.receipt_type.type_value == 'check' && receipt.deposit_check.present? ) ? receipt.deposit_check.check_identifier : \"-\"\n if can? :edit, Receipt\n recipt[:links] = CommonActions.object_crud_paths(nil, edit_receipt_path(receipt), nil)\n else\n recipt[:links] = \"\"\n end\n @recipts.push(recipt)\n }\n render json: {:aaData => @recipts}\n }\n end\n end", "def index\n @states = @country.states.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @states }\n end\n end", "def state_events(state)\n api_return = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?stateCode=' + state + '&apikey=' + $ticket_master_api_key)\n JSON.parse(api_return)\nend", "def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end", "def show\n @unemployment_form = UnemploymentForm.find(params[:id])\n @states = State.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unemployment_form }\n end\n end", "def pull_states\n render template: 'responses/pull_states.xml.builder', layout: false\n end", "def update\n respond_to do |format|\n if @receipt_state.update(receipt_state_params)\n format.html { redirect_to @receipt_state, notice: 'Receipt state was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_state }\n else\n format.html { render :edit }\n format.json { render json: @receipt_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_state\n send_request(FUNCTION_GET_STATE, [], '', 2, '? ?')\n end", "def get_state\n \"Treasury state: #{@resources}\"\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 show\n @tender_state = TenderState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tender_state }\n end\n end", "def index\n @sprint_states = SprintState.all\n end", "def show\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @state }\n end\n end", "def index\n @realestates = Realestate.all\n end", "def index\n @realestates = Realestate.all\n end", "def show\n @state_cadre = StateCadre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state_cadre }\n end\n end", "def show\n @sectioneight_form = SectioneightForm.find(params[:id])\n @states = State.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sectioneight_form }\n end\n end", "def show\n @invoice_status = InvoiceStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_status }\n end\n end", "def index\n @project_states = ProjectState.all\n json_response(@project_states)\n end", "def index\n @user_states = UserState.all\n end", "def index\n @user_states = UserState.all\n end", "def new\n @state = State.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @state }\n end\n end", "def new\n @state = State.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @state }\n end\n end", "def find_kanban_state_id\n issues_status_id = params[:issue_status_id]\n issue_states = IssueStatusKanbanState.where(:issue_status_id=>issues_status_id)\n if issue_states.present?\n kanban_state_id = issue_states.map(&:kanban_state_id).first\n end\n\n if request.xhr?\n render :json => {\n :kanban_state_id=> kanban_state_id\n }\n end\n\n end", "def show\n @prob = Prob.find(params[:id])\n @states = State.find_all_by_prob_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prob }\n end\n end", "def get_receipt_json(receipt_id)\n # Check Receipt using Get Receipt Service\n # https://github.com/CloudCoinConsortium/CloudBank-V2#get-receipt-service\n uri = URI(\"https://bank.cloudcoin.global/service/get_receipt\")\n params = { :rn => receipt_id, :account => Rails.application.credentials.cloudcoin[:account] }\n uri.query = URI.encode_www_form(params)\n\n # Response\n res = \"\"\n Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # Net::HTTPResponse object\n # res.code should be 200\n end\n\n # res.code should be 200\n if (res.is_a?(Net::HTTPSuccess))\n # Receive the JSON response and parse it\n response_json = JSON.parse(res.body)\n return response_json\n else\n # TODO redirect to deposit index\n redirect_to deposit_index_url, alert: \"Did not get a valid response from the get receipt service.\"\n return nil\n end\n end", "def index\n @page_title = 'States'\n @states = State.all\n end", "def sell_shop_orders_states (params={})\r\n url = api_url \"/sell/shop/orders/states\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end", "def show\n @purchase_item_status = PurchaseItemStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_item_status }\n end\n end", "def index\n @ticketstates = Ticketstate.all\n end", "def show\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt }\n end\n end", "def show\n \n @municipality = Municipality.find(params[:state_id],params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipality }\n end\n end", "def show\n #@leader = Leader.find_by_slug(params[:id])\n #@state = State.find_by_slug(params[:id])\n #debugger\n render json: @state\n #render json: @state\n #debugger\n #raise @state.inspect\n #@state = @leader.state\n end", "def show\n @goal_state = GoalState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_state }\n end\n end", "def byState\n @companies = Company.where(\"state_id = ?\", company_params[:state_id])\n\n render json: @companies\n end", "def index\n @action_states = ActionState.all\n end", "def new\n @state = @country.states.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @state }\n end\n end", "def index\n @program_states = ProgramState.all\n end", "def show\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_receipt }\n end\n end", "def view\n\t@country = Country.all\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @state }\n end\n end", "def index\n @asset_states = AssetState.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asset_states }\n end\n end", "def select_state state\r\n select state, :from => \"client_state_phys\"\r\n end", "def specific\n @state = State.find(params[:id])\n @loans = @state.loans.where(:purpose_id == params[:purpose_id])\n render json: { state: @state, loans: @loans }\n end", "def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end", "def show\n @hand_state = HandState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hand_state }\n end\n end", "def index\n @state_types = StateType.all\n end", "def us_states\n response = get('AllUSStates')\n StoreStatesSerializer.new([]).from_xml(response) #.map(&:state)\n end", "def create\n @recipe = Recipe.new(recipe_params)\n @states = State.all\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def device_states_list\n get \"deviceStates\"\n end", "def index\n @event_states = EventState.all\n end", "def show\n json_response(@project_state)\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 states\n []\n end", "def states\n []\n end", "def receipt_state_params\n params.require(:receipt_state).permit(:nombre_stado)\n end", "def orderStates\n @states = Hash.new\n @states[0] = \"Processing\"\n @states[1] = \"Shipped\"\n @states[2] = \"Delivered\"\n @states[3] = \"Cancelled\"\n end", "def getProductStates\n ProductState.all.collect{|ps|[ps.state_name, ps.id]}\n end", "def show\n @state = @contact.support_state\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "def state\r\n\t\t\t`#{BITS::BITSADMIN} /getstate {#{@id}}`\r\n\t\tend", "def states\n @attributes[\"data\"][\"states\"]\n end", "def device_states_get(device_name)\n get \"deviceStates/#{device_name}\"\n end", "def index\n @surgery_states = SurgeryState.all\n end", "def get_state\n @client.get_state\n end", "def find_state\n\t\t\t@state = Category.find_by_parent_uuid_and_url_part(@country.uuid, params[:state_id].downcase) if params[:country_id] && params[:state_id]\n\t\tend", "def find_state\n\t\t\t@state = Category.find_by_parent_uuid_and_url_part(@country.uuid, params[:state_id].downcase) if params[:country_id] && params[:state_id]\n\t\tend", "def states\r\n @states.collect {|id| $data_states[id] }\r\n end", "def all_state(id)\n $app_sessions[id][:state]\nend", "def create\n @state = State.new(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to(states_path, :notice => 'State was Created Successfully.') }\n format.xml { render :xml => @state, :status => :created, :location => @state }\n else\n\t@country = Country.all\n format.html { render :action => \"new\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @federal_states = FederalState.all\n end", "def new\n @map_state = MapState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @map_state }\n end\n end", "def show\n @breadcrumb = 'read'\n @order_status = OrderStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_status }\n end\n end", "def new\n @expense_state = ExpenseState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense_state }\n end\n end", "def new\n @psa_state = PsaState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @psa_state }\n end\n end", "def index\n @back_link = admin_path\n #@state_provs = StateProv.all\n respond_to do |format|\n format.html { @state_provs = StateProv.all }\n format.json { @state_provs = StateProv.search(params[:term]) }\n end\n end", "def state\n status[\"state\"]\n end", "def show\n @estate = Estate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate }\n end\n end" ]
[ "0.7518266", "0.72151774", "0.65934783", "0.6524527", "0.6524462", "0.6524462", "0.64398336", "0.6361585", "0.6247348", "0.6233903", "0.62020814", "0.61944073", "0.61319196", "0.6127227", "0.61244375", "0.6119571", "0.61108017", "0.61108017", "0.61108017", "0.61108017", "0.61108017", "0.6088392", "0.60571957", "0.6005695", "0.6003509", "0.59969324", "0.5991925", "0.5982891", "0.5963408", "0.5959225", "0.5954581", "0.5948973", "0.59256226", "0.58858794", "0.58716416", "0.58680564", "0.58640337", "0.5847205", "0.5843881", "0.5843881", "0.58250815", "0.58246183", "0.57951736", "0.5790113", "0.5787289", "0.5787289", "0.5784949", "0.5784949", "0.577941", "0.5744639", "0.57233316", "0.5723048", "0.57196635", "0.5705792", "0.5697072", "0.56749004", "0.56744975", "0.56596404", "0.56541294", "0.5648205", "0.564483", "0.56418926", "0.5640921", "0.5632478", "0.5626632", "0.5623139", "0.5620218", "0.5618352", "0.560341", "0.5595696", "0.55945563", "0.55830765", "0.55820966", "0.55793273", "0.5575398", "0.55743665", "0.5558034", "0.55549616", "0.55549616", "0.55400616", "0.55388784", "0.5534305", "0.55322623", "0.55315095", "0.5511316", "0.5500983", "0.54987705", "0.54964036", "0.54948753", "0.54948753", "0.5494765", "0.5494233", "0.5482818", "0.54793096", "0.5478762", "0.5478699", "0.54776055", "0.54623085", "0.5449791", "0.54485697", "0.5423004" ]
0.0
-1
POST /receipt_states POST /receipt_states.json
def create @receipt_state = ReceiptState.new(receipt_state_params) respond_to do |format| if @receipt_state.save format.html { redirect_to @receipt_state, notice: 'Receipt state was successfully created.' } format.json { render :show, status: :created, location: @receipt_state } else format.html { render :new } format.json { render json: @receipt_state.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @receipt_states = ReceiptState.all\n end", "def receipt_state_params\n params.require(:receipt_state).permit(:nombre_stado)\n end", "def create\n @state = State.new(state_params)\n\n if @state.save\n render json: @state, status: :created, location: @state\n # 'state was successfully created.'\n else\n render json: @state.errors, status: :unprocessable_entity\n end\n end", "def create\n @state = State.new(state_params)\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render :show, status: :created, location: @state }\n else\n format.html { render :new }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe = Recipe.new(recipe_params)\n @states = State.all\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_receipt_state\n @receipt_state = ReceiptState.find(params[:id])\n end", "def create\n @state = State.new(state_params)\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render :show, status: :created, location: @state }\n else\n format.html { render :new }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state = State.new(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render json: @state, status: :created, location: @state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state = State.new(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render json: @state, status: :created, location: @state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state = State.new(state_params)\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render action: 'show', status: :created, location: @state }\n else\n format.html { render action: 'new' }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state_prov = StateProv.new(state_prov_params)\n\n respond_to do |format|\n if @state_prov.save\n format.html { redirect_to @state_prov, notice: 'State prov was successfully created.' }\n format.json { render :show, status: :created, location: @state_prov }\n else\n format.html { render :new }\n format.json { render json: @state_prov.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@state = State.create(states_params)\n\t\tif @state.save\n\t\t\tflash[:success] = \"Record updated successfully\"\n\t\t\tredirect_to states_path\n\t\t else\n\t\t \tflash[:error] = \"Record not updated\"\n\t\t redirect_to states_path\n\t\tend\n\tend", "def create\n @state = State.new(state_params)\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render json:{message:'State was successfully created.'}, status: :created, location: @state }\n else\n format.html { render action: 'new' }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state = State.new(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to(states_path, :notice => 'State was Created Successfully.') }\n format.xml { render :xml => @state, :status => :created, :location => @state }\n else\n\t@country = Country.all\n format.html { render :action => \"new\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt_state.update(receipt_state_params)\n format.html { redirect_to @receipt_state, notice: 'Receipt state was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_state }\n else\n format.html { render :edit }\n format.json { render json: @receipt_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def orderStates\n @states = Hash.new\n @states[0] = \"Processing\"\n @states[1] = \"Shipped\"\n @states[2] = \"Delivered\"\n @states[3] = \"Cancelled\"\n end", "def create\n @states_assign = StatesAssign.new(states_assign_params)\n\n respond_to do |format|\n if @states_assign.save\n format.html { redirect_to @states_assign, notice: 'State was successfully created.' }\n format.json { render :show, status: :created, location: @states_assign }\n \"#{@states_assign.assigned_to}StateMachine\".constantize.state @states_assign.state.name.to_sym\n\n puts '##############################'\n puts LeadStateMachine.states\n puts '##############################'\n\n else\n format.html { render :new }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state = @country.states.build(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to([@country, @state], :notice => 'State was successfully created.') }\n format.xml { render :xml => @state, :status => :created, :location => [@country, @state] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @surgery_state = SurgeryState.new(surgery_state_params)\n\n respond_to do |format|\n if @surgery_state.save\n format.html { redirect_to @surgery_state, notice: 'Surgery state was successfully created.' }\n format.json { render :show, status: :created, location: @surgery_state }\n else\n format.html { render :new }\n format.json { render json: @surgery_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @map_state = MapState.new(params[:map_state])\n\n respond_to do |format|\n if @map_state.save\n format.html { redirect_to @map_state, :notice => 'Map state was successfully created.' }\n format.json { render :json => @map_state, :status => :created, :location => @map_state }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @map_state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def states_params\n\t \t params.require(:state).permit(:country_id, :name, :status)\n\t end", "def create\n @user_state = UserState.new(user_state_params)\n\n respond_to do |format|\n if @user_state.save\n format.html { redirect_to @user_state, notice: 'User state was successfully created.' }\n format.json { render :show, status: :created, location: @user_state }\n else\n format.html { render :new }\n format.json { render json: @user_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_state = EventState.new(event_state_params)\n\n respond_to do |format|\n if @event_state.save\n format.html { redirect_to @event_state, notice: 'Event state was successfully created.' }\n format.json { render :show, status: :created, location: @event_state }\n else\n format.html { render :new }\n format.json { render json: @event_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_state = UserState.new(user_state_params)\n\n respond_to do |format|\n if @user_state.save\n format.html { redirect_to @user_state, notice: 'User state was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_state }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense_state = ExpenseState.new(params[:expense_state])\n\n respond_to do |format|\n if @expense_state.save\n format.html { redirect_to @expense_state, notice: 'Expense state was successfully created.' }\n format.json { render json: @expense_state, status: :created, location: @expense_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @realestate = Realestate.new(realestate_params)\n\n respond_to do |format|\n if @realestate.save\n format.html { redirect_to @realestate, notice: 'Realestate was successfully created.' }\n format.json { render :show, status: :created, location: @realestate }\n else\n format.html { render :new }\n format.json { render json: @realestate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @realestate = Realestate.new(realestate_params)\n @realestate = current_user.realestates.build(realestate_params)\n respond_to do |format|\n if @realestate.save\n format.html { redirect_to @realestate, notice: \"Realestate was successfully created.\" }\n format.json { render :show, status: :created, location: @realestate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @realestate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_state = Api::State.new(api_state_params)\n\n if @api_state.save\n render json: @api_state, status: :created, location: @api_state\n else\n render json: @api_state.errors, status: :unprocessable_entity\n end\n end", "def create\n @united_state = UnitedState.new(united_state_params)\n\n respond_to do |format|\n if @united_state.save\n format.html { redirect_to @united_state, notice: 'United state was successfully created.' }\n format.json { render :show, status: :created, location: @united_state }\n else\n format.html { render :new }\n format.json { render json: @united_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state = State.new(state_params)\n\n end", "def create\n @project_states = ProjectState.create!(project_state_params)\n json_response(@project_states, :created)\n end", "def create\n @modelstate = Modelstate.new(modelstate_params)\n\n respond_to do |format|\n if @modelstate.save\n format.html { redirect_to @modelstate, notice: 'Modelstate was successfully created.' }\n format.json { render :show, status: :created, location: @modelstate }\n else\n format.html { render :new }\n format.json { render json: @modelstate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sprint_state = SprintState.new(sprint_state_params)\n\n respond_to do |format|\n if @sprint_state.save\n format.html { redirect_to @sprint_state, notice: 'Sprint state was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sprint_state }\n else\n format.html { render action: 'new' }\n format.json { render json: @sprint_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @process_state = ProcessState.new(process_state_params)\n\n respond_to do |format|\n if @process_state.save\n format.html { redirect_to @process_state, notice: 'Process state was successfully created.' }\n format.json { render action: 'show', status: :created, location: @process_state }\n else\n format.html { render action: 'new' }\n format.json { render json: @process_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tender_state = TenderState.new(params[:tender_state])\n\n respond_to do |format|\n if @tender_state.save\n format.html { redirect_to @tender_state, notice: 'Tender state was successfully created.' }\n format.json { render json: @tender_state, status: :created, location: @tender_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tender_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state_object = States.new\n @states = @state_object.abbreviations\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save\n redirect_to \"/restaurants/#{@restaurant.id}\"\n else\n flash[:notice] = \"Your restaurant couldn't be saved. Sorry!\"\n render :new\n end\n end", "def create\n @federal_state = FederalState.new(federal_state_params)\n\n respond_to do |format|\n if @federal_state.save\n format.html { redirect_to @federal_state, notice: 'Federal state was successfully created.' }\n format.json { render action: 'show', status: :created, location: @federal_state }\n else\n format.html { render action: 'new' }\n format.json { render json: @federal_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empire_rc_state = EmpireRcState.new(empire_rc_state_params)\n\n respond_to do |format|\n if @empire_rc_state.save\n format.html { redirect_to empire_rc_states_path, notice: 'Empire rc state was successfully created.' }\n format.json { render :show, status: :created, location: @empire_rc_state }\n else\n format.html { render :new }\n format.json { render json: @empire_rc_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #we're going to be tailoring a message in the case of a wrong or duplicate answer:\n\n@message = \"\"\n\n \n\n#your standard new instance of the Resource line:\n\n@state = State.new(state_params)\n\n \n\n#we'll need this to check if the answer is a duplicate:\n\n@states = State.all\n\n \n\n#let's make sure the answer is correct, and that it's not a duplicate.\n\n#see the Application Helper for these methods:\n\ncorrect = check_answer_state(@state.name)\n\nis_dup = check_for_dup_state(@state.name,@states)\n\n \n\n#we're going to have a couple messages for when the user enters something that is not a city, or is a duplicate answer\n\nif correct == false\n\n@message = \"That is not a state TTS is in.\"\n\nelsif is_dup == true\n\n@message = \"You already guessed that one!\"\n\nend\n\n \n\nrespond_to do |format|\n\n#if we have > 1 city left to name, and the user's answer is true and not a duplicate answer, we'll save it in the database and redirect back to the same page\n\nif @states.count <= 48 && correct == true && is_dup == false && @state.save\n\nformat.html { redirect_to new_state_path, notice: 'State was successfully created.' }\n\nformat.json { render action: 'show', status: :created, location: @state }\n\n#if this is our last city to name, and the user's answer is true and not a duplicate answer, we'll save it in the database and redirect to the 'you won!' page\n\nelsif @states.count == 49 && correct == true && is_dup == false && @state.save\n\nformat.html { redirect_to youwonstate_path, notice: 'State was successfully created.' }\n\nformat.json { render action: 'show', status: :created, location: @state }\n\nelse\n\nformat.html { render action: 'new' }\n\nformat.json { render json: @state.errors, status: :unprocessable_entity }\n\nend\n\nend\n\nend", "def create\n @psa_state = PsaState.new(params[:psa_state])\n\n respond_to do |format|\n if @psa_state.save\n format.html { redirect_to @psa_state, notice: 'Psa state was successfully created.' }\n format.json { render json: @psa_state, status: :created, location: @psa_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @psa_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_draft_all\n @states.set_draft_all\n\n respond_to do |format|\n format.json {\n render json: {\n 'message': t('.success'),\n 'type': 'success'\n }\n }\n end\n end", "def create\n @state_type = StateType.new(state_type_params)\n\n respond_to do |format|\n if @state_type.save\n format.html { redirect_to @state_type, notice: 'State type was successfully created.' }\n format.json { render :show, status: :created, location: @state_type }\n else\n format.html { render :new }\n format.json { render json: @state_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(invoice_params)\n @invoice.workflow_state = @invoice.workflow.workflow_states.find_by(is_start: true)\n set_available_purchase_orders\n set_available_work_orders\n set_available_workflows\n respond_to do |format|\n if @invoice.save\n flash_message(:success, \"Invoice was successfully created.'\")\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n format.js {render js:'window.location.reload();'}\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n format.js {render 'new'}\n end\n end\n end", "def create \n \n\tputs params[:country]\n\tcountry = Country.where(:code => params[:country]).first\n\t\n\tputs country\n\tcountryId = country.id\n \n\tputs countryId\n\t\n @state = State.new :code => params[:code], :name => params[:name], :country_id => countryId\n \n respond_to do |format|\n if @state.save\n format.html { redirect_to(:action => \"index\") }\n else\n format.html { render action: \"new\" } \n end\n end\n end", "def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n deposit_check = DepositCheck.find_by_receipt_id(@receipt.id)\n if deposit_check\n @receipt.update_attributes(:deposit_check_id => deposit_check.id)\n elsif @receipt.receipt_type.present? && @receipt.receipt_type.type_value == \"check\"\n depositCheck = DepositCheck.create(receipt_id: @receipt.id, status: \"open\", receipt_type: @receipt.receipt_type.type_value, check_identifier: @receipt.receipt_check_code, active: 1)\n @receipt.update_attributes(:deposit_check_id => depositCheck.id)\n end\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render json: @receipt, status: :created, location: @receipt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_state = TaskState.new(task_state_params)\n\n respond_to do |format|\n if @task_state.save\n format.html { redirect_to @task_state, success: 'Task state was successfully created.' }\n format.json { render :show, status: :created, location: @task_state }\n else\n format.html { render :new }\n format.json { render json: @task_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def state_params\n params.require(:state).permit(:name, :code, :description, :country_id, :active)\n end", "def add_states(new_states); end", "def create\n @ticketstate = Ticketstate.new(ticketstate_params)\n\n respond_to do |format|\n if @ticketstate.save\n format.html { redirect_to @ticketstate, notice: '创建成功' }\n format.json { render :show, status: :created, location: @ticketstate }\n else\n format.html { render :new }\n format.json { render json: @ticketstate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @counties = County.all\n\n @county = County.create(county_params)\n\n @states = State.all.order(:state_name)\n end", "def create\n @invoice_status = InvoiceStatus.new(params[:invoice_status])\n\n respond_to do |format|\n if @invoice_status.save\n format.html { redirect_to @invoice_status, notice: 'Invoice status was successfully created.' }\n format.json { render json: @invoice_status, status: :created, location: @invoice_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def pull_states\n render template: 'responses/pull_states.xml.builder', layout: false\n end", "def create\n @po_receipt = PoReceipt.new(po_receipt_params)\n\n respond_to do |format|\n if @po_receipt.save\n format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully created.' }\n format.json { render :show, status: :created, location: @po_receipt }\n else\n format.html { render :new }\n format.json { render json: @po_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @action_state = ActionState.new(action_state_params)\n\n respond_to do |format|\n if @action_state.save\n format.html { redirect_to [project, @action_state], notice: 'Action state was successfully created.' }\n format.json { render :show, status: :created, location: @action_state }\n end\n end\n end", "def state_record_params\n params.require(:state_record).permit(:state_id, :confirmed, :recovered, :created_at, :updated_at)\n end", "def create\n @prob = Prob.new(params[:prob])\n states = @prob.state.split(\"\\n\")\n a = 0\n states.each do |state|\n @state = @prob.states.build(\n prob_id: @prob.id,\n compo: state,\n ans: a\n )\n a = 1\n end\n\n\n respond_to do |format|\n if @prob.save\n format.html { redirect_to @prob, notice: 'Prob was successfully created.' }\n format.json { render json: @prob, status: :created, location: @prob }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prob.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @datum_receipt = DatumReceipt.new(datum_receipt_params)\n\n respond_to do |format|\n if @datum_receipt.save\n format.html { redirect_to @datum_receipt, notice: 'Datum receipt was successfully created.' }\n format.json { render :show, status: :created, location: @datum_receipt }\n else\n format.html { render :new }\n format.json { render json: @datum_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @purchase_receipt = PurchaseReceipt.new(params[:purchase_receipt])\n\n respond_to do |format|\n if @purchase_receipt.save\n format.html { redirect_to @purchase_receipt, notice: 'Purchase receipt was successfully created.' }\n format.json { render json: @purchase_receipt, status: :created, location: @purchase_receipt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def stateform_params\n params.require(:stateform).permit(:date, :tax, :time_type, :income,:status ,:state )\n end", "def create_state\n State.create(state:'TX')\n end", "def state_params\n params.fetch(:state, {}).permit(:name, :code, :country_id)\n end", "def state_params\n params.require(:state).permit(:name, :shortname, :code, :population)\n end", "def destroy\n @receipt_state.destroy\n respond_to do |format|\n format.html { redirect_to receipt_states_url, notice: 'Receipt state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @state = @country.states.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @state }\n end\n end", "def create\n @stateform = Stateform.new(stateform_params)\n @stateform.user = current_user\n \n respond_to do |format|\n if @stateform.save\n format.html { redirect_to @stateform, notice: 'Hurray your Estimate is here !!!' }\n format.json { render :show, status: :created, location: @stateform }\n \n \n else\n format.html { render :new }\n format.json { render json: @stateform.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @purchase_item_status = PurchaseItemStatus.new(params[:purchase_item_status])\n\n respond_to do |format|\n if @purchase_item_status.save\n format.html { redirect_to @purchase_item_status, notice: 'Purchase item status was successfully created.' }\n format.json { render json: @purchase_item_status, status: :created, location: @purchase_item_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_item_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @receipt = current_user.receipts.build receipt_params\n\n if @receipt.save\n render json: {\n receiptId: @receipt.id\n }, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end", "def create\n unless params[:country_id]\n @city = City.new(params[:city])\n @city.step=\"2\"\n state = State.find_by_id(params[:city][:state_id]) if params[:city][:state_id]\n @city.state = state\n if @city.save\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@city.errors)\n end\n end\n end", "def create\n @hand_state = HandState.new(params[:hand_state])\n\n respond_to do |format|\n if @hand_state.save\n format.html { redirect_to @hand_state, notice: 'Hand state was successfully created.' }\n format.json { render json: @hand_state, status: :created, location: @hand_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hand_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product_verify_state = ProductVerifyState.new(product_verify_state_params)\n\n\n if @product_verify_state.save\n flash[:notict] = '新增成功'\n redirect_to :controller=>'product_verify_states' , :action=>'index'\n else\n render action: 'new'\n end\n\n end", "def create\n @termination_request = TerminationRequest.new(termination_request_params)\n @termination_request.lease_no = get_active_lease.lease_no\n @termination_request.app_status = 0 #set pending flag\n\n respond_to do |format|\n if @termination_request.save\n format.html { redirect_to @termination_request, notice: 'Termination request was successfully created.' }\n format.json { render :show, status: :created, location: @termination_request }\n else\n format.html { render :new }\n format.json { render json: @termination_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @receipt_detail = ReceiptDetail.new(receipt_detail_params)\n\n respond_to do |format|\n if @receipt_detail.save\n format.html { redirect_to @receipt_detail, notice: 'Receipt detail was successfully created.' }\n format.json { render :show, status: :created, location: @receipt_detail }\n else\n format.html { render :new }\n format.json { render json: @receipt_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def state_params\n params.require(:state).permit(:name)\n end", "def state_params\n params.require(:state).permit(:name)\n end", "def create\n @task_state = TaskState.new(params[:task_state])\n\n respond_to do |format|\n if @task_state.save\n format.html { redirect_to(@task_state, :notice => t(\"screens.notice.successfully_created\")) }\n format.xml { render :xml => @task_state, :status => :created, :location => @task_state }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task_state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @state_cadre = StateCadre.new(params[:state_cadre])\n\n respond_to do |format|\n if @state_cadre.save\n format.html { redirect_to @state_cadre, notice: 'State cadre was successfully created.' }\n format.json { render json: @state_cadre, status: :created, location: @state_cadre }\n else\n format.html { render action: \"new\" }\n format.json { render json: @state_cadre.errors, status: :unprocessable_entity }\n end\n end\n end", "def state_params\n params.require(:state).permit(:name, :abbreviation)\n end", "def spree_order_params\n params.require(:spree_order).permit(:state)\n end", "def surgery_state_params\n params.require(:surgery_state).permit(:nombre_estado)\n end", "def state_params\n params.fetch(:state, {}).permit(:name, :description)\n end", "def create \n # TODO - provide AJAX interface for setting shipping method instead of assuming first available\n shipment = @shipment_presenter.shipment\n shipment.order = @order\n shipment.shipping_method = ShippingMethod.first\n shipment.address = @shipment_presenter.address\n unless @shipment_presenter.valid? and shipment.save\n render :action => \"new\" and return\n end \n @order.state_events.create(:name => t('ship'), :user => current_user, :previous_state => @order.state) if params[:mark_shipped] \n flash[:notice] = t('created_successfully')\n redirect_to collection_url\n end", "def update\n respond_to do |format|\n \"#{@states_assign.assigned_to}StateMachine\".constantize.states.delete(@states_assign.state.name)\n if @states_assign.update(states_assign_params)\n format.html { redirect_to @states_assign, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @states_assign }\n \"#{@states_assign.assigned_to}StateMachine\".constantize.state @states_assign.state.name.to_sym\n\n puts '##############################'\n puts LeadStateMachine.states\n puts '##############################'\n\n puts '##############################'\n puts PaymentStateMachine.states\n puts '##############################'\n\n\n else\n format.html { render :edit }\n format.json { render json: @states_assign.errors, status: :unprocessable_entity }\n end\n end\n end", "def state_params\n # extend with your own params\n accessible = %i[iso name country_id]\n params.require(:state).permit(accessible)\n end", "def empire_rc_state_params\n params.require(:empire_rc_state).permit(:state, :exp_type, :master_list_name, :master_list_quantity, :master_list_update_date, :master_list_update_next, :list_notes, :customers, :matched_customers, :exp_date)\n end", "def state_params\n params.require(:state).permit(:title, :country_id)\n end", "def product_verify_state_params\n params.require(:product_verify_state).permit(:title, :create_user_id, :modify_user_id, :stoped_user_id, :stoped_at , :state)\n end", "def create\n @estate = Estate.new(params[:estate])\n\n respond_to do |format|\n if @estate.save\n format.html { redirect_to @estate, notice: 'Estate was successfully created.' }\n format.json { render json: @estate, status: :created, location: @estate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal_state = GoalState.new(params[:goal_state])\n\n respond_to do |format|\n if @goal_state.save\n format.html { redirect_to @goal_state, notice: 'Goal state was successfully created.' }\n format.json { render json: @goal_state, status: :created, location: @goal_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @states = State.all\n \n render json: @states\n end", "def create\n @state = State.new(params[:state])\n @state.created_by = @created_by\n respond_to do |format|\n if @state.save\n format.html { redirect_to([:admin,@state], :notice => 'State was successfully created.') }\n format.xml { render :xml => @admin_state, :status => :created, :location => @state }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to receipts_url, notice: 'Платеж успешно создан.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n hash = {}\n if @investment_wizard.investment.id.present?\n invs = Investment.find(@investment_wizard.investment.id)\n @investment_wizard.investment.attributes.each do |attr|\n hash.merge!(attr[0].to_sym => attr[1] ) unless attr[0].in? ['id','created_at','updated_at']\n end\n\n hash.merge!(:status => 3) # change sttus to wait for payment\n invs.update_attributes(hash)\n\n generate_payouts(@investment_wizard.investment)\n\n session[:investment_attributes] = nil\n redirect_to pay_wizard_investment_path(investment: invs.id), notice: \"Investment successfully updated\"\n else\n if @investment_wizard.investment.save\n\n generate_payouts(@investment_wizard.investment)\n\n # Queue job to wait untill finish and change status\n InvestmentStatusCheckJob.set(wait_until: @investment_wizard.investment.end_date + 5.minutes).perform_later(@investment_wizard.investment.id)\n\n session[:investment_attributes] = nil\n @investment_wizard.investment.update_attributes(:status => 3) # change sttus to wait for payment\n redirect_to pay_wizard_investment_path(investment: @investment_wizard.investment.id), notice: \"Investment successfully created\"\n else\n redirect_to({action: Wizard::Investment::STEPS.first}, alert: \"There were a problem when creating a investment.\")\n end\n end\n\n end", "def create\n @real_estate = RealEstate.new(real_estate_params)\n\n respond_to do |format|\n if @real_estate.save\n format.html { redirect_to @real_estate, notice: 'Real estate was successfully created.' }\n format.json { render :show, status: :created, location: @real_estate }\n else\n format.html { render :new }\n format.json { render json: @real_estate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @property_state = PropertyState.new(property_state_params)\n\n respond_to do |format|\n if @property_state.save\n format.html { redirect_to @property_state, notice: 'Property state was successfully created.' }\n format.json { render :show, status: :created, location: @property_state }\n else\n format.html { render :new }\n format.json { render json: @property_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @state_province = StateProvince.new(params[:state_province])\n\n respond_to do |format|\n if @state_province.save\n flash[:notice] = 'StateProvince was successfully created.'\n format.html { redirect_to(@state_province) }\n format.xml { render :xml => @state_province, :status => :created, :location => @state_province }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @state_province.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sell_shop_orders_states (params={})\r\n url = api_url \"/sell/shop/orders/states\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end", "def create\r\n @order = Order.new(order_params)\r\n @order.status = false\r\n @order.order_state = true\r\n respond_to do |format|\r\n if @order.save\r\n format.html { redirect_to '/order_details/' + @order.id.to_s, notice: 'Órden creada correctamente' }\r\n format.json { render :show, status: :created, location: @order }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @order.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @program_state = ProgramState.new(program_state_params)\n\n respond_to do |format|\n if @program_state.save\n format.html { redirect_to @program_state, notice: 'Program state was successfully created.' }\n format.json { render action: 'show', status: :created, location: @program_state }\n else\n format.html { render action: 'new' }\n format.json { render json: @program_state.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.649192", "0.63740605", "0.6246726", "0.61306775", "0.6122478", "0.61122656", "0.6104916", "0.60867023", "0.60867023", "0.6065897", "0.60073394", "0.6000724", "0.59957796", "0.59414953", "0.5928737", "0.5911682", "0.58995104", "0.58942944", "0.58910877", "0.5888117", "0.5884519", "0.5884398", "0.5881889", "0.5879604", "0.5855587", "0.5847964", "0.58434665", "0.5817851", "0.5811442", "0.5794378", "0.5761506", "0.57229173", "0.5715907", "0.5712516", "0.5710056", "0.56766355", "0.5668396", "0.5663122", "0.56072754", "0.5600537", "0.5596876", "0.5574524", "0.553901", "0.55250657", "0.55066115", "0.5503264", "0.548353", "0.54823476", "0.54746723", "0.5464986", "0.5460255", "0.54260725", "0.54181063", "0.54159856", "0.540803", "0.5396941", "0.5393843", "0.5381154", "0.53729177", "0.5368659", "0.5365232", "0.5360889", "0.53587276", "0.5349928", "0.5349928", "0.5335309", "0.5328971", "0.5327731", "0.5314147", "0.5307832", "0.53061396", "0.5296255", "0.52957046", "0.5283103", "0.5279192", "0.5279192", "0.5258052", "0.525346", "0.5252762", "0.52513415", "0.524237", "0.5238544", "0.52320975", "0.52255267", "0.52254236", "0.5223149", "0.5213124", "0.5207894", "0.5202599", "0.5175885", "0.5167234", "0.51642627", "0.51630217", "0.5157322", "0.5154654", "0.515266", "0.5144296", "0.51415277", "0.51394665", "0.51360387" ]
0.7340731
0
PATCH/PUT /receipt_states/1 PATCH/PUT /receipt_states/1.json
def update respond_to do |format| if @receipt_state.update(receipt_state_params) format.html { redirect_to @receipt_state, notice: 'Receipt state was successfully updated.' } format.json { render :show, status: :ok, location: @receipt_state } else format.html { render :edit } format.json { render json: @receipt_state.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @state.update(state_params)\n render json: @state\n # 'State was successfully updated.'\n else\n render json: @state.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @state.update_attributes(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render json:{message:'State was successfully updated.'} }\n else\n format.html { render action: 'edit' }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_receipt_state\n @receipt_state = ReceiptState.find(params[:id])\n end", "def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @state }\n else\n format.html { render :edit }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @state }\n else\n format.html { render :edit }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_state = Api::State.find(params[:id])\n\n if @api_state.update(api_state_params)\n head :no_content\n else\n render json: @api_state.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @state_prov.update(state_prov_params)\n format.html { redirect_to @state_prov, notice: 'State prov was successfully updated.' }\n format.json { render :show, status: :ok, location: @state_prov }\n else\n format.html { render :edit }\n format.json { render json: @state_prov.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @v1_order = V1::Order.find(params[:id])\n\n case @v1_order.state\n when 0\n if @v1_order.update(v1_order_params)\n head :no_content\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n else\n render json: {message: 'Can be edited only when in draft(0) state'}, status: 400\n end\n \n end", "def update\n respond_to do |format|\n if @federal_state.update(federal_state_params)\n format.html { redirect_to @federal_state, notice: 'Federal state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @federal_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @modelstate.update(params[:modelstates])\n format.html { redirect_to @modelstate, notice: 'Modelstate was successfully updated.' }\n format.json { render :show, status: :ok, location: @modelstate }\n else\n format.html { render :edit }\n format.json { render json: @modelstate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @po_receipt.update(po_receipt_params)\n format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @po_receipt }\n else\n format.html { render :edit }\n format.json { render json: @po_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sprint_state.update(sprint_state_params)\n format.html { redirect_to @sprint_state, notice: 'Sprint state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sprint_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to(states_path, :notice => 'State was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @process_state.update(process_state_params)\n format.html { redirect_to @process_state, notice: 'Process state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @process_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n if @expense_state.update_attributes(params[:expense_state])\n format.html { redirect_to @expense_state, notice: 'Expense state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @current_state.update(current_state_params)\n format.html { redirect_to \"/\", notice: 'CurrentState was successfully updated.' }\n format.json { render :root, status: :ok, location: @current_state }\n else\n format.html { render :edit }\n format.json { render json: @current_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @realestate.update(realestate_params)\n format.html { redirect_to @realestate, notice: 'Realestate was successfully updated.' }\n format.json { render :show, status: :ok, location: @realestate }\n else\n format.html { render :edit }\n format.json { render json: @realestate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @realestate.update(realestate_params)\n format.html { redirect_to @realestate, notice: \"Realestate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @realestate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @realestate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt_detail.update(receipt_detail_params)\n format.html { redirect_to @receipt_detail, notice: 'Receipt detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_detail }\n else\n format.html { render :edit }\n format.json { render json: @receipt_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n \"#{@states_assign.assigned_to}StateMachine\".constantize.states.delete(@states_assign.state.name)\n if @states_assign.update(states_assign_params)\n format.html { redirect_to @states_assign, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @states_assign }\n \"#{@states_assign.assigned_to}StateMachine\".constantize.state @states_assign.state.name.to_sym\n\n puts '##############################'\n puts LeadStateMachine.states\n puts '##############################'\n\n puts '##############################'\n puts PaymentStateMachine.states\n puts '##############################'\n\n\n else\n format.html { render :edit }\n format.json { render json: @states_assign.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @state = @country.states.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to([@country, @state], :notice => 'State was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @invoice_status = InvoiceStatus.find(params[:id])\n\n respond_to do |format|\n if @invoice_status.update_attributes(params[:invoice_status])\n format.html { redirect_to @invoice_status, notice: 'Invoice status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_draft_all\n @states.set_draft_all\n\n respond_to do |format|\n format.json {\n render json: {\n 'message': t('.success'),\n 'type': 'success'\n }\n }\n end\n end", "def update\n respond_to do |format|\n if @empire_rc_state.update(empire_rc_state_params)\n format.html { redirect_to @empire_rc_state, notice: 'Empire rc state was successfully updated.' }\n format.json { render :show, status: :ok, location: @empire_rc_state }\n else\n format.html { render :edit }\n format.json { render json: @empire_rc_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @state_type.update(state_type_params)\n format.html { redirect_to @state_type, notice: 'State type was successfully updated.' }\n format.json { render :show, status: :ok, location: @state_type }\n else\n format.html { render :edit }\n format.json { render json: @state_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @united_state.update(united_state_params)\n format.html { redirect_to @united_state, notice: 'United state was successfully updated.' }\n format.json { render :show, status: :ok, location: @united_state }\n else\n format.html { render :edit }\n format.json { render json: @united_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n # if food is passed, won't check it again.\n if @food.state == 1\n state = 1 \n else\n state = 0\n end\n\n if @food.update(food_params.merge state: state) # 1 means valid\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @map_state = MapState.find(params[:id])\n\n respond_to do |format|\n if @map_state.update_attributes(params[:map_state])\n format.html { redirect_to @map_state, :notice => 'Map state was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @map_state.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n\n respond_to do |format|\n if @purchase_receipt.update_attributes(params[:purchase_receipt])\n format.html { redirect_to @purchase_receipt, notice: 'Purchase receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event_state.update(event_state_params)\n format.html { redirect_to @event_state, notice: 'Event state was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_state }\n else\n format.html { render :edit }\n format.json { render json: @event_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n if receipt_params[:receipt_date].present? && receipt_params[:form_receipt].blank?\n flash[:warning] = 'Selecione uma forma de recebimento!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #se informou a data da baixa e não alterou para RECEBIDA o status\n if receipt_params[:receipt_date].present? && receipt_params[:status] == 'Á RECEBER'\n flash[:warning] = 'Altere o Status para RECEBIDA, já que você informou a data de recebimento!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #se alterou para RECEBIDA o status e não informou a data do pagamento\n if receipt_params[:status] == 'RECEBIDA' && receipt_params[:receipt_date].blank?\n flash[:warning] = 'Informe a data de recebimento, já que você alerou o status para RECEBIDA!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #verifica se foi marcado como recebida e se foi atualiza a invoice amarrada á essa conta\n if @receipt.status == \"Á RECEBER\" \n @invoice = Invoice.where(id: @receipt.invoice_id)\n if @invoice.present?\n @novostatus = 'RECEBIDA'\n Invoice.update(@invoice, status: @novostatus)\n end\n end\n \n respond_to do |format|\n \n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Recebimento atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @receipt = Receipt.find(params[:id])\n params[:receipt][:receipt_lines_attributes] = @receipt.process_removed_lines(params[:receipt][:receipt_lines_attributes])\n\n respond_to do |format|\n if @receipt.update_attributes(receipt_params)\n deposit_check = DepositCheck.find_by_receipt_id(@receipt.id)\n @receipt.update_attributes(:deposit_check_id => deposit_check.id) if deposit_check\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticketstate.update(ticketstate_params)\n format.html { redirect_to @ticketstate, notice: '更新成功' }\n format.json { render :show, status: :ok, location: @ticketstate }\n else\n format.html { render :edit }\n format.json { render json: @ticketstate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_status = RequestStatus.find(params[:id])\n\n respond_to do |format|\n if @request_status.update_attributes(params[:request_status])\n format.html { redirect_to @request_status, notice: 'Request status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @psa_state = PsaState.find(params[:id])\n\n respond_to do |format|\n if @psa_state.update_attributes(params[:psa_state])\n format.html { redirect_to @psa_state, notice: 'Psa state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @psa_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_state.update(user_state_params)\n format.html { redirect_to @user_state, notice: 'User state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt_slip.update(receipt_slip_params)\n format.html { redirect_to @receipt_slip, notice: 'Receipt slip was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_slip }\n else\n format.html { render :edit }\n format.json { render json: @receipt_slip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @surgery_state.update(surgery_state_params)\n format.html { redirect_to @surgery_state, notice: 'Surgery state was successfully updated.' }\n format.json { render :show, status: :ok, location: @surgery_state }\n else\n format.html { render :edit }\n format.json { render json: @surgery_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @receipt_container = ReceiptContainer.find(params[:id])\n\n respond_to do |format|\n if @receipt_container.update_attributes(params[:receipt_container])\n format.html { redirect_to @receipt_container, notice: 'Receipt container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n @states = State.find(:all,:order=>\"short_name\")\n @genders = Gender.find(:all)\n @email_priorities = EmailPriority.find(:all)\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to(@client, :notice => 'Client was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n if @money_receipt.update_attributes(params[:money_receipt])\n format.html { redirect_to @money_receipt, notice: 'Money receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @money_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @poll_workflow_state = PollWorkflowState.find(params[:id])\n\n respond_to do |format|\n if @poll_workflow_state.update_attributes(params[:poll_workflow_state])\n format.html { redirect_to @poll_workflow_state, notice: 'Poll workflow state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_workflow_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sa_request_status.update(sa_request_status_params)\n format.html { redirect_to @sa_request_status, notice: 'Sa request status was successfully updated.' }\n format.json { render :show, status: :ok, location: @sa_request_status }\n else\n format.html { render :edit }\n format.json { render json: @sa_request_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to receipts_url, notice: 'Платеж успешно сохранен.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @action_state.update(action_state_params)\n format.html { redirect_to [project, @action_state], notice: 'Action state was successfully updated.' }\n format.json { render :show, status: :ok, location: @action_state }\n end\n end\n end", "def update\n @tender_state = TenderState.find(params[:id])\n\n respond_to do |format|\n if @tender_state.update_attributes(params[:tender_state])\n format.html { redirect_to @tender_state, notice: 'Tender state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tender_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n if @receipt.update_attributes(params[:receipt])\n format.html { redirect_to(@receipt, :notice => 'Receipt was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @receipt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @receipt = current_user.receipts.find(params[:id])\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @purchase_item_status = PurchaseItemStatus.find(params[:id])\n\n respond_to do |format|\n if @purchase_item_status.update_attributes(params[:purchase_item_status])\n format.html { redirect_to @purchase_item_status, notice: 'Purchase item status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_item_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store_status.update(store_status_params)\n format.html { redirect_to @store_status, notice: 'Store status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status_shipping.update(status_shipping_params)\n format.html { redirect_to @status_shipping, notice: 'Status shipping was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_shipping }\n else\n format.html { render :edit }\n format.json { render json: @status_shipping.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @reqstatus.update(reqstatus_params)\n format.html { redirect_to @reqstatus, notice: 'Reqstatus was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt.update(receipt_update_params)\n format.html { redirect_to receipt_url({ :type => @receipt.type, :id => @receipt.id }), notice: 'Receipt was successfully updated.' }\n format.js { redirect_to receipt_url({ :type => @receipt.type, :id => @receipt.id }), notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update(review_params)\n render json: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\nend", "def update\n \n puts params\n @state = State.find(params[:targetId])\n \n data = Hash.new\n #pagination - see doc\n data[\"code\"] = params[:code] \n data[\"name\"] = params[:name] \n data[\"countryId\"] = params[:countryId] \n\t\n respond_to do |format|\n if @state.update_attributes(data)\n format.html { redirect_to(:action => \"index\") }\n else \n\t puts @state.errors\n format.html { redirect_to(:action => \"edit\", :id => (params[:targetId])) }\n end\n end\n end", "def update\n rec_id = params[:id].to_i\n begin\n wr = WarehouseReceipt.find_by_id(rec_id)\n wr.update(\n applicant_name: params['applicantName'],\n client_ref: params['clientRef'],\n eta: params['eta'],\n incoterm: params['incoterm'],\n observations: params['observations'],\n status: params['status'],\n order_type: params['orderType'],\n pieces: params['pieces'],\n shipment_method: params['shipmentMethod'],\n third_party_id: params['thirdPartyId'],\n # Shipper\n from_entity: params['fromEntity'],\n from_address1: params['fromAddress1'],\n from_address2: params['fromAddress2'],\n from_city: params['fromCity'],\n from_zipcode: params['fromZipcode'],\n from_state: params['fromState'],\n from_country_id: params['fromCountryId'],\n from_contact: params['fromContact'],\n from_email: params['fromEmail'],\n from_tel: params['fromTel'],\n # Consignee\n to_entity: params['toEntity'],\n to_address1: params['toAddress1'],\n to_address2: params['toAddress2'],\n to_city: params['toCity'],\n to_zipcode: params['toZipcode'],\n to_state: params['toState'],\n to_country_id: params['toCountryId'],\n to_contact: params['toContact'],\n to_email: params['toEmail'],\n to_tel: params['toTel'],\n # GROUND\n ground_entity: params['groundEntity'],\n ground_booking_no: params['groundBookingNo'],\n ground_departure_city: params['groundDepartureCity'],\n ground_departure_date: params['groundDepartureDate'],\n ground_arrival_city: params['groundArrivalCity'],\n ground_arrival_date: params['groundArrivalDate'],\n # AIR\n air_entity: params['airEntity'],\n air_waybill_no: params['airWaybillNo'],\n air_departure_city: params['airDepartureCity'],\n air_departure_date: params['airDepartureDate'],\n air_arrival_city: params['airArrivalCity'],\n air_arrival_date: params['airArrivalDate'],\n # SEA\n sea_entity: params['seaEntity'],\n sea_booking_no: params['seaBookingNo'],\n sea_bill_landing_no: params['seaBillLandingNo'],\n sea_containers_no: params['seaContainersNo'],\n sea_departure_city: params['seaDepartureCity'],\n sea_departure_date: params['seaDepartureDate'],\n sea_arrival_city: params['seaArrivalCity'],\n sea_arrival_date: params['seaArrivalDate'],\n )\n\n puts '*** WR SALVADA / id: ' + rec_id.to_s + ' / OrderNo: ' + params['orderNo'].to_s\n\n respond_to do |format|\n format.json { render json: {message: \"Warehouse Receipt ##{params['orderNo'].to_s} saved.\",\n orderId: rec_id,\n orderNo: params['orderNo']} }\n end\n\n rescue => e\n puts \"ERROR BACKTRACE:\"\n puts e.backtrace\n respond_to do |format|\n format.json { render json: {message: 'Error saving the warehouse receipt No.: ' + params['orderNo'].to_s,\n extraMsg: e.message} }\n end\n end\n\n end", "def update\n respond_to do |format|\n if @program_state.update(program_state_params)\n format.html { redirect_to @program_state, notice: 'Program state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @program_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @state_cadre = StateCadre.find(params[:id])\n\n respond_to do |format|\n if @state_cadre.update_attributes(params[:state_cadre])\n format.html { redirect_to @state_cadre, notice: 'State cadre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state_cadre.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end", "def update\n record = InvoiceLineItem.find(params[:id])\n print record.to_json\n record.update_attributes(params[:record]) \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def create\n @receipt_state = ReceiptState.new(receipt_state_params)\n\n respond_to do |format|\n if @receipt_state.save\n format.html { redirect_to @receipt_state, notice: 'Receipt state was successfully created.' }\n format.json { render :show, status: :created, location: @receipt_state }\n else\n format.html { render :new }\n format.json { render json: @receipt_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # too many issues trying to do strong parametesr.\n # TODO: implement strong params in the future\n params = request.parameters\n\n if !params.has_key?(:invoice_items) then\n flash[:error] = \"No items to update in invoice #{invoice.id}\"\n head status: :precondition_failed\n return\n end\n\n invoice = Invoice.find(params[:id])\n\n #just try to update the damn thing\n params[:invoice_items].each_pair do |key,value|\n InvoiceItem.find(key).update_attributes(value)\n end\n\n invoice.update_attribute(:total_billing, invoice.generate_total_billing)\n # update status\n if invoice.total_billing.zero? then\n invoice.update_attribute(:status, Invoice.statuses[\"settled\"])\n else\n invoice.update_attribute(:status, Invoice.statuses[\"outstanding\"])\n end\n\n flash[:notice] = \"Invoice #{invoice.id} updated\"\n render json: {message:\"Invoice #{invoice.id} updated\", invoice:invoice}, status: :ok\n end", "def update\n\t\t@state = State.find(params[:id])\n\t\tif @state.update(states_params)\n\t\t\tflash[:success] = \"Record updated successfully\"\n\t\t redirect_to states_path\n\t\t else\n \tflash[:error] = \"Record not updated\"\n redirect_to states_path\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @status_request.update(status_request_params)\n format.html { redirect_to @status_request, notice: 'Status request was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_request }\n else\n format.html { render :edit }\n format.json { render json: @status_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @datum_receipt.update(datum_receipt_params)\n format.html { redirect_to @datum_receipt, notice: 'Datum receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @datum_receipt }\n else\n format.html { render :edit }\n format.json { render json: @datum_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_state.update(user_state_params)\n format.html { redirect_to @user_state, notice: 'User state was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_state }\n else\n format.html { render :edit }\n format.json { render json: @user_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_state.update(task_state_params)\n format.html { redirect_to @task_state, success: 'Task state was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_state }\n else\n format.html { render :edit }\n format.json { render json: @task_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @counties = County.all\n @county = County.find(params[:id])\n\n @county.update_attributes(county_params)\n\n @states = State.all.order(:state_name)\n end", "def update\n respond_to do |format|\n if @stateform.update(stateform_params)\n format.html { redirect_to @stateform, notice: 'stateform was successfully updated.' }\n format.json { render :show, status: :ok, location: @stateform }\n else\n format.html { render 'new' }\n format.json { render json: @stateform.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shipping_fee.update_attributes(shipping_fee_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @shipping_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property_state.update(property_state_params)\n format.html { redirect_to @property_state, notice: 'Property state was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_state }\n else\n format.html { render :edit }\n format.json { render json: @property_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract_status.update(contract_status_params)\n format.html { redirect_to @contract_status, notice: 'Contract status was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_status }\n else\n format.html { render :edit }\n format.json { render json: @contract_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def toggle_status\n respond_to do |format|\n status = @invoice.pending? ? Invoice.statuses[:paid] : Invoice.statuses[:pending]\n if @invoice.update(status: status)\n format.html { render partial: 'invoices/invoice_actions', layout: false }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n delete_work_order_invoices\n delete_invoice_lines\n respond_to do |format|\n if @invoice.update(invoice_params)\n flash_message(:success, \"Invoice was successfully updated.'\")\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n format.js {render js:'window.location.reload();'}\n else\n set_available_purchase_orders\n set_available_work_orders\n set_available_workflows\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n format.js {render 'edit'}\n end\n end\n end", "def update\n attributes = fulfillment_bill_params.clone\n puts attributes\n @store = Store.find(attributes[\"store_id\"])\n puts \"Found Store = #{@store.StoreName}\" if [email protected]?\n attributes = attributes.merge(\"store_name\" => @store.StoreName)\n puts attributes\n respond_to do |format|\n if @fulfillment_bill.update(attributes)\n format.html { redirect_to @fulfillment_bill, notice: 'Fulfillment bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @fulfillment_bill }\n else\n format.html { render :edit }\n format.json { render json: @fulfillment_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:roof_status])\n format.html { redirect_to @roof, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @raw_food.update(raw_food_params)\n format.html { redirect_to @raw_food, notice: 'Raw food was successfully updated.' }\n format.json { render :show, status: :ok, location: @raw_food }\n else\n format.html { render :edit }\n format.json { render json: @raw_food.errors, status: :unprocessable_entity }\n end\n end\n @raw_food.opening_hours.build\n @raw_food.rewards.build\n @raw_food.menus.build\n @raw_food.verifying_documents.build\n @raw_food.ordering_method_ids = params[:raw_food][:ordering_method_ids]\n @raw_food.delivery_location_ids = params[:raw_food][:delivery_location_ids]\n @raw_food.online_retail_service_type_ids = params[:raw_food][:online_retail_service_type_ids]\n @raw_food.raw_food_product_category_ids = params[:raw_food][:raw_food_product_category_ids]\n end", "def update\n respond_to do |format|\n if @receipt_entry.update(receipt_entry_params)\n format.html { redirect_to @receipt_entry, notice: 'Receipt entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_entry }\n else\n format.html { render :edit }\n format.json { render json: @receipt_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @activity_receipt.update(activity_receipt_params)\n format.html { redirect_to @activity_receipt, notice: 'Activity receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_receipt }\n else\n format.html { render :edit }\n format.json { render json: @activity_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taxirequest = Taxirequest.find(params[:id])\n\n respond_to do |format|\n if @taxirequest.update_attributes(params[:taxirequest])\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxirequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invstatus.update(invstatus_params)\n format.html { redirect_to @invstatus, notice: 'Invstatus was successfully updated.' }\n format.json { render :show, status: :ok, location: @invstatus }\n else\n format.html { render :edit }\n format.json { render json: @invstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pre_payment_req.update(pre_payment_req_params)\n format.html { redirect_to @pre_payment_req, notice: 'Pre payment req was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_payment_req }\n else\n format.html { render :edit }\n format.json { render json: @pre_payment_req.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product_batch = ProductBatch.find(params[:id])\n if @product_batch.state == 'reject'\n @product_batch.state = 'initial'\n end\n\n respond_to do |format|\n if @product_batch.update_attributes(params[:product_batch])\n format.html { redirect_to @product_batch, notice: 'Product batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_batch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @estate = Estate.find(params[:id])\n\n respond_to do |format|\n if @estate.update_attributes(params[:estate])\n format.html { redirect_to @estate, notice: 'Estate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @invoice_id = args[:invoice_id] if args.key?(:invoice_id)\n @refund_state = args[:refund_state] if args.key?(:refund_state)\n end", "def update\n @project_state.update(project_state_params)\n head :no_content\n end", "def update\n respond_to do |format|\n if @flat_stage.update(flat_stage_params)\n format.html { redirect_to @flat_stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @flat_stage }\n else\n format.html { render :edit }\n format.json { render json: @flat_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @funding_status_option = FundingStatusOption.find(params[:id])\n\n respond_to do |format|\n if @funding_status_option.update_attributes(params[:funding_status_option])\n format.html { redirect_to snippets_path, notice: 'Funding status option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @funding_status_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment_type_status.update(payment_type_status_params)\n format.html { redirect_to @payment_type_status, notice: 'Payment type status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment_type_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shipping_detail.update(shipping_detail_params)\n format.html { redirect_to @shipping_detail, notice: 'Shipping detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shipping_detail.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.63248605", "0.6306019", "0.6288814", "0.6217703", "0.6190923", "0.6190923", "0.6190923", "0.61779803", "0.61779803", "0.6172729", "0.61595523", "0.6146655", "0.60489464", "0.6044657", "0.6022419", "0.60206044", "0.60142106", "0.60083175", "0.5993382", "0.5981407", "0.5976615", "0.59603286", "0.5958698", "0.59571517", "0.5946212", "0.5922367", "0.5918254", "0.5917231", "0.59171265", "0.59171265", "0.58947533", "0.5879857", "0.5847636", "0.5845761", "0.58323306", "0.58322006", "0.5831668", "0.5818855", "0.58013684", "0.57859063", "0.57788044", "0.5760983", "0.57596576", "0.5755093", "0.5745467", "0.57276154", "0.56994456", "0.5692245", "0.56857973", "0.568036", "0.56803596", "0.56769085", "0.56678396", "0.56676996", "0.565651", "0.56494015", "0.56473106", "0.564549", "0.564012", "0.5625435", "0.5604992", "0.56041306", "0.55848944", "0.5574784", "0.55720156", "0.55717665", "0.5571541", "0.5571168", "0.5568266", "0.55676866", "0.5555952", "0.5553522", "0.5548175", "0.5536796", "0.55356276", "0.5528135", "0.5524934", "0.55234253", "0.55230176", "0.5522746", "0.5512387", "0.5512292", "0.5510105", "0.55092186", "0.5508407", "0.5504439", "0.55034596", "0.5501727", "0.54932004", "0.548147", "0.548064", "0.5479595", "0.5478062", "0.5464233", "0.5462643", "0.5436665", "0.5433014", "0.5432125", "0.5427068", "0.5424664" ]
0.7177747
0
DELETE /receipt_states/1 DELETE /receipt_states/1.json
def destroy @receipt_state.destroy respond_to do |format| format.html { redirect_to receipt_states_url, notice: 'Receipt state was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense_state = ExpenseState.find(params[:id])\n @expense_state.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sprint_state.destroy\n respond_to do |format|\n format.html { redirect_to sprint_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url, notice: 'State was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url, notice: 'State was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to(states_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @state = @country.states.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to(country_states_url(@country)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_states_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @modelstate.destroy\n respond_to do |format|\n format.html { redirect_to modelstates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @process_state.destroy\n respond_to do |format|\n format.html { redirect_to process_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @federal_state.destroy\n respond_to do |format|\n format.html { redirect_to federal_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @psa_state = PsaState.find(params[:id])\n @psa_state.destroy\n\n respond_to do |format|\n format.html { redirect_to psa_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_state.destroy\n respond_to do |format|\n format.html { redirect_to user_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state_prov.destroy\n respond_to do |format|\n format.html { redirect_to state_provs_url, notice: 'State prov was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n format.js { render json:{message:'State has been deleted.', status: :ok}}\n end\n end", "def destroy\n @realestate.destroy\n respond_to do |format|\n format.html { redirect_to realestates_url, notice: 'Realestate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @realestate.destroy\n respond_to do |format|\n format.html { redirect_to realestates_url, notice: \"Realestate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @united_state.destroy\n respond_to do |format|\n format.html { redirect_to united_states_url, notice: 'United state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @map_state = MapState.find(params[:id])\n @map_state.destroy\n\n respond_to do |format|\n format.html { redirect_to map_states_url }\n format.json { head :ok }\n end\n end", "def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tender_state = TenderState.find(params[:id])\n @tender_state.destroy\n\n respond_to do |format|\n format.html { redirect_to tender_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @empire_rc_state.destroy\n respond_to do |format|\n format.html { redirect_to empire_rc_states_url, notice: 'Empire rc state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase_item_status = PurchaseItemStatus.find(params[:id])\n @purchase_item_status.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_item_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state_type.destroy\n respond_to do |format|\n format.html { redirect_to state_types_url, notice: 'State type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_state.destroy\n\n head :no_content\n end", "def destroy\n @state_cadre = StateCadre.find(params[:id])\n @state_cadre.destroy\n\n respond_to do |format|\n format.html { redirect_to state_cadres_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_state.destroy\n respond_to do |format|\n format.html { redirect_to event_states_url, notice: 'Event state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_state.destroy\n respond_to do |format|\n format.html { redirect_to user_states_url, notice: 'User state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\n\tputs params[:id]\n \n state = State.find(params[:id])\n\t\n\tputs state\n\t\n state.destroy \n\t\n redirect_to(:action => \"index\") \n end", "def destroy\n @program_state.destroy\n respond_to do |format|\n format.html { redirect_to program_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticketstate.destroy\n respond_to do |format|\n format.html { redirect_to ticketstates_url, notice: '删除成功' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estate = Estate.find(params[:id])\n @estate.destroy\n\n respond_to do |format|\n format.html { redirect_to estates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @product_verify_state.destroy\n @product_verify_state.stoped_at = DateTime.now\n @product_verify_state.stop_user_id = session[:user_id]\n @product_verify_state.state='N'\n @product_verify_state.save\n\n\n respond_to do |format|\n format.html { redirect_to product_verify_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \"#{@states_assign.assigned_to}StateMachine\".constantize.states.delete(@states_assign.state.name)\n @states_assign.destroy\n\n puts '##############################'\n puts LeadStateMachine.states\n puts '##############################'\n\n respond_to do |format|\n format.html { redirect_to states_assigns_url, notice: 'State was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asset_state = AssetState.find(params[:id])\n @asset_state.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal_state = GoalState.find(params[:id])\n @goal_state.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n @purchase_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_state.destroy\n respond_to do |format|\n format.html { redirect_to project, notice: 'Action state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @giftstate = Giftstate.find(params[:id])\n @giftstate.destroy\n\n respond_to do |format|\n format.html { redirect_to(giftstates_url) }\n format.xml { head :ok }\n end\n end", "def unapproveReceipt\n render json: Approved.unapproveReceipt(params[\"id\"], params[\"order\"])\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @surgery_state.destroy\n respond_to do |format|\n format.html { redirect_to surgery_states_url, notice: 'Surgery state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stateform.destroy\n respond_to do |format|\n format.html { redirect_to stateforms_url, notice: 'stateform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hand_state = HandState.find(params[:id])\n @hand_state.destroy\n\n respond_to do |format|\n format.html { redirect_to hand_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @invoice.destroy\n @invoice.update_attributes(is_deleted: true,status_id: 4)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt_detail.destroy\n respond_to do |format|\n format.html { redirect_to receipt_details_url, notice: 'Receipt detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estate.destroy\n respond_to do |format|\n format.html { redirect_to estates_url, notice: 'Usunięto' }\n format.json { head :no_content }\n end\n end", "def destroy\n @civil_state = CivilState.find(params[:id])\n @civil_state.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_civil_states_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task_state.destroy\n respond_to do |format|\n format.html { redirect_to task_states_url, success: 'Task state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @state.destroy\n end", "def destroy\n @state.destroy\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @state_copd.destroy\n respond_to do |format|\n format.html { redirect_to state_copds_url, notice: 'State copd was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt_container = ReceiptContainer.find(params[:id])\n @receipt_container.destroy\n\n respond_to do |format|\n format.html { redirect_to receipt_containers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n lifnr = @po_receipt.lifnr\n lifdn = @po_receipt.lifdn\n werks = @po_receipt.werks\n @po_receipt.destroy\n respond_to do |format|\n format.html { redirect_to po_receipts_url(lifnr: lifnr, lifdn: lifdn, werks: werks) }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_state = Tutorial::State.find(params[:id])\n @tutorial_state.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_states_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cultural_heritage_collection_state = CulturalHeritage::CollectionState.find(params[:id])\n @cultural_heritage_collection_state.deleted = 1\n @cultural_heritage_collection_state.save\n\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_collection_states_url) }\n format.xml { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Платеж успешно удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property_state.destroy\n respond_to do |format|\n format.html { redirect_to property_states_url, notice: 'Property state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @ireceipt.destroy\n respond_to do |format|\n format.html { redirect_to ireceipts_url, notice: 'Receipt was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @private_message_state.destroy\n respond_to do |format|\n format.html { redirect_to private_message_states_url, notice: 'Private message state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum_receipt.destroy\n respond_to do |format|\n format.html { redirect_to datum_receipts_url, notice: 'Datum receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estate.destroy\n respond_to do |format|\n format.html { redirect_to estates_url, notice: 'Propiedad eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@state = State.find(params[:id])\n if @state.destroy\n \tflash[:success] = \"Record destroyed\"\n \tredirect_to states_path\n else\n \tflash[:error] = \"Record not destroyed\"\n end\n\tend", "def destroy\n @money_receipt = MoneyReceipt.find(params[:id])\n @money_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to money_receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @real_estate.destroy\n respond_to do |format|\n format.html { redirect_to real_estates_url, notice: 'Real estate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @poll_workflow_state = PollWorkflowState.find(params[:id])\n @poll_workflow_state.destroy\n\n respond_to do |format|\n format.html { redirect_to poll_workflow_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_status.destroy\n respond_to do |format|\n format.html { redirect_to store_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sa_request_status.destroy\n respond_to do |format|\n format.html { redirect_to sa_request_statuses_url, notice: 'Sa request status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_status = RequestStatus.find(params[:id])\n @request_status.destroy\n\n respond_to do |format|\n format.html { redirect_to request_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state_province = StateProvince.find(params[:id])\n @state_province.destroy\n\n respond_to do |format|\n format.html { redirect_to(state_provinces_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_type_status.destroy\n respond_to do |format|\n format.html { redirect_to payment_type_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt_item_type = current_account.receipt_item_types.find(params[:id])\n @receipt_item_type.destroy\n respond_with @receipt_item_type, location: receipt_item_types_url \n end", "def destroy\n @invoice.destroy\n\n Receipt.destroy_all(invoice_id: @invoice)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Excluido com sucesso.' }\n sweetalert_success('Dados excluidos com sucesso!', 'Sucesso!', useRejections: false)\n format.json { head :no_content }\n end\n end", "def destroy\n @state_statistic.destroy\n respond_to do |format|\n format.html { redirect_to state_statistics_url, notice: 'State statistic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_shipping.destroy\n respond_to do |format|\n format.html { redirect_to status_shippings_url, notice: 'Status shipping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt_slip.destroy\n respond_to do |format|\n format.html { redirect_to receipt_slips_url, notice: 'Receipt slip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Recebimento excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def delete_state(state)\n @states.reject! { |_,v| v == state }\n#$stderr.print \"States: #{@states.length} \"\n end", "def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to(receipts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estate = Estate.find(params[:id])\n @estate.destroy\n \n respond_to do |format|\n format.html { redirect_to(estates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end", "def delete_state(state)\n states.remove(state)\n end", "def delete; update(:status => 'DELETED'); end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n if @purchase_order.status == \"draft\"\n @purchase_order.destroy\n respond_to do |format|\n format.html { redirect_to purchase_orders_path, notice: 'Purchase order was successfully discarded.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to @purchase_order, notice: 'Purchase order can\\'t be deleted.' }\n format.json { head :no_content }\n end\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n if @invoice.status == 'fresh'\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.'}\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to invoices_url\n flash[:danger] = 'You can delete only fresh invoices.'}\n format.json {render nothing: true}\n end\n end\n end" ]
[ "0.70470834", "0.7008135", "0.7008135", "0.6873279", "0.6834429", "0.68301964", "0.68301964", "0.68074685", "0.68043023", "0.67960346", "0.67337346", "0.67021126", "0.66827655", "0.66757196", "0.66734725", "0.6652055", "0.66333133", "0.6571744", "0.6561338", "0.6556591", "0.65479416", "0.6523222", "0.6508518", "0.6487502", "0.64633566", "0.6461216", "0.64567477", "0.6430096", "0.6414686", "0.6410668", "0.64094675", "0.6406504", "0.6396003", "0.6388335", "0.6370336", "0.6351391", "0.6347357", "0.6338424", "0.6334056", "0.6307961", "0.62855667", "0.6269767", "0.62616956", "0.6255784", "0.62463266", "0.62379926", "0.6224877", "0.6213616", "0.61989444", "0.6184395", "0.61808044", "0.6171583", "0.6168093", "0.61638457", "0.61638457", "0.6158347", "0.6153283", "0.6153283", "0.6153283", "0.6148674", "0.61388177", "0.61369324", "0.61331457", "0.6128942", "0.61067164", "0.6100585", "0.6100124", "0.60979164", "0.6097835", "0.60913426", "0.608467", "0.6081466", "0.6079617", "0.60546964", "0.60430205", "0.6042501", "0.6041289", "0.6040458", "0.6036958", "0.6033098", "0.6031841", "0.6024182", "0.6021352", "0.60208255", "0.6020672", "0.6019343", "0.6016959", "0.60162485", "0.6012376", "0.60025877", "0.6000467", "0.5998944", "0.5995617", "0.59919655", "0.59763056", "0.59660125", "0.5962087", "0.5957756", "0.595565", "0.59543717" ]
0.75771815
0
Use callbacks to share common setup or constraints between actions.
def set_receipt_state @receipt_state = ReceiptState.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def receipt_state_params params.require(:receipt_state).permit(:nombre_stado) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def active_code_params\n params[:active_code].permit\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def url_whitelist; end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.6293856", "0.6290323", "0.62816143", "0.6241851", "0.6241208", "0.622036", "0.62128764", "0.62110275", "0.61966056", "0.61776453", "0.617547", "0.6174961", "0.61654735", "0.6153256", "0.61516005", "0.6149498", "0.6123234", "0.6118653", "0.61077267", "0.61061186", "0.6093616", "0.608318", "0.6074428", "0.60650206", "0.60244286", "0.6020295", "0.60155797", "0.6012826", "0.6010141", "0.6010141", "0.60037106", "0.600298", "0.59979576", "0.5994806", "0.5994283", "0.5993927", "0.5980616", "0.59667075", "0.59614897", "0.59610957", "0.596071", "0.5959614", "0.59554", "0.59542966", "0.5946781", "0.5940262", "0.5940262", "0.59401053", "0.5937168", "0.5932135", "0.59293395", "0.592659", "0.59202623", "0.59112674", "0.59088206", "0.590716", "0.59056735", "0.589997", "0.5899655", "0.5898926", "0.5896042", "0.589589", "0.5895867", "0.58894163", "0.5884936", "0.5879227", "0.58740723", "0.5871364", "0.5870148", "0.5869228", "0.5868196", "0.5867967", "0.5865532", "0.58653617", "0.58644646", "0.58631665", "0.5862611", "0.5857609", "0.58558804", "0.5853729", "0.5853025" ]
0.0
-1
GET /reviews/1 GET /reviews/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def review(review, options = {})\n get(\"reviews/#{review}\", options).pop\n end", "def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend", "def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def show\n @review = Review.find(params[:id])\n render json: @review\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def reviews(id, review_type='top_critic', page_limit='20', page='1', country='us')\n results = self.class.get(\"/movies/#{id}/reviews.json\", :query => {:review_type => review_type, :page_limit => page_limit, :page => page, :country => country}).parsed_response\n return results\n end", "def index\n render json: Album.find(params[:album_id]).reviews\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = @place.reviews.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def review\n fetch('restaurant.review')\n end", "def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end", "def index\n @reviews = @post.reviews.all\n respond_with @post, @reviews\n end", "def reviews(params = {})\n data = request(\"/review/list\", params.merge(v: \"2\"))\n reviews = data[\"reviews\"][\"review\"]\n if reviews.present?\n reviews.map { |review| Hashie::Mash.new(review) }\n else\n []\n end\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n end", "def index\n @reviews = Review.all\n \n end", "def show\n render json: @review\n end", "def show\n render json: @review\n end", "def show\n render json: @review\n end", "def index\n @reviews = Review.order(:place_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def show\n @user = User.find(params[:id])\n @reviews = @user.reviews.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @review = @post.reviews.find(params[:id])\n respond_with @post, @review\n end", "def show\n @item = Item.find(params[:id])\n @reviews = @item.reviews\n end", "def index\n logger.ap params\n if params.has_key? 'search_term' and params[:search_term] and !params[:search_term].blank?\n @reviews = Review.basic_search(params[:search_term]).page(params[:page]).per(params[:per_page])\n else\n @reviews = Review.page(params[:page]).per(params[:per_page])\n end\n logger.ap @reviews.length\n render json: @reviews\n end", "def reviews\n download_reviews\n @reviews.flatten!\n end", "def index\n render_json content: Review.all\n end", "def index\n @reviews = current_user.reviews\n end", "def index\n\t\t@reviews = @movie.reviews\n\tend", "def index\n\t\t@book_reviews = BookReview.find_all_by_user_id(current_user.id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render :json => @book_reviews }\n\t\tend\n\tend", "def find_review\n Review.find(params[\"id\"])\n end", "def show\n\n respond_to do |format|\n format.html #show\n format.json { render json: @review }\n end\n end", "def show\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_review }\n end\n end", "def review\n\t@applicants = Applicant.all\n\t\n\trespond_to do |format|\n\tformat.html # review.html.erb\n\tformat.json { render json: @applicants }\n\tend\n\tend", "def index\n @reviews = @story.reviews\n end", "def show\n @review = Review.find(params[:id])\n end", "def show\n @review = Review.find(params[:id])\n end", "def show\n @review = Review.find(params[:id])\n end", "def index\r\n if params[:review_id].nil?\r\n @comments = Comment.all\r\n else\r\n @review = Review.find(params[:review_id])\r\n @comments = @review.comments\r\n end\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @comments }\r\n end\r\n end", "def new\n @review = @place.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n\n end", "def reviews( params={} )\n reviews = get_connections(\"reviews\", params)\n return map_connections reviews, :to => Facebook::Graph::Review\n end", "def show\n render_json content: @review\n end", "def reviews\n @reviews\n end", "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end", "def show\n @wifi = Wifi.find(params[:id])\n @reviews = @wifi.reviews\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wifi }\n end\n end", "def index\n @reviews = Employee.where(reviewed: nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def load_reviews\n response = RestClient.get \"https://developers.zomato.com/api/v2.1/reviews?res_id=#{self.zomato_restaurant_id}\", accept: :json, 'user-key' => Rails.application.config.zomato_key\n if response.code == 200\n if response && response.length >= 2\n response = JSON.parse(response)\n response['user_reviews'].each do |review|\n new_review = Review.new\n new_review.review_rating = review['review']['rating']\n new_review.review_text = review['review']['review_text']\n new_review.rating_color = review['review']['rating_color']\n new_review.rating_text = review['review']['rating_text']\n new_review.review_time_stamp = Time.at(review['review']['timestamp'].to_i).to_time.to_i\n new_review.likes = review['review']['likes']\n new_review.author_name = review['review']['user']['name']\n new_review.author_foodie_level = review['review']['user']['foodie_level']\n new_review.user_image = review['review']['user']['profile_image']\n new_review.comments_count = review['review']['comments_count']\n new_review.restaurant_id = self.zomato_restaurant_id\n new_review.save\n end\n end\n end\n end", "def index\n @reviews = Review.all\n @review = Review.new(review: params[:review][:review], my_book_id: params[:my_book_id])\n end", "def index\n\t\t@shop = Shop.find(params[:shop_id])\n\t\t@reviews = @shop.reviews\n\tend", "def show\n\t\t@book_review = BookReview.find(params[:id])\n\t\t@book = Book.find_by_id(@book_review.book_id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @book_review }\n\t\tend\n\tend", "def index\n @user = User.find(params[:uid])\n @reviews = @reviews.where(user_id: @user.id).where(anonymous: false)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @item_reviews = ItemReview.all\n end", "def index\n @item_reviews = ItemReview.all\n end", "def find_review\n @review = Review.find(params[:id])\n end", "def index\n @product_reviews = ProductReview.all\n end", "def new\n @review = reviewable.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def show\n\t\t@review = Review.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.json {}\n\t\t\tformat.js\n\t\tend\n\tend", "def get_reviews(proposal_id)\n\t\treturn Review.find_all_by_proposal_id(proposal_id)\n\tend", "def index\n @reviews = @publication.reviews.all\n end", "def index\n #deeply nested... so starts with gyms,goes to trainers,goes to clients.\n #since clients belongs to trainer we use trainer here..\n #but in trainers_controller the trainers belongs to gyms so gyms is used orignally.\n @product=Product.find(params[:product_id])\n @reviews=Review.where(product_id: @product.id)\n render json:@reviews, status: :ok\n end", "def index\n @reviews = Review.find(params[:burger_place_id])\n\n render json: @reviews\n end", "def get_all_single_critic_movies\n\t\treviews_array = []\n\t\tcritic_id = params[:id]\n\t\treviews = Critic.find(critic_id).critic_movies\n\t\treviews_array.push(reviews)\n\t\treviews = reviews_array.to_json\n\t\trender :json => reviews\n\tend", "def index\n @reviews = Review.find params[:id]\n\n @user = User.find(params[user:id])\n @review = Review.new\n end", "def index\n @first_reviews = FirstReview.all\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.where(restaurant_id: params[:id])\n end", "def new\n @review = current_user.reviews.new\n 1.times { @review.review_photos.build }\n @place = Place.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def show\n @review = Review.find(params[:id])\n @product = @review.product\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end", "def index\n @critic_reviews = CriticReview.all\n end", "def index\n\t\tparams[:search] ? @reviews=Review.search(params[:search]) : @reviews= Review.where(\"user_id = ?\", current_user.id)\n\t\t@reviews = @reviews.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @reviews }\n\t\t\tformat.js\n\t\tend \n\tend", "def index\n @visitor_reviews = VisitorReview.all\n end", "def index\n\t\t\t\t# @reviews = Driver.find_by!(id: params[:driver_id]).driver_reviews#.order('created_at DESC').to_a\n\t\t\t\t@reviews = DriverReview.where(driver_id: params[:driver_id])\n\t\t\tend", "def index\n @restaurant_reviews = RestaurantReview.all\n end", "def index\n @food_reviews = FoodReview.all\n end", "def show\n\t\t@review = Review.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @review }\n\t\tend\n\tend", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end" ]
[ "0.78802043", "0.7516337", "0.7516337", "0.75039405", "0.7391449", "0.73524773", "0.73433435", "0.73430485", "0.73315936", "0.73315936", "0.7282209", "0.71597594", "0.7129899", "0.7129899", "0.7129899", "0.7129899", "0.7129899", "0.7087675", "0.70691717", "0.70653343", "0.70530605", "0.70516586", "0.70315546", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.7030175", "0.6967749", "0.6952701", "0.6952701", "0.6952701", "0.6904906", "0.6862525", "0.6853695", "0.6847093", "0.68451464", "0.68034863", "0.6766231", "0.6747586", "0.67403585", "0.6726512", "0.6723494", "0.66766435", "0.66741145", "0.6671278", "0.66654384", "0.6664498", "0.6664498", "0.6664498", "0.6635365", "0.6630658", "0.6613556", "0.66133076", "0.66097176", "0.6602204", "0.66005033", "0.6568779", "0.6567112", "0.6560877", "0.6560877", "0.6560877", "0.6560877", "0.6560877", "0.6560877", "0.65592647", "0.6548548", "0.6548291", "0.65263677", "0.6521392", "0.65108377", "0.65108377", "0.6508235", "0.6495039", "0.64756507", "0.64682066", "0.6467768", "0.6467039", "0.64651495", "0.6455038", "0.6448637", "0.6443374", "0.6434221", "0.6433505", "0.64330834", "0.64124554", "0.6405924", "0.6398232", "0.6392087", "0.6390676", "0.6386372", "0.6377629", "0.6369749", "0.6368854" ]
0.0
-1
POST /reviews POST /reviews.json
def create @note = Note.new(note_params) respond_to do |format| if @note.save format.html { redirect_to stock_path(params[])} format.json { render :show, status: :created, location: @note } else format.html { render :new } format.json { render json: @note.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end", "def create\n review = course.reviews.new(review_params)\n \n if review.save\n render json: ReviewSerializer.new(review).serialized_json\n else\n render json: { error: review.errors.messages }, status: 422\n end\n end", "def create\n @user = current_user\n @review = @user.reviews.build(review_params)\n if @user.save\n render json: @review\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n current_user.reviews << @review\n respond_to do |format|\n if @review.save\n format.json { render :show, status: :created, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = reviewable.reviews.build(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to reviewable_review_url(reviewable, @review), notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@review = Review.new(review_params)\n\t\[email protected]_id = current_user.id\n\t\trespond_to do |format|\n\t\t\tif @review.save\n\t\t\t\t@reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\t\t\tformat.html { redirect_to @review; flash[:success]= 'review was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @review }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @review.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend", "def create\n @review = @post.reviews.where(user_id: current_user.id).create(params[:review])\n respond_with @post, @review, location: post_path(@post, anchor: \"review_#{@review.id}\")\n end", "def create\n #binding.pry\n review = Review.new(review_params) \n if review.save\n render json: ReviewSerializer.new(review)\n else\n render json: {errors: review.errors.full_messages}\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review }\n else\n format.html { render action: 'new' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_review(booking, options = {})\n post(\"bookings/#{booking}/reviews\", reviews: [options]).pop\n end", "def create\n\t\treview = Review.create(:user_id=>params[:review][:user_id], :note_id=>params[:review][:note_id], :status=>params[:review][:status])\n\t\treview.save!\n\n render json: []\n\tend", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to dashboard_path, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n @review.user = current_user\n\n if @review.save\n render :show, status: :created, location: @review\n else\n render json: { Error: @review.errors }, status: :unprocessable_entity\n end\n end", "def new\n @review = reviewable.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def create\n @review = current_user.reviews.build(review_params)\n \n if @review.save\n flash[:success] = 'レビューを投稿しました。'\n redirect_to root_url\n else\n @reviews = current_user.reviews.order(id: :desc).page(params[:page])\n flash.now[:danger] = 'レビューの投稿に失敗しました。'\n render '/reviews'\n end\n end", "def create\n @review = Review.new(review_params)\n if @review.save\n redirect_to reviews_path\n else\n render 'new'\n end\n end", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def create\n @review = @publication.reviews.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review.publication, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reviews_and_rating = ReviewsAndRating.new(reviews_and_rating_params)\n\n respond_to do |format|\n if @reviews_and_rating.save\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully created.' }\n format.json { render :show, status: :created, location: @reviews_and_rating }\n else\n format.html { render :new }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if !!@review && current_user\n current_user.reviews << @review\n @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n # TODO redirect to page that shows what their review will look like. \n format.html { redirect_to thanks_path, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: \"レビューが作成されました\" }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user\n @review = current_user.reviews.build(params[:review])\n\n respond_to do |format|\n if @review.save\n flash[:success] = 'Запись успешно добавлена!'\n format.html { redirect_to reviews_path }\n format.json { render json: @review, status: :created, location: reviews_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:error] = 'Вы должны войти в систему!'\n redirect_to root_path\n end\n end", "def create\n @review = Review.new(review_params)\n respond_to do |format|\n if Review.validate(@review) and @review.save\n format.html { redirect_to bookings_path, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n flash[:notice] = \"You are submitting your review multiple times. Aborting\"\n format.html { redirect_to bookings_path }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\[email protected]_id = current_user.id\n\t\n\t# used for partials rendering in SPA\n\t@site = Site.find(@review.site_id)\n\t@sites = Site.all\n\t@reviews = Review.where(site_id: @site.id).order(\"created_at DESC\")\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n\t\tformat.js\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n\t\tformat.js { render 'shared/errors' }\n end\n end\n end", "def save_review\r\n return unless self.review\r\n begin\r\n r = JSON.parse self.review\r\n c = Comment.new\r\n c.id = r['id']\r\n c.content = r['content']\r\n c.user_id = r['user']['id']\r\n c.app_id = r['app']['id']\r\n c.created_at = Time.at r['created_at']\r\n c.model = r['model']\r\n c.sdk = r['sdk']\r\n c.image = r['image']\r\n c.image_size = r['image_size']\r\n c.sns_status_id = r['sns_status_id']\r\n c.sns_id = r['sns_id'] \r\n c.in_reply_to_id = r['in_reply_to_id']\r\n c.save\r\n rescue\r\n end\r\n end", "def create\n @user_review = UserReview.new(user_review_params)\n\n respond_to do |format|\n if @user_review.save!\n format.html { redirect_to user_reviews_path, notice: 'User review was successfully created.' }\n format.json { render :show, status: :created, location: @user_review }\n else\n format.html { render :new }\n format.json { render json: @user_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = @story.reviews.new(review_params)\n if @review.save\n redirect_to @review.story, notice: 'Review was successfully created.'\n else\n render :new\n end\n end", "def new\n @review = current_user.reviews.new\n 1.times { @review.review_photos.build }\n @place = Place.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def create\n @item_review = ItemReview.new(item_review_params)\n\n respond_to do |format|\n if @item_review.save\n format.html { redirect_to @item_review, notice: 'Item review was successfully created.' }\n format.json { render :show, status: :created, location: @item_review }\n else\n format.html { render :new }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:user_id] && params[:recruiter_id] && params[:review]\n user = User.find(params[:user_id])\n # puts user\n recruiter = Recruiter.find(params[:recruiter_id])\n # puts recruiter\n ################################\n params[\"got_interview\"] ? got_interview = params[\"got_interview\"] : got_interview = false\n params[\"got_job\"] ? got_job = params[\"got_job\"] : got_job = false\n got_job ? got_interview = true : \"null\" #if got job then must have had interview\n params[\"rating\"] ? rating = params[\"rating\"] : rating = 0 #0 means not rated\n params[\"recommended\"] ? recommended = params[\"recommended\"] : recommended = false\n params[\"ghoster\"] ? ghoster = params[\"ghoster\"] : ghoster = false\n # puts \"*********$\"\n # puts params\n # puts recommended\n # puts params[:recommended]\n # puts \"***************$\"\n review = Review.new(\n user_id: user.id,\n recruiter_id: recruiter.id,\n review: params[\"review\"],\n got_interview: got_interview,\n got_job: got_job,\n rating: rating,\n recommended: recommended,\n ghoster: ghoster\n ) #Review.new\n\n if review.save\n render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"ERROR SAVE POSTED REVIEW\"}\n end\n ################################\n # render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"no user_id or recruiter_id or review\"}\n end # if params[:user_id]\n end", "def new\n @review = @place.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def create\n @recipe = Recipe.find params[:recipe_id]\n review = Review.new review_params\n review.recipe = @recipe\n review.user = current_user\n if review.save\n render json:{id: review.id}\n else \n render(json: {status: 422},\n status: 422 )\n end\n end", "def create\n @item_review = ItemReview.new(item_review_params)\n\n respond_to do |format|\n if @item_review.save\n format.html { redirect_to @item_review, notice: 'Item review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_review }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = current_user.reviews.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to place_path(@review.place), notice: 'Review was successfully created.' }\n else\n format.html { redirect_to root_path }\n end\n end\n end", "def create\n\t\t@book_review = BookReview.new(params[:book_review])\n\t\t@book_review.user_id = current_user.id\n\t\t@book_review.book_id = params[:book_id]\n\n\t\trespond_to do |format|\n\t\t\tif @book_review.save\n\t\t\t\tformat.html { redirect_to @book_review, :notice => 'Book review was successfully created.' }\n\t\t\t\tformat.json { render :json => @book_review, :status => :created, :location => @book_review }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @book_review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def review\n\t@applicants = Applicant.all\n\t\n\trespond_to do |format|\n\tformat.html # review.html.erb\n\tformat.json { render json: @applicants }\n\tend\n\tend", "def create\n item = Item.find(params[:review][:rateable_id])\n @review = item.reviews.new\n @review.user_id = current_user.id\n @review.rating = params[:review][:rating]\n @review.comment = params[:review][:comment]\n if @review.save\n redirect_to item_path(item)\n else\n flash[:alet] = \"There was a problem creating the review\"\n render :new\n end\n end", "def reviews(params = {})\n data = request(\"/review/list\", params.merge(v: \"2\"))\n reviews = data[\"reviews\"][\"review\"]\n if reviews.present?\n reviews.map { |review| Hashie::Mash.new(review) }\n else\n []\n end\n end", "def create\n @review = @place.reviews.new(params[:review])\n @review.user = current_user\n respond_to do |format|\n if @review.save\n format.html { redirect_to place_path(@place), notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { redirect_to place_path(@place, :anchor => \"review\"), notice: 'Please enter your review!!.' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reviews = Review.all\n @review = Review.new(review: params[:review][:review], my_book_id: params[:my_book_id])\n end", "def create\n @review = Review.new(review_params)\n @review.exceptional ||= 0\n if @review.save\n @apn.update_attribute(:reviewed, true)\n link = reviews_path\n name = @apn.profile.first_name.capitalize + \" \".to_s + @apn.profile.last_name.capitalize\n redirect_to new_review_path, notice: (\"#{name} successfully reviewed.\" +\n \" New application loaded. If you're feeling lazy, <a href='#{link}'>\" +\n \"go to the Dashboard</a>\").html_safe\n else\n render action: \"new\", alert: \"something went wrong with submitting the review\"\n end\n end", "def create\n\t\t@review = Review.new(params[:review])\n\t\[email protected] = Establishment.find(params[:establishment])\n\t\[email protected] = Category.find(params[:category])\n\t\[email protected] = Clientele.find(params[:clientele])\n\t\[email protected]_level = SoundLevel.find(params[:sound_level])\n\t\[email protected] = Hygiene.find(params[:hygiene])\n\t\[email protected] = Rating.find(params[:rating])\n\n\t\trespond_to do |format|\n\t\t\tif @review.save\n\t\t\t\tformat.html { redirect_to(@review, :notice => 'Review was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @review, :status => :created, :location => @review }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @critic_review = CriticReview.new(critic_review_params)\n\n respond_to do |format|\n if @critic_review.save\n format.html { redirect_to @critic_review, notice: 'Critic review was successfully created.' }\n format.json { render :show, status: :created, location: @critic_review }\n else\n format.html { render :new }\n format.json { render json: @critic_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Creates a new review & sends them back to their updated page\n review = current_user.reviews.create(review_params)\n if review.save\n redirect_to :back\n else\n redirect_to product_path(id: params[:product_id])\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def create\n @comic = Comic.find(params[:comic_id])\n @review = current_user.reviews.new(review_params)\n @review.tag_list = params[:tag_list]\n @review.comic_id = @comic.id\n p @review\n p review_params\n respond_to do |format|\n if @review.save\n format.html { redirect_to comic_path(@comic), notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.valid?\n @review.save \n @boardgame = Boardgame.find(params[:boardgame_id])\n render json: @boardgame, status: :created \n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @product = Product.find params[:product_id] \n @review = @product.reviews.create(review_params)\n if @review.save\n redirect_to :back\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def create\n @visitor_review = VisitorReview.new(visitor_review_params)\n\n respond_to do |format|\n if @visitor_review.save\n format.html { redirect_to @visitor_review, notice: 'Visitor review was successfully created.' }\n format.json { render :show, status: :created, location: @visitor_review }\n else\n format.html { render :new }\n format.json { render json: @visitor_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_review = BookReview.new(params[:book_review])\n\n respond_to do |format|\n if @book_review.save\n format.html { redirect_to @book_review, notice: 'Book review was successfully created.' }\n format.json { render json: @book_review, status: :created, location: @book_review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def reviews_params\n params.require(:review).permit(:name, :email, :content, :score)\n end", "def index\n @reviews = @post.reviews.all\n respond_with @post, @reviews\n end", "def create\n @review = Review.new(review_params)\n @review.user_id = current_user.id\n @review.movie_id = @movie.id\n\n respond_to do |format|\n #If the review is saved, it redirects to the movie page and shows the notice.\n if @review.save\n format.html { redirect_to @movie, notice: t('review.create') }\n format.json { render :show, status: :created, location: @review }\n #If the review is not saved, it refreshes the create review page.\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def post_review\n @review = Review.new\n @review.title = params[:title]\n @review.description = params[:description]\n @review.name = params[:name]\n @review.user_id = User.find(session[:user_id]).id\n @review.rating = params[:rating]\n @review.listing = params[:listing]\n @review.save()\n # flash[:notice] = \"Review added successfully.\"\n redirect_to :action => :listing, :id => params[:listing]\n end", "def review_params\n params.require(:review).permit(:customer_id, :car_id, :reservation_id, :content, :rating)\n end", "def create\n if @restaurant.present?\n review = Review.new(review_params)\n if review.save\n render_json content: review\n else\n render_json content: review.errors\n end\n else\n render json: {error: \"restaurant id #{review_params[:restaurant_id]} does not exist\"}, status: :forbidden\n end\n end", "def create\n @book = Book.find(params[:book_id])\n @review = @book.reviews.build(review_params)\n @review.user = current_user\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to book_path(@book), notice: 'Su crítica se envió correctamente.' }\n format.json { render :show, status: :created, location: @review }\n format.js\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @shop = Shop.find(params[:shop_id])\n @review = @shop.reviews.create(reviewer: params[:review][:reviewer], rate: params[:review][:rate], body: params[:review][:body])\n\n if @review.save\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n flash[:notice] = \"レビューの投稿が完了しました\"\n redirect_to shop_path(@shop)\n\n else\n redirect_to shop_path(@shop)\n flash[:notice] = \"レビューの投稿に失敗しました\"\n end\n\n\n end", "def create_review(book_id, params = {})\n params = params.merge(book_id: book_id, v: \"2\")\n\n params[:read_at] = params[:read_at].strftime('%Y-%m-%d') if params[:read_at].is_a?(Time)\n\n params[:'review[review]'] = params.delete(:review) if params[:review]\n params[:'review[rating]'] = params.delete(:rating) if params[:rating]\n params[:'review[read_at]'] = params.delete(:read_at) if params[:read_at]\n\n data = oauth_request_method(:post, '/review.xml', params)\n\n Hashie::Mash.new(data[\"review\"])\n end", "def create\n @review = Review.new(params[:review])\n @review.review_date = Time.now\n @review.user_id = current_user.id\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to place_url(@review.place), notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def review_params\n params.require(:review).permit(:user_id, :comic_id, :review_text, :review_title, :netabare, :tag_list, :star)\n end", "def review\n fetch('restaurant.review')\n end", "def create\n @food_review = FoodReview.new(food_review_params)\n\n respond_to do |format|\n if @food_review.save\n format.html { redirect_to @food_review, notice: 'Food review was successfully created.' }\n format.json { render :show, status: :created, location: @food_review }\n else\n format.html { render :new }\n format.json { render json: @food_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def create\n @restaurant_review = RestaurantReview.new(restaurant_review_params)\n\n respond_to do |format|\n if @restaurant_review.save\n format.html { redirect_to @restaurant_review, notice: 'Restaurant review was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_review }\n else\n format.html { render :new }\n format.json { render json: @restaurant_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def create\r\n _params = review_init_params\r\n _params[:id] = SecurityManager.md5(\"#{@user.id}_#{@task.id}\")\r\n _params[:score] = _params[:score].to_i\r\n _params[:author_id] = @user.id\r\n\r\n begin\r\n @review = @task.reviews.create(_params)\r\n rescue Mongo::Error::OperationFailure\r\n return bad_request(\"duplicated\")\r\n end\r\n\r\n respond_to do |format|\r\n if @review.save\r\n format.html { redirect_to '/task' }\r\n else\r\n return unprocessable_entity\r\n end\r\n end\r\n end", "def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def review_params\n params.require(:review).permit(:description, :rating, :restaurant_id)\n end", "def create\n @review = Review.new(review_params)\n respond_to do |format|\n if @review.save\n format.json { render action: 'show', status: :created, location: @review }\n format.html { redirect_to postings_path, notice: 'Review was successfully created.' }\n if current_user.type == \"Student\"\n format.html { redirect_to postings_path, notice: 'Review was successfully created.' }\n else\n format.html { redirect_to supervisor_application_index_path, notice: 'Review was successfully created.' }\n end\n else\n format.html { redirect_to postings_path, notice: \"Review could not be saved. Make sure you fill out fields with an *.\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@reviews = @share.reviews.order(priority: :asc)\n\t\t@reviewToAlter = @share.reviews.new(review_params)\n\t\t\n\t\tif @reviewToAlter.save\n\t\t\tredirect_to share_reviews_path(@share), notice: \"Review saved!\"\n\t\telse\n\t\t\tflash[:alert] = \"Error : #{@reviewToAlter.errors.full_messages.to_sentence}\"\n\t\t\trender :index\n\t\tend\n\tend", "def reviews( params={} )\n reviews = get_connections(\"reviews\", params)\n return map_connections reviews, :to => Facebook::Graph::Review\n end", "def create\n @review = Review.new(params[:review])\n if @review.save\n flash[:notice] = \"Review Created\"\n redirect_to \"/products\"\n else\n render \"create\"\n end\n end", "def review_params\n params.require(:review).permit(:content, :rating)\n end", "def create \n @refrigerator = Refrigerator.find(params[:refrigerator_id])\n @review = Review.create(create_update_params)\n @refrigerator.reviews << @review\n\n if @review.save!\n\n flash[:notice] = 'Review successfully created.'\n redirect_to refrigerator_path(params[:refrigerator_id])\n else\n flash[:notice] = 'Could not create new review.'\n redirect_to (new_refrigerator_review_path(@refrigerator))\n end\n end", "def review\n @users = User.all\n @review = Review.new\n end", "def create\n @review = Review.new(params[:review])\n @review.user = current_user\n\n respond_to do |format|\n if @review.save\n flash[:notice] = 'Review was successfully created.'\n format.html { redirect_to(@review) }\n format.xml { render :xml => @review, :status => :created, :location => @review }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n end\n end\n end", "def review_params\n params.require(:review).permit(:rating, :comment)\n end", "def review_params\n params.require(:review).permit(:rating, :comment)\n end", "def review_params\n params.require(:review).permit( :description, :rating)\n end", "def create\n @review = Review.new(params[:review])\n\n if @review.save\n redirect_to contact_path, :notice => \"Uw waardering is geplaatst, hartelijk dank!\"\n else\n\t\t\tredirect_to contact_path, :notice => \"Uw waardering kan op dit moment niet geplaatst worden, probeer het later nog eens.\"\n end\n end", "def index\n @reviews = Review.all\n \n end", "def review_params\n params.require(:review).permit(:score, :confidence, :comments, :paper_id)\n end", "def review_params\n params.require(:review).permit(:lecture_id, :user_id, :content, :rating)\n end" ]
[ "0.7576602", "0.75637454", "0.7493771", "0.747111", "0.747111", "0.747111", "0.7300367", "0.72989565", "0.7201945", "0.7201945", "0.71795744", "0.717838", "0.71406734", "0.7120858", "0.7118763", "0.7002209", "0.6988962", "0.6979939", "0.69722533", "0.69606304", "0.6958055", "0.6953352", "0.6946341", "0.6917387", "0.6896529", "0.689131", "0.684411", "0.68377984", "0.6826352", "0.68095565", "0.6805745", "0.68000114", "0.6756741", "0.6750588", "0.6718385", "0.6698959", "0.6666458", "0.6655321", "0.66511434", "0.6650238", "0.66481405", "0.6643257", "0.66334975", "0.6632171", "0.6625182", "0.6617069", "0.6616355", "0.6614021", "0.65939176", "0.6578096", "0.6566304", "0.655079", "0.6537635", "0.65306634", "0.6529929", "0.6526942", "0.6526942", "0.6521888", "0.6516327", "0.65065676", "0.6494446", "0.64794886", "0.6476289", "0.6476289", "0.6476289", "0.6476289", "0.6476289", "0.6476289", "0.6471607", "0.6462259", "0.6460475", "0.64579177", "0.6457529", "0.6450494", "0.64474744", "0.6443972", "0.6440192", "0.642906", "0.64266014", "0.6419717", "0.64197063", "0.641245", "0.641245", "0.64110076", "0.641063", "0.6410248", "0.640811", "0.640109", "0.64005774", "0.6394809", "0.6391521", "0.6385833", "0.6378832", "0.6370554", "0.6365557", "0.6365557", "0.6360124", "0.63526964", "0.63338596", "0.6333214", "0.63185745" ]
0.0
-1
PATCH/PUT /reviews/1 PATCH/PUT /reviews/1.json
def update respond_to do |format| if @note.update(note_params) format.html { redirect_to @note} format.json { render :show, status: :ok, location: @note } else format.html { render :edit } format.json { render json: @note.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n @review = reviewable.reviews.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to reviewable_review_url(reviewable, @review), notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n if @review.update(review_params)\n render json: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\nend", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to restaurent_path(@restaurent.id), notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = @post.reviews.where(user_id: current_user.id).find(params[:id])\n @review.update_attributes(params[:review])\n respond_with @post, @review, location: post_path(@post, anchor: \"review_#{@review.id}\")\n end", "def update\n @review = @place.reviews.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to reviews_path, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review.lecture, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review.lecture }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\treview = Review.find(params['id'].to_i) if params['id']\n\t\treview.review_text = params['review_text'] if params['review_text']\n\t\treview.rating = params['rating'] if params['rating']\n\t\treview.reviewer_id = params['reviewer_id'] if params['reviewer_id']\n\t\treview.user_id = params['user_id'].to_i if params['user_id']\n\t\treview.trip_id = params['trip_id'].to_i if params['trip_id']\n\t\treview.save\n\tend", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_review\n @review = Review.find(params[:id])\n @review.update(params[:review])\n redirect \"/reviews/#{@review.id}\"\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n format.js {render nothing: true}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @user, notice: '评价更新成功' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update(review_params)\n render :show, status: :ok, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @listing, notice: 'Review was updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review.publication, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params) && @review.revoke_approval!\n format.json { render :show, status: :ok, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update_attributes(review_params)\n flash[:success] = \"Review updated\"\n format.html { redirect_to @review.user } # notice: 'Review was successfully updated.'\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = current_user.reviews.find_by_id(params[:id])\n if @review.nil?\n flash[:notice] = t(:review_not_found)\n return redirect_back_or_default()\n else\n @reviewable = @review.reviewable\n @review.content = params[:review][:content]\n @review.reviewable_id = params[:review][:reviewable_id]\n @review.reviewable_type = params[:review][:reviewable_type]\n end\n\n respond_to do |format|\n #if @review.update_attributes(params[:review])\n if @review.save\n format.html { redirect_to review_path(@review), :notice => t(:review_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to project_path(@project), notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n if @book_review.update_attributes(params[:book_review])\n format.html { redirect_to @book_review, notice: 'Book review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n flash[:notice] = 'Review was successfully updated.'\n format.html { redirect_to(@review) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_review(review_id, params = {})\n params = params.merge(v: \"2\")\n\n params[:read_at] = params[:read_at].strftime('%Y-%m-%d') if params[:read_at].is_a?(Time)\n\n params[:'review[review]'] = params.delete(:review) if params[:review]\n params[:'review[rating]'] = params.delete(:rating) if params[:rating]\n params[:'review[read_at]'] = params.delete(:read_at) if params[:read_at]\n\n # Documentation says that you should use HTTP PUT, but API returns\n # 401 Unauthorized when PUT is used instead of POST\n data = oauth_request_method(:post, \"/review/#{review_id}.xml\", params)\n\n Hashie::Mash.new(data[\"review\"])\n end", "def update\n @user = current_user\n @review = Review.find(params[:id])\n @review.update_attributes(review_params)\n render json: @review, include: [:movie]\n end", "def update\n respond_to do |format|\n #If the params are filled in and valid, it redirects to the review page and shows the notice\n if @review.update(review_params)\n format.html { redirect_to @review, notice: t('review.update') }\n format.json { render :show, status: :ok, location: @review }\n #If it doesnt update then it refreshes the edit review page\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_review.update(item_review_params)\n format.html { redirect_to @item_review, notice: 'Item review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to vendor_path(@review.vendor, view: \"recomendacoes\"), notice: 'A sua avaliação foi atualizada com sucesso' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@book_review = BookReview.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @book_review.update_attributes(params[:book_review])\n\t\t\t\tformat.html { redirect_to @book_review, :notice => 'Book review was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.json { render :json => @book_review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @user_review.update!(user_review_params)\n format.html { redirect_to user_reviews_path, notice: 'User review was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_review }\n else\n format.html { render :edit }\n format.json { render json: @user_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: \"振り返りの更新に成功しました。\" }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @restaurant.present?\n if @review.present?\n if @review.update(review_params)\n render_json content: @review\n else\n render_json content: @review.errors\n end\n end\n end\n\n end", "def update\n respond_to do |format|\n if @blade_review.update(blade_review_params)\n format.html { redirect_to blade_reviews_path, notice: 'Blade review was successfully updated.' }\n format.json { render :show, status: :ok, location: @blade_review }\n else\n format.html { render :edit }\n format.json { render json: @blade_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@reviews = @share.reviews.order(priority: :asc)\n\t\t@reviewToAlter = Review.find(params[:id])\n\t\t@review = Review.find(params[:id])\n\t\tif @review.update(review_params)\n\t\t\tredirect_to share_reviews_path(@share), notice: 'Review successfully updated!'\n\t\telse\n\t\t\tflash[:alert] = \"Error : #{@review.errors.full_messages.to_sentence}\"\n\t\t\trender :edit\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @reviews_and_rating.update(reviews_and_rating_params)\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @reviews_and_rating }\n else\n format.html { render :edit }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: \"レビューを更新しました\" }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_review.update(item_review_params)\n format.html { redirect_to @item_review, notice: 'Item review was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_review }\n else\n format.html { render :edit }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_pull_review(repo, pull_number, review_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n put \"#{Repository.path repo}/pulls/#{pull_number}/reviews/#{review_id}\", opts\n end", "def update\n respond_to do |format|\n if @critic_review.update(critic_review_params)\n format.html { redirect_to @critic_review, notice: 'Critic review was successfully updated.' }\n format.json { render :show, status: :ok, location: @critic_review }\n else\n format.html { render :edit }\n format.json { render json: @critic_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n # Broadcast updated review on list from model.\n format.turbo_stream\n format.html { redirect_to recipe_path(@recipe, anchor: \"review_#{@review.id}\"), notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.turbo_stream do\n # Display errors.\n render turbo_stream: turbo_stream.replace(\"review_form_review_#{@review.id}\",\n partial: \"reviews/form\", locals: { recipe: @recipe, review: @review })\n end\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @first_review.update(first_review_params)\n format.html { redirect_to team_path(@first_review.team_id), notice: 'First review was successfully updated.' }\n format.json { render :show, status: :ok, location: @first_review }\n else\n format.html { render :edit }\n format.json { render json: @first_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = @album.review\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n flash[:notice] = \"Review '#{@review}' was successfully updated.\"\n format.html { redirect_to review_url(@review) }\n format.xml { head :ok }\n format.js { render :template => 'music/reviews/success' }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @review.errors.to_xml }\n format.js { render :template => 'music/reviews/error' }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_review.update(admin_review_params)\n format.html { redirect_to admin_review_path(@admin_review), notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_review_path(@admin_review) }\n else\n format.html { render :edit }\n format.json { render json: @admin_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to categories_url, notice: 'レビューの更新完了です!' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n @post.review!\n format.html { redirect_to @post, notice: 'Anúncio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boo_k_review.update(boo_k_review_params)\n format.html { redirect_to @boo_k_review, notice: 'Boo k review was successfully updated.' }\n format.json { render :show, status: :ok, location: @boo_k_review }\n else\n format.html { render :edit }\n format.json { render json: @boo_k_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@review = Review.find(params[:id])\n\t\[email protected] = Establishment.find(params[:establishment])\n\t\[email protected] = Category.find(params[:category])\n\t\[email protected] = Clientele.find(params[:clientele])\n\t\[email protected]_level = SoundLevel.find(params[:sound_level])\n\t\[email protected] = Hygiene.find(params[:hygiene])\n\t\[email protected] = Rating.find(params[:rating])\n\n\t\trespond_to do |format|\n\t\t\tif @review.update_attributes(params[:review])\n\t\t\t\tformat.html { redirect_to(@review, :notice => 'Review was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n\t\t@set_def_avt=params[:review][:default_avatar]\n\t\[email protected]_page.destroy if @set_def_avt\n\n\t\trespond_to do |format|\n\t\t\tif @review.update(review_params)\n\t\t\t\t@reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\t\t\tformat.html { redirect_to @review; flash[:info]= 'review was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @review }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @review.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend", "def update\n @product = Product.find(params[:product_id])\n @review = Review.find(params[:id])\n\n authorize! :update, @review\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @product, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\[email protected]_id = current_user.id\n\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n\t\tformat.js\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n\t\tformat.js { render 'shared/errors' }\n end\n end\n end", "def update\n\t\t@review = Review.find(params[:id])\n\n\t\tif @review.update(review_params.merge(:contract_id => @review.contract_id))\n\t\t\tredirect_to @review\n\t\telse\n\t\t\trender 'edit'\n\t\t\t# => Error when updating empty body element.\n\t\tend\n\tend", "def update\n respond_to_creative :ok, 'Review was successfully updated.', :edit\n end", "def update\n respond_to do |format|\n if @food_review.update(food_review_params)\n format.html { redirect_to @food_review, notice: 'Food review was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_review }\n else\n format.html { render :edit }\n format.json { render json: @food_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bookreview.update(bookreview_params)\n format.html { redirect_to book_path(@bookreview.book_id), notice: 'Bookreview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bookreview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_review.update(product_review_params)\n format.html { redirect_to @product_review, notice: 'Product review was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_review }\n else\n format.html { render :edit }\n format.json { render json: @product_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @reviews = args[:reviews] if args.key?(:reviews)\n @average_rating = args[:average_rating] if args.key?(:average_rating)\n @total_review_count = args[:total_review_count] if args.key?(:total_review_count)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update\n if @review.update_attributes(review_params)\n redirect_to edit_review_path(@review), notice: (\"Review was successfully updated.\")\n else\n render action: \"edit\"\n end\n end", "def update\n @establishment = Establishment.find(params[:establishemnt_id])\n @reviews = @establishment.reviews.find(params[:id])\n @reviews.update(params[:review].permit(:rating, :review_content))\n\n redirect_to @establishment\n=begin\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update_attributes(params[:review])\n\t\t\tredirect_to reviews_path, :notice => \"De waardering is aangepast.\"\n else\n\t\t\tredirect_to reviews_path, :notice => \"De aanpassing kan op dit moment niet worden doorgevoerd. Het is mogelijk dat je meer dan drie referenties wilt aanvinken voor op de voorpagina.\"\n end\n end", "def edit_review\n # client should be able to edit a review.\n puts \"Which review would you like to edit?\"\n pp Client.find_by(name: @@client_name).reviews\n puts \"Please enter the ID\"\n input = gets.strip\n selected_review = Review.find_by(id: input)\n puts \"What would you like for the new review to say?\"\n input = gets.strip\n selected_review.update(text_body: input)\n puts \"Your review has been updated, here's the new review:\"\n pp selected_review\n client_continue\n end", "def update\n if @review.update(review_params)\n @boardgame = Boardgame.find(params[:boardgame_id])\n render json: @boardgame, status: :ok\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @review_id = args[:review_id] if args.key?(:review_id)\n @reviewer = args[:reviewer] if args.key?(:reviewer)\n @star_rating = args[:star_rating] if args.key?(:star_rating)\n @comment = args[:comment] if args.key?(:comment)\n @create_time = args[:create_time] if args.key?(:create_time)\n @update_time = args[:update_time] if args.key?(:update_time)\n @review_reply = args[:review_reply] if args.key?(:review_reply)\n end", "def update\n @review = Review.find(params[:id])\n # respond_to do |format|\n \n if @review.update(review_params)\n flash[:success] = '店舗情報を修正しました。'\n redirect_to reviews_path(@review)\n else\n render 'edit'\n end\n end", "def update\n respond_to do |format|\n if @visitor_review.update(visitor_review_params)\n format.html { redirect_to @visitor_review, notice: 'Visitor review was successfully updated.' }\n format.json { render :show, status: :ok, location: @visitor_review }\n else\n format.html { render :edit }\n format.json { render json: @visitor_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant_review.update(restaurant_review_params)\n format.html { redirect_to @restaurant_review, notice: 'Restaurant review was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_review }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hm_review.update(hm_review_params)\n format.html { redirect_to @hm_review, notice: 'Hm review was successfully updated.' }\n format.json { render :show, status: :ok, location: @hm_review }\n else\n format.html { render :edit }\n format.json { render json: @hm_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_nature_of_review.update(admin_nature_of_review_params)\n format.html { redirect_to @admin_nature_of_review, notice: 'Nature of review was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_nature_of_review }\n else\n format.html { render :edit }\n format.json { render json: @admin_nature_of_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_user.blank?\n redirect_to professor_course_path(\n @review.professor_id,\n @review.course_id\n ),\n notice: 'You must be\n logged in to update a review.'\n else\n @review.authuser_id = current_user.id\n respond_to do |format|\n if @review.update(review_params)\n format.html do\n redirect_to professor_course_path(\n @review.professor_id,\n @review.course_id\n ),\n notice: 'Review was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @review }\n else\n format.html do\n @courses = load_courses\n @professors = load_professors\n render :edit\n end\n format.json do\n render json: @review.errors, status: :unprocessable_entity\n end\n end\n end\n end\n end", "def update\n movie = Movie.find(params[:movie_id])\n review = Review.find(params[:id])\n review.update(review_params)\n redirect_to '/movies/#{movies.id}/reviews/#{review.id}'\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n flash[:success] = \"수정 성공\"\n format.html { redirect_to @review }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update(review_params)\n redirect_to @review.story, notice: 'Review was successfully updated.'\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @event_review.update(event_review_params)\n format.html { redirect_to @event_review, notice: 'Event review was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_review }\n else\n format.html { render :edit }\n format.json { render json: @event_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @correction_review.update(correction_review_params)\n format.html { redirect_to @correction_review, notice: 'Correction review was successfully updated.' }\n format.json { render :show, status: :ok, location: @correction_review }\n else\n format.html { render :edit }\n format.json { render json: @correction_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t\t\trender_invalid_action(current_review) unless current_review.update(update_driver_review_params)\n\t\t\tend", "def update\n respond_to do |format|\n if @employee_review.update(employee_review_params)\n format.html { redirect_to @employee_review, notice: 'Employee review was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_review }\n else\n format.html { render :edit }\n format.json { render json: @employee_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reviewable_object = current_user.reviewable_objects.find(params[:id])\n\n respond_to do |format|\n if @reviewable_object.update_attributes(params[:reviewable_object])\n format.html { redirect_to @reviewable_object, notice: 'Reviewable object was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reviewable_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_review = UserReview.find(params[:id])\n\n respond_to do |format|\n if @user_review.update_attributes(params[:user_review])\n flash[:notice] = 'UserReview was successfully updated.'\n format.html { redirect_to(@user_review) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_review.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @auditreview.update(auditreview_params)\n format.html { redirect_to action: \"index\", notice: 'Auditreview was successfully updated.' }\n format.json { render :show, status: :ok, location: @auditreview }\n else\n format.html { render :edit }\n format.json { render json: @auditreview.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @review = Employee.find(params[:id])\n\n respond_to do |format|\n @review.reviewed = true; @review.score = params[:employee][:score];\n if @review.save\n format.html { redirect_to admin_reviews_path, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if (allowAccessIfOwnerNameIsOrRankAtLeast(\"#{@review.poster}\", 1))\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n end\n end\n else\n respond_to do |format|\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n flash[:notice] = 'You do not have permission to edit this review'\n\n end\n end\n end", "def update\n respond_to do |format|\n if @company_review.update(company_review_params)\n format.html { redirect_to @company_review, notice: 'Company review was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_review }\n else\n format.html { render :edit }\n format.json { render json: @company_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n unless current_user.is_review_moderator? or current_user = @review.user\n redirect_to denied_path\n return\n end\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to(@review, :notice => 'Review was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update_review_with_http_info(account_id, review_id, v, review_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ReviewsApi.update_review ...\"\n end\n # verify the required parameter 'account_id' is set\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling ReviewsApi.update_review\" if account_id.nil?\n # verify the required parameter 'review_id' is set\n fail ArgumentError, \"Missing the required parameter 'review_id' when calling ReviewsApi.update_review\" if review_id.nil?\n # verify the required parameter 'v' is set\n fail ArgumentError, \"Missing the required parameter 'v' when calling ReviewsApi.update_review\" if v.nil?\n # verify the required parameter 'review_request' is set\n fail ArgumentError, \"Missing the required parameter 'review_request' when calling ReviewsApi.update_review\" if review_request.nil?\n # resource path\n local_var_path = \"/accounts/{accountId}/reviews/{reviewId}\".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'reviewId' + '}', review_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'v'] = v\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(review_request)\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IdResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReviewsApi#update_review\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @app = App.find(params[:id])\n \n respond_to do |format|\n if @app.update_attributes(params[:app]) and @app.rating.update_attributes(params[:rating])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n format.json { render :json => @app.errors, :status => :unprocessable_entity } \n end\n end\n end" ]
[ "0.7438452", "0.70832837", "0.70328504", "0.70328504", "0.70328504", "0.69496596", "0.6926178", "0.69167197", "0.69167197", "0.69167197", "0.69167197", "0.6888808", "0.6832852", "0.6780394", "0.6780394", "0.6780394", "0.6735564", "0.67207444", "0.67168", "0.67168", "0.67168", "0.67168", "0.67168", "0.67168", "0.67168", "0.6715161", "0.6659442", "0.6652809", "0.6627023", "0.65952563", "0.6595202", "0.6589615", "0.6570515", "0.6557308", "0.65207696", "0.65187865", "0.64666015", "0.6450603", "0.64436215", "0.64344823", "0.6429671", "0.6396246", "0.63703954", "0.6369165", "0.63664293", "0.6358117", "0.63469225", "0.6344474", "0.6337949", "0.6333852", "0.6326498", "0.6293018", "0.6290055", "0.6272187", "0.6264629", "0.6256186", "0.6247646", "0.62447256", "0.6227053", "0.62228155", "0.6216905", "0.62168336", "0.6216827", "0.6196786", "0.6174792", "0.61712873", "0.6171001", "0.61681205", "0.6149511", "0.61268735", "0.6121636", "0.61198086", "0.6115787", "0.61127466", "0.61107385", "0.6103963", "0.60923755", "0.60873306", "0.6075044", "0.6072742", "0.6070214", "0.60379755", "0.60364723", "0.60328555", "0.6020177", "0.6013674", "0.6007042", "0.5980761", "0.5980402", "0.5976942", "0.59676445", "0.5965022", "0.5959761", "0.59538245", "0.59471226", "0.59397864", "0.59374696", "0.59086525", "0.5899805", "0.58943915", "0.58721" ]
0.0
-1
DELETE /reviews/1 DELETE /reviews/1.json
def destroy @note.destroy respond_to do |format| format.html { redirect_to notes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reviews_delete(id)\n delete id.to_s\n _response_status(204, last_response)\n end", "def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :ok }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user\n @review = Review.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n review = Review.find_by(id: params[:id]).destroy\n render json: review\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to(reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to(reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_review.destroy\n respond_to do |format|\n format.html { redirect_to item_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = @place.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: \"レビューが削除されました\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to(review_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to restaurent_path(@restaurent.id),\n notice: \"Review was successfully destroyed\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: \"振り返りを削除しました。\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n #If destroyed, it display the notice.\n format.html { redirect_to reviews_url, notice: t('review.destroy') }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n respond_to do |format|\n format.html { redirect_to @review.lecture, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = @post.reviews.where(user_id: current_user.id).find(params[:id])\n @review.destroy\n respond_with @post, @review, location: post_path(@post, anchor: \"reviews\")\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to publication_reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, ReviewsController\n @review = Review.find(params[:id])\n if @review\n @review.destroy\n flash[:success] = 'Запись была успешно удалена!'\n else\n flash[:error] = 'Запись не найдена.'\n end\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_review = BookReview.find(params[:id])\n @book_review.destroy\n\n respond_to do |format|\n format.html { redirect_to book_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to project_path(@project), notice: 'Review was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@review = Review.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(reviews_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def destroy\n @review = find_review\n @review.destroy\n redirect_to reviews_path\n end", "def destroy\n @first_review.destroy\n respond_to do |format|\n format.html { redirect_to first_reviews_url, notice: 'First review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_show_path, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviews_and_rating.destroy\n respond_to do |format|\n format.html { redirect_to reviews_and_ratings_url, notice: 'Reviews and rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_review.destroy\n respond_to do |format|\n format.html { redirect_to item_reviews_url, notice: 'Item review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find params[:id]\n @review.destroy\n redirect_to :back\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to @book, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_review = UserReview.find(params[:id])\n @user_review.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @review.destroy\n redirect_to root_url\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n flash[:notice] = \"This review was successfully deleted!\"\n redirect_to root_path\n end", "def destroy\n @shop_review.destroy\n respond_to do |format|\n format.html { redirect_to shop_reviews_url, notice: '가게 리뷰가 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_review.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_reviews_url, notice: 'Restaurant review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @visitor_review.destroy\n respond_to do |format|\n format.html { redirect_to visitor_reviews_url, notice: 'Visitor review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fourth_review.destroy\n respond_to do |format|\n format.html { redirect_to fourth_reviews_url, notice: 'Fourth review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @device_review.destroy\n respond_to do |format|\n format.html { redirect_to device_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_review.destroy\n respond_to do |format|\n format.html { redirect_to admin_reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @auditreview.destroy\n respond_to do |format|\n format.html { redirect_to auditreviews_url, notice: 'Auditreview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviewer = Reviewer.find(params[:id])\n @reviewer.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@review = Review.find(params[:id])\n\t\[email protected]\n\t\tredirect_to share_reviews_path(@share), notice: \"Review successfully deleted!\"\t\t\n\tend", "def destroy\n @critic_review.destroy\n respond_to do |format|\n format.html { redirect_to critic_reviews_url, notice: 'Critic review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n end", "def destroy\n @blade_review.destroy\n respond_to do |format|\n format.html { redirect_to blade_reviews_url, notice: 'Blade review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id]) # param comes from route\n @review.destroy\n\n redirect_to restaurant_path(@restaurant.id)\n end", "def destroy\n @food_review.destroy\n respond_to do |format|\n format.html { redirect_to food_reviews_url, notice: 'Food review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hm_review.destroy\n respond_to do |format|\n format.html { redirect_to hm_reviews_url, notice: 'Hm review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user\n @review_like = ReviewLike.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n @boo_k_review.destroy\n respond_to do |format|\n format.html { redirect_to boo_k_reviews_url, notice: 'Boo k review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_review.destroy\n respond_to do |format|\n format.html { redirect_to user_reviews_url, notice: 'User review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Product.find(params[:product_id]).reviews.find(params[:id])\n @review.destroy\n redirect_to :back\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n if user_signed_in? && current_user.admin?\n @new_review = NewReview.find(params[:id])\n @new_review.destroy\n\n respond_to do |format|\n format.html { redirect_to new_reviews_url }\n format.json { head :no_content }\n end\n else\n redirect_to root_path\n end\n end", "def destroy\n @review_template.destroy\n respond_to do |format|\n format.html { redirect_to review_templates_url }\n format.json { head :no_content }\n end\n end", "def delete_user\n delete_reviews(self)\n self.destroy\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'レビューの削除完了です!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review_count.destroy\n respond_to do |format|\n format.html { redirect_to review_counts_url, notice: 'Review count was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour_review.destroy\n respond_to do |format|\n format.html { redirect_to tour_reviews_url, notice: 'ツアーレビューは正常に削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bollywood_review = BollywoodReview.find(params[:id])\n @bollywood_review.destroy\n\n respond_to do |format|\n format.html { redirect_to bollywood_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Review.destory(params[:id])\nend", "def destroy\n @review.destroy\n respond_to do |format|\n # Broadcast remove review on list from model.\n format.turbo_stream { render turbo_stream: \"\" }\n format.html { redirect_to recipe_path(@recipe, anchor: \"reviews_header\"), notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thesis_review = ThesisReview.find(params[:id])\n @thesis_review.destroy\n\n respond_to do |format|\n format.html { redirect_to(thesis_reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@book_review = BookReview.find(params[:id])\n\t\t@book_review.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to book_reviews_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend", "def destroy\n @admin_nature_of_review.destroy\n respond_to do |format|\n format.html { redirect_to admin_nature_of_reviews_url, notice: 'Nature of review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review_image = ReviewImage.find(params[:id])\n @review_image.destroy\n\n respond_to do |format|\n format.html { redirect_to review_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospital = Hospital.find(params[:hospital_id])\n @review = @hospital.reviews.find(params[:id])\n @review.destroy\n respond_to do |format|\n flash[:success] = \"삭제 성공\"\n format.html { redirect_to @hospital }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @product = Product.find(params[:product_id])\n @revoew = @product.reviews.find(params[:id])\n @review.destroy\n\n redirect_to product_path(@product)\n\n end", "def destroy\n @evenreview.destroy\n respond_to do |format|\n format.html { redirect_to evenreviews_url, notice: 'Evenreview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:project_id])\n @review = @project.reviews.find(params[:id])\n @paths = @review.file\n @line = @review.line\n @review.destroy\n\n respond_to do |format|\n # format.html { redirect_to blob_project_path(@project, 'blob', @paths) }\n format.html { redirect_to line_project_path(@project, 'line', @paths, @line) }\n # format.js { @reviews = @project.reviews_by_line(@paths, @line).paginate(page: params[:page], per_page: 20) }\n format.js { @reviews = Review.with_project(@project).with_file(@paths).with_line(@line).paginate(page: params[:page], per_page: 20) }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Review was successfully destroyed.' }\n end\n end", "def destroy\n unless current_user.is_review_moderator?\n redirect_to denied_path\n return\n end\n\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to(reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n @reservation.reviwed = false\n @reservation.save\n format.html { redirect_to listings_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_review.destroy\n respond_to do |format|\n format.html { redirect_to event_reviews_url, notice: 'Event review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviewable_object = current_user.reviewable_objects.find(params[:id])\n @reviewable_object.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_objects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n vendor = @review.vendor\n user = @review.user\n @review.destroy\n vendor.save # para atualizar o number_reviews\n\n respond_to do |format|\n format.html { redirect_to vendor_path(vendor, view: \"recomendacoes\") }\n format.json { head :ok }\n end\n end", "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\t\tformat.js\n\t\tend\n\tend", "def destroy\n @bookreview.destroy\n respond_to do |format|\n format.html { redirect_to book_path(@bookreview.book_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @bizowners_review.destroy\n respond_to do |format|\n format.html { redirect_to bizowners_reviews_url, notice: 'Bizowners review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n\t format.js\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7832836", "0.7792274", "0.77834046", "0.77717566", "0.77717566", "0.77717566", "0.77717566", "0.77717566", "0.7675156", "0.7674345", "0.7652286", "0.7652286", "0.7652286", "0.7639822", "0.74985015", "0.74985015", "0.7471254", "0.7412546", "0.7410434", "0.7410434", "0.7410434", "0.7410434", "0.7410434", "0.7410434", "0.7410434", "0.7410434", "0.7390844", "0.73759574", "0.7369689", "0.73686945", "0.73536", "0.73536", "0.73536", "0.73187256", "0.73107976", "0.73039883", "0.7284733", "0.7240516", "0.723762", "0.72333944", "0.72189", "0.72131", "0.7197844", "0.7191114", "0.7175696", "0.7145946", "0.7126576", "0.7126383", "0.71141326", "0.71092945", "0.70971817", "0.7082161", "0.70791227", "0.7074264", "0.7070024", "0.7058728", "0.7052589", "0.7038935", "0.70380366", "0.7027665", "0.7019965", "0.7018443", "0.70154047", "0.7007311", "0.70069265", "0.70027673", "0.6990057", "0.6978485", "0.6974199", "0.69537205", "0.69492096", "0.6943586", "0.6920429", "0.69115585", "0.6910739", "0.69045305", "0.6891124", "0.6871236", "0.68618053", "0.68598884", "0.68531996", "0.6831626", "0.6828005", "0.6824591", "0.68063676", "0.68037647", "0.6794131", "0.6779671", "0.6767253", "0.67384154", "0.67291474", "0.6710487", "0.6709244", "0.6688249", "0.66769904", "0.66555184", "0.6651741", "0.66502017", "0.6646272", "0.6645688", "0.6639236" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_note @note = Note.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def duas1(action)\n action.call\n action.call\nend", "def call\n setup_context\n super\n end" ]
[ "0.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53316694", "0.53116405", "0.52972704", "0.5296464", "0.529617", "0.52609056", "0.52449894", "0.52388823", "0.52388823", "0.52388823", "0.52388823", "0.52388823", "0.52339035", "0.52324325", "0.52277064", "0.5221976", "0.5219301", "0.52134573", "0.5207571", "0.52070796", "0.51770556", "0.517467", "0.51727664", "0.51673347", "0.51603955", "0.51581466", "0.515401", "0.51533973", "0.5152852", "0.5143863", "0.5140699", "0.513394", "0.5113603", "0.5113603", "0.51126283", "0.5110439", "0.51070756", "0.50922215", "0.50881314", "0.50826275", "0.50788856", "0.50678945", "0.5055518", "0.5052638", "0.5049997", "0.5049997", "0.50348604", "0.5026469", "0.50217324", "0.50154436", "0.5013927", "0.50015604", "0.50013465", "0.49973735", "0.49900484", "0.49900484", "0.49862546", "0.4981161", "0.49783245", "0.49772155", "0.49678212", "0.49645492", "0.49579585", "0.49572104", "0.49550694", "0.4954394", "0.4952923", "0.49466532", "0.49427935", "0.49338013", "0.4931052", "0.49276745", "0.4927467", "0.4924998", "0.49223173", "0.49208498", "0.49184024", "0.49167758", "0.49163175", "0.4916066", "0.49157935" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def note_params params.require(:note).permit(:comment, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
cell with multiple nodes is represented as singlecolumn table
def cell_table(cell, width, style_options) data = cell.nodes.map { |n| [normalize_cell_node(n, width, style_options)] } pdf.make_table(data, width: width, cell_style: { padding: [0, 0, 0, 0], borders: [], border_width: 0, inline_format: true }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _node_parse_table_cell(node)\n # In a Swordfish::Node::Table object, the number of table cells must equal the\n # total number of rows times the total number of columns; that is, even if\n # two cells are merged together, there must be a Swordfish::Node::TableCell for\n # each one. Merges are defined using the \"merge_up\" and \"merge_left\" properties.\n\n cell = Swordfish::Node::TableCell.new\n extra_cells = []\n\n # Get the inner content of the cell\n node.xpath(\"./w:p\").each do |paragraph|\n cell.append _node_parse_paragraph(paragraph)\n end\n \n # Determine whether this cell spans multiple rows. In Office OpenXML,\n # a table cell is defined in every row, even if the cell is vertically-merged. The representation\n # of the merged cell within each row is given a vMerge property, with the topmost one also\n # having a vMerge value of \"restart\", and the others having no vMerge value.\n if node.xpath(\"./w:tcPr/w:vMerge\").length > 0 && node.xpath(\"./w:tcPr/w:vMerge\")[0]['w:val'].nil?\n cell.merge_up = true\n end\n\n # Determine whether this cell spans multiple columns. Unlike with vertical merges,\n # a horizontally-merged Office OpenXML cell is only defined once, but is given a gridSpan\n # property defining the number of columns it spans. Since Swordfish requires a cell for each\n # column, loop to generate the additional cells, and set their merge_left values appropriately.\n if node.xpath(\"./w:tcPr/w:gridSpan\").length > 0\n node.xpath(\"./w:tcPr/w:gridSpan\")[0]['w:val'].to_i.-(1).times do\n c = Swordfish::Node::TableCell.new\n c.merge_left = true\n extra_cells << c\n end\n end\n\n # Return the generated cell or cells\n if extra_cells.empty?\n return cell\n else\n return [cell] + extra_cells\n end\n end", "def table(node)\n if node.entries.any? { |e| e.kind_of?(Syntax::Assign) }\n # A hash, all entries not being an assign, get a value of nil\n\n g.push_cpath_top\n g.find_const :Hash\n g.push node.entries.size\n g.send :new_from_literal, 1\n\n node.entries.each do |entry|\n g.dup\n if entry.kind_of? Syntax::Assign\n # if key is a single name, we use its string value as key\n if entry.name.expressions.size == 1 &&\n entry.name.expressions.first.kind_of?(Syntax::Message)\n g.push_literal entry.name.expressions.first.name\n else\n entry.name.visit self\n end\n entry.value.visit self\n else\n entry.visit self\n g.push_nil\n end\n g.send :[]=, 2\n g.pop\n end\n else\n # A list\n node.entries.each { |entry| entry.visit self }\n g.make_array node.entries.size\n end\n\n g.push_cpath_top\n g.find_const :Table\n g.swap\n g.send :new, 1\n end", "def create_nodes\n @nodes = [*[email protected]]\n end", "def parse_cells(row)\n first = true\n while match?(:table_header, :table_data) || (first && !end?)\n cell = if match? :table_header\n Element.new(:th)\n else\n Element.new(:td)\n end\n if first\n if current.value == 2\n warning 'First cell on a new line should be \"|\" or \"!\" '\n end\n first = false\n elsif current.value != 2\n warning 'Inline cells should be \"||\" or \"!!\"'\n end\n advance if match?(:table_header, :table_data)\n cell = parse_attributes(cell)\n ## skip next tag since attributes were read\n advance if !cell.attributes.empty? && match?(:table_data, :table_header)\n contents = parse2(true)\n if contents.is_a? Array\n break if contents.empty?\n cell.add_children(*contents)\n else\n cell.add_child(contents)\n end\n advance(-1)\n first = true if match? :break\n advance\n ## Parse multi-line cell\n until end? || match?(:table_header, :table_data, :table_row, :table_end)\n if match? :break\n @line += current.value.length\n advance\n first = true\n redo\n end\n curr = @index\n p = parse2(true)\n if p.nil? && (curr == @index)\n error 'Unable to continue parsing table. Is this actually MediaWiki?'\n end\n break if p.is_a?(Array) && p.empty?\n cell.add_child(p)\n end\n row.add_child(cell)\n end\n row\n end", "def _tableish(html, row_selector, column_selectors) #:nodoc\n doc = Nokogiri::HTML(html)\n # Parse the table.\n rows = doc.search(row_selector)\n\n max_columns = _row_width(rows[0], column_selectors)\n max_rows = _column_height(rows)\n\n # Initialize a 2 dimensional array representing the size of the table in tableish format\n grid = Array.new(max_rows) { Array.new(max_columns, nil) }\n\n table_row_index = 0\n grid.each_with_index do |grid_row, grid_row_index|\n row = rows[table_row_index]\n\n cells = _select_cells(column_selectors, row)\n table_column_index = 0\n grid_row.size.times do |grid_column_index|\n next if grid[grid_row_index][grid_column_index] != nil\n\n cell = cells[table_column_index]\n if cell\n col_span, row_span = 1, 1\n row_span = cell['rowspan'].to_i - 1 if cell['rowspan']\n col_span = cell['colspan'].to_i - 1 if cell['colspan']\n\n # draw blank cells based on colspan and rowspan\n if cell['rowspan'] && cell['colspan']\n row_span.times do |row_offset|\n row_offset_index = grid_row_index + (row_offset + 1)\n col_span.times do |col_offset|\n col_offset_index = grid_column_index + (col_offset + 1)\n grid[row_offset_index][col_offset_index] = \"\" unless row_offset_index >= rows.size || col_offset_index >= max_columns\n end\n end\n end\n\n if cell['rowspan']\n row_span.times do |row_span_offset|\n row_offset_index = grid_row_index + (row_span_offset + 1)\n grid[row_offset_index][grid_column_index] = \"\" unless row_offset_index >= rows.size\n end\n end\n\n if cell['colspan']\n col_span.times do |col_span_offset|\n col_offset_index = grid_column_index + (col_span_offset + 1)\n grid[grid_row_index][col_offset_index] = \"\" unless col_offset_index >= max_columns\n end\n end\n\n # print cell value into grid and move to next table column, only if cell hasn't been touched yet\n if grid[grid_row_index][grid_column_index] == nil\n table_column_index += 1\n grid[grid_row_index][grid_column_index] = _cell_value(cell)\n end\n end\n end\n table_row_index += 1\n end\n\n _pad_grid_with_blanks(grid)\n\n grid\n end", "def flat_table_row node\n td = Nokogiri::XML::Node.new( 'td', $document )\n td[:colspan] = 0\n td.children = node.clone\n tr = Nokogiri::XML::Node.new( 'tr', $document )\n tr.children = td\n tr[:class] = node.name\n\n newnode = node.replace tr\n return newnode\nend", "def _node_parse_table_row(node)\n row = Swordfish::Node::TableRow.new\n node.xpath('./w:tc').each do |cell|\n row.append _node_parse_table_cell(cell)\n end\n row\n end", "def hc(row,col)\n build :cell, row: row, col: col\n end", "def table\r\n\t\tempty = Hash.new\r\n\t\tif @text.length < 2\r\n\t\t\treturn empty\r\n\t\tend\r\n\t\ttableHelper(@tree, \"\")\r\n\t\treturn @table\r\n\tend", "def cells\r\n assert_exists \r\n arr_cells = get_cells\r\n row_cells = Array.new(arr_cells.length)\r\n for i in 0..arr_cells.length - 1 do\r\n row_cells[i] = TableCell.new(@container, :jssh_name, arr_cells[i])\r\n end\r\n return row_cells\r\n end", "def row; end", "def tableify node\n if node.xpath('title').length > 0\n colgroup = Nokogiri::XML::Node.new( 'colgroup', $document )\n node = wrap_up node.name, node, { name: 'table', role: node.name, class: node.name }, Nokogiri::XML::NodeSet.new( $document, [ colgroup, node.children ].flatten )\n else\n colgroup = Nokogiri::XML::Node.new( 'colgroup', $document )\n node = wrap_up node.name, node, { name: 'informaltable', role: node.name, class: node.name }, Nokogiri::XML::NodeSet.new( $document, [ colgroup, node.children ].flatten )\n end\n\n # Convert title to caption (see\n # http://www.sagehill.net/docbookxsl/Tables.html ) and re-order things\n newchildren = []\n node.children.each { |child| child.name == 'title' and convert 'title', child, 'caption' }\n node.children.each { |child| child.name == 'caption' and newchildren << child }\n node.children.each { |child| child.name == 'colgroup' and newchildren << child }\n node.children.each { |child| child.name != 'caption' and child.name != 'colgroup' and newchildren << child }\n node.children = Nokogiri::XML::NodeSet.new( $document, newchildren )\n\n return node\nend", "def cells\n attributes.fetch(:cells)\n end", "def parse_web(table_cells)\nend", "def build_cell(cell)\n # implement in row class\n nil\n end", "def parse_table; end", "def cell_columns\n cells = []\n # for each column\n 1.upto(3).each do |column|\n grid = []\n\n # for each row\n 1.upto(3).each do |row|\n grid << get_cell_value(row, column)\n end\n\n cells << grid\n end\n\n cells\n end", "def table_elements\n lambda do |env|\n name, node = env[:node_name], env[:node]\n if (TABLE_SECTIONS.include?(name) || TABLE_ITEMS.include?(name)) && !node.ancestors.any? { |n| n.name == TABLE }\n node.replace(node.children)\n end\n end\n end", "def cells\n rows.flatten\n end", "def cells\n rows.map { |r| r[key] }\n end", "def rownode_to_row(rownode)\n rownode.xpath('td').map &:text\nend", "def create_cells\n (\"A\"..@height).each do |rows|\n ([email protected]_i).each do |column|\n k=\"#{rows}#{column}\"\n cells[k]=Cell.new(k)\n end\n end\n cells\n end", "def flatten_cells() @cells.flatten end", "def cells\n @cells ||= []\n end", "def to_data(force_level = :none)\n cells = [] \n merges = []\n col_widths = {}\n row_heights = {}\n\n css.reset(force_level)\n\n tb = doc.css('table').first \n\n # ignoring specified formats for anything other than table tr td/th\n tb_format = css.format_from_node(tb) \n\n row = 0\n doc.css('tr').each do |tr|\n tr_format = tb_format.merge(@css.format_from_node(tr))\n\n increment = true\n tr.css('td, th').each_with_index do |td, col|\n \n # TODO Do we really need rowheight and colwidth now that there\n # is css parsing?\n rowheight = td.attributes[\"rowheight\"]\n colwidth = td.attributes[\"colwidth\"]\n rowspan = td.attributes[\"rowspan\"]\n colspan = td.attributes[\"colspan\"]\n\n rowheight &&= rowheight.value.to_i\n colwidth &&= colwidth.value.to_i\n rowspan &&= rowspan.value.to_i\n colspan &&= colspan.value.to_i\n\n add_td_to_cells(row, col, td, tr_format, cells)\n if colspan\n (1..colspan-1).each {|t| \n add_td_to_cells(row, col+t, td, tr_format, cells)\n }\n end\n if rowspan\n (1..rowspan-2).each {|t| \n add_td_to_cells(row+t, col, td, tr_format, cells)\n }\n increment = false\n end\n if colspan || rowspan\n merges << [\n row, col, row + (rowspan || 2)-2, col + (colspan || 1)-1\n ]\n end\n end\n\n row += 1 if increment\n end\n\n puts cells.inspect\n { cells: cells, merges: { 0 => merges } }\n end", "def test_table\n return <<HERE;\n 2 3 5 7 11\n 3 9 15 21 33\n 5 15 25 35 55\n 7 21 35 49 77\n 11 33 55 77 121\nHERE\nend", "def base_column_for_normal_style(node); end", "def add_cells (row_key, cells)\r\n cells.each{|item|\r\n @table.put(row_key, {(item[\"col_family\"]+':'+item[\"col_name\"]) => item[\"value\"]})\r\n } \r\n end", "def row_cells\n rowdata = []\n print_layout.each do |section|\n rowdata += row_cell_items(section[:row_cells])\n end\n rowdata\n end", "def table_row_by_children node\n newchildren = []\n node.children.each do |child|\n unless child.element?\n next\n end\n\n td = Nokogiri::XML::Node.new( 'td', $document )\n td.children = child.clone\n newchildren << td\n end\n tr = Nokogiri::XML::Node.new( 'tr', $document )\n tr.children = Nokogiri::XML::NodeSet.new( $document, newchildren )\n tr[:class] = node.name\n\n newnode = node.replace tr\n return newnode\nend", "def cell_rows\n cells = []\n\n # for each row\n 1.upto(3).each do |row|\n rows = []\n # for each column\n 1.upto(3).each do |column|\n rows << get_cell_value(row, column)\n end\n\n cells << rows\n end\n\n cells\n end", "def table_data\n @building_groups.reduce([]) do |table, bg|\n table << energy_row(bg)\n end\n end", "def cellClass\n ElementTableViewCell\n end", "def create_cells\n (0...rows).each do |r|\n (0...columns).each do |c|\n @fields[r][c] = Cell.new(r, c)\n end\n end\n end", "def rcp_table(row,column); det.table(:id, 'rcpTable')[row][column];end", "def latex_table(data, top_headings, left_headings)\n matrix = [[''] + top_headings] +\n left_headings.zip(data).map { |heading, line| [heading] + line }\n latex_matrix matrix\nend", "def to_s_v1\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n\n row.each do |cell|\n cell = Cell.new(-1, -1) unless cell\n\n body = \" \" # <-- that's THREE (3) spaces!\n east_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n top << body << east_boundary\n\n # three spaces below, too >>-------------->> >...<\n south_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n corner = \"+\"\n bottom << south_boundary << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n\n output\n end", "def actual_cells\n @cells.compact\n end", "def prepare_table(element)\n name=element.attributes[\"name\"]\n oid=SNMPPass.oid2num(element.attributes[\"oid\"])\n\n # Read index and columns\n indexes=element.elements[\"row/linkage\"].elements.collect(\"index\") {|index| index.attributes[\"name\"]}\n columns=element.elements[\"row\"].elements.collect(\"column\") do\n |column|\n column_name=column.attributes[\"name\"]\n column_oid=column.attributes[\"oid\"]\n column_id=SNMPPass.oid2num(column_oid).last\n\n $DEBUG.puts \"TABLE: #{name} NAME: #{column_name} ID #{column_id}, OID: #{column_oid}\"\n\n #column_desc=column.elements[\"description\"].text.gsub(/^[[:blank:]\\n]*/,\"\").gsub(/[[:blank:]\\n]*$/,\"\")\n type=prepare_type(column.elements[\"syntax\"], column_name)\n [column_name,column_id,type]\n end\n\n @indexes[name]=indexes\n @columns[name]=columns\n\n table=DynamicTree.new(oid){|op, *roid| dynamic_tree_callback(name, op, *roid) }\n add_node(table)\n end", "def test_table_too\n return <<HERE;\n 2 3 5 7 11\n 2 4 6 10 14 22\n 3 6 9 15 21 33\n 5 10 15 25 35 55\n 7 14 21 35 49 77\n 11 22 33 55 77 121\nHERE\nend", "def tableHelper(node, text)\r\n\t\tif(node.char == nil)\r\n\t\t\ttableHelper(node.left, text+\"0\")\r\n\t\t\ttableHelper(node.right, text+\"1\")\r\n\t\telse\r\n\t\t\t@table[node.char] = text\r\n\t\tend\r\n\t\treturn text\r\n\tend", "def cells\n @cells\n end", "def cells\n @cells\n end", "def col; end", "def link_cells\n (0...rows).each do |r|\n (0...columns).each do |c|\n cell = @fields[r][c]\n cell.neighbors = find_neighbors(cell)\n end\n end\n end", "def read_cells(sheet = default_sheet)\n validate_sheet!(sheet)\n return if @cells_read[sheet]\n\n sheet_found = false\n doc.xpath(\"//*[local-name()='table']\").each do |ws|\n next unless sheet == attribute(ws, 'name')\n\n sheet_found = true\n col = 1\n row = 1\n ws.children.each do |table_element|\n case table_element.name\n when 'table-column'\n @style_defaults[sheet] << table_element.attributes['default-cell-style-name']\n when 'table-row'\n if table_element.attributes['number-rows-repeated']\n skip_row = attribute(table_element, 'number-rows-repeated').to_s.to_i\n row = row + skip_row - 1\n end\n table_element.children.each do |cell|\n skip_col = attribute(cell, 'number-columns-repeated')\n formula = attribute(cell, 'formula')\n value_type = attribute(cell, 'value-type')\n v = attribute(cell, 'value')\n style_name = attribute(cell, 'style-name')\n case value_type\n when 'string'\n str_v = ''\n # insert \\n if there is more than one paragraph\n para_count = 0\n cell.children.each do |str|\n # begin comments\n #=begin\n #- <table:table-cell office:value-type=\"string\">\n # - <office:annotation office:display=\"true\" draw:style-name=\"gr1\" draw:text-style-name=\"P1\" svg:width=\"1.1413in\" svg:height=\"0.3902in\" svg:x=\"2.0142in\" svg:y=\"0in\" draw:caption-point-x=\"-0.2402in\" draw:caption-point-y=\"0.5661in\">\n # <dc:date>2011-09-20T00:00:00</dc:date>\n # <text:p text:style-name=\"P1\">Kommentar fuer B4</text:p>\n # </office:annotation>\n # <text:p>B4 (mit Kommentar)</text:p>\n # </table:table-cell>\n #=end\n if str.name == 'annotation'\n str.children.each do |annotation|\n next unless annotation.name == 'p'\n # @comment ist ein Hash mit Sheet als Key (wie bei @cell)\n # innerhalb eines Elements besteht ein Eintrag aus einem\n # weiteren Hash mit Key [row,col] und dem eigentlichen\n # Kommentartext als Inhalt\n @comment[sheet] = Hash.new unless @comment[sheet]\n key = [row, col]\n @comment[sheet][key] = annotation.text\n end\n end\n # end comments\n if str.name == 'p'\n v = str.content\n str_v += \"\\n\" if para_count > 0\n para_count += 1\n if str.children.size > 1\n str_v += children_to_string(str.children)\n else\n str.children.each do |child|\n str_v += child.content #.text\n end\n end\n str_v = str_v.gsub(/&apos;/, \"'\") # special case not supported by unescapeHTML\n str_v = CGI.unescapeHTML(str_v)\n end # == 'p'\n end\n when 'time'\n cell.children.each do |str|\n v = str.content if str.name == 'p'\n end\n when '', nil, 'date', 'percentage', 'float'\n #\n when 'boolean'\n v = attribute(cell, 'boolean-value').to_s\n end\n if skip_col\n if !v.nil? || cell.attributes['date-value']\n 0.upto(skip_col.to_i - 1) do |i|\n set_cell_values(sheet, col, row, i, v, value_type, formula, cell, str_v, style_name)\n end\n end\n col += (skip_col.to_i - 1)\n end # if skip\n set_cell_values(sheet, col, row, 0, v, value_type, formula, cell, str_v, style_name)\n col += 1\n end\n row += 1\n col = 1\n end\n end\n end\n doc.xpath(\"//*[local-name()='automatic-styles']\").each do |style|\n read_styles(style)\n end\n\n fail RangeError unless sheet_found\n\n @cells_read[sheet] = true\n @comments_read[sheet] = true\n end", "def get_table_contents(&block)\n TableBodyDSL.new(&block).elements\n end", "def each_cell(row_xml)\n return [] unless row_xml\n row_xml.children.each do |cell_element|\n coordinate = ::Roo::Utils.extract_coordinate(cell_element[\"r\"])\n hyperlinks = hyperlinks(@relationships)[coordinate]\n\n yield cell_from_xml(cell_element, hyperlinks, coordinate)\n end\n end", "def each_cell\n\t\teach_row do |row|\n\t\t\trow.each do |cell|\n\t\t\t\tyield cell if cell\n\t\t\tend\n\t\tend\n\tend", "def build_table_body\n data.each_with_index do |row, i|\n output << \",\\n\" if i > 0 \n build_row(row)\n end\n output << \"\\n\"\n end", "def table_for(enum, cols, title = nil)\n rows = []\n enum.each do |elem|\n rows << yield(elem)\n end\n \n puts Terminal::Table.new(\n title: title,\n headings: cols,\n rows: rows,\n style: {\n border_x: '-',\n border_y: '',\n border_i: '',\n padding_left: 0,\n padding_right: 2\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 bid_cells(bid, seed_on_left_or_right)\n options = {:align => seed_on_left_or_right, :style => \"border-bottom: 1px solid black; padding-#{seed_on_left_or_right}: 2mm;\"}\n seed = content_tag :td, (bid ? \"(#{bid.seed})\" : '&nbsp'), options\n team = content_tag :td, (bid ? h(bid.team.name) : '&nbsp'), options\n cells = [seed, team]\n cells.reverse! if 'right' == seed_on_left_or_right\n cells\n end", "def render_cell(*)\n Capybara.string super\n end", "def cell(op, index, table_type)\n snippet = \"\"\n if op.nil?\n snippet += \"<td class='opcode op-#{index} unused'></td>\"\n else\n snippet += \"<td class='opcode op-#{index} #{op['group'].to_s.tr('/', '-')}'>\"\n snippet += \" <div class='mnemonic'>\"\n snippet += \" #{op['mnemonic']} \"\n snippet += \" #{op['operand1']}\" if op['operand1']\n snippet += \" , #{op['operand2']}\" if op['operand2']\n snippet += \" </div>\"\n snippet += \" <div>\"\n snippet += \" <span class='length'>#{op['length']}</span>\"\n snippet += \" <span class='cycles'>#{op['cycles'].join(\"-\")}</span>\"\n snippet += \" </div>\"\n snippet += \" <div class='flags'>#{op['flags'].join(' ')}</div>\"\n snippet += \"</td>\"\n end\n snippet\nend", "def make_row(column_elements)\n\t\"<tr><td>#{column_elements.join(\"</td><td>\")}</td></tr>\"\nend", "def default_grid\n Array.new(7) { Array.new(6) { CellNode.new }}\n end", "def node_to_row node\n crow = nil\n @list.each_with_index do |e,i|\n if e == node\n crow = i\n break\n end\n end\n crow\n end", "def to_renderable(go_down = true, template = read_template('_table_cell.xml.erb'))\n\n horizontal, vertical = calculate_sizing\n\n cells =\n (0..vertical-1).map do |i|\n (0..horizontal-1).map do |j|\n\n options = {}\n if i == 0 && j == 0\n options[:gridspan] = horizontal >= 2 ? horizontal : false\n options[:rowspan] = vertical >= 2 ? vertical : false\n options[:data] = @data\n\n elsif i == 0\n options[:h_merge] = 1\n options[:rowspan] = vertical >= 2 ? vertical : false\n options[:template] = template\n elsif j == 0\n options[:gridspan] = horizontal >= 2 ? horizontal : false\n options[:v_merge] = i\n options[:template] = template\n else\n options[:h_merge] = 1\n options[:v_merge] = i\n options[:template] = template\n end\n\n options[:template] = template\n\n RenderableCell.new(options.merge(@options))\n end\n end\n\n neighbor_rows = @right.flat_map { |n| n.to_renderable(false, template) }\n\n # join right neighbor rows with mine if we have neighbors\n cells = cells.zip(neighbor_rows).map { |myrow, nrow| myrow + nrow } unless neighbor_rows.empty?\n\n return cells if @bottom.empty? || !go_down\n\n bot_rows = @bottom[0].to_renderable(true, template)\n\n cells + bot_rows\n end", "def build_table_body\n body =\n if data.column_names && !data.column_names.empty?\n data\n else\n data[1..-1]\n end\n body.each { |row| build_md_row(output, row) }\n end", "def table_test\n @pdf.table( [[\"foo\", \"bar\", \"bazbaz\"], [\"1\", \"2\", \"3\"], [\"1\", \"2\", \"3\"], [\"1\", \"2\", \"3\"]],\n :cell_style => { :padding => 12 }, :width => @pdf.bounds.width)\n\n @pdf.move_down 12\n \n @pdf.table([[\"foo\", \"bar \" * 15, \"baz\"],\n [\"baz\", \"bar\", \"foo \" * 15]], :cell_style => { :padding => 12 }) do\n cells.borders = []\n\n # Use the row() and style() methods to select and style a row.\n style row(0), :border_width => 2, :borders => [:bottom]\n\n # The style method can take a block, allowing you to customize\n # properties per-cell.\n style(columns(0..1)) { |cell| cell.borders |= [:right] }\n end\n \n header = %w[Name Occupation]\n data = [\"Bender Bending Rodriguez\", \"Bender\"]\n\n @pdf.table([header] + [data] * 50, :header => true) do\n #row(0).style(:font_style => :bold, :background_color => 'cccccc')\n end\n\n end", "def table_entry_for_cell(row, column)\n if row == 0 && column == 0\n # Special handling for the top-left character, replacing a '1' entry.\n '-'\n else\n list_to_print[row] * list_to_print[column]\n end\n end", "def table; end", "def table; end", "def table; end", "def table; end", "def get_valid_model_table(table)\n new_table = []\n unless table.empty?\n length_table = table.size\n (0..length_table - 1).each do |row_index|\n cells_added = 0\n original_row = [].concat(table[row_index])\n new_table[row_index] = [] if new_table.size <= row_index\n length_row = original_row.size\n (0..length_row - 1).each do |cell_index|\n cell = original_row[cell_index]\n new_cell_index = cell_index + cells_added\n new_row = new_table[row_index]\n until new_row[new_cell_index].nil?\n cells_added += 1\n new_cell_index = cell_index + cells_added\n end\n new_row[new_cell_index] = cell\n\n next unless cell.has_attribute?('rowspan')\n\n rowspan = cell.get_attribute('rowspan').to_i\n\n next unless rowspan > 1\n\n (1..rowspan - 1).each do |rowspan_index|\n new_row_index = row_index + rowspan_index\n new_table[new_row_index] = [] if new_table[new_row_index].nil?\n new_table[new_row_index][new_cell_index] = cell\n end\n end\n end\n end\n new_table\n end", "def draw_tree\n result = ''\n max_cols = @n + 1\n calc_tree.each do |row|\n print = ' ' * ((max_cols - row.length) / 2) * max_cols\n print << row.join(' ')\n result << \"#{print}\\n\"\n end\n puts result\n end", "def table_row_by_words node\n newchildren = []\n children = node.children.to_a\n children.each_index do |child_index|\n child = children[child_index]\n sibling = (child_index+1 == children.length) ? nil : children[child_index+1]\n if not child\n next\n end\n if child.text?\n words = child.text.gsub('--',\"\\u00A0\").split( %r{\\s+} )\n words.each_index do |word_index|\n word = words[word_index]\n unless word =~ %r{^\\s*$}\n td = Nokogiri::XML::Node.new( 'td', $document )\n td.content = word\n if word_index == words.length-1 && word[-1] == \"-\" && sibling && !(sibling.text?) && sibling.element? && sibling.name == 'quote'\n td << sibling.dup\n children[child_index+1] = nil\n end\n newchildren << td\n end\n end\n elsif child.element?\n td = Nokogiri::XML::Node.new( 'td', $document )\n td.children = child.clone\n newchildren << td\n end\n end\n tr = Nokogiri::XML::Node.new( 'tr', $document )\n tr.children = Nokogiri::XML::NodeSet.new( $document, newchildren )\n tr[:class] = node.name\n\n newnode = node.replace tr\n return newnode\nend", "def sen_settg(row,column); det.table(:index, 12)[row][column]; end", "def contents_of(cell)\n \" \"\n end", "def table_content\n # This makes a call to gift_rows and gets back an array of data that will \n # populate the columns and rows of a table I then included some styling to \n # include a header and make its text bold. I made the row background colors \n # alternate between grey and white Then I set the table column widths\n table gift_rows do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = ['DDDDDD', 'FFFFFF']\n self.column_widths = [180, 180, 180]\n end\n end", "def to_s_v2\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n\n row.each do |cell|\n cell = Cell.new(-1, -1) unless cell\n\n body = \" #{contents_of(cell)} \"\n east_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n top << body << east_boundary\n\n south_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n corner = \"+\"\n bottom << south_boundary << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n\n output\n end", "def add_table(rows, columns, options = {})\n @nodes << Table.new(page_config, rows, columns, options)\n end", "def table(vals, probs)\n\tn = vals.length\n\trel = if probs[0].to_s.match(/\\d+\\{\\,\\}\\d+/) then 'w' else 'n' end\n\t\"\\\\begin{tabular}{*{#{n+1}}{ >{$} r <{$} }} \" + \\\n\t\"x_i & #{vals.join(\" & \")} \\\\\\\\ \" + \\\n\t\"#{rel}_i & #{probs.join(\" & \")} \" + \\\n\t\"\\\\end{tabular}\"\nend", "def default_grid\n Array.new(3) { Array.new(3) {Cell.new} }\n end", "def row_cell(tag_string, cell={}, row={})\n cell = self.tag('cell', tag_string, cell)\n self.tag('row', cell, row)\n end", "def cells\n Enumerator.new do |yielder|\n buffer.each do |row|\n row.each do |cell|\n yielder << cell\n end\n end\n end\n end", "def table_content\n table activity_rows do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = ['DDDDDD', 'FFFFFF']\n self.column_widths = [65, 175, 75, 85, 75, 65]\n style(column(3), align: :right)\n style(column(4), align: :right)\n style(column(5), align: :right)\n end\n end", "def row_cells_to_text_columns(table_row)\n table_row.cells.map do |cell|\n # Join paragraphs into a String using a space delimiter.\n cell_paragraphs(cell).join(' ')\n end\n end", "def render_cell(column_name,cell_value,record)\n \"\"\n end", "def create_collection_table(rows:, columns:, col_id:, plate_on_end: nil, display_id: false)\n plate_on_end ||= rows == 12 && columns == 8 ? true : false\n text_color = 'black'\n border_color = '&#E9E9E9'\n bg_color = '&#b8b8b8'\n size = rows * columns\n slots = (1..size + rows + columns + 1).to_a\n tab = slots.each_slice(columns + 1).each_with_index.map do |row, row_idx|\n row.each_with_index.map do |col, col_idx|\n if row_idx == 0 && display_id\n if col_idx == 0\n { class: 'td-empty-slot',\n content: '<b>ID:</b>',\n style: {color: text_color, 'background-color' => border_color } }\n elsif col_idx == 1\n { class: 'td-empty-slot',\n content: \"<b>#{col_id}</b>\",\n style: {color: text_color, 'background-color' => border_color, border: '0px' } }\n else\n { class: 'td-empty-slot',\n content: '',\n style: {color: text_color, 'background-color' => border_color, border: '0px' } }\n end\n elsif row_idx == 0\n { class: 'td-empty-slot',\n content: \"<b>#{plate_on_end ? get_alpha(col_idx) : col_idx}</b>\",\n style: { color: text_color, 'background-color' => border_color } }\n elsif col_idx.zero?\n { class: 'td-empty-slot',\n content: \"<b>#{plate_on_end ? row_idx : get_alpha(row_idx)}</b>\",\n style: { color: text_color, 'background-color' => border_color } }\n else\n { class: 'td-empty-slot',\n content: '',\n style: { 'background-color' => bg_color } }\n end\n end\n end\n end", "def create_cells\n definition['cells'].each do |cellname|\n cells.create!(name: cellname)\n end\n end", "def make_table( given, can )\n\ttable = initialize_table(given, can)\t# init row of 0s\n\t# need one more row than columns (n + 1) rows\n\tcan = [0] + can\n\n\t(0...(given.length)).each do |x|\n\t\t(1...(can.length + 1)).each do |s|\n\t\t\t# do not calculate min for lower diagonals\n\t\t\t# cannot possibly process x_1 with the power of s_2, nor x_2 with s_3\n\t\t\tif s - x < 2\t\n\t\t\t\t\n\t\t\t\ttable[s][x] = min( given[x], can[s] )\n\n\t\t\t\tif s == 1 && x > 1\n\t\t\t\t\ttable[s][x] += column_max( table, x - s - 1 )\n\t\t\t\telsif x >= 1\n\t\t\t\t\ttable[s][x] += table[ s - 1 ][ x - 1 ]\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\tend\n\treturn table\nend", "def rows\n CellCollection.new(@data, @column)\n end", "def get_other_col_cells cell\n\t\treturn get_col_cells(get_col cell) - [cell]\n\tend", "def new_empty_x doc, options={}\n if options.empty?\n doc.ns_create_node 'table:table-cell'\n else\n attr_hash = {}\n if style = options[:style_name]\n attr_hash['table:style-name'] = style\n end\n if num = options[:repeated]\n attr_hash['table:number-columns-repeated'] = num\n end\n doc.ns_create_node 'table:table-cell', nil, attr_hash\n end\n end", "def vis(prefix=\"\")\n puts \"#{prefix}row #{cells.inspect.to_s}\"\n children.each{|c| c.vis(prefix + \" \")}\n end", "def connect_cells\n @grid.each_with_index do |columns, col_i|\n columns.each_with_index do |cell, cell_i|\n cell.left = @grid[col_i-1][cell_i] if col_i != 0 \n cell.up = @grid[col_i][cell_i+1] if cell_i + 1 < columns.length\n cell.right = @grid[col_i+1][cell_i] if col_i + 1 < @grid.length\n cell.down = @grid[col_i][cell_i-1] if cell_i != 0\n cell.lu = @grid[col_i-1][cell_i+1] if col_i != 0 && cell_i + 1 < columns.length\n cell.ld = @grid[col_i-1][cell_i-1] if col_i != 0 && cell_i != 0\n cell.ru = @grid[col_i+1][cell_i+1] if col_i + 1 < @grid.length && cell_i + 1 < columns.length\n cell.rd = @grid[col_i+1][cell_i-1] if col_i + 1 < @grid.length && cell_i != 0\n end\n end\n end", "def init_table\n\t$table = Array.new($height) { Array.new($width, '.')}\nend", "def table config={}, &block\n #def tabular_widget config={}, &block\n require 'canis/core/widgets/table'\n events = [:PROPERTY_CHANGE, :LEAVE, :ENTER, :CHANGE, :ENTER_ROW, :PRESS ]\n block_event = nil\n # if no width given, expand to stack width\n #config.delete :title\n useform = nil\n\n w = Table.new useform, config # NO BLOCK GIVEN\n w.width ||= :expand \n w.height ||= :expand # TODO This has to come before other in stack next one will overwrite.\n _position(w)\n if block_given?\n #@current_object << w\n yield_or_eval &block\n #@current_object.pop\n end\n return w\n end", "def columns; end", "def create_table\n dimension_length = (@numbers_to_multiply.length - 1)\n @multiplication_table = []\n new_table_row = [\" \"]\n\n for i in 0..dimension_length\n new_table_row << @numbers_to_multiply[i]\n end\n\n new_table_row\n @multiplication_table << new_table_row\n\n for x in 0..dimension_length \n new_table_row = []\n new_table_row << @numbers_to_multiply[x]\n # rowValues = \"#{@numbers_to_multiply[x]} |\"\n for y in 0..dimension_length\n nextEntry = @numbers_to_multiply[x] * @numbers_to_multiply[y]\n new_table_row << nextEntry\n end\n @multiplication_table << new_table_row\n end\n end", "def children_table; end", "def generate_row(row)\n '<tr>' + '<td>' + \"#{(row.map {|x| generate_item(x)}).join('</td><td>')}\" + '</td></tr>' + \"\\n\" \n end", "def build_table(content)\n table content do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = %w(DDDDDD FFFFFF)\n self.column_widths = [40, 300, 60, 60, 70]\n self.cell_style = {\n border_width: 0,\n size: 10\n }\n end\n end", "def table_content\n table activity_rows do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = ['DDDDDD', 'FFFFFF']\n self.column_widths = [110, 175, 175, 80]\n end\n end", "def cells(*args)\r\n cells = TableCellCollection.new(self, extract_selector(args).merge(:tag_name => /^(th|td)$/))\r\n cells.locator_class = ChildCellLocator\r\n\r\n cells\r\n end", "def three_row_grid\n grid = []\n grid << [\n Cell.new(:alive, 0, 0),\n Cell.new(:alive, 0, 1),\n Cell.new(:dead, 0, 2)\n ]\n grid << [\n Cell.new(:alive, 1, 0),\n Cell.new(:dead, 1, 1),\n Cell.new(:dead, 1, 2)\n ]\n grid << [\n Cell.new(:dead, 2, 0),\n Cell.new(:dead, 2, 1),\n Cell.new(:dead, 2, 2)\n ]\n grid\nend", "def node_row(node)\n [\n node.key,\n node.query.primary_co2_emission,\n *primary_carriers.map { |ca| node.query.primary_demand_of(ca) },\n *final_carriers.map { |ca| node.query.final_demand_of(ca) }\n ]\n end" ]
[ "0.71189755", "0.6335158", "0.632168", "0.61995035", "0.6161802", "0.6108293", "0.60842776", "0.6019744", "0.6016464", "0.59983504", "0.599295", "0.5964404", "0.5953297", "0.59496063", "0.59333026", "0.5929688", "0.59242576", "0.5920149", "0.59186566", "0.5917206", "0.58535814", "0.5850005", "0.58497405", "0.5830063", "0.5816599", "0.5782492", "0.57802397", "0.5772012", "0.576073", "0.57402724", "0.5733968", "0.5718797", "0.5709348", "0.57077736", "0.570427", "0.5682394", "0.567676", "0.5668568", "0.56658006", "0.5651502", "0.56495625", "0.56111985", "0.56111985", "0.56031376", "0.56025803", "0.55829614", "0.55761737", "0.55682963", "0.5564069", "0.5557994", "0.5532851", "0.5521895", "0.5504832", "0.5497808", "0.5497666", "0.5495215", "0.5488314", "0.54871166", "0.5482034", "0.54788566", "0.5465651", "0.5463667", "0.54610574", "0.54610574", "0.54610574", "0.54610574", "0.5458226", "0.54526293", "0.5451631", "0.54499817", "0.5449455", "0.54416037", "0.5439938", "0.54362637", "0.5431784", "0.5429907", "0.54259354", "0.5419211", "0.5413718", "0.54096824", "0.54074305", "0.54050034", "0.5399488", "0.5395866", "0.5388585", "0.5387638", "0.53810936", "0.5380556", "0.5375909", "0.53744924", "0.53738856", "0.5371943", "0.53655475", "0.53570956", "0.5353169", "0.53511214", "0.5342791", "0.533861", "0.53384954", "0.5337689" ]
0.68957233
1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.notice_mailer.sendmail_confirm.subject
def sendmail_confirm(user) @user = user mail(to: user.email, subject: "会計よりお知らせ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def message_subject=(value)\n @message_subject = value\n end", "def subject\n @mail.subject\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def subject\n self['subject'] || msg['subject']\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end", "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end", "def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def subject=(subject); @message_impl.setSubject subject; end", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end", "def subject=(string)\n set('Subject', string)\n end", "def sendmail_confirm(greeting, text, address, subject)\n @greeting = greeting\n\n @text = text\n mail to: address, subject: subject\n end", "def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def message_subject\n return @message_subject\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 setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def headers\n {\n subject: \"[#{Setting.site_name}] Neue Quelle eingesendet\",\n to: Setting.email,\n reply_to: email,\n from: Setting.get('from'),\n }\n end", "def sendmail_confirm\n @greeting = \"元気ー?\"\n\n mail to: \"[email protected]\"\n end", "def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end", "def send_confirm_email\n settings.fetch('send_mail',{}).fetch('confirm_email', true)\n end", "def getEmailDefaults(subject, toEmail, ccEmail = nil)\n if Rails.env.eql? 'development'\n subject = \"[BASL-DEV] #{subject}\"\n toEmail = '[email protected]'\n ccEmail = toEmail\n else\n subject = \"[BASL] #{subject}\"\n end\n mailInfo = {\n :to => toEmail,\n :subject => subject,\n :cc => ccEmail\n }\n mailInfo\n end", "def confirmed(assignment)\n setup_user_email(assignment)\n @subject += I18n.translate 'assignment_mailer.accepted.subject', :event => assignment.event.code\n end", "def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end", "def subject\n message.subject\n end", "def headers\n {\n :subject => \"Contact Form:#{subject}\",\n :to => Sufia::Engine.config.contact_email, \n :from => Sufia::Engine.config.from_email\n }\n end", "def subject_name=(value)\n @subject_name = value\n end", "def headers\n { subject: \"#{site_name} contact form\", to: site_email, from: email }\n end", "def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def subject_name\n return @subject_name\n end", "def set_subject(subject)\n\t\tend", "def send_subscribe_email(subscriptor)\n @subscriptor = subscriptor\n @subject = \"Thanks for subscribe for our amazing app\"\n mail(to: @subscriptor.email, subject: @subject)\n # mail(to: , from: , subject:)\n end", "def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"[email protected]\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def confirm ( recipient,subject,message)\n @recipients = recipient \n @subject = subject \n @from = '[email protected]' \n @password= 'job1come'\n @message=message \n @headers = {} \n sub = @subject + Time.now.strftime(\"%A %B %d, %Y\") \n \n mail(:to => recipient, :subject => sub)\n \n end", "def welcome_email(resource)\n \n @resource = resource\n\n mail :to => @resource.email, :from => \"[email protected]\", :subject => \"Subject line\"\n \n end", "def subject_titles\n @subject_titles ||= sw_subject_titles\n end", "def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end", "def subject_name\n subject_full_name\n end", "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def course_notification_item_details(course)\n t('notifications.subscribe_course')\n end", "def newcompany_email(company)\n @company = company\n @message = t('mailers.company.created')\n \n emails = AdminUser.all.collect(&:email).join(\",\")\n\n mail(:to => emails, :subject => \"#{t('site_title')}: #{@message}\")\n \n end", "def subject\n self['subject']\n end", "def headers\n {\n :subject => %(#{subject}),\n :to => Contact.first.email,\n :body => %(#{message}),\n :from => %(\"#{email}\")\n }\n end", "def confirmation_instructions(record, token, opts={})\n opts[:from] = %(\"Janice from Beebsy\" <[email protected]>)\n opts[:bcc] = '[email protected]'\n opts[:subject] = 'Thanks for joining Beebsy!'\n opts[:reply_to] = '[email protected]'\n super\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject\n title \n end", "def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end", "def subject; @message_impl.getSubject; end", "def custom_mail( user, subject, title, contents )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @contents = contents\n @title = title\n #subject: \"[#{ GogglesCore::AppConstants::WEB_APP_NAME }@#{ @host }] #{ subject }\",\n mail(\n subject: \"#{ subject } [#{GogglesCore::AppConstants::WEB_APP_NAME}]\",\n to: user.email,\n date: Time.now\n )\n end", "def default_sender_address\n address = Mail::Address.new(Gitlab.config.gitlab.email_from)\n address.display_name = \"GitLab\"\n address\n end", "def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <[email protected]>\",\n from: \"BaseRails <[email protected]>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end", "def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend", "def headers\n {\n :subject => \"Inscripción de músico - #{musician_name}\",\n :to => \"[email protected]\",\n :from => %(\"#{musician_name}\" <#{musician_email}>)\n }\n end", "def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end", "def set_title\n @title = t(:message_0, :scope => [:controller, :scholarships])\n end", "def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end", "def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end", "def email_verification_subject(token, server_hostname, protocol)\n \"#{server_hostname} e-mail verification\"\n end", "def setup_email(user)\n @recipients = user.email\n @body[:user] = user\n @from = FROM_EMAIL\n @subject = case ENV['RAILS_ENV'] \n when 'development': \"[YourApp Development] \"\n when 'staging': \"[YourApp Staging] \"\n else \"[YourApp] \"\n end\n @sent_on = Time.now\n headers \"Reply-to\" => FROM_EMAIL\n end", "def community_member_email(sender, recipient, email_subject, email_content, community)\n @email_type = \"email_from_admins\"\n set_up_layout_variables(recipient, community, @email_type)\n with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do\n @email_content = email_content\n @no_recipient_name = true\n premailer_mail(:to => recipient.confirmed_notification_emails_to,\n :from => community_specific_sender(community),\n :subject => email_subject,\n :reply_to => \"\\\"#{sender.name(community)}\\\"<#{sender.confirmed_notification_email_to}>\")\n end\n end", "def alert_preamble\n text = user ? user.email : ''\n text += \" [#{company.name}]\" if company\n text\n end", "def notify_course_teaching_assignment( user , course ) \n @course = course\n @subject = @course.subject \n @school = @subject.school\n @user = user\n mail( :to => user.email, \n :subject => \"potoSchool | Tuga Mengajar pelajaran #{@subject.name}, kelas #{@course.name} \" )\n end", "def editcompany_email(company)\n @company = company\n @message = t('mailers.company.updated')\n \n emails = AdminUser.all.collect(&:email).join(\",\")\n\n mail(:to => emails, :subject => \"#{t('site_title')}: #{@message}\")\n end", "def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end", "def headers\n {\n subject: I18n.t('contact.subject'),\n to: info_email,\n from: \"Deskspotting <#{info_email}>\"\n }\n end", "def set_subject_and_message(form, subject, message)\n raise Impostor::MissingTemplateMethodError.new(\"set_subject_and_message must be implemented\")\n end", "def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end", "def devalert(subject, body='', extra_to=[])\n recipients = CONTACT_EMAIL_ACCOUNTS\n if RAILS_ENV == 'production'\n extra_to = [extra_to] if extra_to.is_a?(String)\n recipients = [recipients].concat(extra_to).join(',')\n end\n @subject = subject\n @body = {:msg => body}\n @recipients = recipients\n @from = ALERT_EMAIL_DEV\n @sent_on = Time.now\n @headers = {}\n end", "def prompt_message(pre)\n @greeting = \"Hi\"\n @pre = pre\n @prompt = pre.prompt\n\n mail to: \"#{@pre.user.email}\",\n subject: \"#{@prompt.name}\"\n end", "def headers\n {\n :subject => \"#{subject}\",\n :to => \"[email protected]\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def setup_email(options)\n @recipients = options[:recipients]\n @from = options[:from] || SocialNewsConfig[\"email_addrs\"][\"support\"] \n @cc = options[:cc] || ''\n @bcc = options[:bcc] || ''\n @subject = SUBJECT_PREFIX + (options[:subject] || 'No Subject')\n @body = options[:body] || {}\n @headers = options[:headers] || {}\n @charset = options[:charset] || 'utf-8'\n end", "def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def notify_english(dest)\n mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))\n end" ]
[ "0.6913642", "0.68215305", "0.67956865", "0.6684918", "0.66837823", "0.6679666", "0.6677335", "0.6580134", "0.65671325", "0.6547826", "0.64369136", "0.6429522", "0.6425408", "0.63602126", "0.6349901", "0.6337199", "0.6332632", "0.6322143", "0.62865", "0.6223848", "0.61906713", "0.61655366", "0.6147133", "0.6097735", "0.6045171", "0.6018775", "0.59788257", "0.59788257", "0.59788257", "0.59788257", "0.59788257", "0.59788257", "0.59788257", "0.59788257", "0.5974709", "0.59660476", "0.5965051", "0.5965051", "0.5965051", "0.5965051", "0.59541154", "0.59525275", "0.5898442", "0.5894662", "0.5886203", "0.5881147", "0.58797777", "0.5846637", "0.5834575", "0.5811426", "0.5789287", "0.5761651", "0.57434326", "0.5734062", "0.5718954", "0.57171404", "0.57089293", "0.57025695", "0.56929106", "0.56860274", "0.5683792", "0.5668719", "0.56617355", "0.566086", "0.56595415", "0.5612262", "0.56111765", "0.5602525", "0.5602525", "0.5602525", "0.5602525", "0.5602525", "0.5602525", "0.5589141", "0.5586166", "0.5581009", "0.5569097", "0.5565877", "0.55640787", "0.55607164", "0.5560071", "0.55599886", "0.5545534", "0.55413014", "0.55413014", "0.5540746", "0.554022", "0.55353266", "0.55309135", "0.55272764", "0.5523288", "0.55158", "0.5511408", "0.55058146", "0.5501252", "0.5499145", "0.5492592", "0.5485018", "0.5484821", "0.546853", "0.54628253" ]
0.0
-1
input: output: Steps 1 2 3 Commit 2 Initial Solution
def daffify(message) # write code here end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def steps\n find_solution\n end", "def solution4(input)\n end", "def testCommitments_case0\n c1 = ''\n d1 = ''\n a1 = ''\n c2 = ''\n d2 = ''\n a2 = ''\n c3 = ''\n d3 = ''\n a3 = ''\n c4 = ''\n d4 = ''\n a4 = ''\n c5 = ''\n d5 = ''\n a5 = ''\n c6 = ''\n d6 = ''\n a6 = ''\n c7 = ''\n d7 = ''\n a7 = ''\n c8 = ''\n d8 = ''\n a8 = ''\n generate(\n [\n [COMMITMENT, C1, c1, d1, a1],\n [COMMITMENT, C2, c2, d2, a2],\n [COMMITMENT, C3, c3, d3, a3],\n [COMMITMENT, C4, c4, d4, a4],\n [COMMITMENT, C5, c5, d5, a5],\n [COMMITMENT, C6, c6, d6, a6],\n [COMMITMENT, C7, c7, d7, a7],\n [COMMITMENT, C8, c8, d8, a8]\n ],\n [], c1, d1, a1, c2, d2, a2, c3, d3, a3, c4, d4, a4, c5, d5, a5, c6, d6, a6, c7, d7, a7, c8, d8, a8\n ) {\n yield [\n ['testCommitment', C1, c1, '', 'satisfied'],\n ['testCommitment', C2, c2, '', 'satisfied'],\n ['testCommitment', C3, c3, '', 'satisfied'],\n ['testCommitment', C4, c4, '', 'satisfied'],\n ['testCommitment', C5, c5, '', 'satisfied'],\n ['testCommitment', C6, c6, '', 'satisfied'],\n ['testCommitment', C7, c7, '', 'satisfied'],\n ['testCommitment', C8, c8, '', 'satisfied'],\n ]\n }\nend", "def step1\n\n end", "def get_initial_commit\n\t\t`git rev-list --max-parents=0 HEAD`.chomp\n\tend", "def solution1(input)\n return \"Not implemented!\"\nend", "def step1\n \n end", "def last_exercise_minimal_path_correctly_done \n pos = ((self.user_sequence.size() - 1)/STEP_SIZE)*STEP_SIZE #ultimo multiplo de STEP_SIZE\n if self.user_sequence[self.user_sequence.size() - 1][3]\n return self.user_sequence[self.user_sequence.size() - 1][0] # the last one\n else\n pos = ((self.user_sequence.size() - 1)/STEP_SIZE)*STEP_SIZE\n while pos >= 0 && !self.user_sequence[pos][3] do\n pos = pos - STEP_SIZE\n end\n if pos >= 0\n return self.user_sequence[pos][0]\n else\n return nil\n end\n end\n end", "def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend", "def recursive_solution\n\n end", "def start_code_review (jira_issues, pull_request, user)\n i = 0;\n while (i < jira_issues.length) do\n jira_issue = jira_issues[i].join\n transition_issue jira_issue, CODE_REVIEW_ID, user, pull_request, \"opened\"\n i+=1\n end\nend", "def createJobSummary\n comment = \"PR cannot be merged due to following issues:\\n\"\n if MAINTAINERS_FAILED_VALIDATION.length() != 0\n comment += \"- Maintainers\\n\"\n for issueObject in MAINTAINERS_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n if OSSPROJECTS_FAILED_VALIDATION.length() != 0\n comment += \"- OSS Projects\\n\"\n for issueObject in OSSPROJECTS_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n if SOCIALGOOD_FAILED_VALIDATION.length() != 0\n comment += \"- Social Good Projects\\n\"\n for issueObject in SOCIALGOOD_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n @logger.info(\"Summary: #{comment}\")\n File.write(ENV[\"GITHUB_STEP_SUMMARY\"], comment)\nend", "def steps\n steps_keywords = %w(Given When Then And But)\n nsteps = 0\n @steps = []\n while true\n print \"Add step [Y/n]: \"\n choice = gets\n if choice.downcase.strip != \"n\"\n puts \"Step #{nsteps +1}:\"\n step = gets.capitalize\n init_step_word = step.split(' ').first\n if steps_keywords.include?(init_step_word)\n @steps << step\n nsteps = nsteps ++ 1\n else\n puts \"Error: #{init_step_word} unsupported initial value\"\n puts \"Use only #{steps_keywords} keywords\"\n end\n elsif choice.downcase.strip == \"n\"\n break\n else\n \"please enter a valid choice.\"\n end\n end\n write_feature\n end", "def first_puzzle a\n # write down your solution to puzzle 1 here\nend", "def steps(n)\nend", "def process\n filename = \"index.markdown\"\n markdowns = {filename => []} \n state = :message\n message = [\"\\n\"]\n patch = []\n commit = nil\n (@gitlogp.split(\"\\n\")+[\"DONE\"]).each { |line|\n words=line.split\n if line.slice(0,1)==\" \" || words.length==0\n # commit messages start with 4 spaces, diff contents with 1 space\n if state==:message\n if words[0]==\"OUTPUT_FILE:\"\n filename = words[1]\n markdowns[filename] ||= []\n else\n message << \"#{line.slice(4..-1)}\"\n end\n else\n patch << \" #{line}\" if state==:patch\n end\n elsif words[0]==\"commit\" or words[0]==\"DONE\"\n if !commit.nil?\n # replace the short description line with a named link\n shortlog = message[2]\n message[2] = \"<a name='#{shortlog}'> </a>\"\n markdowns[filename] += message.map {|l|\n if l==\"SHOW_PATCH\"\n (patch+[\"{: .diff}\\n\"]).join(\"\\n\")\n else\n l\n end\n }\n series = tags[commit].slice(-2..-1)\n markdowns[filename] << \"\\n#{tags[commit]}: [view on github](#{@commit_link_base}#{commit}), [download #{series}-#{shortlog}.patch](#{@patch_link_base}/#{series}-#{shortlog}.patch)\\n{: .commit}\\n\"\n end\n \n message=[\"\\n\"]\n patch=[]\n\n commit = words[1]\n state = :message\n elsif [\"Author:\", \"Date:\", \"new\", \"index\", \"---\", \"+++\", '\\\\'].include?(words[0])\n # chomp\n elsif words[0]==\"diff\"\n state = :patch\n left = words[2].slice(2..-1)\n right = words[3].slice(2..-1)\n if left==right\n patch << \" ::: #{right}\"\n else\n patch << \" ::: #{left} -> #{right}\"\n end\n elsif words[0]==\"@@\"\n # git tries to put the function or class name after @@. This\n # works great for C diffs, but it only finds the class name in\n # Ruby, which is usually similar to the file name, Therefore\n # it's distracting cruft. Toss it.\n patch << \" #{words.slice(0,4).join(\" \")}\"\n else\n message << \"#{line.slice(4..-1)}\" if state==:message\n patch << \" #{line}\" if state==:patch \n end\n }\n output = {}\n markdowns.each do |fn, markdown|\n output[fn] = markdown.join(\"\\n\")\n Rails.logger.info(output[fn]) if respond_to? :Rails\n end\n return output\n end", "def index \n authorize! :read, @project \n @stepIDs = @project.steps.not_labels.order(\"published_on\").pluck(:id)\n\n # fix step position and ancestry if there's an error\n if @project.steps.where(:position => -1).present?\n Rails.logger.info(\"FIXING STEP POSITIONS AND ANCESTRY\")\n start_position = @project.steps.order(:position).last.position\n @project.steps.where(:position => -1).order(\"created_at\").each do |step|\n last_step = @project.steps.where(:position => start_position).first\n step.update_attributes(:ancestry => last_step.ancestry + \"/\" + last_step.id.to_s)\n step.update_attributes(:position => start_position+1)\n start_position = start_position + 1\n end\n end\n \n respond_to do |format|\n # go directly to the project overview page\n format.html \n format.json\n format.xml \n end\n end", "def showSolution(board)\n history = []\n while board\n history.unshift(board)\n board = board.parent\n end\n puts \"we'll start at the beginning and end at the end\"\n puts \"hit enter to click through\"\n history.each do |b|\n b.print\n gets\n end\nend", "def steps\n %w[first last]\n end", "def pretty_step step\n step.sub!(\"Given\", \"<div class='spector-keyword'>Given</div>\")\n step.sub!(\"When\", \"<div class='spector-keyword'>When</div>\") \n step.sub!(\"Then\", \"<div class='spector-keyword'>Then</div>\") \n step.sub!(\"And\", \"<div class='spector-keyword'>And</div>\")\n if step.include?(\"#\")\n step = \"<div class='spector-comment'>#{step}</div>\"\n end\n step = step.split(\"\\\"\").in_groups_of(2).map{|a,b| b.nil? ? a : \"#{a}<div class='spector-quote'>\\\"#{b}\\\"</div>\"}.join\n step\n end", "def branch; end", "def construct_solution\n path = [@root]\n tabu_list = [@root]\n until @ends.include?(last = path.last)\n step = next_step last, tabu_list\n path << step\n end\n path\n end", "def initialize\n puts 'GitHub Archiver Challenge'\n # get_input\n get_data\n end", "def commit\n\t$VP.join('.git/refs/heads/master').read[0..8] rescue nil\nend", "def git\n\tend", "def solution\n line = 0\n puts \"*********************************\"\n puts \"********* SOLUTION **************\"\n puts \"*********************************\"\n @rows.each do |i|\n puts \"[#{i[0]}][#{i[1]}][#{i[2]}] | [#{i[3]}][#{i[4]}][#{i[5]}] | [#{i[6]}][#{i[7]}][#{i[8]}]\"\n line = line+1\n puts \"---------------------------------\" if line%3==0 end\n end", "def phase_one\n\tputs \"Phase One: Pre-Merge\".yellow\n\t8.times do\n\t\tlost_tribe = @borneo.immunity_challenge\n\t\tputs \"Tribe #{lost_tribe.to_s.red} has lost this round. They are voting off a member.\"\n\t\teliminated_contestant = lost_tribe.tribal_council\n\t\tputs \"#{eliminated_contestant.to_s.capitalize.red} was voted off.\"\n\tend\n\t#puts \"Phase one ends. 8 contestants were voted off in this phase, and 12 contestants remain in the game.\"\nend", "def print_result(node)\n steps = 0\n result = []\n while node.change != \"\"\n result.unshift node.change\n node = node.parent\n steps += 1\n end\n result.each do |z|\n puts z\n end\n puts \"Pocet krokov: #{steps}\"\n steps\n end", "def branches; end", "def findCommits()\n @students.each do |student|\n repos = Octokit.repositories \"#{student[0]}\"\n totalCommits = []\n\n repos.each_with_index do |v, i|\n begin\n commits = Octokit.commits(\"#{student[0]}/#{repos[i][:name]}\").length\n totalCommits << commits\n rescue; end\n end\n\n student[1][:totalCommits] = totalCommits.compact.inject(0) do |sum,x| \n sum + x \n end\n end\nend", "def steps\n %w[/14/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /ASSESSMENT/educations\n /12/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /13/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /ASSESSMENT/client_scores\n /41/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /42/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /15/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /ASSESSMENT/work/characteristics/index\n /29/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /ASSESSMENT/client_immunization/show\n /ASSESSMENT/disability/characteristics/index\n /ASSESSMENT/mental/characteristics/index\n /35/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /ASSESSMENT/substance_abuse/characteristics/index\n /32/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /ASSESSMENT/domestic/characteristics/index\n /38/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /39/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /ASSESSMENT/clients/medical_pregnancy/show\n /19/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /21/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /22/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /23/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /24/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /25/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /26/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /2/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /ASSESSMENT/employments\n /ASSESSMENT/legal/characteristics/index\n /7/assessment_edit/session[:CLIENT_ASSESSMENT_ID]/edit_common_assessment\n /assessment_careers/interest_profiler_questions/interest_profiler_question_wizard_initialize\n ]\n\n end", "def problem_8\nend", "def nextExercise() \n last_done_question = last_question(auto_sequence.user)\n unless last_done_question.nil? \t \n last_exerc = Question.find(last_done_question.from_question_id).exercise.id\n ind_last_exerc = index_of(last_exerc)\n user_sequence[ind_last_exerc][2] = true\n if last_done_question.correct?\n # save as correct answer \n user_sequence[ind_last_exerc][3] = true\n save\n nxt_exerc = next_exercise_minimal_path_not_done\n if nxt_exerc.nil? # no more exercises\n return last_exerc\n # verify if the last exercise index + step size is before of the next exercise of the minimal path\n elsif ind_last_exerc + STEP_SIZE < index_of(Moped::BSON::ObjectId.from_string(nxt_exerc))\n # goes to first exercise not done after the last solved in minimal path\n return first_not_done_exercise\n else \n return nxt_exerc\n end\n else \n save \n nro_tentativas = last_attempt_number(auto_sequence.user)\n mediana = question_median(last_done_question.from_question_id) \n \tif nro_tentativas >= mediana\n min_ind_exerc = last_exercise_minimal_path_correctly_done\n min_index = 0\n if min_ind_exerc.nil? # student failed on every exercises of the minimal path\n # find the last correct exercise before the actual\n min_ind_exerc = last_exercise_correctly_done_before(ind_last_exerc)\n if min_ind_exerc.nil? # no exercise found, then find the last done before the actual\n min_ind_exerc = last_exercise_done_before(ind_last_exerc) \n end\n end\n min_index = index_of(Moped::BSON::ObjectId.from_string(min_ind_exerc)) \n medium_index = (min_index + ind_last_exerc)/2\n return first_not_done_exercise_after_index(medium_index)\n \telse # continues at the same exercise \n \t\treturn last_exerc\n \tend \n end \n else # returns the first exercise\n return self.user_sequence[0][0]\n end\n end", "def exercise_method\n\n # => All jobs\n @old = Job.all\n @jobs=Set.new\n @jobs=@old\n @result=Set.new\n # => let remove the singles, independent one\n @jobs.each do |f| \n if f.predecessor_id.nil? && f.successor_id.nil?\n if @result.add?(f).nil?\n return 'Error 1'\n end\n @jobs.delete(f)\n end\n if f.predecessor_id==f.id || f.successor_id==f.id\n raise \"#{f.inspect}\"\n \n return 'Error 0'\n end\n end\n\n # => following successors\n @jobs.each do |f|\n if f.predecessor_id.nil? \n loop do\n if @result.empty?\n @result.add(f)\n elsif @result.add?(f).nil?\n return 'Error 2'\n end\n @jobs.delete(f)\n if !f.successor_id.nil?\n f = Job.find(f.successor_id)\n else\n f=nil\n end\n break if !f \n end\n end\n end\n \n if @jobs.any?\n return 'Error 3'\n end\n return @result\n end", "def generateDelayToIntegrationByMergeScenario(projectName, localClone, pathOutput)\n\t\tprefixProjectName = formatProjectName(projectName)\n\t\tintegrationLine = []\n\t\tintegrationLineAuthorDateList = []\n\t\tintegrationLineCommitDateList = []\n\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitList.csv\", 'r') do |f1|\n\t\t while line = f1.gets \n\t\t\tf1.each_line do |line|\n\t\t\t\tleftAuthorsList = []\n\t\t rightAuthorsList = []\n\t\t\t\tcampos = line.split(\",\")#.length\t\n\t\t\t\tmergeCommitID = campos[0].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\tisConflicting = campos[1].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\tleftCommits = campos[10].split(\"@@\")\n\t\t\t\trightCommits = campos[11].split(\"@@\")\n leftDelayIntegration = 0\n\t\t\t\trightDelayIntegration = 0\n\t\t\t\tarithmeticMeanDelayIntegration = 0\n\t\t\t\tgeometricMeanDelayIntegration = 0\n\t\t\t\tdeltaIntegration = 0\n\n\t\t\t\tif leftCommits.include?(\"\\n\")\n\t\t\t\t\tleftCommits.delete(\"\\n\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif rightCommits.include?(\"\\n\")\n\t\t\t\t\trightCommits.delete(\"\\n\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Metric\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{leftCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tleftDelayIntegration = (endDate - startDate).to_i\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{rightCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\trightDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tleftDelayLessThanZero = false\n\t\t\t\t\tif (leftDelayIntegration==0)\n\t\t\t\t\t\tleftDelayIntegration = 1\n\t\t\t\t\tend\n\t\t\t\t\trightDelayLessThanZero = false\n\t\t\t\t\tif (rightDelayIntegration==0)\n\t\t\t\t\t\trightDelayIntegration = 1\n\t\t\t\t\tend\n\n\t\t\t\t\tif leftDelayIntegration > rightDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = leftDelayIntegration - rightDelayIntegration\n\t\t\t\t\telsif rightDelayIntegration > leftDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = rightDelayIntegration - leftDelayIntegration\n\t\t\t\t\telse\n\t\t\t\t\t\tdeltaIntegration = 0\n\t\t\t\t\tend\n\n\t\t\t\t\tif (rightDelayIntegration <0)\n\t\t\t\t\t\tleftDelayLessThanZero = true\n\t\t\t\t\tend\n\n\t\t\t\t\tif((leftDelayIntegration * rightDelayIntegration) <0)\n\t\t\t\t\t\tif(leftDelayIntegration <0)\n\t\t\t\t\t\t\tleftDelayIntegration = 1\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\trightDelayIntegration = 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tarithmeticMeanDelayIntegration = (Float(leftDelayIntegration + rightDelayIntegration)/2).round(2)\n\t\t\t\t\tgeometricMeanDelayIntegration = Math.sqrt(Float(leftDelayIntegration*rightDelayIntegration)).round(2)\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tlinha = mergeCommitID+\",\"+isConflicting+\",\"+leftDelayIntegration.to_s+\",\"+rightDelayIntegration.to_s+\",\"+arithmeticMeanDelayIntegration.to_s+\",\"+geometricMeanDelayIntegration.to_s+\",\"+deltaIntegration.to_s\n\t\t\t\t\tintegrationLine.push(linha.gsub(\"\\n\", \"\"))\t\t\n\t\t\t\t\t\n\t\t\t\t\t File.open(localClone+pathOutput+prefixProjectName+\"_DelayDeltaIntegrationList.csv\", 'w') do |file|\n\t\t\t\t\t\tfile.puts \"mergeCommitID, isConflicting, leftDelayIntegration, rightDelayIntegration, arithmeticMeanDelayIntegration, geometricMeanDelayIntegration, deltaIntegration\"\n\t\t\t\t\t\tintegrationLine.each do |dado|\n\t\t\t\t\t\t\tfile.puts \"#{dado}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t end\t\t\t\t \n\n\t\t\t\t# exploring more data - extra internal test\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{leftCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tleftDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{rightCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\trightDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tif leftDelayIntegration > rightDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = leftDelayIntegration - rightDelayIntegration\n\t\t\t\t\telsif rightDelayIntegration > leftDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = rightDelayIntegration - leftDelayIntegration\n\t\t\t\t\telse\n\t\t\t\t\t\tdeltaIntegration = 0\n\t\t\t\t\tend\n\n\t\t\t\t\tif leftDelayIntegration * rightDelayIntegration < 0\n\t\t\t\t\t\tif leftDelayIntegration < 0\n\t\t\t\t\t\t\tleftDelayIntegration = leftDelayIntegration * -1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\trightDelayIntegration = rightDelayIntegration * -1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tarithmeticMeanDelayIntegration = (Float(leftDelayIntegration + rightDelayIntegration)/2).round(2)\n\t\t\t\t\tgeometricMeanDelayIntegration = Math.sqrt(Float(leftDelayIntegration*rightDelayIntegration)).round(2)\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tlinha = mergeCommitID+\",\"+isConflicting+\",\"+leftDelayIntegration.to_s+\",\"+rightDelayIntegration.to_s+\",\"+arithmeticMeanDelayIntegration.to_s+\",\"+geometricMeanDelayIntegration.to_s+\",\"+deltaIntegration.to_s\n\t\t\t\t\tintegrationLineCommitDateList.push(linha.gsub(\"\\n\", \"\"))\t\t\n\t\t\t\t\t\n\t\t\t\t\t File.open(localClone+pathOutput+prefixProjectName+\"_DelayDeltaIntegrationCommitDatesList.csv\", 'w') do |file|\n\t\t\t\t\t\tfile.puts \"mergeCommitID, isConflicting, leftDelayIntegration, rightDelayIntegration, arithmeticMeanDelayIntegration, geometricMeanDelayIntegration, deltaIntegration\"\n\t\t\t\t\t\tintegrationLineCommitDateList.each do |dado|\n\t\t\t\t\t\t\tfile.puts \"#{dado}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t end\n\n\n\t\t\t\t# exploring more data - extra test\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{leftCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tleftDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{rightCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\trightDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tif leftDelayIntegration > rightDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = leftDelayIntegration - rightDelayIntegration\n\t\t\t\t\telsif rightDelayIntegration > leftDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = rightDelayIntegration - leftDelayIntegration\n\t\t\t\t\telse\n\t\t\t\t\t\tdeltaIntegration = 0\n\t\t\t\t\tend\n\t\t\t\t\tif leftDelayIntegration * rightDelayIntegration < 0\n\t\t\t\t\t\tif leftDelayIntegration < 0\n\t\t\t\t\t\t\tleftDelayIntegration = leftDelayIntegration * -1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\trightDelayIntegration = rightDelayIntegration * -1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tarithmeticMeanDelayIntegration = (Float(leftDelayIntegration + rightDelayIntegration)/2).round(2)\n\t\t\t\t\tgeometricMeanDelayIntegration = Math.sqrt(Float(leftDelayIntegration*rightDelayIntegration)).round(2)\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tlinha = mergeCommitID+\",\"+isConflicting+\",\"+leftDelayIntegration.to_s+\",\"+rightDelayIntegration.to_s+\",\"+arithmeticMeanDelayIntegration.to_s+\",\"+geometricMeanDelayIntegration.to_s+\",\"+deltaIntegration.to_s\n\t\t\t\t\tintegrationLineAuthorDateList.push(linha.gsub(\"\\n\", \"\"))\t\t\n\t\t\t\t\t\n\t\t\t\t\t File.open(localClone+pathOutput+prefixProjectName+\"_DelayDeltaIntegrationAuthorDatesList.csv\", 'w') do |file|\n\t\t\t\t\t\tfile.puts \"mergeCommitID, isConflicting, leftDelayIntegration, rightDelayIntegration, arithmeticMeanDelayIntegration, geometricMeanDelayIntegration, deltaIntegration\"\n\t\t\t\t\t\tintegrationLineAuthorDateList.each do |dado|\n\t\t\t\t\t\t\tfile.puts \"#{dado}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t end\t\t\t\t \n\n\t\t\tend #f1eachline\n\t\t end #while\n\t\tend #Fileopen\n\tputs \"end running generateDelayToIntegrationByMergeScenario from #{prefixProjectName} project\"\n\tend", "def phase_one\n puts \"Phase 1 Starting\".yellow\n counter = 8\n eliminated = []\n while counter > 0\n indexer = 8 - counter\n puts \"Phase one, round #{(indexer+1).to_s}:\".green\n tribe_selected = @borneo.immunity_challenge\n puts \"Tribe selected: #{tribe_selected.to_s}\".green\n puts \"Contestant #{tribe_selected.tribal_council} was eliminated without mercy!\".red\n counter -= 1\n end\n 8 # this is here to pass the test, but not sure it's ver useful beyond that\nend", "def step_result; end", "def test_scm_st_036\n printf \"\\n Test 036\"\n end", "def develop_pr_check\n\n result = CheckResult.new(\"Develop PR Check Result\")\n\n ## PR should be sent from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`\n result.message << \"Head Branch check |\"\n is_from_feature = github.branch_for_head.start_with?(\"feature/\")\n is_from_refactor = github.branch_for_head.start_with?(\"refactor/\")\n is_from_fix = github.branch_for_head.start_with?(\"fix/\")\n is_from_issue = github.branch_for_head.start_with?(\"issue/\")\n is_from_version = github.branch_for_head.start_with?(\"version/\")\n if is_from_feature || is_from_refactor || is_from_fix || is_from_issue || is_from_version\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR from a from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should be sent to `develop` branch\n result.message << \"Base Branch check |\"\n is_to_develop = github.branch_for_base == \"develop\"\n if is_to_develop\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR to `develop` branch.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## If PR is sent from a branch that begins with `version/`, do a release modification check\n if is_from_version\n release_modification_check_into_result(result)\n end\n\n ## PR shouldn't contain any merge commits\n result.message << \"Merge Commits check |\"\n contains_merge_commits = git.commits.any? { |c| c.parents.length > 1 }\n unless contains_merge_commits\n result.message << \":o:\\n\"\n else\n fail \"Please don't contain any merge commits in the branch. Consider Rebase if required.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should have less than 1000 lines of modifications if possible.\n result.message << \"Modification Volumn check |\"\n is_fix_too_big = git.lines_of_code > 1_000\n unless is_fix_too_big\n result.message << \":o:\\n\"\n else\n warn \"Too many modifications. Please consider splitting the PR if possible.\"\n result.message << \":heavy_exclamation_mark:\\n\"\n result.warnings += 1\n end\n\n return result\n\nend", "def full_pyramid\n\n#On salut notre visiteur\n\tputs \"Salut, bienvenue dans ma super pyramide ! Combien d'etages veux-tu ?\"\n\tprint \"> \"\n\n#On demande le nombre d'étages\n\tsteps = gets.chomp.to_i\n\n#On affiche la pyramide\n\tputs \"Voici la pyramide :\"\n\tsteps.times do |i|\n\tputs \" \" * (steps - ( i + 1 )) + \"#\" * ( 2 * i + 1) + \" \" * (steps - ( i + 1 ))\nend\nend", "def pre_change_sha(node)\n branch = node['delivery']['change']['pipeline']\n\n if node['delivery']['change']['stage'] == 'verify'\n shell_out(\n \"git rev-parse origin/#{branch}\",\n :cwd => node['delivery']['workspace']['repo']\n ).stdout.strip\n else\n # This command looks in the git history for the last two merges to our\n # pipeline branch. The most recent will be our SHA so the second to last\n # will be the SHA we are looking for.\n command = \"git log origin/#{branch} --merges --pretty=\\\"%H\\\" -n2 | tail -n1\"\n shell_out(command, :cwd => node['delivery']['workspace']['repo']).stdout.strip\n end\n end", "def step0(debug=false)\n\n # make sure we don't step beyond the solution\n return nil if done?\n\n t0 = Time.now\n @nb_iter += 1\n\n puts \"+++iteration #{@nb_iter}+++\" if debug\n puts \"nb problems = #{@pb_list.length}\" if debug\n\n best_pb = @pb_list.shift\n @rejected_grids.push(best_pb.grid)\n\n puts \"best problem:\" if debug\n puts best_pb.show_stats if debug\n\n if best_pb.min_depth == 1 then\n\n # we can create a problem with all the steps included at once\n new_steps = []\n best_pb.each_poss(1) do |poss|\n new_steps.push(Step.new(poss.row, poss.col, poss.first))\n end\n @nb_try += 1\n begin\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n rescue RuntimeError\n # the combination of depth=1 solution caused a conflict\n puts \"Impossible solution for best problem, discard it\" if debug\n @nb_discard += 1\n end\n else\n\n # we need to create a new problem for each possibility\n best_pb.each_poss(best_pb.min_depth) do |poss|\n poss.each do |v|\n @nb_try += 1\n new_steps = [Step.new(poss.row, poss.col, v)]\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n end\n end\n end\n\n # resort the list by max_poss / min_dof\n @pb_list.sort! do |x,y|\n res = x.max_poss <=> y.max_poss\n res = x.dof <=> y.dof if res == 0\n res\n end\n\n @duration += Time.now - t0\n\n #return the solution if we have one\n if @pb_list.empty? then\n return null\n else\n return @pb_list[0]\n end\n\n end", "def how_many_steps?\n puts \"Left\"\n puts \"Right\"\n puts \"/1\\nRight\\n2\\nLeft/\"\n puts \"/3/\"\n puts \"/4/\"\n puts \"/5/\"\n puts \"/6/\"\nend", "def step_test\n 3.upto(6) do |x|\n puts \" \"\n x.upto(x + 2) do |i|\n print \"#{i}\\t\"\n end\n end\nend", "def complete\n # # step 0: 对Solutions的结果做voting,并将最终结果存入Problem的result中\n # PhotoRecognitionJob.perform_later(self.id.to_s)\n # step 1: 修改Problem的状态为solved,未完成的Solutions的状态为failed\n self.set(status: :solved)\n self.solutions.each { |solution|\n if solution.status.waiting?\n solution.set(status: :failed)\n end\n }\n # # step 2: 修改Seeker与Solvers的credit\n # self.creator.crowdsourcing_profile.decrease_credit(self.credit_expend)\n # self.creator.crowdsourcing_profile.decrease_prepared_credit(self.credit_prepared)\n # self.creator.crowdsourcing_profile.touch(:updated_at)\n # self.creator.crowdsourcing_profile.save\n # self.solutions.each { |solution|\n # if solution.status.solved?\n # solution.creator.crowdsourcing_profile.increase_credit(solution.problem.credit)\n # solution.creator.crowdsourcing_profile.touch(:updated_at)\n # solution.creator.crowdsourcing_profile.save\n # end\n # }\n # step 3: 修改Seeker_Profile中的 finished + 1 以及积分变化\n # 修改Solver_Profile:如果完成,finished + 1,积分变化;如果失败,failed + 1,积分不变\n self.creator.seeker_profile.increase_finished\n # self.creator.seeker_profile.increase_credit(self.credit_expend)\n self.creator.seeker_profile.touch(:updated_at)\n self.creator.seeker_profile.save\n self.solutions.each { |solution|\n if solution.status.solved?\n solution.creator.solver_profile.increase_finished\n # solution.creator.solver_profile.increase_credit(solution.problem.credit)\n solution.creator.solver_profile.touch(:updated_at)\n solution.creator.solver_profile.save\n else\n solution.creator.solver_profile.increase_failed\n solution.creator.solver_profile.touch(:updated_at)\n solution.creator.solver_profile.save\n end\n }\n end", "def step\n log_iteration_start\n\n\n @current_task = tasks_list.shift\n status.no_tasks! and return unless current_task #empty tasks list\n\n solve_current_task\n\n return unless current_basis_plan # no optimal plan, so we don't change record and continue\n\n if current_target_function <= record # not interested as previsous record is higher\n status.target_less_than_record!\n elsif task.satisfies_integer?(current_basis_plan)\n change_record\n else\n split_current_task\n end\n log_status\n end", "def phase_three\n puts \"Phase 3 has been started\"\n\n 7.times do\n immune = @borneo.individual_immunity_challenge\n puts \"#{immune} wins the immunity\".blue\n\t\tvoted_off_contestant = @merge_tribe.tribal_council(immune: immune)\n\t\[email protected]_member voted_off_contestant\n\t\tputs \"#{voted_off_contestant}! is OUT!\".red\n end\nend", "def commit(opts = {:use_dirstate => true, :update_dirstate => true})\n valid = false # don't update the DirState if this is set!\n \n commit = ((modified || []) + (added || [])).sort\n remove = removed\n xtra = extra.dup\n branchname = xtra[\"branch\"]\n text = description\n \n p1, p2 = parents.map {|p| p.node }\n c1 = repo.changelog.read(p1) # 1 parent's changeset as an array\n c2 = repo.changelog.read(p2) # 2nd parent's changeset as an array\n m1 = repo.manifest.read(c1[0]).dup # 1st parent's manifest\n m2 = repo.manifest.read(c2[0]) # 2nd parent's manifest\n \n if opts[:use_dirstate]\n oldname = c1[5][\"branch\"]\n tests = [ commit.empty?, remove.empty?, !opts[:force],\n p2 == NULL_ID, branchname == oldname ]\n if tests.all?\n UI::status \"nothing changed\"\n return nil\n end\n end\n \n xp1 = p1.hexlify\n xp2 = p2 == NULL_ID ? \"\" : p2.hexlify\n \n Hook.run_hook :pre_commit\n journal = Amp::Mercurial::Journal.new(:opener => repo.store_opener)\n \n fresh = {} # new = reserved haha i don't know why someone wrote \"haha\"\n changed = []\n link_rev = repo.size\n \n (commit + (remove || [])).each {|file| UI::status file }\n \n # foreach file in commit:\n # commit_file file\n # end\n commit.each do |file|\n versioned_file = self[file]\n fresh[file] = versioned_file.commit :manifests => [m1, m2],\n :link_revision => link_rev,\n :journal => journal ,\n :changed => changed\n \n new_flags = versioned_file.flags\n \n # TODO\n # Clean this shit up\n if [ changed.empty? || changed.last != file, \n m2[file] != fresh[file]\n ].all?\n changed << file if m1.flags[file] != new_flags\n end\n m1.flags[file] = new_flags\n \n repo.staging_area.normal file if opts[:use_dirstate]\n end\n \n # add_manifest_entry\n man_entry, updated, added = *add_manifest_entry(:manifests => [m1, m2],\n :changesets => [c1, c2],\n :journal => journal ,\n :link_rev => link_rev,\n :fresh => fresh ,\n :remove => remove ,\n :changed => changed )\n\n # get_commit_text\n text = get_commit_text text, :added => added, :updated => updated,\n :removed => removed, :user => user ,\n :empty_ok => opts[:empty_ok] ,\n :use_dirstate => opts[:use_dirstate]\n \n # atomically write to the changelog\n # add_changelog_entry\n # for the unenlightened, rents = 'rents = parents\n new_rents = add_changelog_entry :manifest_entry => man_entry,\n :files => (changed + removed),\n :text => text,\n :journal => journal,\n :parents => [p1, p2],\n :user => user,\n :date => date,\n :extra => xtra\n \n \n # Write the dirstate if it needs to be updated\n # basically just bring it up to speed\n if opts[:use_dirstate] || opts[:update_dirstate]\n repo.dirstate.parents = new_rents\n removed.each {|f| repo.dirstate.forget(f) } if opts[:use_dirstate]\n repo.staging_area.save\n end\n \n # The journal and dirstates are awesome. Leave them be.\n valid = true\n journal.close\n \n # if an error and we've gotten this far, then the journal is complete\n # and it deserves to stay (if an error is thrown and journal isn't nil,\n # the rescue will destroy it)\n journal = nil\n \n # Run any hooks\n Hook.run_hook :post_commit, :added => added, :modified => updated, :removed => removed, \n :user => user, :date => date, :text => text,\n :revision => repo.changelog.index_size\n return new_rents\n rescue StandardError => e\n if !valid\n repo.dirstate.invalidate!\n end\n if e.kind_of?(AbortError)\n UI::warn \"Abort: #{e}\"\n else\n UI::warn \"Got exception while committing. #{e}\"\n UI::warn e.backtrace.join(\"\\n\")\n end\n \n # the journal is a vestigial and incomplete file.\n # destroyzzzzzzzzzzz\n journal.delete if journal\n end", "def steps (n, row = 0, stair = '')\n return if n == row\n\n if n == stair.length\n puts stair\n return steps(n, row + 1)\n end\n\n stair.length <= row ? stair += '#' : stair += ' '\n\n steps(n, row, stair)\nend", "def problem_14(*input)\n if input[0] == nil then input.push(0) end\n if input[-1].is_a? Integer then input << {:problem => :count_clumps} end\n if input[-1][:problem] == :same_ends\n same_ends(*input[0..-2])\n else\n count_clumps(*input[0..-2])\n end\nend", "def initial_ref\n %x[git rev-parse #{branch}].chomp\nend", "def upa_steps; end", "def next_exercise_minimal_path_not_done\n i = 0\n while(i < self.user_sequence.size() && self.user_sequence[i][2]) do\n i = i + STEP_SIZE\n end\n if i < self.user_sequence.size()\n return self.user_sequence[i][0]\n elsif self.user_sequence.last[2] # last exercise is done\n return nil\n else\n return self.user_sequence.last[0]\n end \n end", "def problem_14\nend", "def build_output(items, no_of_issues, v_name, r_date, n_branch, target)\n target = target\n\n output_filename = v_name + '_changelog_for_' + target + '.txt'\n out_file = File.new(output_filename, 'w')\n\n # Categories counter\n c_cnt = 0\n # Issues with category counter\n i_cnt = 0\n # Issues without category counter\n nc_i_cnt = 0\n\n if target == 'packaged_file'\n out_file << \"== #{r_date} v#{v_name}\\n\\n\"\n elsif target == 'website'\n out_file << \"h1. Changelog #{v_name}\\n\\n\" if n_branch == true\n out_file << \"h2. version:#{v_name} (#{r_date})\\n\\n\"\n end\n\n # Print the categories...\n items.each do |key, values|\n key = key.empty? ? '-none-' : key\n\n if target == 'packaged_file'\n out_file << \"=== [#{key}]\\n\"\n elsif target == 'website'\n out_file << \"h3. [#{key}]\\n\"\n end\n out_file << \"\\n\"\n (c_cnt += 1) unless key == '-none-'\n\n # ...and their associated issues\n values.each do |val|\n out_file << \"* #{val['tracker']} ##{val['id']}: #{val['subject']}\\n\"\n key == '-none-' ? (nc_i_cnt += 1) : (i_cnt += 1)\n end\n out_file << \"\\n\"\n end\n\n summary(v_name, target, i_cnt, nc_i_cnt, no_of_issues, c_cnt)\n\n out_file.close\n end", "def solution_correct?\n current = params[:solution].strip\n current.gsub!(/\\/\\*[\\w\\s]*\\*\\//,\"\") \n current.gsub!(/--.*\\n/,\"\")\n existing = format_str(@lesson.solution.strip)\n current = format_str(current.strip)\n if existing == current\n return true\n else\n existing_arr = existing.split\n current_arr = current.split\n len= existing_arr.length\n err =[]\n j=0 \n for i in 0..len\n if existing_arr[i]!=current_arr[i]\n err[j]= existing_arr[i]\n j=j+1 \n end\n end\n return err\n end \n end", "def pre_change_sha(node)\n branch = node['delivery']['change']['pipeline']\n\n if node['delivery']['change']['stage'] == 'verify'\n shell_out(\n \"git rev-parse origin/#{branch}\",\n cwd: repo_path(node)\n ).stdout.strip\n else\n # This command looks in the git history for the last two merges to our\n # pipeline branch. The most recent will be our SHA so the second to last\n # will be the SHA we are looking for.\n command = \"git log origin/#{branch} --merges --pretty=\\\"%H\\\" -n2 | tail -n1\"\n shell_out(command, cwd: repo_path(node)).stdout.strip\n end\n end", "def dump_code( type_switch = 1 )\n wf_name = label.downcase.gsub(/ /,'_')\n puts\n puts \"Code Snippets for #{ label }:\"\n puts\n puts \"Number of tasks: #{ @task_list.count }\"\n puts \"Number of flows: #{ @flow_list.count }\"\n puts \"Number of states: #{ @status_list.count }\"\n puts\n puts \"List of Task Labels (I18n format):\"\n puts \n puts \" workflow:\"\n puts \" w00:\"\n puts \" label:\\t'#{ label }'\"\n puts \" tasks:\"\n @task_list.each_with_index do |t,i|\n next if t.nil?\n puts \" #{ sprintf('t%02d',i)}:\\t'#{ t.label }#{ ' <obsolete>' if t.obsolete }'\"\n end\n puts \" states:\"\n obsolete_marker = Array.new( status_list.count, false )\n @flow_list.each{ |f| obsolete_marker[ f.status_id ] |= f.obsolete }\n @status_list.each_with_index do |l,i|\n puts \" #{ sprintf('s%02d',i )}:\\t'#{ status_list[ i ]}#{ ' <obsolete>' if obsolete_marker[ i ] }'\"\n end\n puts\n puts \"Transition Structure:\"\n puts\n printf \"@#{ wf_name } = WorkFlowHelper.new([\"\n\n case type_switch\n when 0\n sep = \"\\n\"\n @task_list.each do |t|\n flows = t.outflows.collect{ |f| f.id }.join(',')\n tasks = t.outflows.collect{ |f| f.target_task_id }.join(',')\n printf \"%s [[%s],[%s]]\", sep, flows, tasks\n sep = \",\\n\"\n end\n when 1\n sep = \"\\n\"\n flow_tasks = ''\n @task_list[0...-1].each do |t|\n next if t.nil?\n flow_tasks = t.outflows.collect{ |f| \"[ %d, %d ]\" % [ f.status_id, f.target_task_id ]}.join(',')\n printf \"%s [%s]\", sep, flow_tasks\n sep = \",\\n\"\n end\n printf \"%s [[ -1, %d ]]\\n\", sep, @task_list.length - 1\n end\n\n puts \"])\"\n puts\n\n # list all roles with tasks for which they are responsible\n\n puts 'Responsibilities:'\n puts\n @role_list.each_with_index do |r,i|\n s = sprintf \"%-20s\", @role_list[ i ]\n sep = ''\n @task_list[0...-1].each_with_index do |t,j|\n next if t.nil?\n if t.role_id == i then\n s += sep + j.to_s\n sep = ','\n end\n end\n puts s\n end\n puts\n\n # better warn the user if there were any validation errors ...\n\n if @validation_errors > 0 then\n puts \">>> Errors detected during validation - check full report above. <<<\"\n puts\n end\n\n end", "def upa_steps=(_arg0); end", "def step1_1_team_analysis_commit\n# DEBUG\n logger.debug( \"\\r\\n\\r\\n!! ------ #{self.class.name} - team_analysis_commit -----\" )\n logger.debug( \"> #{params.inspect}\" )\n # [Steve, 20161001] We need to whitelist all parameters, since we are using this as Admins\n params.permit!()\n overridden_alias_actions = {}\n confirmed_actions_ids = []\n data_import_session_id = 0\n must_go_back_on_commit = false\n is_ok = true\n # Parse parameters:\n params.each do |key, value|\n data_import_session_id = value.to_i if ( key.to_sym == :data_import_session_id)\n if ( key.to_s =~ /id_/i )\n confirmed_actions_ids << ( key.to_s.split('id_')[1] ).to_i\n end\n must_go_back_on_commit = value.to_i > 0 if ( key.to_sym == :must_go_back)\n end\n force_missing_meeting_creation = (params[:force_meeting_creation] == 'true') ||\n (params[:force_meeting_creation].to_i > 0)\n force_team_or_swimmer_creation = (params[:force_team_or_swimmer_creation] == 'true') ||\n (params[:force_team_or_swimmer_creation].to_i > 0)\n\n # [Steve] The following override hash has the structure:\n #\n # params[:alias_ids] => {\n # analysis_result.id.to_s => overridden_alias_team_id.to_s,\n # #...\n # }\n overridden_alias_actions = params['alias_ids'] if params['alias_ids'].present?\n# DEBUG\n# logger.debug \"\\r\\ndata_import_session_id: #{data_import_session_id}\"\n logger.debug \"Confirmed IDs: #{confirmed_actions_ids.inspect}\"\n logger.debug \"Overridden Alias IDs: #{overridden_alias_actions.inspect}\\r\\n- params['alias_ids']: #{params['alias_ids'].class.name}\\r\\n- params['alias_ids']: #{params['alias_ids'].inspect}\"\n data_import_session = DataImportSession.find( data_import_session_id )\n importer = DataImporter.new( current_admin.id, data_import_session, flash )\n result_processor = TeamAnalysisResultProcessor.new( data_import_session, flash )\n # retrieve results from dedicated table:\n all_results = DataImportTeamAnalysisResult.where( data_import_session_id: data_import_session_id )\n\n # For each confirmed result, execute the suggested actions (either the team\n # alias is confirmed, or a new Team w/ affiliation must be created from scratch):\n all_results.each do |analysis_result|\n is_confirmed = confirmed_actions_ids.include?( analysis_result.id )\n alias_override_id = overridden_alias_actions.has_key?( analysis_result.id.to_s ) ?\n overridden_alias_actions[ analysis_result.id.to_s ].to_i :\n nil\n # Execute the suggested actions:\n is_ok = result_processor.run(\n analysis_result,\n is_confirmed,\n alias_override_id\n )\n end\n\n# FIXME NOT USED ANYMORE:\n# importer.set_analysis_logs(\n# result_processor.process_log,\n# result_processor.sql_diff_text_log\n# )\n # Write the DB-diff to file anyway:\n result_processor.save_diff_file( data_import_session )\n# FIXME NOT USED ANYMORE:\n# importer.write_analysis_logfile( is_ok )\n# importer.write_sql_diff_logfile\n# DEBUG\n# logger.debug(\"\\r\\n- is_ok: #{is_ok}, data_import_session_id: #{data_import_session_id}\")\n # Redirect to next action accordingly:\n if is_ok\n flash[:info] = I18n.t('admin_import.team_analysis_completed')\n if must_go_back_on_commit # Since we are aborting full-data import, we need to clean up the broken session:\n importer.destroy_data_import_session\n else # Clear just the results from the session if everything is ok:\n # The Log has become too long & complex to be saved into the table!\n\n # [Steve, 20141111] We cannot save the log on table: the UPDATE statement will take\n # a progressively longer time to complete, slowing the process considerably\n # and eventually make the statement execution fail with MySQL disconnection error.\n # A more quick, professional and permanent solution to obtain the logging serialized\n # on DB it would be to add a separate table entity with a row for each single log\n # event.\n # As it is, the only viable solution is to keep the logging only on file.\n\n # Quick hack: disregard any update to the log members and keep them just\n # as variables:\n# FIXME NOT USED ANYMORE:\n# data_import_session.phase_1_log_will_change!\n# data_import_session.phase_1_log << result_processor.process_log\n# data_import_session.sql_diff_will_change!\n# data_import_session.sql_diff << result_processor.sql_diff_text_log\n\n data_import_session.phase = 11 # Update \"last completed phase\" indicator in session (11 = 1.1)\n data_import_session.save!\n DataImportTeamAnalysisResult.where( data_import_session_id: data_import_session_id ).delete_all\n # Go directly to Swimmer name analysis results, if possible:\n if data_import_session.data_import_swimmer_analysis_results.any?\n flash[:info] = I18n.t( 'admin_import.swimmer_analysis_needed' )\n redirect_to(\n di_step1_1_swimmer_analysis_path(\n id: importer.data_import_session.id,\n force_meeting_creation: force_missing_meeting_creation ? '1' : nil\n )\n ) and return\n else\n redirect_to(\n di_step2_checkout_get_path(\n id: data_import_session_id,\n force_meeting_creation: force_missing_meeting_creation ? '1' : '0',\n force_team_or_swimmer_creation: '1' # After the Team analysis, we can serialize the missing teams (WAS: force_team_or_swimmer_creation ? '1' : '0' )\n )\n ) and return\n end\n end\n else\n redirect_to( di_step1_status_path() ) and return\n end\n end", "def prescription_1\n\tputs \"*** Prescription 1 ***\"\n\tputs \"Use the TDD process to create and adjust your code's design in small, incremental steps.\\n\\n\"\nend", "def solve\n @second > @first ? right_hand_solve : left_hand_solve\n if @path.length > 10\n \"#{@path[0..3]}, ... #{@path[-3..-1]} steps: #{@path.length}\"\n else\n @path\n end\n end", "def run_tests()\n check_solution(1, [1, 3, 5, 4], [5])\n check_solution(2, [4, 2, 3, 6, 10], [4, 10])\n check_solution(3, [4, 2, 11, 6, 10], [4, 11, 10])\nend", "def main()\n rules = { # a/bc/bcd/bcdd/bcda/bcdbc/bcbc/cbc/aa/\n 'abcd' => [''],\n 'a' => ['bc'],\n 'bc' => ['bcd', 'c'],\n 'd' => ['a', 'db'],\n 'db' => ['b'],\n 'cbc' => ['ab'],\n '...' => ['a']\n }\n rows= [\n 'bd',\n ]\n moves = 10\n width = 7\n solver = Solver.new(rules, moves, width)\n game_data = GameState.new(rules, rows[0], width)\n solution = solver.find_solution(game_data)\n\n if !solution.nil?\n solution.each do |move|\n puts(move.to_s)\n end\n else\n puts 'No solution found'\n end\nend", "def print_slew_steps_rev(io, run, rev)\n\n\n io.puts \"<h3>Slewing Correction</h3>\"\n io.puts \"<div style=\\\"text-align: center;\\\">\"\n\n\n io.puts \"<table>\"\n io.puts \" <tr>\"\n io.puts \" <td></td>\"\n (1..$pad).each { |p|\n \tio.puts \"<td>pad\\##{p}</td>\"\n }\n io.puts \" </tr>\"\n (1..rev).each { |r|\n\tio.puts \" <tr>\"\n\tio.puts \" <td>step #{r}</td>\"\n \t(1..$pad).each { |p|\n \t\tm = (r-1) % $mod + 1\n \tio.puts \" <td>\" + link_fig(\"dT#{$mod}vsToT_m#{m}_p#{p}_rev#{r}\") + \"</td>\"\n \t}\n \tio.puts \" </tr>\" \n }\n io.puts \"</table>\" \n io.puts \"</div>\"\n\nend", "def hailstone1(num)\n count = 0\n\n if num == 1\n print \"#{num} \"\n num = (num * 3) + 1\n count += 1\n end\n\n print \"#{num} \"\n\n hailoop(num, count)\n\n puts\n puts \"HAILSTONE 1 - Number of steps: #{count}\"\nend", "def test_steps; end", "def test_steps; end", "def solution(x, b)\n puts x\nputs b\nend", "def solve\n end", "def input\n lines = File.new('day12_input.txt').readlines()\n initial_state = lines[0].match('initial state:\\s*([^\\n]*)')[1]\n .chars\n .each_with_index\n .map { |x, i| [i, x] }\n rules = lines[2...lines.length].map { |item|\n item.strip.split(\" => \")\n }\n return initial_state, rules\nend", "def getNumberOfChangedFilesAndChangedLines (projectName, localClone, pathInput, pathOutput)\n\t prefixProjectName = formatProjectName(projectName)\n\t\tfilesList = []\n\t\tdataList = []\n\t\tcountTemp = 0\n\t\t#_ParentsFiles\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitList.csv\", 'r') do |fileMerges| \n\t\t\twhile line = fileMerges.gets \n\t\t\t\tfileMerges.each_line do |line|\n\t\t\t\t\tcamposMerge = line.split(\",\")\n\t\t\t\t\tFile.open(localClone+pathInput+prefixProjectName+\"_MergeScenarioList.csv\", 'r') do |fileTEMP|\n\t\t\t\t\t\twhile lineTEMP = fileTEMP.gets \n\t\t\t\t\t\t\tfileTEMP.each_line do |lineTEMP|\n\t\t\t\t\t\t\t\tcamposParents = lineTEMP.split(\",\")\n\t\t\t\t\t\t\t\tif (camposMerge[0].eql? camposParents[0])\n\t\t\t\t\t\t\t\t\tdata = camposMerge[0].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposMerge[1].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposMerge[10].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposMerge[11].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposParents[4].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")+\",\"+camposParents[6].gsub(\"\\\"\", \"\").gsub(\"\\n\",\"\")\n\t\t\t\t\t\t\t\t\tdataList.push(data)\n\t\t\t\t\t\t\t\t\tcountTemp +=1\n\t\t\t\t\t\t\t end\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitListAndFilesList.csv\", 'w') do |file|\n\t\t\tfile.puts \"mergeCommitID, isConflicting, listLeftCommits, listRightCommits, leftFiles, rightFiles\"\n\t\t\tdataList.each do |dado|\n\t\t\t\tfile.puts \"#{dado}\"\n\t\t\tend\n\t\tend\n\t\t\n\t\tprojectsList = []\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitListAndFilesList.csv\", 'r') do |f1| \n\t\t\twhile line = f1.gets \n\t\t\t\tf1.each_line do |line|\n\t\t\t\t\tcampos = line.split(\",\")#.length\t\n\t\t\t\t\tmergeCommitID = campos[0].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tisConflicting = campos[1].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tleftCommits = campos[2].split(\"@@\")\n\t\t\t\t\trightCommits = campos[3].split(\"@@\")\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tleftFiles = campos[4][1..campos[4].length-2].split(\"@\")\t\t\t\t\n\t\t\t\t\tif !campos[5].include?(\"\\n\")\n\t\t\t\t\t\trightFiles = campos[5][1..campos[5].length-2].split(\"@\")\n\t\t\t\t\telse\n\t\t\t\t\t\trightFiles = campos[5][1..campos[5].length-3].split(\"@\")\n\t\t\t\t\tend\t\n\n\t\t\t\t\t#leftFiles=[]\n\t\t\t\t\tcountLeftLines =0\n\t\t\t\t\tcountRightLines=0\n\t\t\t\t\t#rightFiles\n\t\t\t\t\tarithmeticMeanChangedFiles = 0 \n\t\t\t\t\tgeometricMeanChangedFiles = 0\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif leftCommits.include?(\"\\n\")\n\t\t\t\t\t\tleftCommits.delete(\"\\n\")\n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\t\tif rightCommits.include?(\"\\n\")\n\t\t\t\t\t\trightCommits.delete(\"\\n\")\n\t\t\t\t\tend\n\t\t\t\n\t\t\t\t\tleftCommits.each do |commit|\n\t\t\t\t\t\tdata = %x(git --no-pager log -1 --stat #{commit}) \n\t\t\t\t\t\tlistInfo = data.split(\"\\n\")\n\t\t\t\t\t\tleftFiles.each do |f|\n\t\t\t\t\t\t\tlistInfo.each do |item|\n\t\t\t\t\t\t\t\tif item.include?(f+\" \") and item.include?(\"|\") and (!f.include?(\".bmp\") and !f.include?(\".dib\") and !f.include?(\".jpg\") and !f.include?(\".jpeg\") and !f.include?(\".jpe\") and !f.include?(\".jfif\") and !f.include?(\".gif\") and !f.include?(\".tif\") and !f.include?(\".tiff\") and !f.include?(\".png\") and !f.strip.eql?(\"Gemfile.lock\"))\n\t\t\t\t\t\t\t\t\ttmpItem = item.split(\"|\")\n\t\t\t\t\t\t\t\t\tcountLeftLines += tmpItem[1][/\\d+/].to_i\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\trightCommits.each do |commit|\n\t\t\t\t\t\tdata = %x(git --no-pager log -1 --stat #{commit}) \n\t\t\t\t\t\tlistInfo = data.split(\"\\n\")\n\t\t\t\t\t\t\n\t\t\t\t\t\trightFiles.each do |f|\n\t\t\t\t\t\t\tlistInfo.each do |item|\n\t\t\t\t\t\t\t\tif item.include?(f+\" \") and item.include?(\"|\") and (!f.include?(\".bmp\") and !f.include?(\".dib\") and !f.include?(\".jpg\") and !f.include?(\".jpeg\") and !f.include?(\".jpe\") and !f.include?(\".jfif\") and !f.include?(\".gif\") and !f.include?(\".tif\") and !f.include?(\".tiff\") and !f.include?(\".png\") and !f.strip.eql?(\"Gemfile.lock\"))\n\t\t\t\t\t\t\t\t\ttmpItem = item.split(\"|\")\n\t\t\t\t\t\t\t\t\tcountRightLines += tmpItem[1][/\\d+/].to_i\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tif (countLeftLines == 0)\n\t\t\t\t\t\tcountLeftLines = 1\n\t\t\t\t\tend\n\t\t\t\t\tif (countRightLines == 0)\n\t\t\t\t\t\tcountRightLines = 1\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tarithmeticMeanChangedLines = (Float(countLeftLines + countRightLines)/2).round(2)\n\t\t\t\t\tgeometricMeanChangedLines = Math.sqrt(Float(countLeftLines*countRightLines)).round(2)\n\t\t\t\t\tdados = mergeCommitID+\",\"+isConflicting+\",\"+\"#{countLeftLines}\"+\",\"+\"#{countRightLines}\"+\",\"+\"#{arithmeticMeanChangedLines}\"+\",\"+\"#{geometricMeanChangedLines}\"\n\t\t\t\t\tprojectsList.push(dados.gsub(\"\\\"\", \"\"))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_NumberOfChangedLines.csv\", 'w') do |file|\n\t\t\tfile.puts \"mergeCommitID, isConflicting, countLeftLines, countRightLines, arithmeticMeanChangedLines, geometricMeanChangedLines\"\n\t\t\tprojectsList.each do |dado|\n\t\t\t\tfile.puts \"#{dado}\"\n\t\t\tend\n\t\tend\n\n\n\t\tprojectsList = []\n\t\tprojectsFilesList = []\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitListAndFilesList.csv\", 'r') do |f1| \n\t\t\twhile line = f1.gets \n\t\t\t\tf1.each_line do |line|\n\t\t\t\t\tcampos = line.split(\",\")#.length\t\n\t\t\t\t\tmergeCommitID = campos[0].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tisConflicting = campos[1].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tleftFiles = campos[4].split(\"@\")\t\n\t\t\t\t\trightFiles = campos[5].split(\"@\")\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tcountLeftFiles = leftFiles.length\n\t\t\t\t\tcountRightFiles = rightFiles.length\n\t\t\t\t\t\n\t\t\t\t\tarithmeticMeanChangedFiles = 0 \n\t\t\t\t\tgeometricMeanChangedFiles = 0\t\t\t\t\n\t\t\t\t\t\n\n\t\t\t\t\tarithmeticMeanChangedFiles = (Float(countLeftFiles + countRightFiles)/2).round(2)\n\t\t\t\t\tgeometricMeanChangedFiles = Math.sqrt(Float(countLeftFiles*countRightFiles)).round(2)\n\t\t\t\t\tdados = mergeCommitID+\",\"+isConflicting+\",\"+\"#{countLeftFiles}\"+\",\"+\"#{countRightFiles}\"+\",\"+\"#{arithmeticMeanChangedFiles}\"+\",\"+\"#{geometricMeanChangedFiles}\"\n\t\t\t\t\tprojectsFilesList.push(dados.gsub(\"\\\"\", \"\"))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_NumberOfChangedFiles.csv\", 'w') do |file|\n\t\t\tfile.puts \"mergeCommitID, isConflicting, countLeftFiles, countRightFiles, arithmeticMeanChangedFiles, geometricMeanChangedFiles\"\n\t\t\tprojectsFilesList.each do |dado|\n\t\t\t\tfile.puts \"#{dado}\"\n\t\t\tend\n\t\tend\n\t\tputs \"end running getNumberOfChangedFilesAndChangedLines from #{prefixProjectName} project\"\n\tend", "def act(base, relative)\n project = getProjectFromPath(base)\n\n # Create new repo and read last commit\n repo = Grit::Repo.new(File.join(@@repo_folder, project))\n puts \"#{repo.commits.first.author.name} <#{repo.commits.first.author.email}> in #{project}: #{repo.commits.first.message}\"\n\n# repo.commits.each do |commit|\n# puts \"#{commit.author.email}: #{commit.message}\"\n# commit.tree.contents.each do |entry|\n# puts \"-#{entry.name}\"\n# end\n# end\nend", "def phase_one\n\t#Intro\n\n\t\[email protected] do |tribe|\n\t\tputs \"Welcome #{tribe}\".green\n\t\tend\n\nprint_header(\"For Phase 1, you will now compete in 8 challenges for immunity. Good luck!\")\n\n\t8.times do\n\t\timmunity_challenge_losing_tribe = @borneo.immunity_challenge\n\t\tputs \"#{immunity_challenge_losing_tribe}\".green + \" has lost the immunity challenge and must now vote out 1 member.\"\n\t\tmember_voted_off = immunity_challenge_losing_tribe.tribal_council\n\tend\t\nend", "def step1_1_swimmer_analysis_commit\n# DEBUG\n logger.debug( \"\\r\\n\\r\\n!! ------ #{self.class.name} - swimmer_analysis_commit -----\" )\n logger.debug( \"> #{params.inspect}\" )\n # [Steve, 20161001] We need to whitelist all parameters, since we are using this as Admins\n params.permit!()\n overridden_alias_actions = {}\n confirmed_actions_ids = []\n data_import_session_id = 0\n must_go_back_on_commit = false\n is_ok = true\n # Parse parameters:\n params.each do |key, value|\n data_import_session_id = value.to_i if ( key.to_sym == :data_import_session_id)\n if ( key.to_s =~ /id_/i )\n confirmed_actions_ids << ( key.to_s.split('id_')[1] ).to_i\n end\n must_go_back_on_commit = value.to_i > 0 if ( key.to_sym == :must_go_back)\n end\n force_missing_meeting_creation = (params[:force_meeting_creation] == 'true') ||\n (params[:force_meeting_creation].to_i > 0)\n force_team_or_swimmer_creation = (params[:force_team_or_swimmer_creation] == 'true') ||\n (params[:force_team_or_swimmer_creation].to_i > 0)\n\n # [Steve] The following override hash has the structure:\n #\n # params[:alias_ids] => {\n # analysis_result.id.to_s => overridden_alias_team_id.to_s,\n # #...\n # }\n overridden_alias_actions = params['alias_ids'] if params['alias_ids'].present?\n# DEBUG\n# logger.debug \"\\r\\ndata_import_session_id: #{data_import_session_id}\"\n# logger.debug \"Confirmed IDs: #{confirmed_actions_ids.inspect}\"\n# logger.debug \"Overridden Alias IDs: #{overridden_alias_actions.inspect}\\r\\n- params['alias_ids']: #{params['alias_ids'].class.name}\\r\\n- params['alias_ids']: #{params['alias_ids'].inspect}\"\n data_import_session = DataImportSession.find( data_import_session_id )\n importer = DataImporter.new( current_admin.id, data_import_session, flash )\n result_processor = SwimmerAnalysisResultProcessor.new( data_import_session, flash )\n # retrieve results from dedicated table:\n all_results = DataImportSwimmerAnalysisResult.where( data_import_session_id: data_import_session_id )\n\n # For each confirmed result, execute the suggested actions (either the team\n # alias is confirmed, or a new Team w/ affiliation must be created from scratch):\n all_results.each do |analysis_result|\n is_confirmed = confirmed_actions_ids.include?( analysis_result.id )\n alias_override_id = overridden_alias_actions.has_key?( analysis_result.id.to_s ) ?\n overridden_alias_actions[ analysis_result.id.to_s ].to_i :\n nil\n # Execute the suggested actions:\n is_ok = result_processor.run(\n analysis_result,\n is_confirmed,\n alias_override_id\n )\n end\n\n# FIXME NOT USED ANYMORE:\n# importer.set_analysis_logs(\n# result_processor.process_log,\n# result_processor.sql_diff_text_log\n# )\n # Write the DB-diff to file anyway:\n result_processor.save_diff_file( data_import_session )\n# FIXME NOT USED ANYMORE:\n# importer.write_analysis_logfile( is_ok )\n# importer.write_sql_diff_logfile\n# DEBUG\n# logger.debug(\"\\r\\n- is_ok: #{is_ok}, data_import_session_id: #{data_import_session_id}\")\n # Redirect to next action accordingly:\n if is_ok\n flash[:info] = I18n.t('admin_import.swimmer_analysis_completed')\n if must_go_back_on_commit # Since we are aborting full-data import, we need to clean up the broken session:\n importer.destroy_data_import_session\n else # Clear just the results from the session if everything is ok:\n # The Log has become too long & complex to be saved into the table!\n\n # [Steve, 20141111] We cannot save the log on table: the UPDATE statement will take\n # a progressively longer time to complete, slowing the process considerably\n # and eventually make the statement execution fail with MySQL disconnection error.\n # A more quick, professional and permanent solution to obtain the logging serialized\n # on DB it would be to add a separate table entity with a row for each single log\n # event.\n # As it is, the only viable solution is to keep the logging only on file.\n\n # Quick hack: disregard any update to the log members and keep them just\n # as variables:\n# data_import_session.phase_1_log_will_change!\n# FIXME NOT USED ANYMORE:\n# data_import_session.phase_1_log << result_processor.process_log\n# data_import_session.sql_diff_will_change!\n# data_import_session.sql_diff << result_processor.sql_diff_text_log\n\n data_import_session.phase = 11 # Update \"last completed phase\" indicator in session (11 = 1.1)\n data_import_session.save!\n DataImportSwimmerAnalysisResult.where( data_import_session_id: data_import_session_id ).delete_all\n redirect_to(\n di_step2_checkout_get_path(\n id: data_import_session_id,\n force_meeting_creation: force_missing_meeting_creation ? '1' : '0',\n force_team_or_swimmer_creation: '1' # After all the analysis phases, we can serialize any missing team (WAS: force_team_or_swimmer_creation ? '1' : '0' )\n )\n ) and return\n end\n else\n redirect_to( di_step1_status_path() ) and return\n end\n end", "def incrementStep\r\n if @openstudio_2\r\n super\r\n else\r\n # compute result\r\n current_result = result\r\n\r\n @workflow.incrementStep\r\n end\r\n end", "def last_done_exercise_of_greater_difficulty\n i = self.user_sequence.size() - 1\n while(!self.user_sequence[i][2]) do\n i = i - 1\n end\n return self.user_sequence[i][0]\n end", "def last_exercise_correctly_done_before(index)\n index -= 1\n while index >= 0 && !self.user_sequence[index][3] do\n index -= 1\n end\n if index >= 0\n return self.user_sequence[index][0]\n else\n return nil\n end\n end", "def steps\n %w[\n household_member_demographics_step\n household_member_address_step\n household_member_address_search_results_step\n household_member_citizenship_step\n household_member_education_step\n household_member_employments_step\n household_member_assessment_employment_step\n household_member_incomes_step\n household_member_unearned_incomes_step\n household_member_expenses_step\n household_member_resources_step\n household_member_relations_step\n ]\n end", "def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}, &block)\r\n logger.debug \"<cvs> revisions path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}\"\r\n \r\n path_with_project=\"#{url}#{with_leading_slash(path)}\"\r\n cmd = \"#{CVS_BIN} -d #{root_url} rlog\"\r\n cmd << \" -d\\\">#{time_to_cvstime(identifier_from)}\\\"\" if identifier_from\r\n cmd << \" #{shell_quote path_with_project}\"\r\n shellout(cmd) do |io|\r\n state=\"entry_start\"\r\n \r\n commit_log=String.new\r\n revision=nil\r\n date=nil\r\n author=nil\r\n entry_path=nil\r\n entry_name=nil\r\n file_state=nil\r\n branch_map=nil\r\n \r\n io.each_line() do |line| \r\n \r\n if state!=\"revision\" && /^#{ENDLOG}/ =~ line\r\n commit_log=String.new\r\n revision=nil\r\n state=\"entry_start\"\r\n end\r\n \r\n if state==\"entry_start\"\r\n branch_map=Hash.new\r\n if /^RCS file: #{Regexp.escape(root_url_path)}\\/#{Regexp.escape(path_with_project)}(.+),v$/ =~ line\r\n entry_path = normalize_cvs_path($1)\r\n entry_name = normalize_path(File.basename($1))\r\n logger.debug(\"Path #{entry_path} <=> Name #{entry_name}\")\r\n elsif /^head: (.+)$/ =~ line\r\n entry_headRev = $1 #unless entry.nil?\r\n elsif /^symbolic names:/ =~ line\r\n state=\"symbolic\" #unless entry.nil?\r\n elsif /^#{STARTLOG}/ =~ line\r\n commit_log=String.new\r\n state=\"revision\"\r\n end \r\n next\r\n elsif state==\"symbolic\"\r\n if /^(.*):\\s(.*)/ =~ (line.strip) \r\n branch_map[$1]=$2\r\n else\r\n state=\"tags\"\r\n next\r\n end \r\n elsif state==\"tags\"\r\n if /^#{STARTLOG}/ =~ line\r\n commit_log = \"\"\r\n state=\"revision\"\r\n elsif /^#{ENDLOG}/ =~ line\r\n state=\"head\"\r\n end\r\n next\r\n elsif state==\"revision\"\r\n if /^#{ENDLOG}/ =~ line || /^#{STARTLOG}/ =~ line \r\n if revision\r\n \r\n revHelper=CvsRevisionHelper.new(revision)\r\n revBranch=\"HEAD\"\r\n \r\n branch_map.each() do |branch_name,branch_point|\r\n if revHelper.is_in_branch_with_symbol(branch_point)\r\n revBranch=branch_name\r\n end\r\n end\r\n \r\n logger.debug(\"********** YIELD Revision #{revision}::#{revBranch}\")\r\n \r\n yield Revision.new({ \r\n :time => date,\r\n :author => author,\r\n :message=>commit_log.chomp,\r\n :paths => [{\r\n :revision => revision,\r\n :branch=> revBranch,\r\n :path=>entry_path,\r\n :name=>entry_name,\r\n :kind=>'file',\r\n :action=>file_state\r\n }]\r\n }) \r\n end\r\n \r\n commit_log=String.new\r\n revision=nil\r\n \r\n if /^#{ENDLOG}/ =~ line\r\n state=\"entry_start\"\r\n end\r\n next\r\n end\r\n \r\n if /^branches: (.+)$/ =~ line\r\n #TODO: version.branch = $1\r\n elsif /^revision (\\d+(?:\\.\\d+)+).*$/ =~ line\r\n revision = $1 \r\n elsif /^date:\\s+(\\d+.\\d+.\\d+\\s+\\d+:\\d+:\\d+)/ =~ line\r\n date = Time.parse($1)\r\n author = /author: ([^;]+)/.match(line)[1]\r\n file_state = /state: ([^;]+)/.match(line)[1]\r\n #TODO: linechanges only available in CVS.... maybe a feature our SVN implementation. i'm sure, they are\r\n # useful for stats or something else\r\n # linechanges =/lines: \\+(\\d+) -(\\d+)/.match(line)\r\n # unless linechanges.nil?\r\n # version.line_plus = linechanges[1]\r\n # version.line_minus = linechanges[2]\r\n # else\r\n # version.line_plus = 0\r\n # version.line_minus = 0 \r\n # end \r\n else \r\n commit_log << line unless line =~ /^\\*\\*\\* empty log message \\*\\*\\*/\r\n end \r\n end \r\n end\r\n end\r\n end", "def solutions(args)\n book = require_arg(args,'book')\n hw = get_hw_from_file_or_die(require_arg(args,'in_file'))\n sets = hw_to_sets(hw,book)\n stream_labels = assign_starts_of_streams_to_sets(sets,hw)\n out_file = require_arg(args,'out_file')\n class_title = require_arg(args,'class_title')\n sets = require_arg(args,'sets')\n gb_file = require_arg(args,'gb_file')\n sample = (args.has_key?('sample') && args['sample'].to_i==1)\n roster = get_roster_from_opengrade(gb_file) # roster[\"blow_joe\"]={last, first, class, id_string, and id_int}\n solution_in_book = {} # [label]=boolean\n sources_parent_dir = File.expand_path(require_arg(args,'sources_parent_dir'))\n subdir_list = []\n Dir.chdir(sources_parent_dir) do # do block so we chdir back afterward\n subdir_list=Dir[\"*\"].reject{|o| not File.directory?(o)}.sort\n end\n probs = {}\n n_hw_defined=0\n header = true\n students_encountered = {}\n problem_labels_encountered = []\n File.readlines(sets).each { |line|\n if header then\n header = false\n else\n # set,book,ch,num,parts,flags,chunk,student\n unless line=~/(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*)/ then fatal_error(\"illegal line in #{sets}: #{line}\") end\n hw,ch,num,student = [$1.to_i,$3.to_i,$4,$8] # no to_i on num, could be \"g7\"\n if hw>n_hw_defined then n_hw_defined=hw end\n students_encountered[student] = true\n if probs[student].nil? then probs[student] = {} end\n if probs[student][hw].nil? then probs[student][hw] = [] end\n l = $num_to_label[[ch,num]]\n if l.nil? then fatal_error(\"no label found for ch. #{ch}, problem #{num}\") end\n problem_labels_encountered.push(l)\n probs[student][hw].push(l)\n end\n }\n students_encountered.keys.each { |k|\n unless roster.has_key?(k) then fatal_error(\"student #{k} occurs in #{sets}, but not in #{gb_file}\") end\n }\n roster.keys.each { |k|\n unless students_encountered.has_key?(k) then fatal_error(\"student #{k} occurs in #{gb_file}, but not in #{sets}\") end\n }\n label_to_source_file = {}\n problem_labels_encountered.each { |l|\n p = $label_to_num[l]\n solution_in_book[l] = $has_solution[p]\n subdir_list.each { |d|\n t = sources_parent_dir+\"/\"+d+\"/\"+l+\".tex\"\n if File.exists?(t) then label_to_source_file[l] = t; next end\n }\n if !solution_in_book[l] && label_to_source_file[l].nil? then $stderr.print \"warning: no solution found for #{l} in any subdirectory of #{sources_parent_dir}\\n\" end\n }\n head = <<-\"HEAD\"\n \\\\documentclass{simplesolns}\n \\\\begin{document}\n {\\\\Huge\\\\textbf{Solutions for #{class_title}}}\\\\\\\\\\n\n HEAD\n tail = <<-'TAIL'\n \\end{document}\n TAIL\n toc = ''\n tex = ''\n 1.upto(n_hw_defined) { |hw|\n toc = toc + \"\\\\noindent Homework #{hw} ... \\\\pageref{set#{hw}}\\\\\\\\\\n\"\n first_student = true\n roster.keys.sort.each { |student|\n label_for_toc = ''\n if sample && !first_student then break end\n if first_student then label_for_toc = \"\\\\label{set#{hw}}\" end\n tex = tex + <<-\"TEX\"\n\n \\\\pagebreak\n\n \\\\noindent%\n {\\\\large\\\\textbf{Solutions to Homework #{hw}, #{class_title},\n #{roster[student][\"first\"]} #{roster[student][\"last\"]} }}#{label_for_toc}\\\\\\\\\\n\n TEX\n first_student = false\n probs[student][hw].each { |label|\n p = $label_to_num[label]\n if solution_in_book[label] then\n tex = tex+solution_helper(p,'solution in the back of the book')\n else\n source_file = label_to_source_file[label]\n missing = false\n if source_file.nil?\n missing = true\n else\n s,err = slurp_file_with_detailed_error_reporting(source_file)\n if s.nil? then \n missing=true \n $stderr.print \"warning: error reading file #{source_file}, #{err}\"\n else\n tex = tex+solution_helper(p,s)\n end\n end\n if missing then\n tex = tex+solution_helper(p,'!!!!!!!!!!! missing solution !!!!!!!!!!!!!!')\n end\n end\n }\n }\n }\n File.open(out_file,'w') { |f|\n f.print head+toc + \"\\\\pagebreak\" + tex+tail\n }\nend", "def step_two()\r\nend", "def normalize_expected_commit_data commit_data\n # Convert file string list into real array\n commit_data[:file_name] = Kappamaki.from_sentence commit_data[:file_name]\n\n # Create individual expected commits for each location provided\n Kappamaki.from_sentence(commit_data.delete(:location)).map do |location|\n branch = branch_name_for_location location, commit_data[:branch]\n commit_data.clone.merge branch: branch\n end\nend", "def phase_one\n\tputs divider\n\tputs \"Phase One\"\n\tputs divider\n\t8.times do \n\t\ttribe_immunity_challenge\n\tend\nend", "def work(toy_index, cube)\n if $debug && cube.available_heads.empty?\n puts \"\\t\" * toy_index + \"Working for piece #{toy_index} but it has no available heads; recursing.\"\n end\n\n if $debug\n puts \"\\t\" * toy_index + \"Working for piece #{toy_index} which has #{cube.available_heads.count} available heads. Cube:\"\n cube.display_in_line(toy_index)\n end\n\n cube.available_heads.each do |available_head|\n cah = C.new(available_head[:face], available_head[:row], available_head[:left])\n\n puts \"\\t\" * toy_index + \"Attempting to place piece #{toy_index} from head #{cah.to_s}\" if $debug\n\n [:vertical_up, :vertical_down, :sideways_right, :sideways_left, :long_far, :long_near].each do |orientation|\n if cube.place! piece: $toy[toy_index], orientation: orientation, c: cah\n puts \"\\t\" * toy_index + \"\\tPlaced piece #{toy_index} in orientation #{orientation}\" if $debug\n\n if cube.complete?\n $solution_counter += 1\n puts \"====================== SOLUTION #{$solution_counter} FOUND! ===========================\"\n cube.display_in_line\n else\n if toy_index <= $toy.size && !cube.available_heads.empty?\n work(toy_index + 1, cube.clone2)\n else\n puts \"\\t\" * toy_index + \"Not progressing to piece #{toy_index + 1}, no available heads.\" if $debug\n end\n end\n\n puts \"\\t\" * toy_index + \"Undo orientation #{orientation} and progressing to the next one.\" if $debug\n cube.undo!\n else\n puts \"\\t\" * toy_index + \"\\t\\tTried to place piece #{toy_index} in orientation #{orientation} but it didn't work\" if $debug\n end\n end\n puts \"\\t\" * toy_index + \"Tried all possible orientations, moving to the next available head.\" if $debug\n end\n puts \"\\t\" * toy_index + \"Tried all available heads. Recurse back from piece #{toy_index} to piece #{toy_index - 1}.\" if $debug\nend", "def challenge; end", "def getPath\n puts \"Introduce Source Code\"\n start = gets.delete!(\"\\n\")\n puts \"Introduce end Code\"\n finish = gets.delete!(\"\\n\")\n return start, finish\n end", "def task_steps_simple\n # this is a read-only display of workflow steps needed or completed\n # D - C - P - B - S\n # maybe it'll contain a id of the related item\n steps = Task.find_all_by_job_id(self).sort { |a, b| (a.order || 1) <=> (b.order || 1) } \n \n #puts steps.class\n end", "def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend", "def solve\n # 1\n generation = Generation.new(@starting_paths)\n\n # 2\n while !generation.target_reached?\n generation = generation.next\n end\n\n # 3\n message = \"Maze description : going from #{@source} to #{@target}\\n\"\n message << generation.to_s\n Renderer.result(message)\n end", "def step_name\n \"=> #{initial_vertex.name}#{final_vertex.name} \"\n end", "def create\n\n # ensure that the submitted parent_id actually exists\n if !Step.exists?(params[:step][:parent_id].to_i)\n logger.debug \"Step doesn't exist!\"\n if @project.steps.last\n params[:step][:parent_id] = @project.steps.last.id\n else\n params[:step][:parent_id] = nil\n end\n end\n\n if params[:step][:pin] && params[:step][:pin].empty?\n params[:step][:pin] = nil\n end\n\n @step = @project.steps.build(params[:step])\n authorize! :create, @step \n\n if params[:step][:position]\n @step.position = params[:step][:position]\n else\n @step.position = @numSteps\n end\n \n respond_to do |format|\n if @step.save\n\n # update corresponding collections\n @step.project.collections.each do |collection|\n collection.touch\n end\n \n # create an edit entry\n Edit.create(:user_id => current_user.id, :step_id => @step.id, :project_id => @project.id)\n\n # check whether project is published\n if @project.public? || @project.privacy.blank?\n @project.set_published(current_user.id, @project.id, @step.id)\n end\n\n @project.set_built\n\n # update the project updated_at date\n @project.touch\n\n # update the user last_updated_at date\n current_user.touch\n\n @step.update_attributes(:published_on => @step.created_at)\n\n # create a public activity for any added question\n if @step.question\n Rails.logger.debug(\"created new question\")\n @step.question.create_activity :create, owner: current_user, primary: true\n end\n\n # log the creation of a new step\n @project.delay.log\n\n format.html { \n\n # update all images with new step id\n new_step_images = @project.images.where(\"step_id = -1\")\n new_step_images.each do |image|\n image.update_attributes(:saved => true)\n image.update_attributes(:step_id => @step.id)\n end\n\n # update all videos with new step id\n new_step_videos = @project.videos.where(\"step_id = -1\")\n new_step_videos.each do |video|\n video.update_attributes(:saved=>true)\n video.update_attributes(:step_id=> @step.id)\n end\n\n # push project to village if it doesn't already exist\n if @project.village_id.blank? && current_user.from_village? && @project.public? && !access_token.blank?\n create_village_project\n elsif [email protected]_id.blank? && !access_token.blank?\n update_village_project\n end\n \n redirect_to project_steps_path(@project), :flash=>{:createdStep => @step.id}\n \n }\n \n format.json { render :json => @step }\n else\n Rails.logger.debug(@step.errors.inspect)\n format.html { render :action => \"new\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def first_not_done_exercise\n i = 0\n while(i < self.user_sequence.size() && self.user_sequence[i][2]) do\n i = i + STEP_SIZE\n end\n if i < self.user_sequence.size()\n i = i - STEP_SIZE + 1\n while(self.user_sequence[i][2]) do\n i = i + 1\n end\n return self.user_sequence[i][0]\n elsif self.user_sequence.last[2] # last exercise is done\n return nil\n else\n i = i - STEP_SIZE + 1\n while(self.user_sequence[i][2]) do\n i = i + 1\n end\n return self.user_sequence[i][0]\n end\n end", "def quarterly_committers(start_month, year=Time.now.year)\n \"git log --since='#{start_month}/1/#{year}' --until='#{start_month + 2}/31/#{year}' | git shortlog -n -s\"\nend", "def getStepCount(input1,input2,input3,input4)\n\tways = possible_moves(input1,input2,input3,input4)\n\tfound = true\n\tcount = 1\n\n\twhile found do\n\t temp = []\n\t\tways.each do |way|\n\t\t\tmoves = possible_moves(way.first,way.last,input3,input4)\n\t\t\tif moves.include?([input3,input4])\n\t\t\t\tfound = false\n\t\t\tend\n\t\t\tmoves.each {|arr| temp.push(arr) }\n\t\tend\n\t\tcount += 1\n\t\tways = temp\n\tend\n\tcount\nend", "def start_solution plan\n solutions = []\n 15.times do\n s = mutate_pairs plan, valid_solution2(false)\n solutions << s\n end\n\n #0.times do\n # s = random_solution plan\n #end\n\n 10.times do\n s = structured_solution plan\n solutions << mutate_pairs(plan, s)\n end\n sort_soluitons plan, solutions\n end", "def phase_one\n\tputs \"Phase 1\"\n\t8.times do\n\t\ttribe_lost = @borneo.immunity_challenge\n\t\tputs \"#{tribe_lost.name} lost the game for immunity.\".green\n\t\tmember_voted_out = tribe_lost.tribal_council\n\t\tputs \"The tribe has spoken! #{member_voted_out.name.capitalize} it is time to go!\".green\n\t\tputs\n\tend\nend", "def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend", "def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend", "def proof_of_stake\n title(\"Proof of Stake\")\n\n eco_scale = \"https://en.wikipedia.org/wiki/Economies_of_scale\"\n pros1 = \"Energy efficient\"\n pros2 = \"More expensive to attack for attackers\"\n pros3 = \"Not susceptible to ecnomies of scale \\n\\t (for more details about this topic click on this link:\\n\\t #{eco_scale}).\"\n\n pros = [pros1, pros2, pros3]\n\n nothing_at_stake = \"https://medium.com/coinmonks/understanding-proof-of-stake-the-nothing-at-stake-theory-1f0d71bc027\"\n cons = \"nothing-at-stake problem \\n(for more details click on this link:\\n#{nothing_at_stake})\"\n\n\n ppc = {name: \"Peercoin\", website: \"https://peercoin.net/\"}\n pivx = {name: \"Pivx\", website: \"https://pivx.org/\"}\n rdd = {name: \"Reddcoin\", website: \"https://reddcoin.com/\"}\n\n used_by = [ppc, pivx, rdd]\n\n consensus_type = \"Competitive consensus\"\n\n\n explanation = \"\"\"\n The proof of stake was created as an alternative to the proof of work (PoW),\n to tackle inherent issues in the latter. Here instead of using mining, you\n have to have some stake(coins) in the system. So, if you own 10% of the\n stake(coins), then your probability of mining next block will be 10%.\n \"\"\"\n\n further_reading = \"https://en.wikipedia.org/wiki/Proof_of_stake\"\n\n p_o_s = {\n \"pros\" => pros,\n \"cons\" => cons,\n \"used_by\" => used_by,\n \"consensus_type\" => consensus_type,\n \"explanation\" => explanation,\n \"further_reading\" => further_reading\n }\n\n choice = \"0\"\n\n while !choice.include?(\"Q\") && !choice.include?(\"q\")\n choice = consensus_features\n if choice.include?(\"1\")\n puts \"Pros:\"\n p_o_s[\"pros\"].each_with_index { |val, index| puts \"\\t#{index+1}) #{val}\" }\n\n cons = p_o_s[\"cons\"]\n puts \"Cons: #{cons}\"\n elsif choice.include?(\"2\")\n puts \"Used by:\"\n p_o_s[\"used_by\"].each_with_index do\n |valeur, index|\n puts \"#{index+1})\"\n valeur.each do\n |key, value| puts \" #{key}: #{value}\"\n end\n end\n puts \"And others.\"\n elsif choice.include?(\"3\")\n consensus_type = p_o_s[\"consensus_type\"]\n puts \"Type: #{consensus_type}\"\n elsif choice.include?(\"4\")\n explanation = p_o_s[\"explanation\"]\n puts \"Explanation: #{explanation}\"\n elsif choice.include?(\"5\")\n further_reading = p_o_s[\"further_reading\"]\n puts \"Further Reading: #{further_reading}\"\n elsif choice.include?(\"Q\") || choice.include?(\"q\")\n break\n else\n puts \"Error\"\n end\n end\n\nend", "def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend" ]
[ "0.6290672", "0.62173474", "0.5873614", "0.5618567", "0.55538255", "0.5520001", "0.5497463", "0.5491631", "0.54683095", "0.54658955", "0.53777206", "0.5376906", "0.5370618", "0.5365146", "0.5355532", "0.53511", "0.53492326", "0.53184116", "0.5295605", "0.5273225", "0.5271605", "0.5269343", "0.5268053", "0.5255256", "0.5246094", "0.5242704", "0.52313584", "0.5230263", "0.52239424", "0.5221377", "0.5187273", "0.5179351", "0.5174719", "0.51721245", "0.51719004", "0.51668257", "0.51634085", "0.5157785", "0.5154259", "0.5141748", "0.51410615", "0.5131237", "0.51185447", "0.51152205", "0.5111825", "0.51104563", "0.51099366", "0.50994027", "0.5079857", "0.5069582", "0.5063504", "0.50618094", "0.5061542", "0.50588053", "0.50523865", "0.50495166", "0.50473905", "0.5043485", "0.5041352", "0.50396764", "0.5034307", "0.50333464", "0.50328726", "0.50317717", "0.5022324", "0.5017469", "0.5014604", "0.5014604", "0.50135046", "0.5010579", "0.5008273", "0.499472", "0.4990509", "0.49900174", "0.49877793", "0.4984175", "0.49789494", "0.49766448", "0.49706405", "0.4969414", "0.49642876", "0.4955453", "0.49539068", "0.49465275", "0.49464804", "0.49457592", "0.49402088", "0.493816", "0.49378356", "0.49368826", "0.49335444", "0.49258363", "0.4921517", "0.49211806", "0.49201304", "0.49156314", "0.49124664", "0.4911654", "0.4911654", "0.49116078", "0.4909334" ]
0.0
-1
Use the array's native insert method
def insert(element) if @ary.include? element return false else @ary << element return element end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def using_insert(array, element)\n array.insert(4,element)\nend", "def using_insert(array,element)\n array.insert(4,element)\nend", "def using_insert(array, element)\n array.insert(4, element)\nend", "def using_insert(array, element)\n array.insert(4, element)\nend", "def using_insert(array, element)\n array.insert(4, element)\nend", "def using_insert(array, element)\n array.insert(4, element)\nend", "def using_insert(array, element)\n array.insert(4, element)\nend", "def using_insert(array, element)\n \n array.insert(4, element)\n \nend", "def using_insert(array, item)\n array.insert(4, item)\nend", "def using_insert(array, element)\n array.insert(4, element)\n end", "def using_insert(array, element)\n array = array.insert(4, element)\n\n \nend", "def using_insert(array,element)\n array.insert(4,element)\n end", "def using_insert (array, element)\n return array.insert(4, element)\nend", "def using_insert(arr, elem)\n arr.insert(4, elem)\nend", "def insert_(array, item, index)\n array = array.insert(index, item)\n puts array\n return array\n \nend", "def using_insert(array, i)\n array.insert(4, i)\nend", "def insert_element_at_given_index(array, index, element)\n array.insert(index, element)\nend", "def test_insert_negative_index_append\n assert_equal([\"a\",\"b\",\"c\",7,8,9], @array.insert(-1, 7, 8, 9))\n end", "def array_insert(*args)\n json_op(:array_insert, self, *path_value_args(args))\n end", "def insert(ind, *rest) end", "def insert(value, index)\n end", "def insert(buf); @a.copy(buf); end", "def insert(p0, p1) end", "def _insert(*)\n fail NotImplementedError\n end", "def insert(index,object)\n\nend", "def insert(v)\n \n end", "def call(arr, operation, *args)\n # arr = arr.dup\n raise \"[Pipetree] Unknown Insert operation #{args.inspect}\" unless Operations.include?(operation)\n\n send(\"#{operation}!\", arr, *args) # replace!(arr, Old, New)\n\n # arr\n end", "def insert(index, *args, **_arg2, &block); end", "def insert(o)\n @mut.synchronize{@array.unshift o}\n end", "def insert(index, element)\n oob_throw(index)\n if index == 0\n @array = [element] + @array[index + 1..-1]\n else\n @array = @array[0..index-1] + [element] + @array[index..-1]\n end\n end", "def index_arr_add(arr, index, element)\n # Add `element` at position `index` to the Array variable `arr` and return `arr`\n return arr.insert(index, element)\nend", "def insert(*values)\n raise NotImplementedError, NOTIMPL_MSG\n end", "def insert(value)\n # YOUR WORK HERE\n end", "def add_element_to_beginning_of_array(array, element)\n array.insert(0, element)\nend", "def insert(idx, *args)\n return self if args.__size == 0\n idx = Maglev::Type.coerce_to(idx, Fixnum, :to_int)\n idx += (size + 1) if idx < 0\n raise IndexError, \"#{idx} out of bounds\" if idx < 0\n self[idx, 0] = args\n self\n end", "def insert(data)\n if data.is_a?(Array) and data[0].is_a?(Array)\n data.each do |arraydata|\n process_and_insert(arraydata)\n end\n elsif data.is_a?(Array) and data[0].is_a?(String)\n process_and_insert(data)\n else\n raise\n end\n end", "def insert(key)\n end", "def insert(index,element)\n return nil if index < 0 || index > @size\n if element.new?\n pair = [element,element.class]\n else\n pair = [element.rod_id,element.class]\n end\n @map.keys.sort.reverse.each do |key|\n if key >= index\n value = @map.delete(key)\n @map[key+1] = value\n end\n end\n @map[index] = @added.size\n @added << pair\n #@commands << [:insert,pair]\n @size += 1\n self\n end", "def insert_id!(arr, insertable)\n arr << insertable\n insertable\nend", "def insert(value)\n #YOUR WORK HERE\n end", "def insert(indice,values,axis:nil)\n if axis\n values = self.class.asarray(values)\n nd = values.ndim\n midx = [:new]*(ndim-nd) + [true]*nd\n case indice\n when Numeric\n midx[-nd-1] = true\n midx[axis] = :new\n end\n values = values[*midx]\n else\n values = self.class.asarray(values).flatten\n end\n idx = Int64.asarray(indice)\n nidx = idx.size\n if nidx == 1\n nidx = values.shape[axis||0]\n idx = idx + Int64.new(nidx).seq\n else\n sidx = idx.sort_index\n idx[sidx] += Int64.new(nidx).seq\n end\n if axis\n bit = Bit.ones(shape[axis]+nidx)\n bit[idx] = 0\n new_shape = shape\n new_shape[axis] += nidx\n a = self.class.zeros(new_shape)\n mdidx = [true]*ndim\n mdidx[axis] = bit.where\n a[*mdidx] = self\n mdidx[axis] = idx\n a[*mdidx] = values\n else\n bit = Bit.ones(size+nidx)\n bit[idx] = 0\n a = self.class.zeros(size+nidx)\n a[bit.where] = self.flatten\n a[idx] = values\n end\n return a\n end", "def insert(index, object)\n # raises IndexOutOfBoundsException if index is out of bounds [0, @length)\n # TODO\n end", "def using_insert(list_of_programming_languages, another_language)\n list_of_programming_languages = [\"Ruby\", \"JavaScript\", \"Java\", \"C#\", \"Objective C\", \"C++\", \"PHP\"]\n another_language = \"Python\"\n new_array = list_of_programming_languages.insert(4, another_language)\nend", "def insert(item)\n\n\n\n\n end", "def insert row_ind\n row = @row_refs[row_ind]\n return if row.nil? || row.repeated?\n @row_refs.insert_after(row_ind, row.send(:insert_after))[1]\n end", "def insert(data)\n @array << data\n i = @array.size - 1\n while (i >= 0) && (data > @array[(i -1)/2])\n @array[(i -1)/2], @array[i] = @array[i], @array[(i -1)/2]\n i = parent(i)\n end\n @array\n end", "def insert(idx, row)\n order_check(row)\n super\n end", "def insert_array(column, value)\n @columns << column\n @values << Translate.escape_array(value)\n end", "def insert(elem)\n @vector.push(elem)\n \n end", "def <<(*args)\n insert(*args)\n end", "def index_arr_add(arr, index, element)\n # Add `element` at position `index` to the Array \n # variable `arr` and return `arr`\n arr.insert(index, element)\n end", "def _bulkinsert (data,first)\n @length = 0\n cur = first\n while cur\n k = data[cur]\n # FIXME: Check for `Deleted`?\n if k\n if not_deleted?(k)\n # FIXME: Doing k == Deleted or k != Deleted here fails.\n # FIXME: Combining these on one line triggers bug.\n v = data[cur + 1]\n self[k] = v\n end\n end\n cur = data[cur + 2]\n end\n nil\n end", "def insert_multiple(array, &block)\n if block\n array.each {|i| insert(block[i])}\n else\n array.each {|i| insert(i)}\n end\n end", "def insert(**opts)\n add(**opts)\n save!\n end", "def insert()\n\n end", "def insert(elem)\n @vector.push(elem)\n end", "def insertion(val, rel, recursive = T.unsafe(nil), list = T.unsafe(nil)); end", "def insert(data) \n set data, 1\n end", "def insert(data) \n set data, 1\n end", "def insert(key, value)\n index = hash(key)\n\n if array[index].nil?\n @array[index] = []\n end\n\n if key_pair = pair(key, index)\n key_pair[1] = value\n else\n @array[index] << [key, value]\n end\n\n if should_resize?\n puts \"resizing: #{collisions?} - #{fifty_percent_usage?}\"\n\n resize\n end\n\n value\n end", "def insert(*args)\n dataset.insert(*args)\n self\n end", "def insert_in_database\n Fetch.new(insertion_query).array\n end", "def insert(other)\n other = coerce(other)\n insert_left(other).join(insert_right(other))\n end", "def insert(value)\n search_result = binary_search_internal(value)\n unless search_result[0]\n @inner.length.downto(search_result[1] + 1) { |i| @inner[i] = @inner[i - 1] }\n @inner[search_result[1]] = value\n end\n return search_result[1]\n end", "def insert_in_list_at(position = 1)\n insert_at_position(position)\n end", "def insert_in_list_at(position = 1)\n insert_at_position(position)\n end", "def insert(index, string)\n execute_only(:insert, index, string)\n end", "def insert(num)\n self[num].push(num) unless include?(num)\n end", "def insert(key, values, opt={})\n do_op(:insert, column_family, key, values, opt)\n end", "def insert(key, values, opt={})\n do_op(:insert, column_family, key, values, opt)\n end", "def insert_before(index, *args, **_arg2, &block); end", "def added(array)\nend", "def insert(ary, low, right, gap)\n loc = low + gap\n\n while loc <= right\n i = loc - gap\n value = ary[loc]\n\n while i >= low && (cur_val = ary[i]) > value\n ary[i + gap] = cur_val\n i -= gap\n end\n\n ary[i + gap] = value\n loc += gap\n end\n end", "def prepend(number, array)\n return array.insert(0, number)\nend", "def add_to_array(array, item)\n array << item\nend", "def prepend(arr, num)\n new_arr = arr.insert(0, num)\n return new_arr\nend", "def add_element_to_start_of_array(array, element)\n array.unshift(element) \nend", "def insert(index, element)\n raise OutOfBoundsException unless valid_index?(index)\n\n temp_list = array_list\n @array_list = FixedArray.new(length + 1)\n (index -1).times do |below_index|\n array_list.set(below_index, temp_list.get(below_index))\n end\n\n array_list.set(index,element)\n\n (index + 1).upto(length - 1) do |above_index|\n @array_list.set(above_index, temp_list.get(index))\n end\n\n element\n end", "def insert (node, splice_position)\n _insert(node, splice_position)\n\n delete_old_nodes\n\n node\n end", "def insert(x, arr)\n if arr.empty?\n [x]\n else\n head, *tail = arr\n if head > x\n [x] + arr\n else\n [head] + insert(x, tail)\n end\n end\nend", "def prepend(arr, num)\n return arr.insert(0, num)\nend", "def insert(*objects)\n objects = objects.first if objects.size == 1 && objects.first.is_a?(Array)\n res = @db.insert_into_db(@name, objects)\n res.size > 1 ? res : res.first\n end", "def insert_statement(statement)\n self.inserts << statement\n end", "def insert_statement(statement)\n self.inserts << statement\n end", "def add_to_array!(array, item)\n array << item\nend", "def insert_first(new)\n insert_after(nil, new)\n end", "def add_element_to_start_of_array(array, element)\n array.unshift(element)\nend", "def insert_ascending(value)\r\n raise NotImplementedError\r\n end", "def fast_insert(rows, base_cmd, end_cmd = '')\n RawDB.fast_insert(db, rows, base_cmd, end_cmd)\n end", "def _insert_raw(ds)\n ds.insert(_insert_values)\n end", "def _insert_raw(ds)\n ds.insert(_insert_values)\n end", "def insert(name, tuples)\n raise NotSupportedError, \"Unable to insert in `#{self}`\"\n end", "def insert(element)\n [email protected]\n\n @store[@store.length]=element\n return if insertindex==1\n\n #For even inserts parent index is insertedindex/2-1 otherwise its juts insertedindex/2\n\n parentindex=insertindex/2\n\n #Incase it does not fit in(violating Heap Property)\n while insertindex!=1 && @store[parentindex] > @store[insertindex]\n swap(parentindex,insertindex)\n insertindex=parentindex\n parentindex=insertindex/2\n end\n\n end", "def insert_before(klass, new_klass, options=nil)\n @ustack.insert(index(klass), [new_klass, options])\n end", "def insert(num)\n false if include?(num)\n self[num] << num\n true\n end", "def insert(value)\n store.push value\n swim(length)\n self\n end", "def insert(x)\n @info.push(x)\n self\n end", "def insert(x)\n @info.push(x)\n self\n end", "def insert(x)\n @info.push(x)\n self\n end", "def insert(node, &block); end" ]
[ "0.83433336", "0.83423513", "0.8329462", "0.8329462", "0.8329462", "0.8329462", "0.8329462", "0.83247113", "0.83023584", "0.8230463", "0.82256", "0.8193648", "0.8189784", "0.8056227", "0.7931485", "0.7851081", "0.7523291", "0.73973036", "0.7380108", "0.73222804", "0.7195992", "0.71208316", "0.71030617", "0.7096976", "0.7010096", "0.69915", "0.6951463", "0.69318634", "0.6907228", "0.6893638", "0.67939204", "0.6758152", "0.6744442", "0.6721357", "0.67147595", "0.6699533", "0.6672075", "0.6662504", "0.6659497", "0.665373", "0.65640044", "0.65384895", "0.6535311", "0.6403203", "0.6367284", "0.6355403", "0.6336598", "0.63276345", "0.6299698", "0.6270338", "0.6262419", "0.6248168", "0.6247477", "0.62300175", "0.622861", "0.6228585", "0.62231916", "0.6222876", "0.6222876", "0.62217224", "0.62137103", "0.62031776", "0.6199865", "0.6186614", "0.617758", "0.617758", "0.61554176", "0.6154535", "0.61507785", "0.61507785", "0.6109704", "0.6106472", "0.61063486", "0.6102022", "0.60996974", "0.6096666", "0.6093284", "0.6076648", "0.60696685", "0.6064669", "0.6049613", "0.60432017", "0.6041218", "0.6041218", "0.60376686", "0.603718", "0.60337", "0.60326356", "0.6023806", "0.6020546", "0.6020546", "0.6019219", "0.60184866", "0.60151905", "0.60105556", "0.60090554", "0.5992212", "0.5992212", "0.5992212", "0.5991753" ]
0.6455882
43
Use the array's native include method
def include?(element) @ary.include? element end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def using_include(array, element)\n\tarray.include?(element)\nend", "def includes(*args)\n @options[:include] ||= []\n @options[:include] |= args\n end", "def include(*args)\n include_or_extend(:include, *args)\n end", "def include? array, item\n array.include?(item)\nend", "def include?(arr, include_item)\n arr.each { |item| return true if item == include_item }\n false\nend", "def includes\n end", "def includes\n end", "def include(*i)\n @includes |= i.flatten\n end", "def includes() return @includes end", "def include?(*args)\n args.inject(true) {|val, x| val = self.single_include?(x)}\n end", "def include?(o)\n @mut.synchronize{@array.include?(o)}\n end", "def include?(array, value)\n array.any?(value)\nend", "def includes(*args)\n config.includes.push *args\n end", "def my_include?(array, target)\n return false if array.empty?\n return true if array.first == target\n my_include?(array.drop(1), target)\nend", "def include?(arg0)\n end", "def included_in\n @included_in ||= []\n end", "def include?(array, query)\n array.each do |el|\n return true if el == query\n end\n false\nend", "def arr_includes_all?(arr, *inc)\n inc.map { |i| arr.include? i }.reduce(&:&)\n end", "def include?(arr, value)\n includes = false\n arr.each { |n| includes = true if n == value }\n includes\nend", "def include?(array, value)\n array.each do |elem|\n return true if elem == value\n end\n false\nend", "def include?(array, search)\n array.each do |value|\n return true if value == search\n end\n false\nend", "def test_include\n list = []\n list << 'xyz'\n assert_includes list, 'xyz'\n end", "def includes(*paths)\n @includes.concat(paths) unless paths.empty?\n @includes\n end", "def include?(array, value)\n array.each { |element| return true if value == element }\n false\nend", "def include?(arr, search)\n result = false\n arr.each { |num| result = true if num == search }\n result\nend", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(array, arg)\n boolean_return = false\n array.each {|value| return boolean_return = true if value == arg}\n boolean_return\nend", "def include?(something); end", "def include?(arr, search)\n arr.each do |element|\n if element == search\n return true\n end\n end\n false\nend", "def rinclude\n -> v, x { x.include?(v) }.curry\n end", "def includes\n @includes ||= params[:include].to_s.split(',')\n end", "def do_xinclude(options = T.unsafe(nil)); end", "def do_xinclude(options = T.unsafe(nil)); end", "def include\n -> x, v { x.include?(v) }.curry\n end", "def include?(item)\n end", "def include?(array, target)\n matches = array.select { |element| element == target }\n !matches.empty?\nend", "def include?(arr, target)\n arr.any?{ |ele| ele == target} ? true : false\nend", "def include?(arr, search)\n arr.any? { |i| i == search }\nend", "def include?(item)\n self.__contains__(item).rubify\n end", "def refute_includes(collection, obj, msg = T.unsafe(nil)); end", "def include? (array, search)\n array.each { |item| return true if search == item }\n return false\nend", "def includes()\n includes = @data[\"includes\"]\n if includes.nil? || includes == \"\"\n return []\n elsif includes.class == String\n return [includes]\n elsif includes.class == Array\n return includes\n else\n raise InvalidIncludesFormat.new(\"Value for 'includes' in #{@name} must be a String or an Array, (#{includes.inspect})\")\n end\n end", "def include?(arr, search)\n arr.any? { |elem| elem == search }\nend", "def include inc\n @includes << inc\n end", "def include?(array, value)\n array.each do |integer|\n return true if integer == value\n end\n return false\nend", "def include_string(arr)\r\n arr.map{ |s| \"-I#{s}\" }.join(' ')\r\nend", "def include?(name); end", "def includes\n []\n end", "def include?(*args_)\n _offset_for_args(args_) ? true : false\n end", "def include?(arg)\n arg.is_a?(Module) ? !!included_modules.detect{ |m| m === arg } : store.include?(arg)\n end", "def include?(array, value)\r\n array.count(value) > 0\r\nend", "def includes(options)\n @includes = options\n end", "def include?(key); end", "def include?(key); end", "def include?(name)\n includes?(name)\n end", "def array_includes?(array, given_thing)\n answer = false\n\n array.each do |thing|\n if thing == given_thing\n answer = true\n end\n end\n\n return answer\nend", "def include?(array, value)\n !!array.find_index(value)\nend", "def include?(array, value)\n !!array.find_index(value)\nend", "def include?(array, integer)\r\n array.each do |element|\r\n return true if element == integer\r\n end\r\n\r\nfalse\r\nend", "def include; end", "def include; end", "def includes?(array, target)\n if array.empty?\n false\n elsif array.first == target\n true\n else\n includes?(array.drop(1),target)\n end\nend", "def includes(*paths)\n self.included_files.concat(expand_globs(paths))\n end", "def include?(item)\n return true\n end", "def assert_includes(elem, array, message = nil)\n message = build_message message, '<?> is not found in <?>.', elem, array\n assert_block message do\n array.include? elem\n end\n end", "def include(*files)\n @include += files.flatten\n self\n end", "def include?(filename)\n \n end", "def include_strategy\n :includes\n end", "def include?\n @options[:include]\n end", "def include?(arr, val)\n arr.each { |el| return el == val if el == val }\n false\nend", "def test_0210_includeq\n @@log.debug \"test_0210_includeq starts\" if @@log.debug?\n assert_respond_to(@list, :include?, \"test_0210_includeq_respond\")\n # Test does include\n assert(@list.include?(@bsb),\"test_0210_includeq_basic\")\n # Test does not include\n ta = Person.new(\"A\", \"B\", \"C\", 456)\n assert(@list.include?(ta) == false,\"test_0210_includeq_backwards\")\n\n @@log.debug \"test_0210_includeq ends\" if @@log.debug?\n end", "def include?(arr, num)\n arr.each{ |element| return true if element == num}\n return false\nend", "def include?(arr, val)\n arr.any? { |element| element == val }\nend", "def included\n return [] if directory.empty? || directory == '*'\n @included ||= process_globs(@raw_data['include'])\n end", "def add_include include\n add_to @includes, include\n\n include\n end", "def include?(key)\n value.include?(key)\n end", "def include_any?(arr, arr2)\n #good for large sets w/ few matches\n # Set.new(self).intersection(arr).empty?\n arr2.any? {|e| arr.include?(e) }\n end", "def includes\n @include_ids.collect { |idx| BInclude.store[idx] }\n end", "def include?(ary, value)\r\n ary.select{ |obj| obj == value } != []\r\nend", "def include?(arr, search_value)\n arr.each do |num|\n if num == search_value\n return true\n end\n end\n false\nend", "def include?(array, value)\n # https://ruby-doc.com/core-2.7.2/Array.html#method-i-find_index\n !!array.find_index(value)\nend", "def include?(arr, search_value)\n new_arr = arr.select { |element| element == search_value}\n !new_arr.empty?\nend", "def include?(file)\n all_files.include? file\n end", "def add_includes(inc)\r\n return if inc.nil?\r\n \r\n inc = [inc] if (!inc.respond_to?(:each) || inc.kind_of?(String))\r\n \r\n if inc.include?(:all)\r\n ole_methods.each do |m|\r\n m = m.to_s\r\n if m =~ /\\AInclude/ && m != 'IncludeRetElementList'\r\n @request.__send__(\"#{m.underscore}=\", true)\r\n end\r\n end\r\n return\r\n end\r\n \r\n inc.each do |item|\r\n cam_item = item.to_s.camelize.gsub(/Id/, \"ID\")\r\n if @request.respond_to_ole?(\"Include#{cam_item}\")\r\n @request.__send__(\"include_#{item}=\", true)\r\n else\r\n @request.IncludeRetElementList.Add(cam_item)\r\n end\r\n end\r\n end", "def include(*args)\n include_private(*args)\n end", "def assert_includes(collection, obj, msg = T.unsafe(nil)); end", "def includes\n @spec['includes'].dup.concat(@type.includes)\n end", "def includes(*args)\n fresh.tap do |criteria|\n criteria.includes_values = (includes_values || []) + args\n end\n end", "def includes?(array, target)\n return true if array.first == target\n return false if array.empty?\n includes?(array.drop(1), target)\nend", "def include?(array, value)\n # method A\n array.any? { |element| element == value }\n \n # method B\n # for item in array\n # return true if item == value\n # end\n \n # false\nend", "def include?(arr, value)\n !(arr.select { |element| element == value }).empty?\nend", "def test_include?\n assert_includes list, 'xyz'\nend", "def test_includes_car\n car = Car.new\n arr = [1, 2, 3]\n arr << car\n\n assert_includes(arr, car)\n end", "def include?(ary, value)\n !!ary.index(value)\nend", "def include(*others)\n IncludesTracker.reset!\n __orig_include(*others)\n end" ]
[ "0.8226738", "0.726154", "0.7227126", "0.7145582", "0.71411514", "0.7136233", "0.7136233", "0.7124808", "0.70020485", "0.69860375", "0.69860035", "0.6983733", "0.6928293", "0.69255954", "0.6866376", "0.6859661", "0.68410623", "0.68348384", "0.6812307", "0.6811412", "0.67660534", "0.67578036", "0.67374086", "0.6694923", "0.6679652", "0.66765624", "0.6676254", "0.6676254", "0.6676254", "0.6676254", "0.6676254", "0.6671497", "0.6664065", "0.66596407", "0.6643901", "0.66177917", "0.66104335", "0.66104335", "0.6606258", "0.66044605", "0.65581214", "0.6556362", "0.65432984", "0.6537767", "0.6535005", "0.65341353", "0.6530264", "0.65274954", "0.65262914", "0.6486516", "0.6483603", "0.64818835", "0.64730304", "0.6463587", "0.6454528", "0.64457303", "0.6439957", "0.6434523", "0.6434523", "0.6434193", "0.6430566", "0.6428706", "0.6428706", "0.64243615", "0.6417985", "0.6417985", "0.640713", "0.63981247", "0.6393294", "0.6391111", "0.6389315", "0.6385866", "0.638256", "0.6380275", "0.63654333", "0.63622737", "0.6359787", "0.6357289", "0.6353082", "0.635044", "0.63455564", "0.63296103", "0.6317814", "0.63094425", "0.63072956", "0.63015187", "0.6283424", "0.62809193", "0.6276948", "0.6271782", "0.6271566", "0.6271281", "0.6261218", "0.6258521", "0.625001", "0.6246734", "0.62417513", "0.6241742", "0.62366354", "0.62345123" ]
0.6959373
12
Use the array's native sort method
def get_sorted_array @ary.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n sorted_array=array.sort\nend", "def sort_array_asc(array)\n\tarray.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def my_array_sorting_method(array)\n\t@array=array\n\[email protected]\n\treturn @array\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort arr \n\trec_sort arr, []\nend", "def sort arr\r\n\trec_sort arr, []\r\nend", "def sort1(array)\n\nend", "def sort(arr)\n\tnew_arr = arr.sort\n\tp new_arr\nend", "def sort_array_asc(array)\n asc_array = array.sort\n asc_array\nend", "def orderly(array)\n p array.sort\nend", "def my_array_sorting_method(source)\n # sort by converting the integers, if there are, into strings for the purpose of sorting only\n return source.sort {|a,b| a.to_s <=> b.to_s }\nend", "def my_array_sorting_method(source)\n p source.sort {|x,y| x.to_s <=> y.to_s}\nend", "def my_array_sorting_method(source)\n source.sort { |a, b| a.to_s <=> b.to_s } \nend", "def my_array_sorting_method(source)\n return source.sort {|a,b| a.to_s <=> b.to_s }\nend", "def sort arr\n rec_sort arr, []\nend", "def my_array_sorting_method(source)\n source.sort {|x,y| x.to_s <=> y.to_s }\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n source.sort {|x, y| x.to_s <=> y.to_s }\nend", "def my_array_sorting_method(source) \n # sorted = source.dup\n sorted_array = source.sort {|a, b| a.to_s <=> b.to_s}\nend", "def my_array_sorting_method(array, number)\n\nend", "def sort_nums_ascending(arr)\n return arr.sort\nend", "def sort_array_desc(array)\n array.sort do |a, b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend", "def my_array_sorting_method(source)\n result = source.sort { |a, b| a.to_s <=> b.to_s }\nend", "def sort_array_desc(array)\n array.sort do |a,b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend", "def sort_rever(array)\n p array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort do |a,b|\n b <=> a\n end\nend", "def sort_array_desc(array)\n array.sort do |a,b|\n b <=> a\n end\nend", "def sort_array_desc(arry)\n arry.sort do |num1, num2|\n num2 <=> num1\n end\nend", "def sort_array_desc(array)\n\tarray.sort do |a, b|\n\t\tb <=> a\n\tend\nend", "def my_array_sorting_method(source)\n p source.sort_by { |a| a.to_s }\nend", "def foo arr\n arr.sort\nend", "def sort_array_desc(array)\n array.sort {|x,y| y <=>x }\nend", "def sort_array_asc(arr)\n arr.sort{|a,b| a<=>b}\nend", "def sort_array_desc(array)\n array.sort {|x,y| y <=> x}\nend", "def sort_array_desc(array)\n array.sort {|a,b| b <=> a}\nend", "def sort_array_desc(array)\n array.sort do |x,y|\n if x == y\n 0\n elsif x < y\n 1\n elsif x > y\n -1\n end\n end\nend", "def sort some_array\n\tsorted_array = []\n\trecursive_sort some_array, sorted_array\nend", "def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend", "def sort_array_asc(integers)\n integers.sort\nend", "def sort some_array\n\trecursive_sort some_array, []\nend", "def sort some_array\n\trecursive_sort some_array, []\nend", "def sort_array_desc(array)\n return array.sort{ |a, b| b <=> a }\nend", "def my_array_sorting_method(source)\n source.sort_by { |element|\n element.to_s\n }\nend", "def qsort(arr)\nend", "def sort_array_desc(arr)\n arr.sort{|a,b| b<=>a}\nend", "def sort_array_desc(array)\n array.sort do | left, right|\n right <=> left\n end\nend", "def sort some_array \n\tsortingRec some_array, []\nend", "def sort_array_desc(array)\n array.sort do |a, b|\n b<=>a\n end\nend", "def take_array(array)\r\n array.sort\r\nend", "def sort_array_desc(array)\n desc_array = array.sort {|a, b| b <=> a}\n desc_array\nend", "def sort2(array, max_value)\n\nend", "def sort array # This \"wraps\" recursive_sort.\n recursive_sort array, []\nend", "def sort some_array # This \"wraps\" rec_sort so you don't have to pass rec_sort an empty array each iteration \n rec_sort some_array, []\nend", "def dub_sort(arr)\nend", "def my_array_sorting_method(source)\n source.sort_by { |x| x.to_s }\nend", "def my_array_sorting_method(source)\n source.sort { |a,b| a.to_s <=> b.to_s } # sort string within array alphabetically\nend", "def sort_array_desc(a)\n a.sort {|b, c|c<=>b}\nend", "def bubble_sort ary\n bubble_sort_by(ary) {|l,r| l <=> r}\nend", "def my_array_sorting_method(source)\n # Convert each element in the array to a string, for comparison/sorting purposes\n for index in 0...source.length\n source[index] = source[index].to_s\n end\n\n sorted_array = source.sort_by do |element|\n element\n end\n\n return sorted_array\nend", "def my_array_sorting_method(array)\n return array.sort_by { |x| x.to_s }\nend", "def sort_array_desc(array)\n new = array.sort\n new.reverse\nend", "def quick_sort(array)\nend", "def my_array_sorting_method(array)\n array.sort_by { |element| element.to_s }\nend", "def sort(arr)\n\tarr.reduce([]) do |sorted, element|\n\t\tindex = sorted.find_index do |item|\n\t\t\telement< item\n\t\tend\n\t\tindex ||= sorted.length\n\t\tsorted.insert(index, element) \n\tend\nend", "def del_sort(array)\n end", "def my_array_sorting_method(array)\n return array.sort_by {|x| x.to_s}\nend", "def two(array)\n array.sort\nend", "def my_array_sorting_method(source)\n source.sort_by {|a| a.to_s}\nend", "def bubble_sort(arr)\n\tbubble_sort_by(arr) { |a,b| b-a }\nend", "def sort a\r\n sort_rec a, []\r\nend", "def sort a\r\n sort_rec a, []\r\nend", "def my_array_sorting_method(source)\n source.sort_by {|i| i.to_s}\nend", "def dictionary_sort arr ## this is a wrapper method ..\r\n\trec_dict_sort arr, [] ## when trying to sort an array,\r\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def my_array_sorting_method(source)\n source.sort_by { |x| x.to_s }\nend", "def my_array_sorting_method(source)\n source.sort_by {|value| value.to_s}\nend", "def my_array_sorting_method(source)\n puts source.map{|x| x.to_s}.sort \n\n #return source.sort_by{|x| x.to_s} => see comment A below regarding this line\nend", "def my_array_sorting_method(array)\n array.sort_by{ |x| x.to_s }\nend", "def funny_sort(array)\n\tputs array.sort{ |a, b| findEarliestDigits(a) <=> findEarliestDigits(b) }\nend" ]
[ "0.83593535", "0.83593535", "0.8135982", "0.8135982", "0.8135982", "0.8067925", "0.8043106", "0.7923096", "0.7869841", "0.7848484", "0.7848484", "0.7848484", "0.7848484", "0.7848484", "0.7848484", "0.7792767", "0.7758906", "0.7757075", "0.76980895", "0.76470274", "0.76228076", "0.75421107", "0.75194335", "0.74563766", "0.74314266", "0.7429041", "0.74274015", "0.7417293", "0.7417293", "0.7417293", "0.7417293", "0.7417293", "0.7417293", "0.7417293", "0.74112123", "0.7406763", "0.74008304", "0.73912036", "0.7380033", "0.7350942", "0.73357147", "0.7334675", "0.7333791", "0.7333791", "0.7328568", "0.73266095", "0.7324834", "0.7322512", "0.7314391", "0.7308782", "0.7283798", "0.7268382", "0.7267136", "0.7262689", "0.7260978", "0.7260781", "0.7251345", "0.7251345", "0.7246191", "0.724616", "0.7230387", "0.7230049", "0.72273463", "0.7227239", "0.7224113", "0.7217292", "0.72124946", "0.7188566", "0.7156765", "0.71538854", "0.7152466", "0.7138906", "0.71338606", "0.7125557", "0.7123086", "0.7113267", "0.7108577", "0.70990795", "0.7092832", "0.7091363", "0.7089898", "0.7088793", "0.7084822", "0.7074016", "0.7054315", "0.70343924", "0.7033073", "0.7033073", "0.7027078", "0.70098263", "0.7007469", "0.7007469", "0.7007469", "0.7007469", "0.7007469", "0.6996137", "0.6994808", "0.6989754", "0.6980153", "0.6969056" ]
0.7109493
76
totals_arr = [] sum = 0 loop do break if arr.length == 0 totals_arr << sum = arr.shift + sum end totals_arr end
def running_total(arr) totals_arr = [] acc = 0 arr.each do |num| acc = acc + num totals_arr << acc end totals_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_total arr\n totals = []\n sum = 0\n arr.each do |elm|\n sum += elm\n totals << sum\n end\n totals\nend", "def sum(arr)\n return 0 if arr.empty?\n el = arr.shift\n total = sum(arr)\n total + el\nend", "def sum_of_sums(arr)\n total_sum = 0\n dup_arr = arr.dup # make a copy to avoid mutating original array\n until dup_arr.empty?\n total_sum += dup_arr.reduce(:+)\n dup_arr.pop\n end\n total_sum\nend", "def running_total(arr)\n res = []\n running_total = 0\n\n arr.each do |element|\n running_total += element\n res << running_total\n end\n\n res\nend", "def running_total(arr)\n return [] if arr.empty?\n running_sum = [arr[0]]\n counter = 1\n loop do \n break if counter == arr.size\n \n current_value = arr[counter]\n last_number = running_sum.last\n running_sum << current_value + last_number\n \n counter += 1\n end\n running_sum\nend", "def running_total(array)\n total = 0\n new_array = []\n while array.size > 0\n total += array.shift\n new_array << total\n end\n new_array\nend", "def running_total2(array)\n total = 0\n array.each_with_object([]) do |num, arr|\n total += num\n arr << total\n end\nend", "def my_running_total(array)\n result_array = []\n result_array << array.shift unless array.empty?\n\n until array.empty?\n result_array << result_array.last + array.shift\n end\n\n result_array\nend", "def totals(array)\n array.inject([]) do |result, elem|\n if result.empty?\n result << elem\n else\n result << result.last + elem\n end\n end\nend", "def sum_of_sums(array)\r\n total = array[0]\r\n new_arr = []\r\n array.each do |x|\r\n if new_arr.empty?\r\n new_arr << x\r\n else\r\n total += x\r\n new_arr << total\r\n end\r\n end\r\n new_arr.reduce(:+)\r\nend", "def running_total(arr)\n results = []\n total = 0\n arr.each do |el|\n total += el\n results << total\n total = total\n end\n results\nend", "def sum_of_sums(array)\n total = 0\n until array.size == 0\n total += array.reduce(:+)\n array.pop\n end\n total\nend", "def running_total(arr)\n running_total_arr = []\n sum = 0\n arr.each do |num|\n sum += num\n running_total_arr << sum\n end\n running_total_arr\nend", "def sum arr\n sum_array = 0 \n arr.each { |x| sum_array = sum_array + x } \n return sum_array\nend", "def running_total(arr)\n totals = []\n arr.inject(0) do |total, num|\n totals << num + total\n total += num\n end\n return totals\nend", "def running_total(input_arr)\n running_total_arr = []\n input_arr.each_with_index do |elem, idx|\n if idx == 0\n running_total_arr[idx] = input_arr[idx]\n p running_total_arr\n else\n running_total_arr[idx] = running_total_arr[idx - 1] + input_arr[idx]\n p running_total_arr\n end\n end\n return running_total_arr\nend", "def running_total(arr)\n sum = 0\n arr.inject([]) { |running_sum, num| running_sum << sum += num }\nend", "def sum_of_sums(arry)\n total = 0\n loop do\n arry.each do |num|\n total += num\n end\n arry.pop\n break if arry.size == 0\n end\n total\nend", "def running_total(array)\n result = []\n sum = 0\n index = 0\n\n while array.size > index\n result << sum += array[index]\n index += 1\n end\n result\nend", "def running_total(array)\n # new_array = []\n sum = 0\n array.inject([]) do |arr, val| \n sum += val\n arr << sum \n arr\n end\nend", "def running_total_3 arr\n sum = 0\n arr.each_with_object([]) do |elm, obj|\n sum += elm\n obj << sum\n end\nend", "def running_total(array)\n sum = 0\n array.each_with_object([]) do |el, new_array|\n new_array << sum += el\n end\nend", "def sum_of_sums(array)\n results = []\n\n loop do \n break if array.empty?\n results << array.inject(:+)\n array.pop\n end\n\n results.inject(:+)\nend", "def sum_of_sums(arr)\n sum = 0\n total = 0\n\n arr.each do |num|\n sum += num\n total += sum\n end\n total\nend", "def sum_of_sums(arr)\n sum = 0\n total = 0\n\n arr.each do |num|\n sum += num\n total += sum\n end\n total\nend", "def sum arr\n\ttotal = 0\n\tif arr.size > 0\n\t\ttotal = arr.reduce(:+)\n\tend\n\n\treturn total\nend", "def running_total_3(array)\n #total = 0\n #array_new = []\n array.each_with_object([]) do |i,x|\n next if i == 0\n x += array[i-1]\n end\nend", "def running_total1(array)\n array_new = []\n loop do\n break if array.empty?\n array_new << array[0]\n array[1] = array[0] + array[1] if array.size >= 2\n array.shift\n end\n array_new\nend", "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 running_total(array)\n sum = 0\n running_total = []\n\n array.each do |element|\n sum += element\n running_total << sum\n end\n\n running_total\nend", "def total(arr)\n sum = 0\n index = 0\n while index < arr.size\n sum += arr[index]\n index += 1\n end\n sum\nend", "def running_total(array)\n sum = 0\n\n array.each_with_object([]) do |number, new_array|\n new_array << sum += number\n end\nend", "def total arr\nsum_total = 0\narr.each do |el|\nsum_total += el\nend\nsum_total\nend", "def running_total(array)\n result = []\n count = 0\n total = 0\n\n while count < array.size\n total += array[count]\n result << total\n count += 1\n end\n result\nend", "def sum arr\n total = 0\n arr.each do |i|\n total += i\n end\n total\nend", "def running_total(nums_ary)\n ary = []\n\n nums_ary.reduce(0) do |sum, num|\n ary << sum + num\n sum + num\n end\n ary\nend", "def sum_of_sums(arr)\n new_arr = []\n \n arr.each_with_index do |num, idx|\n new_arr << arr[0..idx].reduce(:+)\n end\n \n p new_arr.reduce(:+)\nend", "def sum arr \n return 0 if arr.empty?#checks to return 0 if empty\n arr.inject(0){|s, e| s+e}#block accumulator to add e's of arr \nend", "def my_sum(arr)\n accumulator = arr.first # store first element as accumulator\n\n arr.each_index do |idx|\n next if idx == 0 # skip first element: it's already the accumulator\n accumulator += arr[idx] # increment accumulator by current element\n end\n\n accumulator\nend", "def total(arr)\n\tsum = 0\n\tarr.each do |i|\n\t\tsum = sum + i\n\tend\n\treturn sum\nend", "def total(arr)\n\tarr.inject(0) { |x, y| x + y }\nend", "def sum arr\n arr.reduce 0, :+ # reduce method is clearlier than inject. from 0 add to +:\nend", "def total(arr)\n\tsum\t= 0\n\tarr.each{|i| sum+= i}\n\treturn sum\nend", "def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n counter = -1\n while counter + 1 > -arr.size\n total_sum += arr.slice(idx..counter).reduce(:+)\n counter -= 1\n end\n total_sum\nend", "def total(array)\n sum = 0\n new_array = []\n \n array.each do |number|\n sum += number\n new_array.push(sum)\n end\n \nreturn new_array[-1]\nend", "def running_total_2 arr\n arr.each_with_index { |elm, idx| idx == 0 ? next : arr[idx] += arr [idx-1] }\nend", "def arr_sum(arr)\r\n sum_arr = 0\r\n arr.each { |i| sum_arr+=i}\r\n sum_arr\r\nend", "def reduce_to_total(array)\n total = 0 \n count = 0 \n while count < array.length do\n total = total + array[count]\n count += 1\n end\n total\nend", "def sum arr\n rtn = 0\n arr.each { |n| rtn += n }\n return rtn\nend", "def running_total(input_array)\n sum = 0 # => 0, 0, 0, 0\n new_array = input_array.map do |value| # => [2, 5, 13], [14, 11, 7, 15, 20], [3], []\n sum += value # => 2, 7, 20, 14, 25, 32, 47, 67, 3\n end # => [2, 7, 20], [14, 25, 32, 47, 67], [3], []\nend", "def running_total(array)\n sum = 0\n new_array = []\n array.each do |num|\n sum += num\n new_array << sum\n end\n new_array\nend", "def running_total(arr)\n sum = 0\n arr.map { |ele| sum += ele }\nend", "def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend", "def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend", "def sum arr\n return 0 if arr.empty?\n arr.inject(:+)\nend", "def total(arr)\n return arr.inject(:+)\nend", "def running_total(old_array)\n counter = 0\n new_array = []\n loop do \n break if counter >= old_array.length\n if counter == 0\n new_array[counter] = old_array[counter]\n else \n new_array[counter] = old_array[counter] + new_array[counter-1]\n end\n counter += 1\n end\n new_array\nend", "def running_total(array)\r\n new_arr = []\r\n total = 0\r\n array.map do |x|\r\n total += x\r\n new_arr << total\r\n end\r\n new_arr\r\n end", "def running_total(arr)\n new_arr = []\n running_total = arr[0]\n arr.each_with_index do |element, index|\n new_arr.push(running_total)\n running_total = running_total + arr[index + 1].to_s.to_i\n end\n new_arr\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 total(arr)\n total = 0\n arr.each {|i| total += i}\n return total\nend", "def total array\n array.inject(0){|sum,x| sum + x }\nend", "def total(arr)\n output = 0\n arr.each do |x|\n output += x\n end\n output\nend", "def running_total(array)\n new_array = []\n sum = 0\n count = 0\n\n while count < array.size\n array.each do |num|\n sum += num\n new_array << sum\n count += 1\n end\n end\n new_array\nend", "def sum arr\n if !arr.empty?\n soma = 0\n arr.each do |elt| ; soma += elt ; end\n return soma\n end\n return 0 \nend", "def running_total(array)\n output = []\n return output if array.empty?\n output[0] = array[0]\n counter = 1\n\n while counter < array.size\n output << (output[counter - 1] + array[counter])\n counter += 1\n end\n output\n end", "def array_sum(arr)\n return 0 if arr.empty?\n\n arr.reduce(&:+)\nend", "def running_total(arr)\n tot = []\n arr.size.times do |i|\n tot << arr[0..i].reduce(&:+)\n end\n tot\nend", "def sum_array (arr)\n result = 0\n arr.each do |value|\n result +=value\n end\n result\nend", "def array_sum(arr)\n if arr.length == 0\n return 0\n end\n arr.reduce(:+)\nend", "def running_total(arr)\n total_sum = 0\n arr.map { |elem| total_sum += elem }\nend", "def sum_of_sums(array)\n\n sums_array = []\n\n sum = 0\n array.each do |value|\n sum += value\n sums_array << sum\n end\n \n sums_array.sum\nend", "def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend", "def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend", "def sum arr\n result = 0\n arr.each do |num|\n \tresult += num\n end\n result\nend", "def total(array)\n array[0..-1].reduce(:+)\nend", "def sum arr\n sum = 0\n arr.each { |a| sum += a }\n return sum\nend", "def sum_of_sums(arr)\n total = 0\n (0..(arr.size - 1)).each { |i| total += arr[0..i].reduce(:+) }\n total\nend", "def sum arr\n if arr.length==0\n return 0\n end\n s = arr.reduce(:+)\n return s\nend", "def sum arr\n arraySum = 0\n arr.each{|i|arraySum+=i}\n return arraySum\nend", "def sum arr\n sum1 = 0;\n \n arr.each do\n |num|\n sum1+=num;\n end\n \n if arr.empty?\n return 0;\n end\n \n return sum1;\nend", "def sum arr\n arr.inject(0,:+)\nend", "def sum arr\n arr.inject(0,:+)\nend", "def array_sum(arr)\n if arr.empty?\n 0\n else\n arr.reduce(:+)\nend\nend", "def running_total(array)\n run_total = []\n \n index = 1\n while index <= array.length\n element = array.slice(0,index)\n run_total << element.inject(:+)\n index += 1\n end\n run_total\nend", "def total(arr)\n x = arr.reduce(:+)\n return x\nend", "def total(array)\n sum = 0.0\n result = 0.0\n if array.length > 0 then\n array.each do |item|\n sum += item\n end\n result = sum \n end\n return result\nend", "def sum arr\n res = 0\n arr.each {|i| res+=i}\n return res\nend", "def running_total(array)\n\n sum = 0\n\n array.map { |value| sum += value }\n\nend", "def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend", "def total(arr)\n arr.inject(:+)\nend", "def sum_of_sums(arr)\n counter = 1\n total = 0\n\n loop do\n break if counter > arr.size\n\n total += arr.take(counter).sum\n counter += 1\n end\n total\nend", "def running_total(array)\n result = []\n\n array.inject(0) do |sum, num|\n result << sum += num\n sum # have to return sum\n end\n result\nend", "def total(array)\n sum = 0\n array.each { |i| sum += i}\n return sum\nend", "def total (arr)\n sum = 0\n for i in 0...arr.length\n sum = sum + arr[i]\n end\n return sum\nend", "def sum arr\n s = 0\n arr.each {|x| s += x}\n s\nend", "def running_total(array)\n sum = 0\n array.map { |value| sum += value }\nend", "def running_total3(array)\n sum = 0\n array.map do |num|\n sum = [sum, num].inject(:+)\n end\nend", "def running_total(array)\n sum = 0\n array.map { |value| sum += value }\nend", "def running_total(array)\n sum = 0\n array.map { |value| sum += value }\nend" ]
[ "0.8280244", "0.8051251", "0.7988912", "0.79777217", "0.79608136", "0.7953595", "0.7936917", "0.79359597", "0.7891125", "0.78767204", "0.7874809", "0.78728706", "0.78562427", "0.7850454", "0.7846423", "0.7823093", "0.78026164", "0.7798185", "0.7794741", "0.77891934", "0.7788477", "0.7766305", "0.7747262", "0.77425456", "0.77425456", "0.77413654", "0.7737145", "0.7737118", "0.7727682", "0.772325", "0.77200264", "0.768993", "0.76793367", "0.76759905", "0.7675351", "0.76677734", "0.7660662", "0.76569986", "0.76462835", "0.7646133", "0.7642252", "0.7630987", "0.7629099", "0.76210374", "0.76193744", "0.76190233", "0.76100105", "0.7607518", "0.7605476", "0.76046604", "0.7589043", "0.7588158", "0.7577367", "0.7577367", "0.7546043", "0.7544928", "0.7536331", "0.7525865", "0.7522975", "0.7520589", "0.7516179", "0.7508823", "0.75079423", "0.7506619", "0.75039464", "0.74878854", "0.7486803", "0.7481897", "0.7481366", "0.74804634", "0.74804", "0.7478462", "0.7476191", "0.7476191", "0.74641985", "0.7462213", "0.7458394", "0.74559355", "0.74540865", "0.74454296", "0.74417096", "0.7440101", "0.7440101", "0.7439006", "0.7436884", "0.74347377", "0.7432783", "0.7422696", "0.7420504", "0.7419269", "0.74189603", "0.741829", "0.7412127", "0.74049056", "0.74039763", "0.74021745", "0.7401006", "0.74005103", "0.7400059", "0.7400059" ]
0.78732044
11
Invokes rake in the specified directory with the specified target
def invokeRake(directory, target) cmd = "(cd #{directory}; rake #{target} BIN_DIR=../#{BIN_DIR} DEBUG_FLAG=#{DEBUG_FLAG})" sh cmd end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invokeRake(directory, target)\n cmd = \"(cd #{directory}; rake #{target} LIB_DIR=../#{LIB_DIR} DEBUG_FLAG=#{DEBUG_FLAG})\"\n sh cmd\nend", "def rake(*args) run_command('rake', args) end", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def rake\n Dir.chdir @temp_dir\n system(\"rake\")\n end", "def rake *args\n ruby \"-S\", \"rake\", *args\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def rake(task,*args)\n run 'rake', rake_task(task,*args)\n end", "def execute\n command = (rake_command || []).join(\" \")\n target_vms.each { |vm| execute_on_vm(vm, command) }\n end", "def rake command\n install_deps 'rake', :type => Gem\n @shell.call \"cd #{self.checkout_path} && rake #{command}\"\n end", "def execute_on_vm(vm, command)\n vm.env.actions.run(:rake,\n \"rake.command\" => command,\n \"rake.cwd\" => options[:cwd])\n end", "def rake(command, options = {})\n execute_command :rake, command, options\n end", "def rake(command, options = {})\r\n log 'rake', command\r\n env = options[:env] || 'development'\r\n sudo = options[:sudo] ? 'sudo ' : ''\r\n in_root { run(\"#{sudo}rake #{command} RAILS_ENV=#{env}\", false) }\r\n end", "def run_remote_rake(rake_cmd)\n rake_args = ENV['RAKE_ARGS'].to_s.split(',')\n cmd = \"cd #{fetch(:latest_release)} && #{fetch(:rake, \"rake\")} RAILS_ENV=#{fetch(:rails_env, \"production\")} #{rake_cmd}\"\n cmd += \"['#{rake_args.join(\"','\")}']\" unless rake_args.empty?\n run cmd\n set :rakefile, nil if exists?(:rakefile)\nend", "def rake(app_name, cmd)\n\t\tpost(\"/apps/#{app_name}/rake\", cmd)\n\tend", "def run_a_rake_command(rake_task_and_args)\n command_text = \"cd /opt/supermarket/embedded/service/supermarket && \\\n RAILS_ENV=\\\"production\\\" env PATH=/opt/supermarket/embedded/bin \\\n bin/rake #{rake_task_and_args}\"\n\n shell_out = Mixlib::ShellOut.new(command_text)\n shell_out.run_command\n $stdout.puts shell_out.stdout\n $stderr.puts shell_out.stderr\n exit shell_out.exitstatus\nend", "def rake(command, options = {})\n log 'rake', command\n env = options[:env] || 'development'\n sudo = options[:sudo] ? 'sudo ' : ''\n in_root { run(\"#{sudo}rake #{command} RAILS_ENV=#{env}\", false) }\n end", "def run_sphinx task\n rsudo \"cd #{current_path} && RAILS_ENV=#{Rubber.env} #{fetch(:rake, 'rake')} #{task}\", :as => runner\n end", "def run_a_rake_command(rake_task_and_args)\n cmd_helper = CtlCommandHelper.new('spdx-<command>')\n cmd_helper.must_run_as 'supermarket'\n\n command_text = cmd_helper.rails_env_cmd(\"bin/rake #{rake_task_and_args}\")\n shell_out = Mixlib::ShellOut.new(command_text)\n shell_out.run_command\n $stdout.puts shell_out.stdout\n $stderr.puts shell_out.stderr\n exit shell_out.exitstatus\nend", "def rake(app_name, cmd)\n # deprecated by virtue of start deprecation 08/02/2012\n start(app_name, \"rake #{cmd}\", :attached).to_s\n end", "def call_rake(arguments)\n if RUBY_PLATFORM =~ /mswin/\n rake_cmd = \"rake.bat\" #very important because windows will break with just \"rake\"\n else\n rake_cmd = \"rake\"\n end\n puts \"calling #{rake_cmd} \" + arguments\n puts system(\"#{rake_cmd} \" + arguments)\n puts $?\nend", "def remote_rake(task)\n on primary(:app) do\n within current_path do\n with rails_env: fetch(:rails_env) do\n rake task\n end\n end\n end\n end", "def rake\n deprecate(\"`heroku #{current_command}` has been deprecated. Please use `heroku run rake` instead.\")\n command = \"rake #{args.join(' ')}\"\n run_attached(command)\n end", "def call_rake(task, options = {})\n options[:rails_env] ||= Rails.env\n args = options.map { |n, v| \"#{n.to_s.upcase}='#{v}'\" }\n system \"/usr/bin/rake #{task} #{args.join(' ')} --trace 2>&1 >> #{Rails.root}/log/rake.log &\"\n end", "def rake(*tasks)\n \"rake #{tasks.join(' ')}\"\n end", "def define_run_task\n desc @run_description\n task 'run' do\n target_sha = ENV['TARGET_SHA']\n ts = TTNT::TestSelector.new(repo, target_sha, expanded_file_list)\n tests = ts.select_tests!\n\n if tests.empty?\n STDERR.puts 'No test selected.'\n else\n if ENV['ISOLATED']\n tests.each do |test|\n args = \"#{ruby_opts_string} #{test} #{option_list}\"\n run_ruby args\n break if @failed && ENV['FAIL_FAST']\n end\n else\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{tests.to_a.join(' ')} #{option_list}\"\n run_ruby args\n end\n end\n end\n end", "def target(name)\n Target.load_from(self.targets_path.join(name,'target.rake')).tap do |target|\n target.application = self\n end\n end", "def call_rake(task, options = {})\n options[:rails_env] ||= Rails.env\n args = options.map { |k,v| \"#{k.to_s.upcase}='#{v}'\" }\n system \"rake #{task} #{args.join(' ')} --trace >> #{Rails.root}/log/rake.log &\"\n end", "def run_build\n cd 'cookbooks/example'\n run_simple \"bundle exec rake\", false\n end", "def from_instructions\n \"cd #{Dubya.root_path} && bundle exec rake update\"\n end", "def execute_task\n create_test_files\n commands = rake_result[:commands] = []\n allow(task).to receive(:sh) do |command, _|\n commands << command\n end\n Rake::Task[:default].invoke\n end", "def rake_task task_name\n @rake.invoke_task task_name\n end", "def call_rake_task( task_name, options={} )\n command = [\n \"rake #{task_name}\",\n options.map { |k, v| [k.to_s.upcase, v.to_s].join('=') },\n ''\n ].join(' ')\n logger.info \"Calling Rake Task >> #{command}\"\n system(command)\n end", "def foreground_rake(task)\n on roles(:app) do\n execute \"cd #{release_path} && bundle exec rake RAILS_ENV=#{fetch(:rails_env)} #{task}\"\n end\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def ruby_rake_task(task)\n Rake::Task[task].invoke\nend", "def target\n return nil unless @target_dir\n unless @target\n @target = file(File.expand_path(@target_dir)) { |task| run if @target == task }\n @target.enhance @include.select {|f| f.is_a?(Rake::FileTask)}\n @target.enhance @exclude.select {|f| f.is_a?(Rake::FileTask)}\n @target.enhance copy_map.values\n end\n @target\n end", "def invoke_task(task_string)\n #puts \"invoking task: '#{task_string}'\"\n taskPath, args = parse_task_string(task_string)\n #puts \"parsed args are #{args}\"\n \n projectPath, name = GetProjectFilePathName(taskPath)\n \n if(projectPath == nil and (name == \"clean\" or name == \"clobber\"))\n # Execute all clean targets\n puts \"Cleaning all projects...\"\n @ProjectFileLoader.LoadedProjectFiles().each do |projFile| \n task = projFile[name]\n task.invoke(*args)\n end\n else\n task = self[taskPath]\n task.invoke(*args)\n end\n end", "def rake(app_name, cmd)\n\t\tpost(\"/apps/#{app_name}/rake\", cmd)\n\trescue RestClient::RequestFailed => e\n\t\traise(AppCrashed, e.response.body) if e.response.code.to_i == 502\n\t\traise e\n\tend", "def buildwise_run_sequential_build_target(build_id, task_name) \r\n begin\r\n FileUtils.rm_rf(\"spec/reports\") if File.exist?(\"spec/reports\")\r\n Rake::Task[task_name].invoke\r\n ensure\r\n puts \"Finished: Notify build status\"\r\n sleep 2 # wait a couple of seconds to finish writing last test results xml file out\r\n puts \"[Rake] finish the build\"\r\n buildwise_finish_build(build_id)\r\n end\r\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def util_custom_configure(target)\n <<-EO_MKRF\n File.open(\"Rakefile\", \"w\") do |f|\n f.puts <<-EOF\n task :default do\n lib_dir = ENV[\"RUBYARCHDIR\"] || ENV[\"RUBYLIBDIR\"]\n touch File.join(lib_dir, #{target.inspect})\n end\n EOF\n end\n EO_MKRF\n end", "def run_serverspec(target_specdir)\n $log.debug 'Running serverspec'\n cmd = \"cd #{target_specdir} && sudo rake spec\"\n $log.debug \"cmd=#{cmd}\"\n result = `#{cmd}`\n puts result\n end", "def run_task(broker, targets, task, files, input: {}, metadata: nil, **kwargs, &block)\n params = { task: task, input: input, files: files }\n params[:metadata] = metadata if metadata\n do_module_action(broker, agent_identities(targets), 'task', 'run', params, **kwargs, &block)\nend", "def run_rails_rake_tasks(*names)\n ARGV.clear\n ARGV.concat(names)\n ARGV << \"RAILS_ENV=test\"\n Dir.chdir(RAILS_ROOT) do\n old = Rake.application\n Rake.application = Rake::Application.new\n begin\n Rake.application.run\n ensure\n Rake.application = old\n end\n end\nend", "def install_run(target)\n # TODO: move atomically\n FileUtils.mv run_dir, target\n logger.info \"#{run_dir} moved to #{target}\"\n\n File.chmod 0755, target\n logger.info \"Changed permissions for #{target} to 0755\"\n\n FileUtils.ln_s target, Conf.global_conf[:basecall_dir]\n logger.info \"Aliased #{target} to #{Conf.global_conf[:basecall_dir]}\"\n\n link = File.join(Conf.global_conf[:basecall_dir], self.run_name)\n fix_permissions(target, link)\n end", "def run!\n target_files.shuffle.each do |target_file|\n FileRunnerBasic.new(target_file).run!\n end\n end", "def run\n if not @test then\n @dirs.each do |dir|\n if @local\n `cd #{dir}; ./local-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task run: #{dir}\"\n else\n `cd #{dir}; ./pbs-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task queued: #{dir}\"\n end\n end\n end\n end", "def execute_task task\n puts \"starting #{task}...\"\n Rake::Task[\"railties:install:migrations\"].reenable\n Rake::Task[task].reenable\n r = Rake::Task[task].invoke\n puts \"#{task} done! #{r}\"\nend", "def task_run(task_name, params)\n config_data = { 'modulepath' => File.join(Dir.pwd, 'spec', 'fixtures', 'modules') }\n inventory_hash = inventory_hash_from_inventory_file\n target_node_name = ENV['TARGET_HOST'] if target_node_name.nil?\n\n result = run_task(task_name, target_node_name, params, config: config_data, inventory: inventory_hash)\n\n raise \"task failed\\n`#{task_name}`\\n======\\n#{result}\" if result.first['status'] != 'success'\n\n result\n end", "def run(cmd)\n Dir.chdir @target\n\n log \"Running: #{cmd}\"\n `#{cmd}`\n # if $?.exitstatus != 0\n # raise IOError, %{Error executing command: \"#{cmd}\"}\n # end\n\n Dir.chdir @starting_dir\n end", "def background_rake(task)\n on roles(:app) do\n execute \"cd #{release_path}; ( ( nohup bundle exec rake RAILS_ENV=#{fetch(:rails_env)} #{task} &>/dev/null ) & )\"\n end\nend", "def run(command, log_action = true)\r\n log 'executing', \"#{command} from #{Dir.pwd}\" if log_action\r\n `#{command}`\r\n end", "def single_target(user, pass, target, evil)\n\t\tprint_status(\"Running psexec #{user} #{pass} #{target} #{evil}.....\")\n\t\tDir.chdir(\"#{MSFPATH}tools/\") {\n\t\t\tsystem(\"psexec.rb #{user} #{pass} #{target} #{evil}\")\n\t\t}\n\tend", "def exec_cmd\n\t\t\tif ! rakeAppAndRvm\n\t\t\t\terror \"The current directory does not seem to be the root of a rake app or rvm is not installed. Nothing to do!\"\n\t\t\t\texit 0\n\t\t\telse\n\t\t\t\tyield\n\t\t\tend\n\t\tend", "def util_custom_configure(target)\n <<~EO_MKRF\n File.open(\"Rakefile\", \"w\") do |f|\n f.puts <<~EOF\n require 'fileutils'\n task :default do\n lib_dir = ENV[\"RUBYARCHDIR\"] || ENV[\"RUBYLIBDIR\"]\n FileUtils.touch File.join(lib_dir, #{target.inspect})\n end\n EOF\n end\n EO_MKRF\n end", "def execute\n args = ['rubocop'] + arguments\n todo = target_directory.join('.rubocop_todo.yml')\n\n results = Dir.chdir(target_directory) do\n replacements.unshift([/^#{Regexp.quote(Dir.pwd)}/, current_directory.to_s])\n\n stdout, stderr, status = Open3.capture3(*args, stdin_data: stdin)\n\n [munge_output(stdout), munge_output(stderr), status.exitstatus]\n end\n\n # copy the todo file back for the case where we've used --auto-gen-config\n FileUtils.cp(todo, current_directory) if todo.exist?\n\n results\n end", "def test_relloadpath4\n with_fixture 'relloadpath4' do\n cd 'src' do\n assert system('ruby', ocra, 'relloadpath4.rb', *DefaultArgs)\n assert File.exist?('relloadpath4.exe')\n assert system('relloadpath4.exe')\n end\n end\n end", "def run\n drop_pid\n \n puts \"Starting rake process with process id #{@pid}:\" if @verbose\n \n at_exit do \n clear_pid\n end\n end", "def execute(args=nil)\n args ||= EMPTY_TASK_ARGS\n if application.options.dryrun\n application.trace \"** Execute (dry run) #{name}\"\n return\n end\n if application.options.trace\n application.trace \"** Execute #{name}\"\n end\n application.enhance_with_matching_rule(name) if @actions.empty?\n\n # here's the patch!\n self.working_dir = `pwd`.strip # it'll maybe change in the task, so set it first\n Rake.ensure_only_one_task_is_running name, self.working_dir if self.is_only_one_task\n\n @actions.each do |act|\n case act.arity\n when 1\n act.call(self)\n else\n act.call(self, args)\n end\n end\n end", "def run(argv)\n load_tasks\n\n if argv.empty?\n print_help\n else\n build_task(argv).run\n end\n end", "def run\n # Like RuboCop itself, we'll lazy load so the task\n # doesn't substantially impact Rakefile load time.\n require 'ruumba'\n\n analyzer = Ruumba::Analyzer.new\n puts 'Running Ruumba...'\n\n analyzer.run @dir\n end", "def invoke_or_reboot_rake_task(task)\n if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty?\n ruby_rake_task task\n else\n Rake::Task[task].invoke\n end\n end", "def invoke_or_reboot_rake_task(task)\n if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty?\n ruby_rake_task task\n else\n Rake::Task[task].invoke\n end\n end", "def run(paths)\n passed = @runner.run!(paths)\n\n throw :task_has_failed unless passed\n @runner.run_all! if @options[:all_on_pass]\n end", "def remote_rake_executable\n rake.remote_executable\n end", "def setup_target\n link_target_task project.target, (project.sources + [project.main]).map {|fn| objectsify fn }\n end", "def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end", "def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end", "def run_target(target, dry=false)\n error \"Target '#{target}' not found\" if not @hash[target]\n if not @already_run.include?(target)\n @already_run << target\n @hash[target].last.run(dry)\n end\n end", "def exec_setup\n exec_task_traverse 'setup'\n end", "def run_on_project\n @target_dir = @params[:target_dir]\n zones = @project.get_element('zones')\n\n # iterates all zones, descend into zone\n run_on_project_zones(zones)\n\n # use the specwrite class to write a complete\n # serverspec example in a subdirectory(serverspec)\n target_specdir = File.join(@target_dir, 'serverspec')\n\n begin\n spec_writer = SpecWriter.new(target_specdir, @spec_code)\n spec_writer.write\n\n outputs 'SPEC', \"Serverspecs written to #{target_specdir}. Run:\"\n outputs 'SPEC', \"( cd #{target_specdir}; sudo rake spec )\"\n outputs 'SPEC', 'To run automatically, use --run'\n rescue => exception\n $log.error \"Error writing serverspec files, #{exception}\"\n STDERR.puts exception.inspect\n end\n\n run_serverspec(target_specdir) if @params[:auto_run]\n end", "def run( file_name )\n application = select_app( file_name )\n system( \"#{application} #{file_name}\" )\n end", "def test_pour nom, description\n desc description\n task nom do\n sh %{rake tous_les_tests TEST=spec/#{nom.to_s}_spec.rb}\n end\nend", "def local_rake_executable\n rake.local_executable\n end", "def rake_functionals(opts=nil)\n if ENV['RUBYOPT']\n # remove bundler/setup require that prematurely checks for gems and crashes\n ENV['RUBYOPT'] = ENV['RUBYOPT'].gsub(%r{-r\\s*bundler/setup}, '')\n end\n # runs all the tests for each ruby version in each rails dir\n system(\"bash test/test.sh #{opts}\")\nend", "def run file_name \n application = select_app file_name \n system \"#{application} #{file_name}\" \n end", "def run_local_story(filename, options={})\n run File.join(File.dirname(__FILE__), filename), options\nend", "def cucumber_task(target,environment,url,prefix=\"\")\n cuke_task = CapyBrowser::Rake::CucumberTask.new(target,environment,url,prefix)\n desc cuke_task.description\n task( cuke_task.target, [:command_line_arguments] => CapyBrowser::Rake.dependencies) do |task,args|\n args.with_defaults(:command_line_arguments => \"\")\n puts CapyBrowser::Rake.cucumber(cuke_task.command_line( args.command_line_arguments)).invoke!\n end\nend", "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n\n res = typed_file_task get_rake_task_type(), get_task_name => object_multitask do\n cmd = calc_command_line\n Dir.chdir(@project_dir) do\n mapfileStr = @mapfile ? \" >#{@mapfile}\" : \"\"\n rd, wr = IO.pipe\n cmdLinePrint = cmd\n printCmd(cmdLinePrint, \"Linking #{executable_name}\", false) #OK\n cmd << {\n :out=> @mapfile ? \"#{@mapfile}\" : wr, # > xy.map\n :err=>wr\n }\n sp = spawn(*cmd)\n cmd.pop\n # for console print\n cmd << \" >#{@mapfile}\" if @mapfile\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmdLinePrint, consoleOutput, @tcs[:LINKER][:ERROR_PARSER], nil)\n check_config_file()\n post_link_hook(@tcs[:LINKER])\n end\n end\n res.tags = tags\n res.immediate_output = true\n res.enhance(@config_files)\n res.enhance([@project_dir + \"/\" + @linker_script]) if @linker_script\n\n add_output_dir_dependency(get_task_name, res, true)\n add_grouping_tasks(get_task_name)\n setup_rake_dependencies(res, object_multitask)\n\n # check that all source libs are checked even if they are not a real rake dependency (can happen if \"build this project only\")\n begin\n libChecker = task get_task_name+\"LibChecker\" do\n if File.exists?(get_task_name) # otherwise the task will be executed anyway\n all_dependencies.each do |bb|\n if bb and StaticLibrary === bb\n f = bb.get_task_name # = abs path of library\n if not File.exists?(f) or File.mtime(f) > File.mtime(get_task_name)\n def res.needed?\n true\n end\n break\n end\n end\n end\n end\n end\n rescue\n def res.needed?\n true\n end\n end\n libChecker.transparent_timestamp = true\n res.enhance([libChecker])\n\n return res\n end", "def run(target, verbose: false)\n if target.is_a?(Service)\n if target.pid?\n puts \"Service `#{target.name}` already running, use `#{bin} restart #{target.name}` to restart.\"\n return\n elsif root?\n puts \"Service `#{target.name}` cannot be run (but can be started) as root.\"\n return\n end\n end\n\n Array(target).each do |service|\n service_load(service, enable: false)\n end\n end", "def run_tests(m)\n IO.popen(\"cd #{FANCY_DIR} && rake test\", \"r\") do |o|\n lines = o.readlines\n failed = lines.select{|l| l =~ /FAILED:/}\n amount = failed.size\n if amount > 0\n failed << \"=> #{amount} failed tests!\"\n gist_url = paste_text(failed.join, \"rake test\")\n end\n m.reply \"=> #{amount} failed tests! See: #{gist_url}\"\n end\n end", "def run_tests(sketch, type)\n sh %{rake make:#{type} sketch=examples/#{sketch}}\nend", "def invoke!(args = [], options = {:capture => true})\n output = nil\n # Some commands work with a directory that doesn't yet exist\n dir = File.exists?(project_root) ? project_root : '.'\n Dir.chdir(dir) do\n if options[:capture]\n output = capture_output(proc { thor_class.start(args) })\n else\n thor_class.start(args)\n end\n end\n end", "def maven(*goals)\n Dir.chdir(\"./recipeminer-java\") { |path| system('/usr/bin/mvn', *goals)}\nend", "def single_target(user, pass, target, evil)\n\tputs \"Running psexec #{user} #{pass} #{target} #{evil}.....\"\n\tif @home == @tools\n\t\tsystem(\"psexec.rb #{user} #{pass} #{target} #{evil}\")\n\telse\n\t\tDir.chdir(\"#{MSF}tools/\") {\n\t\t\tsystem(\"psexec.rb #{user} #{pass} #{target} #{evil}\")\n\t\t}\n\tend\nend", "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "def invoke_build_task\n Log.info :build, \"Running the build task\"\n call_or_invoke_task config.build_task\n end", "def run_command(broker, targets, command, **kwargs, &block)\n params = { command: command }\n do_module_action(broker, agent_identities(targets), 'command', 'run', params, **kwargs, &block)\nend", "def test_dry_run_bug\n rakefile_dryrun\n\n rake\n\n FileUtils.rm_f \"temp_one\"\n\n rake \"--dry-run\"\n\n refute_match(/No such file/, @out)\n end", "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def rake\n app.init 'stratus'\n app.load_rakefile\n app.top_level\n end", "def exec\n FileUtils.cd(@dest) do\n puts \"Running `bundle install` in #{Dir.pwd}\"\n system(\"bundle install\")\n end\n end" ]
[ "0.8038424", "0.72597986", "0.7108391", "0.7108391", "0.7108391", "0.7050125", "0.6764478", "0.6604507", "0.6604507", "0.6595312", "0.6496554", "0.634112", "0.62914366", "0.62500584", "0.6182974", "0.61442274", "0.6118453", "0.609759", "0.60698587", "0.6042244", "0.60379475", "0.60094756", "0.5964546", "0.596228", "0.5895842", "0.5809363", "0.580499", "0.57613677", "0.57557744", "0.57483894", "0.57132024", "0.5706361", "0.5637392", "0.56058514", "0.5603441", "0.5578445", "0.5573061", "0.5573061", "0.5573061", "0.5573061", "0.5519105", "0.5510161", "0.5506347", "0.5505995", "0.54287225", "0.5428143", "0.5428143", "0.54217345", "0.54181653", "0.5395828", "0.53706276", "0.53525496", "0.5329282", "0.5327631", "0.52907133", "0.528566", "0.5283087", "0.5263063", "0.52475506", "0.52305055", "0.52191013", "0.52154166", "0.5208232", "0.5202382", "0.5173472", "0.5164913", "0.51639384", "0.5163775", "0.5156783", "0.5156783", "0.51557416", "0.5151553", "0.5135481", "0.5127163", "0.5127163", "0.5117879", "0.51048803", "0.50842273", "0.5068066", "0.5067294", "0.5054903", "0.50371355", "0.50304836", "0.50143427", "0.5010214", "0.5003651", "0.499811", "0.49963808", "0.49921283", "0.49917", "0.49824432", "0.49695647", "0.496122", "0.4956025", "0.4927505", "0.49111062", "0.49077335", "0.49077335", "0.49057212", "0.48887315" ]
0.8239398
0
Constructs a new task for the project/target combination. The target will invoke a rake target on the subproject
def createTask(project, target) task "#{project}.#{target}" do print "#######################################################\n" invokeRake project, target end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_tasks\n super\n all_object_files = []\n all_object_folders = []\n @toolchains.each do |toolchain, sources|\n toolchain.add_include_paths(@api_headers+@configuration_headers)\n object_files, object_folders = toolchain.create_compile_tasks(sources)\n all_object_files |= object_files\n all_object_folders |= object_folders\n end\n\n project_filename = @parent_project.project_name.to_s.gsub(':','-')\n library_files, library_folders = @default_toolchain.create_static_library_tasks(all_object_files, project_filename)\n dependencies = @dependencies+all_object_folders+library_folders+library_files\n\n desc \"Build library '#{@parent_project.project_name}' with configuration '#{@configuration_name}'\"\n new_task = static_library_task @configuration_name => dependencies do |t|\n @post_build.call if @post_build.respond_to? :call\n puts \"built library #{t.name}.\"\n @tests.each do |test|\n if Rake::Task.task_defined? test\n Rake::Task[test].invoke\n else\n $stderr.puts \"warning: Skipping unknown test '#{test}'\"\n end\n end\n end\n new_task.api_headers = @api_headers\n new_task.configuration_headers = @configuration_headers\n new_task.library_files = library_files\n end", "def initialize(*args)\n super\n\n self.targets.each do |tgt|\n tgt_f = application.define_task(Rake::FileTask, File.join(self.to_s, tgt))\n tgt_f.comment = \"Build #{tgt} in #{self}\"\n tgt_f.enhance([self])\n end\n end", "def build(rakeTask)\n\t\tprintAndCall(@cmd)\n\tend", "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "def create_project_with_task(project_options: {}, task_options: {})\n project = create_project(project_options)\n task = create_task(task_options)\n project.tasks << task\n\n return project\n end", "def build_rake_step(b, tasks)\n b.tag! \"hudson.plugins.rake.Rake\" do\n b.rakeInstallation \"(Default)\"\n b.rakeFile\n b.rakeLibDir\n b.rakeWorkingDir\n b.tasks tasks\n b.silent false\n end\n end", "def rake_task task_name\n @rake.invoke_task task_name\n end", "def rake(task,*args)\n run 'rake', rake_task(task,*args)\n end", "def remote_rake(task)\n on primary(:app) do\n within current_path do\n with rails_env: fetch(:rails_env) do\n rake task\n end\n end\n end\n end", "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n archiver = @tcs[:ARCHIVER]\n\n res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do\n cmd = calc_command_line\n aname = calc_archive_name\n Dir.chdir(@project_dir) do\n FileUtils.rm(aname) if File.exists?(aname)\n# cmd.map! {|c| c.include?(' ') ? \"\\\"#{c}\\\"\" : c }\n rd, wr = IO.pipe\n cmd << {\n :err => wr,\n :out => wr\n }\n sp = spawn(*cmd)\n cmd.pop\n\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmd, consoleOutput, @tcs[:ARCHIVER][:ERROR_PARSER], \"Creating #{aname}\")\n\n check_config_file()\n end\n end\n res.tags = tags\n enhance_with_additional_files(res)\n add_output_dir_dependency(get_task_name, res, true)\n\n add_grouping_tasks(get_task_name)\n\n setup_rake_dependencies(res, object_multitask)\n return res\n end", "def initialize(programName, build, config)\n @programName = Makr.cleanPathName(programName)\n super(ProgramTask.makeName(@programName), config)\n @build = build\n\n # first we make dependency on the target program file\n @targetDep = @build.getOrMakeNewTask(@programName) {FileTask.new(@programName, false)}\n addDependencyUnique(@targetDep)\n @targets = [@programName]\n\n # now add another dependency task on the config\n @configDep = @build.getOrMakeNewTask(ConfigTask.makeName(@name)) {ConfigTask.new(ConfigTask.makeName(@name))}\n addDependencyUnique(@configDep)\n\n @extraStaticLibs = Array.new # for static libs specified by user\n @useStaticLibsGroup = true\n @useGoldLinker = false\n\n Makr.log.debug(\"made ProgramTask with @name=\\\"\" + @name + \"\\\"\")\n end", "def build(rakeTask)\n\t\t#we've called ourselves after updating prereqs and running them; now do our work\n\t\t\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes non-file prereq tasks, so do our own\n\t\t\tlinker().link(:objs => linkDepsOrdered(), :target => target())\n\t\tend\n\tend", "def new\n @task = @project.tasks.build\n end", "def setup_target\n link_target_task project.target, (project.sources + [project.main]).map {|fn| objectsify fn }\n end", "def define_task(task_class, *args, &block)\n @ProjectFileLoader.CurrentlyLoadedProjectFile().define_task(task_class, *args, &block)\n end", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def build_rake_step\n @rake_task << self.global_config # Open the rake Stek and get General Configuration information\n @rake_task << (self.render self.get_config_template) # get Specific Configuration. Defined in the [tool].rb module file (erb)\n @opt_parser.check_error # stop here if errors found in the configuration\n @rake_task << self.test_validation # step is already done ? Defined in the tool_template.rb file\n @rake_task << (self.render self.tool_template) # get specific Task Code. Defined in the [tool].rb module file (erb)\n @rake_task << self.write_validation # write the check file Defined in the tool_template.rb file\n @rake_task << self.close_step # To close the rake Step Defined in the tool_template.rb file\n end", "def run_build_task(klass)\n verbose { TraceInfo.new(:build_task, klass, :green) }\n klass = eval(\"::Texas::Build::Task::#{klass}\") if [Symbol, String].include?(klass.class)\n klass.new(self).run\n end", "def ruby_rake_task(task)\n Rake::Task[task].invoke\nend", "def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end", "def target(name)\n Target.load_from(self.targets_path.join(name,'target.rake')).tap do |target|\n target.application = self\n end\n end", "def build_task(argv)\n arguments = argv.dup\n task_name = arguments.shift\n klazz = Task.from_name(task_name)\n klazz.new(*klazz.parse_options!(arguments))\n rescue NameError\n task_not_found(task_name)\n exit(FALSE)\n rescue ArgumentError\n help(task_name)\n exit(FALSE)\n end", "def generate_rake_tasks\n @rake_tasks = outputs.map do |output, inputs|\n additional_paths = []\n inputs.each do |input|\n\n create_file_task(input.fullpath).dynamic do\n additional_paths += additional_dependencies(input)\n end\n end\n additional_paths.each { |path| create_file_task(path) }\n\n create_file_task(output.fullpath, inputs.map(&:fullpath)) do\n output.create { generate_output(inputs, output) }\n end\n end\n end", "def define\n desc @description\n task @name => Array(deps) do\n FileUtilsExt.verbose(@verbose) do\n puts \"Use TESTOPTS=\\\"--verbose\\\" to pass --verbose\" \\\n \", etc. to runners.\" if ARGV.include? \"--verbose\"\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{file_list_string} #{option_list}\"\n ruby args do |ok, status|\n if !ok && status.respond_to?(:signaled?) && status.signaled?\n raise SignalException.new(status.termsig)\n elsif !ok\n status = \"Command failed with status (#{status.exitstatus})\"\n details = \": [ruby #{args}]\"\n message =\n if Rake.application.options.trace or @verbose\n status + details\n else\n status\n end\n\n fail message\n end\n end\n end\n end\n self\n end", "def define_tasks!\n\n define_test_tasks! if has_tests?\n define_rspec_tasks! if has_specs?\n\n namespace(@task_namespace) do\n desc \"Updates the filelist in the gemspec file\"\n task(:manifest) { manifest_task }\n\n desc \"Builds the .gem package\"\n task(:build => :manifest) { build_task }\n\n desc \"Sets the version of the gem in the gemspec\"\n task(:set_version => [:check_version, :check_current_branch]) { version_task }\n task(:check_version => :fetch_origin) { check_version_task }\n\n task(:fetch_origin) { fetch_origin_task }\n task(:check_current_branch) { check_current_branch_task }\n task(:check_clean_status) { check_clean_status_task }\n task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }\n\n checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]\n checks.unshift('spec:basic') if has_specs?\n checks.unshift('test:basic') if has_tests?\n # checks.push << [:check_rubyforge] if gemspec.rubyforge_project\n\n desc \"Perform all checks that would occur before a release\"\n task(:release_checks => checks)\n\n release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]\n # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project\n\n desc \"Release a new version of the gem using the VERSION environment variable\"\n task(:release => release_tasks) { release_task }\n \n namespace(:release) do\n desc \"Release the next version of the gem, by incrementing the last version segment by 1\"\n task(:next => [:next_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a patch increment (0.0.1)\"\n task(:patch => [:next_patch_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a minor increment (0.1.0)\"\n task(:minor => [:next_minor_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a major increment (1.0.0)\"\n task(:major => [:next_major_version] + release_tasks) { release_task }\n end\n\n # task(:check_rubyforge) { check_rubyforge_task }\n # task(:rubyforge_release) { rubyforge_release_task }\n task(:gemcutter_release) { gemcutter_release_task }\n task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }\n task(:tag_version) { tag_version_task }\n task(:commit_modified_files) { commit_modified_files_task }\n\n task(:next_version) { next_version_task }\n task(:next_patch_version) { next_version_task(:patch) }\n task(:next_minor_version) { next_version_task(:minor) }\n task(:next_major_version) { next_version_task(:major) }\n \n desc \"Updates the gem release tasks with the latest version on Github\"\n task(:update_tasks) { update_tasks_task }\n end\n end", "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n\n res = typed_file_task get_rake_task_type(), get_task_name => object_multitask do\n cmd = calc_command_line\n Dir.chdir(@project_dir) do\n mapfileStr = @mapfile ? \" >#{@mapfile}\" : \"\"\n rd, wr = IO.pipe\n cmdLinePrint = cmd\n printCmd(cmdLinePrint, \"Linking #{executable_name}\", false) #OK\n cmd << {\n :out=> @mapfile ? \"#{@mapfile}\" : wr, # > xy.map\n :err=>wr\n }\n sp = spawn(*cmd)\n cmd.pop\n # for console print\n cmd << \" >#{@mapfile}\" if @mapfile\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmdLinePrint, consoleOutput, @tcs[:LINKER][:ERROR_PARSER], nil)\n check_config_file()\n post_link_hook(@tcs[:LINKER])\n end\n end\n res.tags = tags\n res.immediate_output = true\n res.enhance(@config_files)\n res.enhance([@project_dir + \"/\" + @linker_script]) if @linker_script\n\n add_output_dir_dependency(get_task_name, res, true)\n add_grouping_tasks(get_task_name)\n setup_rake_dependencies(res, object_multitask)\n\n # check that all source libs are checked even if they are not a real rake dependency (can happen if \"build this project only\")\n begin\n libChecker = task get_task_name+\"LibChecker\" do\n if File.exists?(get_task_name) # otherwise the task will be executed anyway\n all_dependencies.each do |bb|\n if bb and StaticLibrary === bb\n f = bb.get_task_name # = abs path of library\n if not File.exists?(f) or File.mtime(f) > File.mtime(get_task_name)\n def res.needed?\n true\n end\n break\n end\n end\n end\n end\n end\n rescue\n def res.needed?\n true\n end\n end\n libChecker.transparent_timestamp = true\n res.enhance([libChecker])\n\n return res\n end", "def build(rakeTask)\n\t\tunless uptodate?(@output, [@input]) #the check rake does always fails because it includes non-file prereq tasks, so do our own\n\t\t\tprintAndCall(\"#{@mocpath} -o #{@output} #{@input}\")\n\t\tend\n\tend", "def _task_( library, name, &params )\n item = library.get(name)\n item.parent = self\n item.merge_instance_variables(self)\n item.instance_eval(&params) if block_given?\n item.generate\n end", "def define_run_task\n desc @run_description\n task 'run' do\n target_sha = ENV['TARGET_SHA']\n ts = TTNT::TestSelector.new(repo, target_sha, expanded_file_list)\n tests = ts.select_tests!\n\n if tests.empty?\n STDERR.puts 'No test selected.'\n else\n if ENV['ISOLATED']\n tests.each do |test|\n args = \"#{ruby_opts_string} #{test} #{option_list}\"\n run_ruby args\n break if @failed && ENV['FAIL_FAST']\n end\n else\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{tests.to_a.join(' ')} #{option_list}\"\n run_ruby args\n end\n end\n end\n end", "def simple_rake_task(task_name = 'test_task', indent: '', task_body: \"\\n\")\n \"\\n\" + indent +\n \"desc 'task named #{task_name}'\\n\" +\n indent + \"task :#{task_name} do\\n\" +\n indent + \" \" + task_body +\n indent + \"end\\n\\n\"\n\n end", "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n archiver = @tcs[:ARCHIVER]\n\n res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do\n dir = @project_dir\n objs = @objects\n aname = get_archive_name\n \n if @output_dir_abs\n dir = @output_dir\n prefix = File.rel_from_to_project(@project_dir, @output_dir)\n objs.map! { |m| m[prefix.length..-1] }\n aname = aname[prefix.length..-1]\n end\n \n Dir.chdir(dir) do\n\n FileUtils.rm(aname) if File.exists?(aname)\n cmd = [archiver[:COMMAND]] # ar\n cmd += archiver[:ARCHIVE_FLAGS].split(\" \")\n cmd += archiver[:FLAGS].split(\" \") # --all_load\n cmd << aname # -o debug/x.exe\n cmd += objs\n\n if Cxxproject::Utils.old_ruby?\n cmdLine = cmd.join(\" \")\n if cmdLine.length > 8000\n inputName = aname+\".tmp\"\n File.open(inputName,\"wb\") { |f| f.write(cmd[1..-1].join(\" \")) }\n consoleOutput = `#{archiver[:COMMAND] + \" @\" + inputName}`\n else\n consoleOutput = `#{cmd.join(\" \")} 2>&1`\n end\n else\n rd, wr = IO.pipe\n cmd << {\n :err=>wr,\n :out=>wr\n }\n sp = spawn(*cmd)\n cmd.pop\n \n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n end\n\n process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], \"Creating #{aname}\")\n end\n end\n\n enhance_with_additional_files(res)\n add_output_dir_dependency(get_task_name, res, true)\n\n add_grouping_tasks(get_task_name)\n\n setup_rake_dependencies(res)\n return res\n end", "def rake project_symbol, options = {}, &gem_config\n program_file = first_caller_file\n program_home = File.dirname(program_file)\n\n # load the project module\n program_name = File.basename(program_home)\n\n require File.join('lib', program_name)\n project_module = fetch_project_module(project_symbol)\n\n # supply default options\n options[:rubyforge_project] ||= program_name\n options[:rubyforge_section] ||= program_name\n options[:raa_project] ||= program_name\n options[:license_file] ||= 'LICENSE'\n options[:logins_file] ||= File.join(ENV['HOME'], '.config', 'inochi', 'logins.yaml')\n options[:upload_delete] ||= false\n options[:upload_options] ||= []\n \n authors = project_module.const_get(:AUTHORS) rescue nil\n unless authors\n # add AUTHORS constant to the project module\n license = File.read(options[:license_file])\n\n copyright_holders =\n license.scan(/Copyright.*?\\d+\\s+(.*)/).flatten.\n map {|s| (s =~ /\\s*<(.*?)>/) ? [$`, $1] : [s, ''] }\n\n project_module.const_set :AUTHORS, copyright_holders\n end\n\n require 'rake/clean'\n\n hide_rake_task = lambda do |name|\n Rake::Task[name].instance_variable_set :@comment, nil\n end\n\n # documentation\n desc 'Build all documentation.'\n task :doc => %w[ doc:api doc:man ]\n\n # user manual\n doc_man_src = 'doc/index.erb'\n doc_man_dst = 'doc/index.xhtml'\n doc_man_deps = FileList['doc/*.erb']\n\n doc_man_doc = nil\n task :doc_man_doc => doc_man_src do\n unless doc_man_doc\n unless project_symbol == :ERBook\n gem 'erbook', '~> 6'\n require 'erbook'\n end\n\n doc_man_txt = File.read(doc_man_src)\n doc_man_doc = ERBook::Document.new(:xhtml, doc_man_txt, doc_man_src, :unindent => true)\n end\n end\n\n desc 'Build the user manual.'\n task 'doc:man' => doc_man_dst\n\n file doc_man_dst => doc_man_deps do\n Rake::Task[:doc_man_doc].invoke\n File.write doc_man_dst, doc_man_doc\n end\n\n CLOBBER.include doc_man_dst\n\n # API reference\n doc_api_dst = 'doc/api'\n\n desc 'Build API reference.'\n task 'doc:api' => doc_api_dst\n\n require 'yard'\n YARD::Rake::YardocTask.new doc_api_dst do |t|\n t.options.push '--protected',\n '--output-dir', doc_api_dst,\n '--readme', options[:license_file]\n\n task doc_api_dst => options[:license_file]\n end\n\n hide_rake_task[doc_api_dst]\n\n CLEAN.include '.yardoc'\n CLOBBER.include doc_api_dst\n\n # announcements\n desc 'Build all release announcements.'\n task :ann => %w[ ann:feed ann:html ann:text ann:mail ]\n\n # it has long been a tradition to use an \"[ANN]\" prefix\n # when announcing things on the ruby-talk mailing list\n ann_prefix = '[ANN] '\n ann_subject = ann_prefix + project_module::DISPLAY\n ann_project = ann_prefix + project_module::PROJECT\n\n # fetch the project summary from user manual\n ann_nfo_doc = nil\n task :ann_nfo_doc => :doc_man_doc do\n ann_nfo_doc = $project_summary_node\n end\n\n # fetch release notes from user manual\n ann_rel_doc = nil\n task :ann_rel_doc => :doc_man_doc do\n unless ann_rel_doc\n if parent = $project_history_node\n if child = parent.children.first\n ann_rel_doc = child\n else\n raise 'The \"project_history\" node in the user manual lacks child nodes.'\n end\n else\n raise 'The user manual lacks a \"project_history\" node.'\n end\n end\n end\n\n # build release notes in HTML and plain text\n # converts the given HTML into plain text. we do this using\n # lynx because (1) it outputs a list of all hyperlinks used\n # in the HTML document and (2) it runs on all major platforms\n convert_html_to_text = lambda do |html|\n require 'tempfile'\n\n begin\n # lynx's -dump option requires a .html file\n tmp_file = Tempfile.new(Inochi::PROGRAM).path + '.html'\n\n File.write tmp_file, html\n text = `lynx -dump #{tmp_file} -width 70`\n ensure\n File.delete tmp_file\n end\n\n # improve readability of list items that span multiple\n # lines by adding a blank line between such items\n text.gsub! %r{^( *[^\\*\\s].*)(\\r?\\n)( *\\* \\S)}, '\\1\\2\\2\\3'\n\n text\n end\n\n # binds relative addresses in the given HTML to the project docsite\n resolve_html_links = lambda do |html|\n # resolve relative URLs into absolute URLs\n # see http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax\n require 'addressable/uri'\n uri = Addressable::URI.parse(project_module::DOCSITE)\n doc_url = uri.to_s\n dir_url = uri.path =~ %r{/$|^$} ? doc_url : File.dirname(doc_url)\n\n html.to_s.gsub %r{(href=|src=)(.)(.*?)(\\2)} do |match|\n a, b = $1 + $2, $3.to_s << $4\n\n case $3\n when %r{^[[:alpha:]][[:alnum:]\\+\\.\\-]*://} # already absolute\n match\n\n when /^#/\n a << File.join(doc_url, b)\n\n else\n a << File.join(dir_url, b)\n end\n end\n end\n\n ann_html = nil\n task :ann_html => [:doc_man_doc, :ann_nfo_doc, :ann_rel_doc] do\n unless ann_html\n ann_html = %{\n <center>\n <h1>#{project_module::DISPLAY}</h1>\n <p>#{project_module::TAGLINE}</p>\n <p>#{project_module::WEBSITE}</p>\n </center>\n #{ann_nfo_doc}\n #{ann_rel_doc}\n }\n\n # remove heading navigation menus\n ann_html.gsub! %r{<div class=\"nav\"[^>]*>(.*?)</div>}, ''\n\n ann_html = resolve_html_links[ann_html]\n end\n end\n\n ann_text = nil\n task :ann_text => :ann_html do\n unless ann_text\n ann_text = convert_html_to_text[ann_html]\n end\n end\n\n ann_nfo_text = nil\n task :ann_nfo_text => :ann_nfo_doc do\n unless ann_nfo_text\n ann_nfo_html = resolve_html_links[ann_nfo_doc]\n ann_nfo_text = convert_html_to_text[ann_nfo_html]\n end\n end\n\n # HTML\n ann_html_dst = 'ANN.html'\n\n desc \"Build HTML announcement: #{ann_html_dst}\"\n task 'ann:html' => ann_html_dst\n\n file ann_html_dst => doc_man_deps do\n Rake::Task[:ann_html].invoke\n File.write ann_html_dst, ann_html\n end\n\n CLEAN.include ann_html_dst\n\n # RSS feed\n ann_feed_dst = 'doc/ann.xml'\n\n desc \"Build RSS announcement: #{ann_feed_dst}\"\n task 'ann:feed' => ann_feed_dst\n\n file ann_feed_dst => doc_man_deps do\n require 'time'\n require 'rss/maker'\n\n feed = RSS::Maker.make('2.0') do |feed|\n feed.channel.title = ann_project\n feed.channel.link = project_module::WEBSITE\n feed.channel.description = project_module::TAGLINE\n\n Rake::Task[:ann_rel_doc].invoke\n Rake::Task[:ann_html].invoke\n\n item = feed.items.new_item\n item.title = ann_rel_doc.title\n item.link = project_module::DOCSITE + '#' + ann_rel_doc.here_frag\n item.date = Time.parse(item.title)\n item.description = ann_html\n end\n\n File.write ann_feed_dst, feed\n end\n\n CLOBBER.include ann_feed_dst\n\n # plain text\n ann_text_dst = 'ANN.txt'\n\n desc \"Build plain text announcement: #{ann_text_dst}\"\n task 'ann:text' => ann_text_dst\n\n file ann_text_dst => doc_man_deps do\n Rake::Task[:ann_text].invoke\n File.write ann_text_dst, ann_text\n end\n\n CLEAN.include ann_text_dst\n\n # e-mail\n ann_mail_dst = 'ANN.eml'\n\n desc \"Build e-mail announcement: #{ann_mail_dst}\"\n task 'ann:mail' => ann_mail_dst\n\n file ann_mail_dst => doc_man_deps do\n File.open ann_mail_dst, 'w' do |f|\n require 'time'\n f.puts \"Date: #{Time.now.rfc822}\"\n\n f.puts 'To: [email protected]'\n f.puts 'From: \"%s\" <%s>' % project_module::AUTHORS.first\n f.puts \"Subject: #{ann_subject}\"\n\n Rake::Task[:ann_text].invoke\n f.puts '', ann_text\n end\n end\n\n CLEAN.include ann_mail_dst\n\n # packaging\n desc 'Build a release.'\n task :pak => [:clobber, :doc] do\n sh $0, 'package'\n end\n CLEAN.include 'pkg'\n\n # ruby gem\n require 'rake/gempackagetask'\n\n gem = Gem::Specification.new do |gem|\n authors = project_module::AUTHORS\n\n if author = authors.first\n gem.author, gem.email = author\n end\n\n if authors.length > 1\n gem.authors = authors.map {|name, mail| name }\n end\n\n gem.rubyforge_project = options[:rubyforge_project]\n\n # XXX: In theory, `gem.name` should be assigned to\n # ::PROJECT instead of ::PROGRAM\n #\n # In practice, PROJECT may contain non-word\n # characters and may also contain a mixture\n # of lowercase and uppercase letters.\n #\n # This makes it difficult for people to\n # install the project gem because they must\n # remember the exact spelling used in\n # `gem.name` when running `gem install ____`.\n #\n # For example, consider the \"RedCloth\" gem.\n #\n gem.name = project_module::PROGRAM\n\n gem.version = project_module::VERSION\n gem.summary = project_module::TAGLINE\n gem.description = gem.summary\n gem.homepage = project_module::WEBSITE\n gem.files = FileList['**/*'].exclude('_darcs') - CLEAN\n gem.executables = project_module::PROGRAM\n gem.has_rdoc = true\n\n unless project_module == Inochi\n gem.add_dependency 'inochi', Inochi::VERSION.requirement\n end\n\n project_module::REQUIRE.each_pair do |gem_name, version_reqs|\n gem.add_dependency gem_name, *version_reqs\n end\n\n # additional configuration is done by user\n yield gem if gem_config\n end\n\n Rake::GemPackageTask.new(gem).define\n\n # XXX: hide the tasks defined by the above gem packaging library\n %w[gem package repackage clobber_package].each {|t| hide_rake_task[t] }\n\n # releasing\n desc 'Publish a release.'\n task 'pub' => %w[ pub:pak pub:doc pub:ann ]\n\n # connect to RubyForge services\n pub_forge = nil\n pub_forge_project = options[:rubyforge_project]\n pub_forge_section = options[:rubyforge_section]\n\n task :pub_forge do\n require 'rubyforge'\n pub_forge = RubyForge.new\n pub_forge.configure('release_date' => project_module::RELEASE)\n\n unless pub_forge.autoconfig['group_ids'].key? pub_forge_project\n raise \"The #{pub_forge_project.inspect} project was not recognized by the RubyForge client. Either specify a different RubyForge project by passing the :rubyforge_project option to Inochi.rake(), or ensure that the client is configured correctly (see `rubyforge --help` for help) and try again.\"\n end\n\n pub_forge.login\n end\n\n # documentation\n desc 'Publish documentation to project website.'\n task 'pub:doc' => [:doc, 'ann:feed'] do\n target = options[:upload_target]\n\n unless target\n require 'addressable/uri'\n docsite = Addressable::URI.parse(project_module::DOCSITE)\n\n # provide uploading capability to websites hosted on RubyForge\n if docsite.host.include? '.rubyforge.org'\n target = \"#{pub_forge.userconfig['username']}@rubyforge.org:#{File.join '/var/www/gforge-projects', options[:rubyforge_project], docsite.path}\"\n end\n end\n\n if target\n cmd = ['rsync', '-auvz', 'doc/', \"#{target}/\"]\n cmd.push '--delete' if options[:upload_delete]\n cmd.concat options[:upload_options]\n\n p cmd\n sh(*cmd)\n end\n end\n\n # announcement\n desc 'Publish all announcements.'\n task 'pub:ann' => %w[ pub:ann:forge pub:ann:raa pub:ann:talk ]\n\n # login information\n ann_logins_file = options[:logins_file]\n ann_logins = nil\n\n task :ann_logins do\n ann_logins = begin\n require 'yaml'\n YAML.load_file ann_logins_file\n rescue => e\n warn \"Could not read login information from #{ann_logins_file.inspect}:\"\n warn e\n warn \"** You will NOT be able to publish release announcements! **\"\n {}\n end\n end\n\n desc 'Announce to RubyForge news.'\n task 'pub:ann:forge' => :pub_forge do\n project = options[:rubyforge_project]\n\n if group_id = pub_forge.autoconfig['group_ids'][project]\n # check if this release was already announced\n require 'mechanize'\n www = WWW::Mechanize.new\n page = www.get \"http://rubyforge.org/news/?group_id=#{group_id}\"\n\n posts = (page/'//a[starts-with(./@href, \"/forum/forum.php?forum_id=\")]/text()').map {|e| e.to_s.gsub(\"\\302\\240\", '').strip }\n\n already_announced = posts.include? ann_subject\n\n if already_announced\n warn \"This release was already announced to RubyForge news, so I will NOT announce it there again.\"\n else\n # make the announcement\n Rake::Task[:ann_text].invoke\n pub_forge.post_news project, ann_subject, ann_text\n\n puts \"Successfully announced to RubyForge news:\"\n puts page.uri\n end\n else\n raise \"Could not determine the group_id of the #{project.inspect} RubyForge project. Run `rubyforge config` and try again.\"\n end\n end\n\n desc 'Announce to ruby-talk mailing list.'\n task 'pub:ann:talk' => :ann_logins do\n host = 'http://ruby-forum.com'\n ruby_talk = 4 # ruby-talk forum ID\n\n require 'mechanize'\n www = WWW::Mechanize.new\n\n # check if this release was already announced\n already_announced =\n begin\n page = www.get \"#{host}/forum/#{ruby_talk}\", :filter => %{\"#{ann_subject}\"}\n\n posts = (page/'//div[@class=\"forum\"]//a[starts-with(./@href, \"/topic/\")]/text()').map {|e| e.to_s.strip }\n posts.include? ann_subject\n rescue\n false\n end\n\n if already_announced\n warn \"This release was already announced to the ruby-talk mailing list, so I will NOT announce it there again.\"\n else\n # log in to RubyForum\n page = www.get \"#{host}/user/login\"\n form = page.forms.first\n\n if login = ann_logins['www.ruby-forum.com']\n form['name'] = login['user']\n form['password'] = login['pass']\n end\n\n page = form.click_button # use the first submit button\n\n if (page/'//a[@href=\"/user/logout\"]').empty?\n warn \"Could not log in to RubyForum using the login information in #{ann_logins_file.inspect}, so I can NOT announce this release to the ruby-talk mailing list.\"\n else\n # make the announcement\n page = www.get \"#{host}/topic/new?forum_id=#{ruby_talk}\"\n form = page.forms.first\n\n Rake::Task[:ann_text].invoke\n form['post[subject]'] = ann_subject\n form['post[text]'] = ann_text\n\n form.checkboxes.first.check # enable email notification\n page = form.submit\n\n errors = [page/'//div[@class=\"error\"]/text()'].flatten\n if errors.empty?\n puts \"Successfully announced to ruby-talk mailing list:\"\n puts page.uri\n else\n warn \"Could not announce to ruby-talk mailing list:\"\n warn errors.join(\"\\n\")\n end\n end\n end\n end\n\n desc 'Announce to RAA (Ruby Application Archive).'\n task 'pub:ann:raa' => :ann_logins do\n show_page_error = lambda do |page, message|\n warn \"#{message}, so I can NOT announce this release to RAA:\"\n warn \"#{(page/'h2').text} -- #{(page/'p').first.text.strip}\"\n end\n\n resource = \"#{options[:raa_project].inspect} project entry on RAA\"\n\n require 'mechanize'\n www = WWW::Mechanize.new\n page = www.get \"http://raa.ruby-lang.org/update.rhtml?name=#{options[:raa_project]}\"\n\n if form = page.forms[1]\n resource << \" (owned by #{form.owner.inspect})\"\n\n Rake::Task[:ann_nfo_text].invoke\n form['description'] = ann_nfo_text\n form['description_style'] = 'Pre-formatted'\n form['short_description'] = project_module::TAGLINE\n form['version'] = project_module::VERSION\n form['url'] = project_module::WEBSITE\n form['pass'] = ann_logins['raa.ruby-lang.org']['pass']\n\n page = form.submit\n\n if page.title =~ /error/i\n show_page_error[page, \"Could not update #{resource}\"]\n else\n puts \"Successfully announced to RAA (Ruby Application Archive).\"\n end\n else\n show_page_error[page, \"Could not access #{resource}\"]\n end\n end\n\n # release packages\n desc 'Publish release packages to RubyForge.'\n task 'pub:pak' => :pub_forge do\n # check if this release was already published\n version = project_module::VERSION\n packages = pub_forge.autoconfig['release_ids'][pub_forge_section]\n\n if packages and packages.key? version\n warn \"The release packages were already published, so I will NOT publish them again.\"\n else\n # create the FRS package section\n unless pub_forge.autoconfig['package_ids'].key? pub_forge_section\n pub_forge.create_package pub_forge_project, pub_forge_section\n end\n\n # publish the package to the section\n uploader = lambda do |command, *files|\n pub_forge.__send__ command, pub_forge_project, pub_forge_section, version, *files\n end\n\n Rake::Task[:pak].invoke\n packages = Dir['pkg/*.[a-z]*']\n\n unless packages.empty?\n # NOTE: use the 'add_release' command ONLY for the first\n # file because it creates a new sub-section on the\n # RubyForge download page; we do not want one package\n # per sub-section on the RubyForge download page!\n #\n uploader[:add_release, packages.shift]\n\n unless packages.empty?\n uploader[:add_file, *packages]\n end\n\n puts \"Successfully published release packages to RubyForge.\"\n end\n end\n end\n end", "def create_project_target(target, project, machine, pool)\n handle_action_exceptions(__method__) do\n cmd_line = [\n \"createprojecttarget '#{target}' '#{project}' \"\\\n \"'#{machine}' '#{pool}'\"\n ]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def foreground_rake(task)\n on roles(:app) do\n execute \"cd #{release_path} && bundle exec rake RAILS_ENV=#{fetch(:rails_env)} #{task}\"\n end\nend", "def invoke_build_task\n Log.info :build, \"Running the build task\"\n call_or_invoke_task config.build_task\n end", "def build(rakeTask)\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes a non-file prereq task\n\t\t\tstaticLibMaintainer().addOrUpdate(:lib => target(), :objs => filePrereqs)\n\t\t\tstaticLibMaintainer().index(target())\n\t\tend\n\tend", "def invoke_task(task_string)\n #puts \"invoking task: '#{task_string}'\"\n taskPath, args = parse_task_string(task_string)\n #puts \"parsed args are #{args}\"\n \n projectPath, name = GetProjectFilePathName(taskPath)\n \n if(projectPath == nil and (name == \"clean\" or name == \"clobber\"))\n # Execute all clean targets\n puts \"Cleaning all projects...\"\n @ProjectFileLoader.LoadedProjectFiles().each do |projFile| \n task = projFile[name]\n task.invoke(*args)\n end\n else\n task = self[taskPath]\n task.invoke(*args)\n end\n end", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def define\n logger.debug \"Defining tasks for #{name} #{version}\"\n\n namespace \"#{name}\" do\n define_download\n define_verify\n define_unpack\n define_patch\n define_build\n define_install\n\n task :done => \"#{name}:install\"\n task :default => \"#{name}:done\"\n end\n\n desc \"Build and Install #{name} #{version}\"\n task name => \"#{name}:default\"\n end", "def initialize(rake_testtask = nil)\n @rake_testtask = rake_testtask || Rake::TestTask.new\n\n # There's no `test_files` method so we can't delegate it\n # to the internal task through `method_missing`.\n @test_files = @rake_testtask.instance_variable_get('@test_files')\n\n yield self if block_given?\n\n target = (name == :test) ? '' : \" for #{name}\"\n @anchor_description = \"Generate test-to-code mapping#{target}\"\n @run_description = \"Run selected tests#{target}\"\n define_tasks\n end", "def generate()\n objects = []\n\n # generate object file tasks\n files.each do |fname|\n output_file = File.join(@build_dir, File.basename(fname).ext('o'))\n objects.push output_file\n file output_file => [ fname ] do\n get_toolchain().compile( fname, output_file )\n end\n end\n\n # Link object files\n file output_file() => objects do\n get_toolchain().link( objects, output_file() )\n end\n\n # Create top level task\n desc \"Build the #{@name} application\"\n task @name => [ output_file() ]\n end", "def rake(*args) run_command('rake', args) end", "def invokeRake(directory, target)\n cmd = \"(cd #{directory}; rake #{target} LIB_DIR=../#{LIB_DIR} DEBUG_FLAG=#{DEBUG_FLAG})\"\n sh cmd\nend", "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "def task(*args, &block)\n args, cond = Rake::Task.strip_conditions(args)\n task = Rake::Task.define_task(*args, &block)\n task.add_conditions cond\n task\n end", "def define_tasks\n # Task definitions are taken from Rake::TestTask\n # https://github.com/ruby/rake/blob/e644af3/lib/rake/testtask.rb#L98-L112\n namespace :ttnt do\n namespace name do\n define_run_task\n define_anchor_task\n end\n end\n end", "def build_default_tasks\n @rake_task << self.step_template # get General Configuration information\n end", "def create_rake_files(base_dir)\n\n one_task_fn = File.join(base_dir, 'one_task.rake')\n make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn)\n\n another_task_fn = File.join(base_dir, 'another_task.rake')\n make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_fn)\n\n my_tasks_mine_fn = File.join(base_dir, 'my_tasks_all_mine.rake')\n make_tasks_in_file(['task1', 'task2', 'task3', 'task4'], my_tasks_mine_fn, namespace: 'mine') if ok_to_create?(my_tasks_mine_fn)\n\n tasks_run_all_fn = File.join(base_dir, 'other_tasks_run_all.rake')\n make_tasks_in_file(['other_task1_run_me', 'other_task2_run_me', 'other_task3_run_me', 'other_task_not_run_yet'], tasks_run_all_fn) if ok_to_create?(tasks_run_all_fn)\n\n tasks_mixed_duplicates_fn = File.join(base_dir, 'other_tasks_mixed_duplicates.rake')\n make_tasks_in_file(['other_task2_run_me', 'other_task3_run_me'], tasks_mixed_duplicates_fn) if ok_to_create?(tasks_mixed_duplicates_fn)\n\n task2_duplicate_fn = File.join(base_dir, 'task2_duplicate.rake')\n make_tasks_in_file(['task2'], task2_duplicate_fn, namespace: 'mine') if ok_to_create?(task2_duplicate_fn)\n\n task4_duplicate_fn = File.join(base_dir, 'task4_duplicate.rake')\n make_tasks_in_file(['task4'], task4_duplicate_fn, namespace: 'mine') if ok_to_create?(task4_duplicate_fn)\n end", "def to_task\n\t\tt = Rubyfocus::Task.new(nil)\n\t\tinstance_variables.each do |ivar|\n\t\t\tnext if ivar == :\"@document\"\n\t\t\tsetter = ivar.to_s.gsub(/^@/,\"\") + \"=\"\n\t\t\tt.send(setter, self.instance_variable_get(ivar))\tif t.respond_to?(setter)\n\t\tend\n\t\tt\n\tend", "def execute\n new_task = Task.new(new_task_attributes)\n assign_location(new_task)\n new_task\n end", "def invokeRake(directory, target)\n cmd = \"(cd #{directory}; rake #{target} BIN_DIR=../#{BIN_DIR} DEBUG_FLAG=#{DEBUG_FLAG})\"\n sh cmd\nend", "def createSimpleTask _obj, _args\n \"_obj createSimpleTask _args;\" \n end", "def define \n desc @description\n task @name => Array(deps) do\n unless Dir.exist?(@outdir)\n Dir.mkdir(@outdir)\n end\n make_file_list\n @file_list.each do |target|\n js = target.execute\n target_file = File.join(@outdir,File.basename(target.file))\n File.open(target_file, 'w') { |f| f.write(js) }\n end\n end\n\n self\n end", "def task name, options={}, &block\n task = Task.new name, options, &block\n TodoRunner.registry[name] = task\n end", "def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend", "def build_and_run_task(task_class, params = nil)\n task_run = TaskRun.new(task_class, params)\n @task_run_stack.last.runs << task_run\n\n @task_run_stack.push(task_run)\n task = super(task_class, params)\n @task_run_stack.pop\n task\n end", "def task_create(task, data=nil)\n if task_present? task\n task = task_get task\n elsif task.is_a? Deployment::Task\n task = task_add task\n else\n task = Deployment::Task.new task, node, data\n task = task_add task\n end\n task.data = data if data\n task\n end", "def call_rake(task, options = {})\n options[:rails_env] ||= Rails.env\n args = options.map { |k,v| \"#{k.to_s.upcase}='#{v}'\" }\n system \"rake #{task} #{args.join(' ')} --trace >> #{Rails.root}/log/rake.log &\"\n end", "def define\n desc default_description unless ::Rake.application.last_description\n\n task(name, [:files]) do |_task, task_args|\n run_cli(task_args)\n end\n end", "def create_tasks\n Application.features[self].each{ |f|\n extend Rake::DSL\n taskname = \"#{f.to_s.split('::').last}\"\n desc \"Feature\"\n task taskname => [\"#{taskname}:install\"] do\n end\n namespace taskname do\n desc \"install #{taskname}\"\n task :install do\n puts \"----> installing #{taskname}\"\n puts \"#{self} | #{f}\"\n Application.install[f.name].each{ |c|\n puts \"#{c}\"\n }\n end\n end \n } if Application.features[self]\n end", "def rake command\n install_deps 'rake', :type => Gem\n @shell.call \"cd #{self.checkout_path} && rake #{command}\"\n end", "def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end", "def call_rake(task, options = {})\n options[:rails_env] ||= Rails.env\n args = options.map { |n, v| \"#{n.to_s.upcase}='#{v}'\" }\n system \"/usr/bin/rake #{task} #{args.join(' ')} --trace 2>&1 >> #{Rails.root}/log/rake.log &\"\n end", "def define\n\t\ttask :foo do\n\t\t\tputs 'foo!'\n\t\tend\n\tend", "def define_anchor_task\n desc @anchor_description\n task 'anchor' do\n # In order to make it possible to stop coverage services like Coveralls\n # which interferes with ttnt/anchor because both use coverage library.\n # See test/test_helper.rb\n ENV['ANCHOR_TASK'] = '1'\n\n Rake::FileUtilsExt.verbose(verbose) do\n # Make it possible to require files in this gem\n gem_root = File.expand_path('../..', __FILE__)\n args =\n \"-I#{gem_root} -r ttnt/anchor \" +\n \"#{ruby_opts_string}\"\n\n expanded_file_list.each do |test_file|\n run_ruby \"#{args} #{test_file}\"\n end\n end\n\n if @code_files\n mapping = TestToCodeMapping.new(repo)\n mapping.select_code_files!(@code_files)\n mapping.write!\n end\n end\n end", "def create_copy_task srcGlob, targetDir, taskSymbol\n mkdir_p(targetDir, :verbose => false)\n FileList[srcGlob].each do |f|\n target = File.join(targetDir, File.basename(f))\n file target => [f] do |t|\n cp f, target\n end\n task taskSymbol => target\n end\nend", "def add_task(task, description = '', parent = @tree)\n task = task.split(':') if task.is_a? String\n current = task.shift\n content = Task.new\n content.command = current\n content.description = description if task.empty?\n if parent[current]\n t = parent[current]\n else\n t = parent << Tree::TreeNode.new(current, content)\n end\n task.empty? ? t : add_task(task, description, t)\n end", "def initialize(libFileName, build, config)\n @libFileName = Makr.cleanPathName(libFileName)\n @libName = File.basename(@libFileName)\n super(StaticLibTask.makeName(@libFileName), config)\n @build = build\n\n # first we need a dependency on the target\n @libTargetDep = @build.getOrMakeNewTask(@libFileName) {FileTask.new(@libFileName, false)}\n addDependencyUnique(@libTargetDep)\n @targets = [@libFileName]\n\n # now add another dependency task on the config\n @configDep = @build.getOrMakeNewTask(ConfigTask.makeName(@name)) {ConfigTask.new(ConfigTask.makeName(@name))}\n addDependencyUnique(@configDep)\n\n Makr.log.debug(\"made StaticLibTask with @name=\\\"\" + @name + \"\\\"\")\n end", "def to_make\n Target.new(@output, @objects, [command, \"ranlib #{output}\"])\n end", "def initialize(fileName, build, config = nil, fileIsGenerated = false, generatorTask = nil)\n @fileName = Makr.cleanPathName(fileName)\n # now we need a unique name for this task. As we're defining a FileTask as dependency to fileName\n # and a FileTask on the @objectFileName to ensure a build of the target if it was deleted or\n # otherwise modified (whatever you can think of here), we need a unique name not related to these\n super(CompileTask.makeName(@fileName), config)\n @build = build\n\n # the dep tasks, that are constructed below are not added yet to the dependencies Array as this is done\n # in buildDependencies(), called before update\n\n # first construct a dependency on the file itself, if it isnt generated\n # (we dont add dependencies yet, as they get added upon automatic dependency generation in\n # the function buildDependencies())\n @fileIsGenerated = fileIsGenerated\n @generatorTaskDep = generatorTask\n if not @fileIsGenerated then\n @compileFileDep = @build.getOrMakeNewTask(@fileName) {FileTask.new(@fileName)}\n end\n\n # construct a dependency task on the target object file\n @objectFileName = makeObjectFileName(fileName)\n @compileTargetDep = @build.getOrMakeNewTask(@objectFileName) {FileTask.new(@objectFileName, false)}\n @targets = [@objectFileName] # set targets produced by this task\n deleteTargets() # delete targets upon construction to guarantee a first update\n\n # construct a dependency task on the configuration\n @configTaskDep = @build.getOrMakeNewTask(ConfigTask.makeName(@name)) {ConfigTask.new(ConfigTask.makeName(@name))}\n\n # then add the dependencies constructed above\n File.delete(@objectFileName + \".d\") rescue nil # first delete an existing dep file\n\n # we call this here to safe code, although no dep file exists, still we need to add the\n # static dependencies (@compileFileDep,...)\n buildDependencies()\n\n Makr.log.debug(\"made CompileTask with @name=\\\"\" + @name + \"\\\"\") # debug feedback\n end", "def generate_targets\n has_metaname = has_version?\n\n %w[clean update fetch configure export build install].each do |target|\n target_name = \"#{@name}_#{target}\".to_sym\n target_metaname = \"#{@metaname}_#{target}\".to_sym if has_metaname\n func = pkg_default_target_func(@name.to_sym, target)\n\n task = Rake::Task.define_task(target_name, &func)\n metatask = Rake::Task.define_task(target_metaname, &func) if has_metaname\n\n # Add per-task dependency\n case target\n when /install/i\n task.enhance([\"#{@name}_build\".to_sym])\n metatask.enhance([\"#{@metaname}_build\".to_sym]) if has_metaname\n when /build/i\n task.enhance([\"#{@name}_export\".to_sym])\n metatask.enhance([\"#{@metaname}_export\".to_sym]) if has_metaname\n\n # Generate package export dependencies\n @build_deps.each do |dep|\n task.enhance([\"#{dep}_export\".to_sym])\n metatask.enhance([\"#{dep}_export\".to_sym]) if has_metaname\n end\n\n # Generate package build dependencies\n @clean_deps.each do |dep|\n task.enhance([\"#{dep}_install\".to_sym])\n metatask.enhance([\"#{dep}_install\".to_sym]) if has_metaname\n end\n when /export/i\n task.enhance([\"#{@name}_configure\".to_sym])\n metatask.enhance([\"#{@metaname}_configure\".to_sym]) if has_metaname\n when /configure/i\n task.enhance([\"#{@name}_fetch\".to_sym])\n metatask.enhance([\"#{@metaname}_fetch\".to_sym]) if has_metaname\n when /clean/i\n # Generate package clean dependencies\n @clean_deps.each do |dep|\n task.enhance([\"#{dep}_clean\".to_sym])\n metatask.enhance([\"#{dep}_clean\".to_sym]) if has_metaname\n end\n end\n\n update_global_task(target, target_name)\n end\n\n # Create the default package task named after the package name\n task = Rake::Task.define_task(\"#{@name}\" => [\"#{@name}_install\".to_sym])\n metatask = Rake::Task.define_task(\"#{@metaname}\" => [\"#{@metaname}_install\".to_sym]) if has_metaname\n end", "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def rake\n app.init 'stratus'\n app.load_rakefile\n app.top_level\n end", "def rake\n Dir.chdir @temp_dir\n system(\"rake\")\n end", "def resolve_task(task)\n if root_task && task.kind_of?(Roby::Task)\n root_task.plan.add(task)\n model_task = Coordination::Models::Task.new(task.model)\n script_task = instance_for(model_task)\n bind_coordination_task_to_instance(script_task, task, on_replace: :copy)\n else\n model_task = self.model.task(task)\n script_task = instance_for(model_task)\n end\n\n [script_task, model_task]\n end", "def create\n @task = @project.tasks.build(params[:task])\n #alias field is non mandatory\n \n respond_to do |format|\n if @task.save\n flash[:notice] = 'Task was successfully created.'\n format.html { redirect_to [@project, :tasks] }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n flash[:notice] = 'Failed to create task.'\n flash[:errors] = @task.errors.full_messages.join('<br />')\n format.html { redirect_to :back }\n end\n end\n end", "def target\n return nil unless @target_dir\n unless @target\n @target = file(File.expand_path(@target_dir)) { |task| run if @target == task }\n @target.enhance @include.select {|f| f.is_a?(Rake::FileTask)}\n @target.enhance @exclude.select {|f| f.is_a?(Rake::FileTask)}\n @target.enhance copy_map.values\n end\n @target\n end", "def run_sphinx task\n rsudo \"cd #{current_path} && RAILS_ENV=#{Rubber.env} #{fetch(:rake, 'rake')} #{task}\", :as => runner\n end", "def generateRakeForMix(iMixName, iFinalSources)\n rTarget = \"Mix_#{iMixName}\".to_sym\n\n # If the target already exists, do nothing\n if (!Rake::Task.task_defined?(rTarget))\n lDependenciesTarget = \"Dependencies_Mix_#{iMixName}\".to_sym\n lFinalMixTask = \"FinalMix_#{iMixName}\".to_sym\n # Create the target being the symbolic link\n lSymLinkFileName = get_shortcut_file_name(getFinalMixFileName(iMixName))\n\n desc \"Mix #{iMixName}\"\n task rTarget => lSymLinkFileName\n\n desc \"Symbolic link pointing to the mix file #{iMixName}\"\n file lSymLinkFileName => lDependenciesTarget do |iTask|\n # Get the mix name from the name of the Dependencies target\n lMixName = iTask.prerequisites[0].to_s.match(/^Dependencies_Mix_(.*)$/)[1]\n FileUtils::mkdir_p(File.dirname(iTask.name))\n create_shortcut(iTask.prerequisites[1], getFinalMixFileName(lMixName))\n end\n\n desc \"Dependencies needed to mix #{iMixName}\"\n task lDependenciesTarget => lFinalMixTask do |iTask|\n lMixName = iTask.name.match(/^Dependencies_Mix_(.*)$/)[1]\n\n # Modify the dependencies of the symbolic link\n Rake::Task[get_shortcut_file_name(getFinalMixFileName(lMixName))].prerequisites.replace([\n iTask.name,\n Rake::Task[iTask.prerequisites.first].data[:FileName]\n ])\n end\n\n # Use the corresponding final mix task to create the whole processing chain\n # First, compute dependencies of the final mix task\n lLstDeps = []\n @RecordConf[:Mix][iMixName][:Tracks].keys.sort.each do |iTrackID|\n raise UnknownTrackIDError, \"TrackID #{iTrackID} is not defined in the configuration for the mix.\" if (iFinalSources[iTrackID] == nil)\n lLstDeps << iFinalSources[iTrackID]\n end\n\n desc \"Create processing chain for mix #{iMixName}\"\n task lFinalMixTask => lLstDeps do |iTask|\n # This task is responsible for creating the whole processing chain from the source files (taken from prerequisites' data), and storing the top-level file name as its data.\n lMixName = iTask.name.match(/^FinalMix_(.*)$/)[1]\n lMixConf = @RecordConf[:Mix][lMixName]\n lFinalMixFileName = nil\n if (lMixConf[:Tracks].size == 1)\n # Just 1 source for this mix\n lTrackID = lMixConf[:Tracks].keys.first\n lTrackInfo = lMixConf[:Tracks][lTrackID]\n lSourceFileName = Rake::Task[@Context[:FinalMixSources][lTrackID]].data[:FileName]\n # Use all processes\n lLstProcesses = []\n lLstProcesses.concat(lTrackInfo[:Processes]) if (lTrackInfo[:Processes] != nil)\n lLstProcesses.concat(lMixConf[:Processes]) if (lMixConf[:Processes] != nil)\n lLstProcesses = optimizeProcesses(lLstProcesses)\n if (lLstProcesses.empty?)\n # Nothing to do\n lFinalMixFileName = lSourceFileName\n else\n lFinalMixFileName = generateRakeForProcesses(lLstProcesses, lSourceFileName, getMixDir)\n end\n else\n # Here, there will be a step of mixing files\n # 1. Process source files if needed\n lLstProcessedSourceFiles = []\n lMixConf[:Tracks].keys.sort.each do |iTrackID|\n lTrackInfo = lMixConf[:Tracks][iTrackID]\n # Get the source file for this track ID\n lSourceFileName = Rake::Task[@Context[:FinalMixSources][iTrackID]].data[:FileName]\n # By default it will be the processed file name\n lProcessedFileName = lSourceFileName\n # Get the list of processes to apply to it\n if (lTrackInfo[:Processes] != nil)\n lLstProcesses = optimizeProcesses(lTrackInfo[:Processes])\n if (!lLstProcesses.empty?)\n lProcessedFileName = generateRakeForProcesses(lLstProcesses, lSourceFileName, getMixDir)\n end\n end\n lLstProcessedSourceFiles << lProcessedFileName\n end\n # 2. Mix all resulting files\n lFinalMixFileName = getMixFileName(getMixDir, lMixName, lMixConf[:Tracks])\n\n desc \"Mix all processed sources for mix #{lMixName}\"\n file lFinalMixFileName => lLstProcessedSourceFiles do |iTask2|\n lMixInputFile = iTask2.prerequisites.first\n lLstMixFiles = iTask2.prerequisites[1..-1]\n wsk(lMixInputFile, iTask2.name, 'Mix', \"--files \\\"#{lLstMixFiles.join('|1|')}|1\\\" \")\n end\n\n # 3. Process the mix result\n if (lMixConf[:Processes] != nil)\n lLstProcesses = optimizeProcesses(lMixConf[:Processes])\n if (!lLstProcesses.empty?)\n lFinalMixFileName = generateRakeForProcesses(lLstProcesses, lFinalMixFileName, getMixDir)\n end\n end\n end\n log_info \"File produced from the mix #{lMixName}: #{lFinalMixFileName}\"\n iTask.data = {\n :FileName => lFinalMixFileName\n }\n end\n\n end\n\n return rTarget\n end", "def cocoa_build *args, &block\n\n name = nil\n params = []\n deps = []\n\n if Hash === args[0] \n # task :t => [:d]\n name = args[0].keys.first\n deps = args[0].values.first\n else\n name = args.shift\n if Hash === args[0]\n # task :t, [a] => [:d]\n params = args[0].keys.first\n deps = args[0].values.first\n else\n # task :t || task :t, [:a]\n deps = args[0] if args[0]\n end\n end\n\n rule(%r{^build/#{name}\\.app/} =>\n [ lambda { |fn| File.dirname fn },\n lambda { |fn| fn.sub %r{^build/#{name}\\.app/}, \"\" } ]) do |t|\n cp t.source, t.name\n end\n\n CocoaTasks::CocoaBuildTask.define_task(:build, params => deps, &block)\n\nend", "def create(rubyOF_project=nil)\n\t\t# If you invoke with no arguments, provide useful help,\n\t\t# rather than the standard error message.\n\t\tif rubyOF_project.nil?\n\t\t\traise ArgumentError, \"<1 argument>: Need to specify project name, or relative path (relative to [GEM_ROOT]/bin/projects), or absolute path to project (project folder will be created automatically).\"\n\t\tend\n\t\t\t\n\t\t\n\t\t# == Figure where to place the new project\n\t\tRubyOF::Build.create_project(rubyOF_project) do |path|\n\t\t\t# == Copy the template project into the target location\n\t\t\ttemplate_project_name = 'boilerplate'\n\t\t\t\n\t\t\t# Need to clean the example first, so you don't copy built files\n\t\t\t# run_task('clean_project', template_project_name)\n\t\t\t# ^ NOTE: This has been separated from the Rakefile, so it is no longer possible to clean out the example. But that's not actually so bad.\n\t\t\t\n\t\t\t# Find full path to template\n\t\t\t# NOTE: template_name == template_project_name\n\t\t\ttemplate_name, template_path =\n\t\t\t\tRubyOF::Build.load_project(template_project_name)\n\t\t\t\n\t\t\t# Copy the full directory to destination\n\t\t\tFileUtils.mkdir_p File.dirname(path) # make sure containg dir exists\n\t\t\tFileUtils.cp_r template_path, path\n\t\tend\n\t\t\n\t\t\n\t\t# # NOTE: This is the job for a unit test. Don't test this here\n\t\t# # The name inputted should be exactly the same as the name outputted.\n\t\t# # If not, there is a problem with the parsing function.\n\t\t# if template_project_name != template_name\n\t\t# \traise \"ERROR: RubyOF::Build.create_project() parsed incorrectly.\" +\n\t\t# \t \" Given '#{template_project_name}' \"\n\t\t# end;\n\t\t\n\t\t\n\t\t\n\t\t# Make sure that the GEM_ROOT path is set correctly,\n\t\t# regaurdless of where the new project has been created.\n\t\tself.update(rubyOF_project)\n\tend", "def to_task; self end", "def initialize(name = nil)\n @tasks = []\n @spec_task = nil\n\n last_desc = ::Rake.application.last_description\n desc nil\n\n yield self if block_given?\n\n if cfndsl_opts\n desc last_desc if last_desc\n task(name || :generate) { |_t, _args| cfndsl_opts[:files].each { |opts| generate(opts) } }\n else\n define_base_tasks(name || :generate, last_desc)\n end\n end", "def exec_setup\n exec_task_traverse 'setup'\n end", "def call_rake_task( task_name, options={} )\n command = [\n \"rake #{task_name}\",\n options.map { |k, v| [k.to_s.upcase, v.to_s].join('=') },\n ''\n ].join(' ')\n logger.info \"Calling Rake Task >> #{command}\"\n system(command)\n end", "def make_test_task\n return if Rake::Task.task_defined? :test\n test = Rake::Task.define_task :test do\n wix_run 'smoke', \"-nologo wix/#{name}.msi\"\n end\n test.comment = 'Validate the MSI'\n end", "def configure_tasks\n end", "def task(name, *dependencies, &block)\n if block.nil?\n Task.new(name, *dependencies)\n else\n Task.new(name, *dependencies) do |task|\n task.define(&block)\n end\n end\n end", "def make(options)\n @this_version = extract_version\n check\n with_release_candidate_version do |release_candidate_buildfile|\n args = '-S', 'rake', '--rakefile', release_candidate_buildfile\n if options\n args += options.split(' ')\n else\n args << 'clean' << 'build' << 'DEBUG=no'\n end\n ruby *args\n end\n tag_release resolve_tag\n update_version_to_next if this_version != resolve_next_version(this_version)\n end", "def to_task\n task = Task.new(work_block: proc { run!(params_to_hash) })\n task.recreatable = true\n task.recreatable.freeze # Avoid further mutations on this.\n task.recreatable_class = self.class\n task.recreatable_class.freeze\n task.recreatable_params = params_to_hash\n task.recreatable_params.freeze\n task\n end", "def define_default_tasks\n\n\t\t# task used to indicate that rake-deveiate has already been setup once; for\n\t\t# global rakefiles.\n\t\ttask :deveiate do\n\t\t\t# no-op\n\t\tend\n\n\t\tdesc \"The task that runs by default\"\n\t\ttask( :default => :spec )\n\n\t\tdesc \"Check in the current changes\"\n\t\ttask :checkin => [ :precheckin, :check, :test ]\n\t\ttask :commit => :checkin\n\t\ttask :ci => :checkin\n\t\ttask :precheckin\n\n\t\tdesc \"Sanity-check the project\"\n\t\ttask :check\n\n\t\tdesc \"Update the history file\"\n\t\ttask :update_history\n\n\t\tdesc \"Package up and push a release\"\n\t\ttask :release => [ :prerelease, :gem, :release_gem, :postrelease ]\n\t\ttask :prerelease\n\t\ttask :release_gem\n\t\ttask :postrelease\n\n\t\tdesc \"Run all the project's tests\"\n\t\ttask :test\n\t\ttask :spec\n\t\ttask :integration\n\n\t\tdesc \"Set up the project for development\"\n\t\ttask :setup do\n\t\t\tself.install_dependencies\n\t\tend\n\n\t\tdesc \"Turn on maintainer mode: build with extra warnings and debugging\"\n\t\ttask :maint do\n\t\t\tENV['MAINTAINER_MODE'] = 'yes'\n\t\tend\n\n\tend", "def initialize(task)\n super()\n @task= task \n end" ]
[ "0.6761918", "0.67353636", "0.66902137", "0.64816827", "0.646784", "0.6325721", "0.62509596", "0.6201537", "0.61972183", "0.6140512", "0.61384", "0.6127104", "0.61219263", "0.6118963", "0.61107564", "0.6088339", "0.6088339", "0.6088339", "0.6064164", "0.60499454", "0.6041911", "0.6029521", "0.5971506", "0.5951936", "0.59423554", "0.59158087", "0.5907445", "0.58862716", "0.5859258", "0.58523905", "0.584991", "0.5820683", "0.5818382", "0.5810626", "0.5792139", "0.57914084", "0.57810116", "0.5774877", "0.57397133", "0.5736858", "0.5676157", "0.5676157", "0.5676157", "0.5676157", "0.56745213", "0.5659625", "0.56526923", "0.56504244", "0.5649905", "0.5645577", "0.56437844", "0.5632878", "0.5628756", "0.56235194", "0.5597995", "0.55928636", "0.55883884", "0.55466217", "0.5540109", "0.5536244", "0.5536222", "0.5530677", "0.54967785", "0.5488709", "0.5485627", "0.5481996", "0.5472494", "0.54655045", "0.5459435", "0.544553", "0.5433519", "0.54329205", "0.5412139", "0.5408014", "0.53917485", "0.5389344", "0.5385183", "0.53823835", "0.53823835", "0.5380116", "0.5379863", "0.53773206", "0.53762347", "0.5373824", "0.5363514", "0.5359529", "0.5354889", "0.5353906", "0.53509945", "0.5338941", "0.5336362", "0.5334553", "0.5328773", "0.53272474", "0.53254485", "0.5320052", "0.5314803", "0.53138626", "0.53123033" ]
0.8077233
1
Action to list the alerts registered in the application. It also allows to search in the alerts by _name_ and/or _description_. [URL] GET /alerts [Parameters] page _(Optional)_ The page of results to show. q _(Optional)_ A search query to filter alerts.
def index @alerts = Alert.all # If an activation status is passed, get the specified alerts check_active_param @alerts = @alerts.where(:active => @active) if (@active != nil) # If a search query is received, filter the results if (!params[:q].blank?) # Do the search @query = params[:q] @alerts = @alerts.where("$or" => [{:name => /#{@query}/i}, {:description => /#{@query}/i}]) end # If a page number is received, save it (if not, the page is the first) if (!params[:page].blank?) page = params[:page].to_i page = 1 if (page < 1) else page = 1 end # Paginate! @alerts = @alerts.page(page) respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_alerts(opts = {})\n data, _status_code, _headers = list_alerts_with_http_info(opts)\n return data\n end", "def list_alert(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts'\n\t\targs[:query]['Action'] = 'ListAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :alert_name\n\t\t\targs[:query]['AlertName'] = optional[:alert_name]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tself.run(args)\n\tend", "def alerts(query)\n get_json(\"#{api_url}/alerts/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end", "def index\n @alerts = Alert.all\n end", "def index\n @alerts = Alert.all\n end", "def index\n @alerts = Alert.all\n end", "def alerts\n response = self.class.get(\"/#{self.class.account}/activities.xml\")\n response['alerts'].map { |alert| ScoutScout::Alert.new(alert) }\n end", "def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n end\n end", "def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n end\n end", "def alerts\n return @alerts\n end", "def index\n @sleep_alerts = SleepAlert.all\n end", "def list_alerts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_alerts ...\"\n end\n if @api_client.config.client_side_validation && opts[:'search_identifier_type'] && !['id', 'name'].include?(opts[:'search_identifier_type'])\n fail ArgumentError, 'invalid value for \"search_identifier_type\", must be one of id, name'\n end\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling AlertApi.list_alerts, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_alerts, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_alerts, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && opts[:'sort'] && !['createdAt', 'updatedAt', 'tinyId', 'alias', 'message', 'status', 'acknowledged', 'isSeen', 'snoozed', 'snoozedUntil', 'count', 'lastOccurredAt', 'source', 'owner', 'integration.name', 'integration.type', 'report.ackTime', 'report.closeTime', 'report.acknowledgedBy', 'report.closedBy'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of createdAt, updatedAt, tinyId, alias, message, status, acknowledged, isSeen, snoozed, snoozedUntil, count, lastOccurredAt, source, owner, integration.name, integration.type, report.ackTime, report.closeTime, report.acknowledgedBy, report.closedBy'\n end\n if @api_client.config.client_side_validation && opts[:'order'] && !['asc', 'desc'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of asc, desc'\n end\n # resource path\n local_var_path = \"/v2/alerts\"\n\n # query parameters\n query_params = {}\n query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?\n query_params[:'searchIdentifier'] = opts[:'search_identifier'] if !opts[:'search_identifier'].nil?\n query_params[:'searchIdentifierType'] = opts[:'search_identifier_type'] if !opts[:'search_identifier_type'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListAlertsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n org = Organization.find(current_employee.organization_id)\n @alerts = org.alerts\n render \"index.json.jbuilder\", status: :ok\n end", "def index\n # @alerts = Alert.all\n @user = User.find(session[:id])\n @alerts = @user.alerts\n end", "def index_records\n # If there is an ID passed, try to load the alert\n if (!params[:id].blank?) && (params[:id] != \"all\")\n load_alert\n return if (@alert.blank?)\n end\n\n # if there is an alert loaded, filter the results\n if ([email protected]?)\n @alert_records = AlertRecord.where(:alert_id => @alert.id)\n else\n @alert_records = AlertRecord.all\n end\n\n # Ordering results\n @alert_records = @alert_records.desc(:open).desc(:updated_at)\n\n # If a page number is received, save it (if not, the page is the first)\n if (!params[:page].blank?)\n page = params[:page].to_i\n page = 1 if (page < 1)\n else\n page = 1\n end\n \n # Paginate!\n @alert_records = @alert_records.page(page)\n\n respond_to do |format|\n format.html\n end\n end", "def alerts\n @alerts ||= []\n end", "def index\n authorize! :read, ItemAlert\n @item_alerts = ItemAlert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_alerts }\n end\n end", "def alerts=(value)\n @alerts = value\n end", "def get_site_alerts(id, opts = {})\n data, _status_code, _headers = get_site_alerts_with_http_info(id, opts)\n data\n end", "def alerts\n slurp_stream(\"alert\") do |data|\n yield data\n end\n end", "def index\n add_breadcrumb \"Index\"\n\n @alerts = AlarmNotification.not_archieved.order(\"created_at DESC\").page(params[:page])\n\n respond_with(@alerts)\n end", "def alerts(type = 'price')\n authenticated_post(\"auth/r/alerts\", params: {type: type}).body\n end", "def get_site_alerts(id, opts = {})\n data, _status_code, _headers = get_site_alerts_with_http_info(id, opts)\n return data\n end", "def read_all\n @alerts = @current_event.alerts\n authorize(@alerts)\n @alerts.update_all(resolved: params[:resolved])\n\n respond_to do |format|\n format.html { redirect_to admins_event_alerts_path(@current_event, resolved: params[:resolved].!), notice: t(\"alerts.updated\") }\n format.json { head :ok }\n end\n end", "def index\n if current_user.is_admin\n @user_alerts = UserAlert.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_alerts }\n end\n else\n redirect_to new_session_path\n end\n end", "def index\n @sms_alerts = @account.sms_alerts\n end", "def index\n @q = @elist_reports.search params[:q]\n @elist_reports = @q.result.page(params[:page])\n end", "def list_alert_state(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts_state'\n\t\targs[:query]['Action'] = 'ListAlertState'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :alert_name\n\t\t\targs[:query]['AlertName'] = optional[:alert_name]\n\t\tend\n\t\tif optional.key? :dimensions\n\t\t\targs[:query]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tif optional.key? :end_time\n\t\t\targs[:query]['EndTime'] = optional[:end_time]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :start_time\n\t\t\targs[:query]['StartTime'] = optional[:start_time]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @alertes = Alerte.all\n render layout: 'views/index'\n end", "def get_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = get_site_snmp_alerts_with_http_info(id, opts)\n data\n end", "def get_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = get_site_snmp_alerts_with_http_info(id, opts)\n return data\n end", "def index\n @price_alerts = PriceAlert.all\n end", "def index\n @ticketalerts = Ticketalert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticketalerts }\n end\n end", "def index\n @alarms = Alarm.page(params[:page])\n\n respond_with(@alarms)\n end", "def index\r\n @notifications = current_user.alerts.paginate(page: params[:page])\r\n current_user.reset_alerts\r\n end", "def get_alerts_for_trigger(trigger_id)\n # TODO: add additional filters\n return [] unless trigger_id\n\n url = '/?triggerIds=' + trigger_id\n ret = http_get(url)\n val = []\n ret.each { |a| val.push(Alert.new(a)) }\n val\n end", "def search_alert_site\n if params[:collection_ids]\n data = []\n params[:collection_ids].each do |id|\n result = search_alert_site_by_collection id, params\n data.concat result\n end\n render json: data\n else\n render json: []\n end\n end", "def alerts_v2\n return @alerts_v2\n end", "def index\n @resolved = params[:resolved].eql?(\"true\") ? true : false\n @q = @current_event.alerts.includes(:subject).where(resolved: @resolved).order(priority: :desc, event_id: :asc, created_at: :desc).ransack(params[:q])\n @alerts = @q.result\n\n authorize(@alerts)\n @pokes = @current_event.pokes.where(operation_id: @alerts.where(subject_type: 'Transaction').uniq(&:subject_id).pluck(:subject_id))\n @alerts = @alerts.group_by(&:priority)\n end", "def index\n current_user.havemessage = 0\n current_user.save\n @alerts = current_user.alerts.order(\"created_at DESC\").page(params[:page]).per(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n end\n end", "def get_alerts\r\n\t\turl = URI.parse(\"http://api.wunderground.com/api/#{@token}/alerts/q/#{@state_code}/#{@city}.json\")\r\n\t\thttp_response = HTTParty.get(url).parsed_response\r\n\t\tputs JSON.pretty_generate(http_response)\r\n\tend", "def index\n # limit all queries\n @audits = query_limit_all(AUDIT, :login, :message).reverse\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @audits }\n end\n end", "def get_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]'\n\t\targs[:query]['Action'] = 'GetAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def index\n @email_alerts = EmailAlert.order(\"id desc\").limit(300)\n end", "def show\n submenu_item 'applications-index'\n @app = App.find(params[:id], query)\n @alerts = Alert.all({\n :conditions => [\"source_type = 2 and source_id = ? and severity <> 0\", @app.id]\n })\n @services = @app.services\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def index\r\n if params[:patient_id]\r\n @patient_alerts = @patient.patient_alerts\r\n @patient_alerts.sort! {|x, y| x.alert_date <=> y.alert_date} \r\n else\r\n @patient_alerts = PatientAlert.find(:all, :order => \"alert_date\")\r\n end\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @patient_alerts }\r\n end\r\n end", "def index\n @weather_station_alerts = WeatherStationAlert.all\n end", "def show\n @alert = Alert.find(params[:id])\n end", "def pause_all_alerts\n\n endpoint = '/api/admin/pause-all-alerts'\n logger.debug(\"pause all alerts (POST #{endpoint})\") if @debug\n\n post( endpoint, nil )\n end", "def index\n @empls = Empl.page params[:page]\n end", "def get_site_smtp_alerts(id, opts = {})\n data, _status_code, _headers = get_site_smtp_alerts_with_http_info(id, opts)\n data\n end", "def index\n \t#render json: Api::Alert.all, status: :ok\n \tend", "def alert\n self[:alert]\n end", "def get_site_smtp_alerts(id, opts = {})\n data, _status_code, _headers = get_site_smtp_alerts_with_http_info(id, opts)\n return data\n end", "def index\n #@alarms = Alarm.all\n @alarms = Alarm.where(machine_id:Tenant.find(current_tenant.id).machines.ids).distinct(:alarm_message).order(\"updated_at DESC\").where('updated_at > ?', 3.days.ago)\n render json: @alarms\n end", "def list\n @allAlerts = []\n @myAlerts = []\n @alertsRaw = UserAlert.where(user_id: current_user.id)\n @createdAlerts = Alert.where(created_by_id: current_user.id)\n puts @alerts\n\n @alertsRaw.each do |a|\n a.alert.assigned = true\n @myAlerts.push(a.alert)\n @allAlerts.push(a.alert)\n end\n @createdAlerts.each do |a|\n a.assigned = false\n unless (@allAlerts.include?(a))\n @allAlerts.push(a)\n end\n end\n end", "def list_saved_searches_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_saved_searches ...\"\n end\n # resource path\n local_var_path = \"/v2/alerts/saved-searches\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListSavedSearchesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_saved_searches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @exhibits = Exhibit.added_by(current_admin_user).page(params[:page]).per(10)\n end", "def get_single_alert(alert_id)\n ret = http_get('/alert/' + alert_id)\n val = Alert.new(ret)\n val\n end", "def index_users\n load_alert\n return if (@alert.blank?)\n\n # Preload the users\n @users = User.where(:_id.in => @alert.user_ids)\n\n respond_to do |format|\n format.html\n end\n end", "def display_alerts\n @queue.alerts.each do |alert|\n clear_line\n\n message = alert.kind_of?(HighTrafficAlert) ? alert.message.red : alert.message.green\n print \"[ALERT]\\t#{message}\\n\"\n end\n end", "def get_alert(identifier, opts = {})\n data, _status_code, _headers = get_alert_with_http_info(identifier, opts)\n return data\n end", "def index\n @ems = Em.all\n end", "def list_dimensions(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]/dimensions'\n\t\targs[:query]['Action'] = 'ListDimensions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tself.run(args)\n\tend", "def get_alerts(opts={})\n args = {}\n args[:shopper_id] = opts[\"shopper_id\"] if opts[\"shopper_id\"]\n args[:proximity] = opts[\"proximity\"] if opts[\"proximity\"] && [\"close\", \"detected\", \"away\"].include?(opts[\"proximity\"])\n p opts\n p opts[\"proximity\"]\n Euclid::Alert.get_alerts(@credential, args)\n end", "def addAlert(alert)\n\t\[email protected](alert)\n\tend", "def index\n @emergencies = Emergency.all\n end", "def index\n @eventnotifiers = Eventnotifier.all\n end", "def index\n @ee_reports = EeReport.all\n end", "def index\n @ee_reports = EeReport.all\n end", "def alert_messages(*alert_message)\n # delete invalid message\n alert_message.reject! { |msg| msg.blank? } unless alert_message.blank?\n alert_message = [] if alert_message.blank?\n # delete invalid system alert message\n if alert.class == Array && !alert.blank?\n system_alert = alert.reject { |msg| msg.blank? }\n elsif !alert.blank?\n system_alert = alert\n end\n # concatinate alerts\n unless system_alert.blank?\n if system_alert.class == Array\n alert_message += system_alert\n else\n alert_message << system_alert\n end\n end\n\n return \"\" if alert_message.blank?\n\n message = alert_message.class == Array ? alert_message.map { |msg| content_tag(:li, msg) }.join : \"<li>#{alert_message.to_s}</li>\"\n\n html = <<-HTML\n <div class=\"alert alert-block\">\n <a class=\"close\" data-dismiss=\"alert\">&times;</a>\n <h4 class=\"alert-heading\">#{t('alert_title')}</h4>\n <ul>#{message}</ul>\n </div>\n HTML\n html.html_safe\n end", "def list_logs_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_logs ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.list_logs\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n if @api_client.config.client_side_validation && opts[:'direction'] && !['next', 'prev'].include?(opts[:'direction'])\n fail ArgumentError, 'invalid value for \"direction\", must be one of next, prev'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_logs, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_logs, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && opts[:'order'] && !['asc', 'desc'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of asc, desc'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/logs\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListAlertLogsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list \n @employees = Employee.find( :all ) # return an array of all Employees\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def alerts; @alerts.dup; end", "def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def get_site_syslog_alerts(id, opts = {})\n data, _status_code, _headers = get_site_syslog_alerts_with_http_info(id, opts)\n data\n end", "def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend", "def alert\n Alert.new(self)\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def set_alert\n @alert = ::Alert::Alert.find(params[:id])\n end", "def index\n @empleados = Empleado.search(params[:search], params[:page])\n end", "def alert\n state[\"alert\"]\n end", "def index\n @events = Event.getRecords(params[:page])\n end", "def query\t\n\t\t if !org.nil?\t\n\t\t\t criteria = Event.includes(host: :org).where(orgs: {id: org.id})\n\t\t\t criteria = criteria.where(hosts: {id: host.id}) if !host.nil?\n\t\t\t events = criteria.order(occurred_at: :desc).take(SHOW_TOP) \n\n\t\t\t render json: events, status: 200\n\t\t else\n\t\t render_error \"Not Authrized to see all events. Required param not found. You sent #{params[:orgname]} and #{params[:hostname]}\", 422\t \n\t\t end\n\t\tend", "def get_site_syslog_alerts(id, opts = {})\n data, _status_code, _headers = get_site_syslog_alerts_with_http_info(id, opts)\n return data\n end", "def index\n @ephems = Ephem.page(params[:page])\n end", "def index\n @energies = Energy.all\n end", "def index\n if !params[:email].nil?\n reports = Report.where(user_email: params[:email]).order('created_at DESC')\n if reports\n render json: reports, include: :pet, status: :ok\n else\n render json: {message: 'There are no reports to show'}, status: :ok\n end\n else\n render json: {message: 'Please provide user email and try again'}, status: :bad_request\n end\n end", "def alerts\n #checking to see if params hash in flash msg has a value\n alert = (flash[:alert] || flash[:error] || flash[:notice])\n\n if alert\n alert_generator alert\n end\n end", "def messages\n Client.get(EVENTS_PATH, {\n recipient: @email_address\n })\n end", "def all\n @events = Event.order(updated_at: :desc).page(params[:page]).per(10)\n end", "def applications_list\n get \"applications\"\n end", "def index\n # todo implement search and sort and paginate\n @events = Legacy::LegacyEvent.order(\"created_date DESC\").paginate(:page => params[:page])\n end", "def index\n # This should never be called, just used for debugging\n @emergencies = Emergency.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @emergencies }\n end\n end", "def results\n # Load the service from the database\n load_service\n return if (@service.blank?)\n\n # Alert records of this service\n @alert_records = AlertRecord.where(:service_id => @service.id).desc(:open).desc(:updated_at).limit(8)\n\n respond_to do |format|\n format.html\n format.js\n end\n end", "def all(params = {})\n req = WebPay::EventListRequest.create(params)\n raw_response = @client._request(:get, 'events', req)\n WebPay::EventResponseList.new(raw_response)\n end", "def alerts_v2=(value)\n @alerts_v2 = value\n end" ]
[ "0.734026", "0.72697806", "0.7262496", "0.69386715", "0.69386715", "0.69386715", "0.67378265", "0.63825816", "0.63825816", "0.63803816", "0.6277441", "0.62561816", "0.6194796", "0.61825985", "0.61007595", "0.6085848", "0.60785973", "0.60614866", "0.602489", "0.6018239", "0.60108143", "0.5979466", "0.597077", "0.5940974", "0.5922436", "0.5852796", "0.5796729", "0.57691246", "0.57644707", "0.5722532", "0.56694466", "0.56687564", "0.56653816", "0.5659693", "0.55494225", "0.55473447", "0.5543193", "0.5535736", "0.5494039", "0.54916775", "0.5468233", "0.54667157", "0.5387602", "0.5387577", "0.5356904", "0.534879", "0.5341672", "0.53347796", "0.5330051", "0.5304169", "0.5294665", "0.5286439", "0.5248846", "0.52422035", "0.52113676", "0.52010876", "0.5157657", "0.513517", "0.5129799", "0.5125925", "0.51254267", "0.5118638", "0.511017", "0.5105732", "0.50939727", "0.5079159", "0.5072078", "0.50699806", "0.506846", "0.506846", "0.50641316", "0.50499797", "0.504875", "0.50443417", "0.5021483", "0.50145346", "0.50002724", "0.49871153", "0.49860764", "0.49807882", "0.49805152", "0.49805152", "0.4978873", "0.49763775", "0.496879", "0.49663958", "0.49660376", "0.49642304", "0.49641696", "0.49617824", "0.49594775", "0.49237332", "0.491117", "0.49107555", "0.49030572", "0.49015108", "0.48835272", "0.48649997", "0.48591352", "0.4851509" ]
0.7629379
0
Action to show the service creation form. [URL] GET /alerts/new
def new @alert = Alert.new respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n parameters = alert_params\n parameters[:service] = Service.where(:_id => parameters[:service_id]).first\n parameters[:hosts] = Host.where(:_id.in => parameters[:host_ids]).to_a if (!parameters[:host_ids].blank?)\n\n # Delete string'd id's\n parameters.delete(:service_id)\n parameters.delete(:host_ids)\n\n # Apply the params received\n @alert = Alert.new(parameters)\n\n respond_to do|format|\n format.html{\n # Can be saved?\n if (@alert.save)\n flash[:notice] = t(\"alerts.notice.created\", :name => @alert.name)\n redirect_to alert_path(@alert)\n else\n # If an error raises, show the form again.\n render :action => :new\n end\n return\n }\n end\n end", "def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to root_path, notice: \"Has creado una nueva alerta. Pronto te avisaremos cuando encontremos lo que buscas\" }\n format.json { render :show, status: :created, location: @alert }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to alerts_path, notice: 'Alert was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @alert }\n else\n format.html { render action: 'new' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(alert_params)\n if @alert.save!\n redirect_to alerts_path(@alert)\n else \n render 'new', :notice => \"Uh Oh\"\n end\n end", "def new\n @alert = Alert.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def new_alert\n@alert = Alert.new(params[:id])\nend", "def create\n # Creation of a Service resource is not allowed. Must be created as part of the creation of a specific service type resource.\n flash[:error] = 'Select the type of service you would like to submit first'\n respond_to do |format|\n format.html { redirect_to(new_service_url) }\n format.xml { render :xml => '', :status => 404 }\n end\n end", "def create\n @service = Service.new(service_params)\n\n if @service.save\n redirect_to tool_path(service_params[:tool_id]); gflash :success => 'Service was successfully created.'\n else\n render action: 'new'\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @service = Service.new\n\n # If a valid type is received, apply to the host to create.\n check_priority_param\n @service.priority = @priority if([email protected]?)\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n respond_to do |format|\n format.html\n end\n end", "def new\n submenu_item 'services-new'\n @service = Service.new(:type_id => params[:type_id], :check_interval => 300)\n @service_type = @service.type\n service_param\n\n unless @service_type\n if @app\n redirect_to types_app_services_path(@app)\n elsif @site\n redirect_to types_site_services_path(@site)\n elsif @host\n redirect_to types_host_services_path(@host)\n elsif @device\n redirect_to types_device_services_path(@device)\n else\n redirect_to params.update(:action => \"select\")\n end\n return\n end\n dictionary\n s = @serviceable\n @service.agent_id = @host.agent_id if @host\n @service.serviceable_id = s && s.id\n @service.name = @service_type.default_name\n @service.ctrl_state = @service_type.ctrl_state\n @service.threshold_critical = @service_type.threshold_critical\n @service.threshold_warning = @service_type.threshold_warning\n @service.check_interval = @default_check_interval\n respond_to do |format|\n format.html\n format.xml { render :xml => @service }\n end\n end", "def create\n @tipo_alerta = TipoAlerta.new(params[:tipo_alerta])\n\n respond_to do |format|\n if @tipo_alerta.save\n format.html { redirect_to @tipo_alerta, notice: 'Tipo alerta was successfully created.' }\n format.json { render json: @tipo_alerta, status: :created, location: @tipo_alerta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_alerta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully created.') }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = @enterprise.services.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido creado satisfactoriamente.' }\n format.json { render :edit, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @show = @ticketalert.show\n\n respond_to do |format|\n if @ticketalert.save\n flash[:notice] = 'Ticketalert was successfully created.'\n format.html { redirect_to(@ticketalert) }\n format.xml { render :xml => @ticketalert, :status => :created, :location => @ticketalert }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticketalert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @alert_trigger_type = AlertTriggerType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alert_trigger_type }\n end\n end", "def create\n @sms_alert = @account.sms_alerts.new\n set_sms_fields\n if @sms_alert.save\n redirect_to account_sms_alerts_url, notice: 'Sms alert was successfully created.'\n else\n render :new \n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def create\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to(@service, :notice => t(\"screens.notice.successfully_created\")) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @emt_service = EmtService.new(emt_service_params)\n\n respond_to do |format|\n if @emt_service.save\n format.html { redirect_to @emt_service, notice: 'Emt service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @emt_service }\n else\n format.html { render action: 'new' }\n format.json { render json: @emt_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n #format.html { redirect_to services_path, notice: 'Service was successfully created.' }\n\tflash[:notice]= 'Service was successfully created.'\n\tformat.html { redirect_to action: 'index'}\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n \n end\n end\n end", "def new\n @service_journals_event = ServiceJournalsEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_journals_event }\n end\n end", "def create\n @alert_trigger_type = AlertTriggerType.new(params[:alert_trigger_type])\n\n respond_to do |format|\n if @alert_trigger_type.save\n flash[:notice] = 'AlertTriggerType was successfully created.'\n format.html { redirect_to(admin_alert_trigger_type_path(@alert_trigger_type)) }\n format.xml { render :xml => @alert_trigger_type, :status => :created, :location => @alert_trigger_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alert_trigger_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n \n respond_to do |format|\n if @service.save\n flash[:notice] = 'Service was successfully created.'\n format.html { redirect_to(@service) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @service_checker = ServiceChecker.new(:strict => \"0\", :checker_type => \"0\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_checker }\n end\n end", "def create\n @supplier = Supplier.find(params[:supplier_id])\n @service = @supplier.services.create(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to supplier_path(@supplier), notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tipo_alerta = TipoAlerta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_alerta }\n end\n end", "def create\n @price_alert = PriceAlert.new(price_alert_params)\n\n respond_to do |format|\n if @price_alert.save\n format.html { redirect_to @price_alert, notice: 'Price alert was successfully created.' }\n format.json { render :show, status: :created, location: @price_alert }\n else\n format.html { render :new }\n format.json { render json: @price_alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n flash[:notice] = 'Service was successfully created.'\n format.html { redirect_to(@service) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @scheduled_service = ScheduledService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_service }\n end\n end", "def create\n parameters = service_params\n parameters[:probe_config] = params[:probe_config] if (!params[:probe_config].blank?)\n\n # Apply the params received\n @service = Service.new(parameters)\n\n respond_to do|format|\n format.html{\n # Can be saved?\n if (@service.save)\n flash[:notice] = t(\"services.notice.created\", :name => @service.name)\n redirect_to service_path(@service)\n else\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n # If an error raises, show the form again.\n render :action => :new\n end\n return\n }\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @alert = Alert.new\n @selected = params[:alert_ids]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def create\n @service_start = ServiceStart.new(service_start_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_service_start\n format.html { redirect_to redirect_target(@service_start), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @service_start }\n else\n format.html { render :new }\n format.json { render json: @service_start.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_service = EventService.new(event_service_params)\n\n respond_to do |format|\n if @event_service.save\n format.html { redirect_to @event_service, notice: 'Event service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event_service }\n else\n format.html { render action: 'new' }\n format.json { render json: @event_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(sp_company)\n if @service.save\n flash[:success] = \"A record add been succefully added\"\n redirect_to services_path\n else\n render 'new'\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_url, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @service = Service.new\n @vendors = Vendor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n @service_todo = ServiceTodo.new\n end", "def new\n @show = @ticketalert.show\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticketalert }\n end\n end", "def new\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nagios_service_escalation_template }\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\n end\n end", "def create\n @email_alert = EmailAlert.new(email_alert_params)\n\n respond_to do |format|\n if @email_alert.save\n format.html { redirect_to @email_alert, notice: 'Email alert was successfully created.' }\n format.json { render :show, status: :created, location: @email_alert }\n else\n format.html { render :new }\n format.json { render json: @email_alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @servicetype = Servicetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @servicetype }\n end\n end", "def new\n @service_type = ServiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_type }\n end\n end", "def new\n @service = Service.new\n @service.date = Time.now.strftime('%Y-%m-%d ')\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @service }\n end\n end", "def new\n @service = @page.services.new\n \n #default: 8:30 => 16:30. breaks: 11:30, 12:00\n @service.settings.build(:name => \"Monday\", :day => 0 )\n @service.settings.build(:name => \"Tuesday\", :day => 1 )\n @service.settings.build(:name => \"Wednesday\", :day => 2 )\n @service.settings.build(:name => \"Thursday\", :day => 3 )\n @service.settings.build(:name => \"Friday\", :day => 4 )\n @service.settings.build(:name => \"Saturday\", :day => 5, :day_off => true )\n @service.settings.build(:name => \"Sunday\", :day => 6, :day_off => true )\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @page_id = \"services\"\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n create_service_feature\n @tid = params[:service_id]\n if (@tid && @tid.to_i > 0)\n if current_user.services.find(@tid).nil?\n raise AppExceptions::InvalidParameter.new('Security Alert: Invalid service_id was specified!')\n end\n @service_feature.service_id = @tid\n end\n load_service\n\n @guided_workflow = params[:guided_workflow]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @service_feature }\n end\n end", "def new\n @service = Service.new\n @teams = current_user.teams.where('role = ?', 'admin')\n @myTeam = params[:myTeam]\n @buttonvalue = \"create service\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @servicetype = Servicetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicetype }\n end\n end", "def new_service\n ReservationMailer.new_service\n end", "def create\n @service_checker = ServiceChecker.new(params[:service_checker])\n\n respond_to do |format|\n if @service_checker.save\n flash[:notice] = 'ServiceChecker was successfully created.'\n format.html { redirect_to(@service_checker) }\n format.xml { render :xml => @service_checker, :status => :created, :location => @service_checker }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service_checker.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @alert_email = AlertEmail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alert_email }\n end\n end", "def new\n @service_email = ServiceEmail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_email }\n end\n end", "def new\n @service_request = ServiceRequest.new\n\t@servicegrades = ServiceGrade.all\n\t@curr_menu = \"layouts/hostfamily_menu\"\n\t@curr_layout = \"layouts/user_layout\"\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_request }\n end\n end", "def create_alert(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @alert = Alert.create(data)\n else\n create_service\n create_host\n\n @service.hosts << @host\n @service.save\n \n @alert = Alert.create(:name => \"Test Alert #{rand(1..1000)}\", :description => \"Test alert description.\", :active => true, :limit => 600, :condition => :greater_than, :condition_target => Alert::CONDITION_TARGET_ALL, :error_control => true, :service_id => @service.id, :hosts => [@host])\n end\n end", "def create\n @service = Service.new(params[:service])\n # passing teams to create in case service name left blank, required for 'new' action to reload from here\n @teams = current_user.teams.where('role = ?', 'admin')\n @buttonvalue = \"create service\"\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to :services, notice: 'Your service has been successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @service = Service.new\n end", "def create\n @additional_service = AdditionalService.new(params[:additional_service])\n\n respond_to do |format|\n if @additional_service.save\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully created.' }\n format.json { render json: @additional_service, status: :created, location: @additional_service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @additional_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = current_user.services.build(service_params)\n respond_to do |format|\n if @service.save\n format.html { redirect_to dashboard_path, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.is_admin\n @user_alert = UserAlert.new(params[:user_alert])\n\n respond_to do |format|\n if @user_alert.save\n flash[:notice] = 'UserAlert was successfully created.'\n format.html { redirect_to(@user_alert) }\n format.xml { render :xml => @user_alert, :status => :created, :location => @user_alert }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_alert.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to new_session_path\n end\n end", "def create\n # @weather_station_alert = WeatherStationAlert.new(weather_station_alert_params)\n #\n # respond_to do |format|\n # if @weather_station_alert.save\n # format.html { redirect_to @weather_station_alert, notice: 'Weather station alert was successfully created.' }\n # format.json { render :show, status: :created, location: @weather_station_alert }\n # else\n # format.html { render :new }\n # format.json { render json: @weather_station_alert.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def new\r\n @patient_alert = PatientAlert.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @patient_alert }\r\n end\r\n end", "def new\n @additional_service = AdditionalService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @additional_service }\n end\n end", "def create\n @final_service = FinalService.new(params[:final_service])\n\n respond_to do |format|\n if @final_service.save\n format.html { redirect_to(@final_service, :notice => 'FinalService was successfully created.') }\n format.xml { render :xml => @final_service, :status => :created, :location => @final_service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @final_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(params[:alert])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.save\n format.html { redirect_to @alert, notice: 'Alert was successfully created.' }\n format.json { render json: @alert, status: :created, location: @alert }\n\t AlertMailer.new_alert(@alert.id).deliver\n else\n format.html { render action: \"new\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @online_service = OnlineService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_service }\n end\n end", "def create\n @servicetype = Servicetype.new(params[:servicetype])\n\n respond_to do |format|\n if @servicetype.save\n format.html { redirect_to @servicetype, :notice => 'Servicetype was successfully created.' }\n format.json { render :json => @servicetype, :status => :created, :location => @servicetype }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @servicetype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @servicetype = Servicetype.new(params[:servicetype])\n\n respond_to do |format|\n if @servicetype.save\n format.html { redirect_to @servicetype, notice: 'Servicetype was successfully created.' }\n format.json { render json: @servicetype, status: :created, location: @servicetype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @servicetype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_status = ServiceStatus.new(service_status_params)\n\n respond_to do |format|\n if @service_status.save\n format.html { redirect_to @service_status, notice: 'Service status was successfully created.' }\n format.json { render :show, status: :created, location: @service_status }\n else\n format.html { render :new }\n format.json { render json: @service_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @additional_service = AdditionalService.new(additional_service_params)\n\n respond_to do |format|\n if @additional_service.save\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully created.' }\n format.json { render :show, status: :created, location: @additional_service }\n else\n format.html { render :new }\n format.json { render json: @additional_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @value_added_service = ValueAddedService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @value_added_service }\n end\n end", "def create\n @sevice = Sevice.new(sevice_params)\n\n respond_to do |format|\n if @sevice.save\n format.html { redirect_to @sevice, notice: 'Sevice was successfully created.' }\n format.json { render :show, status: :created, location: @sevice }\n else\n format.html { render :new }\n format.json { render json: @sevice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_journals_event = ServiceJournalsEvent.new(params.require(:service_journals_event).permit(:name))\n\n respond_to do |format|\n if @service_journals_event.save\n format.html { redirect_to service_journals_events_url,\n notice: 'ServiceJournalsEvent was successfully created.' }\n format.json { render json: @service_journals_event, status: :created, location: @service_journals_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service_journals_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n @service.published = false\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to [:admin,@service], notice: 'Feito! Empresa criada' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service_location = ServiceLocation.new(service_location_params)\n if @service_location.save\n flash[:notice] = \"Successfully added '#{@service_location.location.name}' as a contact for '#{@service_location.service.name}'.\"\n redirect_to service_path(@service_location.service)\n else\n @service = Service.find(params[:service_location][:service_id])\n render action: 'new', locals: { service: @service }\n end\n end", "def create\n @em_service = EmService.new(em_service_params)\n\n respond_to do |format|\n if @em_service.save\n format.html { redirect_to list_em_services_path, notice: '创建成功.' }\n format.json { render :show, status: :created, location: @em_service }\n else\n drop_breadcrumb(\"员工服务管理\",em_services_path)\n drop_page_title(\"新增\")\n drop_breadcrumb\n flash.now[:alert] = \"操作失败 #{@em_service.errors.full_messages}\"\n format.html { render :new }\n format.json { render json: @em_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_service_hosts\n if ((!params[:id].blank?) && (params[:id] != \"new\"))\n load_alert\n return if (@alert.blank?)\n else\n @alert = Alert.new()\n end\n\n @service = Service.where(:_id => params[:service_id]).first\n\n respond_to do |format|\n format.js\n end\n end", "def create\n @service_type = ServiceType.new(params[:service_type])\n\n respond_to do |format|\n if @service_type.save\n format.html { redirect_to @service_type, notice: 'Service type was successfully created.' }\n format.json { render json: @service_type, status: :created, location: @service_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @service = Service.new(params[:service])\n respond_to do |format|\n if @service.save\n\n format.html { }\n format.xml { render :xml => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service }\n end\n end\n end", "def new\n create_service_pricing_scheme\n @tid = params[:service_id]\n if (@tid && @tid.to_i > 0)\n if current_user.services.find(@tid).nil?\n raise AppExceptions::InvalidParameter.new('Security Alert: Invalid service_id was specified!')\n end\n @service_pricing_scheme.service_id = @tid\n end\n load_service\n\n @tid = params[:service_charging_resource_type_id]\n if (@tid && @tid.to_i > 0)\n if current_user.service_charging_resource_types.find(@tid).nil?\n raise AppExceptions::InvalidParameter.new('Security Alert: Invalid service_charging_resource_type_id was specified!')\n end\n @service_pricing_scheme.service_charging_resource_type_id = @tid\n end\n load_service_charging_resource_type\n\n @guided_workflow = params[:guided_workflow]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @service_pricing_scheme }\n end\n end", "def create_action\n if has_errors?\n render :new, options\n else\n redirect_to resource_location\n end\n end", "def create\n @eventnotifier = Eventnotifier.new(eventnotifier_params)\n\n respond_to do |format|\n if @eventnotifier.save\n format.html { redirect_to @eventnotifier, notice: 'Eventnotifier was successfully created.' }\n format.json { render :show, status: :created, location: @eventnotifier }\n else\n format.html { render :new }\n format.json { render json: @eventnotifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @service_style = ServiceStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_style }\n end\n end", "def new\n @service_request = ServiceRequest.new\n @service_request.warning_date = Date.tomorrow\n @service_request.alert_date = Date.tomorrow + 1\n @categories = Category.order(:name) #Category.all(:order => 'name DESC')\n @service_request.category = @categories.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_request }\n end\n end", "def new\n @service_record = ServiceRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_record }\n end\n end" ]
[ "0.7403234", "0.6892984", "0.68458104", "0.6833722", "0.6783962", "0.6763968", "0.6761493", "0.66932", "0.6658992", "0.6657319", "0.6631185", "0.66295797", "0.6619513", "0.6585567", "0.6565171", "0.6549883", "0.6518372", "0.6511708", "0.6500327", "0.6500327", "0.6500327", "0.6500327", "0.6491196", "0.6475338", "0.64551187", "0.64460164", "0.6406377", "0.63806164", "0.63767976", "0.63687825", "0.6355333", "0.6354953", "0.6348606", "0.63457793", "0.63337034", "0.63286996", "0.63286996", "0.63266754", "0.6321491", "0.6307921", "0.62991667", "0.6296538", "0.62857157", "0.6274302", "0.6274302", "0.626977", "0.6269212", "0.6254246", "0.6252045", "0.6252045", "0.6252045", "0.6252045", "0.6252045", "0.6252045", "0.62437195", "0.62338287", "0.6225168", "0.6204508", "0.62032896", "0.6198207", "0.6190339", "0.618764", "0.61835265", "0.614579", "0.61451113", "0.6143818", "0.6142823", "0.6136316", "0.61233354", "0.6117518", "0.61165726", "0.6114549", "0.61132795", "0.6106475", "0.61021215", "0.6098307", "0.6082053", "0.6061935", "0.60474396", "0.60407573", "0.6033929", "0.60338867", "0.60237944", "0.602224", "0.6009257", "0.6001376", "0.5998252", "0.599758", "0.5995289", "0.59931237", "0.5990828", "0.5986738", "0.5986607", "0.5985692", "0.59778875", "0.59723955", "0.59702486", "0.59699327", "0.59641933", "0.5963055" ]
0.6904004
1
Action to create a new alert with the data received from the form. [URL] POST /alerts [Parameters] alert All the data recolected of the new service.
def create parameters = alert_params parameters[:service] = Service.where(:_id => parameters[:service_id]).first parameters[:hosts] = Host.where(:_id.in => parameters[:host_ids]).to_a if (!parameters[:host_ids].blank?) # Delete string'd id's parameters.delete(:service_id) parameters.delete(:host_ids) # Apply the params received @alert = Alert.new(parameters) respond_to do|format| format.html{ # Can be saved? if (@alert.save) flash[:notice] = t("alerts.notice.created", :name => @alert.name) redirect_to alert_path(@alert) else # If an error raises, show the form again. render :action => :new end return } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to root_path, notice: \"Has creado una nueva alerta. Pronto te avisaremos cuando encontremos lo que buscas\" }\n format.json { render :show, status: :created, location: @alert }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to alerts_path, notice: 'Alert was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @alert }\n else\n format.html { render action: 'new' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(alert_params)\n if @alert.save!\n redirect_to alerts_path(@alert)\n else \n render 'new', :notice => \"Uh Oh\"\n end\n end", "def create_alert(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @alert = Alert.create(data)\n else\n create_service\n create_host\n\n @service.hosts << @host\n @service.save\n \n @alert = Alert.create(:name => \"Test Alert #{rand(1..1000)}\", :description => \"Test alert description.\", :active => true, :limit => 600, :condition => :greater_than, :condition_target => Alert::CONDITION_TARGET_ALL, :error_control => true, :service_id => @service.id, :hosts => [@host])\n end\n end", "def create\n @email_alert = EmailAlert.new(email_alert_params)\n\n respond_to do |format|\n if @email_alert.save\n format.html { redirect_to @email_alert, notice: 'Email alert was successfully created.' }\n format.json { render :show, status: :created, location: @email_alert }\n else\n format.html { render :new }\n format.json { render json: @email_alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(params[:alert])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.save\n format.html { redirect_to @alert, notice: 'Alert was successfully created.' }\n format.json { render json: @alert, status: :created, location: @alert }\n\t AlertMailer.new_alert(@alert.id).deliver\n else\n format.html { render action: \"new\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_alert\n@alert = Alert.new(params[:id])\nend", "def create\n @price_alert = PriceAlert.new(price_alert_params)\n\n respond_to do |format|\n if @price_alert.save\n format.html { redirect_to @price_alert, notice: 'Price alert was successfully created.' }\n format.json { render :show, status: :created, location: @price_alert }\n else\n format.html { render :new }\n format.json { render json: @price_alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_alert(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts'\n\t\targs[:query]['Action'] = 'CreateAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :alert\n\t\t\targs[:body]['Alert'] = optional[:alert]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n if current_user.is_admin\n @user_alert = UserAlert.new(params[:user_alert])\n\n respond_to do |format|\n if @user_alert.save\n flash[:notice] = 'UserAlert was successfully created.'\n format.html { redirect_to(@user_alert) }\n format.xml { render :xml => @user_alert, :status => :created, :location => @user_alert }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_alert.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to new_session_path\n end\n end", "def create\n @tipo_alerta = TipoAlerta.new(params[:tipo_alerta])\n\n respond_to do |format|\n if @tipo_alerta.save\n format.html { redirect_to @tipo_alerta, notice: 'Tipo alerta was successfully created.' }\n format.json { render json: @tipo_alerta, status: :created, location: @tipo_alerta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_alerta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(params[:alert])\n @alert.sent = false\n\n if @alert.save\n if @alert.hit_web\n @alert.update_attribute(:sent, true)\n redirect_to new_alert_url, notice: \"¡Hey! Ya hay trenes para esta fecha. Visita <a href='http://www.renfe.com'>Renfe</a>\".html_safe\n else\n AlertMailer.created(@alert).deliver\n redirect_to new_alert_url, notice: 'Nueva alerta configurada. Recibirás email cuando haya disponibilidad de trenes'\n end\n else\n render action: \"new\"\n end\n end", "def create\n alerts = JSON.parse(params[:alert] || params[:deployment]) \n user_application = UserApplication.find_by_name(alerts[\"application_name\"])\n @alert = build_application_alert(user_application,alerts) if params.has_key?(\"alert\")\n # @deploy_alert = build_deployment_alert(params[:deployment]) if params.has_key?(\"deployment\")\n # @alert = ApplicationAlert.new(params[:application_alert])\n @error = {:error => 'Error while creating record'}\n \n if [email protected]? && @alert.save\n respond_to do |format|\n format.json { render :nothing => true, :status => :ok}\n format.xml { render :nothing => true, :status => :ok }\n end\n # elsif @deploy_alert.save\n # respond_to do |format|\n # format.json { render :nothing => true, :status => :ok}\n # format.xml { render :nothing => true, :status => :ok }\n # end\n else\n respond_to do |format|\n format.json { render :json => @error}\n format.xml { render :xml => @error}\n end\n end\n end", "def new\n @alert = Alert.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def create\r\n @patient_alert = PatientAlert.new(params[:patient_alert])\r\n @patient_alert.patient = @patient\r\n \r\n respond_to do |format|\r\n if @patient_alert.save\r\n flash[:notice] = 'PatientAlert was successfully created.'\r\n APP_LOGGER_LOG.info \"ALERT CREATED - for PATIENT ID \" + \r\n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\r\n format.html { redirect_to(@patient_alert) }\r\n format.xml { render :xml => @patient_alert, :status => :created, :location => @patient_alert }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @patient_alert.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n user = User.find(session[:id])\n \n alert = {:title => alert_params[:title], :city_name => alert_params[:city_name], :alert_time => alert_params[:alert_time], :user => user }\n puts 'ALERT TIME!!!!!!!!!!!!!!!!!!!!!!!!'\n puts alert_params[:alert_time][0]\n @alert = Alert.new(alert)\n respond_to do |format|\n if @alert.save\n # format.html { redirect_to @user, notice: 'Alert was successfully created.' }\n format.html { redirect_to('/alerts', notice: 'Alert was successfully created.') }\n format.json { render :show, status: :created, location: @alert }\n else\n format.html { render :new }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def create\n @alert_trigger_type = AlertTriggerType.new(params[:alert_trigger_type])\n\n respond_to do |format|\n if @alert_trigger_type.save\n flash[:notice] = 'AlertTriggerType was successfully created.'\n format.html { redirect_to(admin_alert_trigger_type_path(@alert_trigger_type)) }\n format.xml { render :xml => @alert_trigger_type, :status => :created, :location => @alert_trigger_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alert_trigger_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item_alert = ItemAlert.new(item_alert_params)\n authorize! :create, ItemAlert\n\n respond_to do |format|\n if @item_alert.save\n format.html do\n redirect_to @item_alert, notice: 'Item alert was successfully created.'\n end\n format.json do\n render json: @item_alert, status: :created, location: @item_alert\n end\n else\n format.html { render 'new' }\n format.json do\n render json: @item_alert.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html\n end\n end", "def create\n @sms_alert = @account.sms_alerts.new\n set_sms_fields\n if @sms_alert.save\n redirect_to account_sms_alerts_url, notice: 'Sms alert was successfully created.'\n else\n render :new \n end\n end", "def create_alert(obj, alert_type)\n alert = self.alerts.new\n alert.thing = obj\n alert.reason_type = alert_type\n alert.save\n end", "def create_alert(body, opts = {})\n data, _status_code, _headers = create_alert_with_http_info(body, opts)\n return data\n end", "def new\n @alert = Alert.new\n @selected = params[:alert_ids]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def create\n # from mac - state, duration, uuid, major, minor\n # we have - current_employee.id , @beacon.id\n @alert = Alert.new(beacon_id: @beacon.id,\n duration: params[:duration],\n state: params[:state],\n employee_id: current_employee.id)\n if @alert.save\n render json: { success: \"PREY ACQUIRED! TRACKING MODE ACTIVATED! SCREEEEEEEEE!\" }, status: :ok\n else\n render json: { errors: @alert.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def addAlert(alert)\n\t\[email protected](alert)\n\tend", "def alert_params\n params.require(:alert).permit(:title, :message, :begins, :ends)\n end", "def create\n @show = @ticketalert.show\n\n respond_to do |format|\n if @ticketalert.save\n flash[:notice] = 'Ticketalert was successfully created.'\n format.html { redirect_to(@ticketalert) }\n format.xml { render :xml => @ticketalert, :status => :created, :location => @ticketalert }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticketalert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(params[:alert])\n respond_to do |format|\n if @alert.save\n format.html { redirect_to(alerts_path, :notice => 'Alert was successfully created.') }\n format.xml { render :xml => @alert, :status => :created, :location => @alert }\n else\n NO_OF_IMAGES.times {@alert.alert_uploads.build}\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # @weather_station_alert = WeatherStationAlert.new(weather_station_alert_params)\n #\n # respond_to do |format|\n # if @weather_station_alert.save\n # format.html { redirect_to @weather_station_alert, notice: 'Weather station alert was successfully created.' }\n # format.json { render :show, status: :created, location: @weather_station_alert }\n # else\n # format.html { render :new }\n # format.json { render json: @weather_station_alert.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @alert_email = AlertEmail.new(params[:alert_email])\n\n respond_to do |format|\n if @alert_email.save\n format.html { redirect_to(:root, :notice => 'You signed up successfully.') }\n #format.xml { render :xml => @alert_email, :status => :created, :location => @alert_email }\n else\n format.html { redirect_to(:root, :notice => 'Please use a valid email address.') }\n #format.xml { render :xml => @alert_email.errors, :status => :unprocessable_entity }\n end\n end\n end", "def alert_params\n params.require(:alert).permit(:name, :description, :active, :service_id, :condition, :limit, :condition_target, :error_control, :host_ids => [])\n end", "def set_alert\n unless params[:alert].blank?\n # remove single/double quotes from name to avoid display error:\n params[:alert][:name] = params[:alert][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:alert][:name].blank?\n end\n @alert = current_user.alerts.find(params[:id])\n end", "def create\n puts alert_params.class\n @alert = Alert.new(alert_params)\n respond_to do |format|\n if @alert.save\n key = ENV['GCMKEY']\n gcm = GCM.new(key)\n client = @alert.client\n options = { data: {msg: \"ALERTA ENVIADA AL ADMINISTRADOR\"}, collapse_key: \"ALERTA\"}\n reg_id = [client.reg_id]\n response = gcm.send(reg_id, options)\n puts response\n format.html { redirect_to @alert, notice: 'Alert was successfully created.' }\n format.json { render json: {msg: \"ALERTA ENVIADA AL ADMINISTRADOR\", response: response} }\n else\n format.html { render :new }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def alert_params\n params.require(:alert).permit(:the_type, :description, :time, :merchant, :amount)\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def alert_params\n params.require(:alert).permit(\n :search_id, :active, :description, :last_run, :last_status_change, :name, :status,\n :threshold_count, :threshold_operator, :threshold_time_seconds, :logs_in_email,\n :history\n )\n end", "def set_alert\n @alert = ::Alert::Alert.find(params[:id])\n end", "def set_alert\n @alert = alert.find(params[:id])\n end", "def create_alert(category = nil, email = '[email protected]')\n category ||= Admin::Alert.categories[:breakdown]\n\n Admin::Alert.create!(description: 'test ' * 25,\n category: category,\n email: email)\n end", "def create_alert_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.create_alert ...\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling AlertApi.create_alert\"\n end\n # resource path\n local_var_path = \"/v2/alerts\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#create_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n if params[:product_sku].present? && params[:best_price].present?\n build_results(params).each do |result|\n alert = Alert.new(result)\n if alert.save\n @success = true\n else\n @success = false\n end\n end\n if @success == true\n redirect_to root_path, notice: 'Price alerts were successfully created.'\n else\n redirect_to root_path, notice: 'Something went wrong, and one or more of your price alerts was not saved.'\n end\n else\n redirect_to :back, notice: 'Oops, make sure you enter a max price and check the box beside at least one of the results.'\n end\n end", "def alert_params\n params.require(:alert).permit(:start, :end, :last_sent, :sms, :email, :user_id, :line_id, :service_name, :recipient_id)\n end", "def set_alert\n@alert = Alert.find(params[:id])\nend", "def new\n @alert_trigger_type = AlertTriggerType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alert_trigger_type }\n end\n end", "def create\n @sleep_alert = SleepAlert.new(sleep_alert_params)\n\n @sleep_alert.bed_time = @sleep_alert.wake_time - 9.hours\n\n respond_to do |format|\n if @sleep_alert.save\n format.html { redirect_to @sleep_alert, notice: 'Sleep alert was successfully created.' }\n format.json { render :show, status: :created, location: @sleep_alert }\n else\n format.html { render :new }\n format.json { render json: @sleep_alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @alert_email = AlertEmail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alert_email }\n end\n end", "def alert_params\n params.fetch(:alert_alert, {}).permit(:id, :apiotics_instance, :led_attributes => [\"led_state\", \"id\"], :button_attributes => [\"safe\", \"id\"])\n end", "def alert_params\n params.require(:alert).permit(:id, :name, :created_at, :updated_at, :date_requested, :last_seen, :last_known_address, :last_known_city, :last_known_state, :last_known_zip, :last_known_county, :site_of_incident, :nic, :agency_name, :agency_phone, :reporting_agency_phone, :reporting_agency_email, :investigating_officer_name, :investigating_officer_title, :investigating_officer_phone,\n victims_attributes: [:id, :last_name, :first_name, :birth_date, :gender, :hair_color, :height_ft, :height_inch, :weight, :eye_color, :race, :type, :age, :age_unit, :additional_info, :alert_id, :_destroy],\n suspects_attributes: [:id, :last_name, :first_name, :birth_date, :gender, :hair_color, :height_ft, :height_inch, :weight, :eye_color, :race, :type, :age, :age_unit, :additional_info, :alert_id, :_destroy],\n vehicles_attributes: [:id, :make, :model, :style, :year, :color, :license_plate_number, :license_plate_state, :additional_info, :alert_id, :_destroy])\n end", "def alert_params\n params.require(:alert).permit(:alert_type, :latitude, :longitude,:email, :harrasment_type)\n end", "def alert_params\n params.require(:alert).permit(:resolved, :priority)\n end", "def get_single_alert(alert_id)\n ret = http_get('/alert/' + alert_id)\n val = Alert.new(ret)\n val\n end", "def alert_params\n params.require(:alert).permit(:city_name, :alert_time, :title)\n end", "def new\n @tipo_alerta = TipoAlerta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_alerta }\n end\n end", "def alert=(alert)\n @alert = alert\n end", "def alert_params\n params.require(:alert).permit(:user_id, :content)\n end", "def create\n @eventnotifier = Eventnotifier.new(eventnotifier_params)\n\n respond_to do |format|\n if @eventnotifier.save\n format.html { redirect_to @eventnotifier, notice: 'Eventnotifier was successfully created.' }\n format.json { render :show, status: :created, location: @eventnotifier }\n else\n format.html { render :new }\n format.json { render json: @eventnotifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to [:admins, @current_event, @alert], notice: t(\"alerts.updated\") }\n format.json { render json: @alert, status: :ok, location: [:admins, @current_event, @alert] }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: \"Alert was successfully updated.\" }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def alert_params\n {\n description: description&.truncate(::AlertManagement::Alert::DESCRIPTION_MAX_LENGTH),\n ended_at: ends_at,\n environment: environment,\n fingerprint: gitlab_fingerprint,\n hosts: truncate_hosts(Array(hosts).flatten),\n monitoring_tool: monitoring_tool&.truncate(::AlertManagement::Alert::TOOL_MAX_LENGTH),\n payload: payload,\n project_id: project.id,\n prometheus_alert: gitlab_alert,\n service: service&.truncate(::AlertManagement::Alert::SERVICE_MAX_LENGTH),\n severity: severity,\n started_at: starts_at,\n title: title&.truncate(::AlertManagement::Alert::TITLE_MAX_LENGTH)\n }.transform_values(&:presence).compact\n end", "def update\n load_alert\n return if (@alert.blank?)\n\n parameters = alert_params\n parameters[:service] = Service.where(:_id => parameters[:service_id]).first if (!parameters[:service_id].blank?)\n\n if (!parameters[:host_ids].blank?)\n # Remove removed hosts\n @alert.hosts.select{|h| parameters[:host_ids].include?(h.id.to_s) == false}.each{|h| @alert.hosts.delete(h)}\n\n # Add the new hosts\n host_ids_add = parameters[:host_ids].select{|h| @alert.host_ids.include?(h) == false}\n Host.where(:_id.in => host_ids_add, :service_ids => parameters[:service_id]).to_a.each do |h|\n @alert.hosts << h\n end\n else\n # Empty the hosts array\n parameters[:hosts] = []\n end\n\n respond_to do|format|\n format.html{\n # The alert can be updated?\n if (@alert.update_attributes(parameters))\n flash[:notice] = t(\"alerts.notice.updated\", :name => @alert.name)\n redirect_to alert_path(@alert)\n else\n # If an error raises, show the form again\n render :action => :edit\n end\n return\n }\n end\n end", "def create_dimensions(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]/dimensions'\n\t\targs[:query]['Action'] = 'CreateDimensions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :dimensions\n\t\t\targs[:body]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @alarm = Alarm.new(alarm_params)\n if @alarm.save\n render json: {\n message: 'Alarm was successfully created.',\n alarm: @alarm\n }\n else\n render json: {\n message: \"Alarm does't created\"\n }\n end\n end", "def alerts(type = 'price')\n authenticated_post(\"auth/r/alerts\", params: {type: type}).body\n end", "def alert\n Alert.new(self)\n end", "def create\n @ee_report = EeReport.new(ee_report_params)\n \n\n respond_to do |format|\n if @ee_report.save\n format.html { redirect_to @ee_report, notice: 'Ee report was successfully created.' }\n format.json { render :show, status: :created, location: @ee_report }\n else\n format.html { render :new }\n format.json { render json: @ee_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @emergency = Emergency.new(create_emergency_params)\n if @emergency.save\n render :show, status: :created, location: @emergency\n else\n render json: { message: @emergency.errors }, status: :unprocessable_entity\n end\n end", "def new\n if current_user.is_admin\n @user_alert = UserAlert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_alert }\n end\n else\n redirect_to new_session_path\n end\n end", "def alert_params\n params.permit(:alert_type,:value,:status)\n end", "def create\n @panic_alarm = PanicAlarm.new(params[:panic_alarm])\n\n respond_to do |format|\n if @panic_alarm.save\n format.html { redirect_to root_path, notice: 'Panic Alarm was Activated' }\n format.json { render json: root_path, status: :created, location: @panic_alarm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @panic_alarm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]'\n\t\targs[:query]['Action'] = 'UpdateAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :alert\n\t\t\targs[:body]['Alert'] = optional[:alert]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @incidente = Incidente.new(incidente_params)\n\n respond_to do |format|\n if @incidente.save\n flash[:success] = @@msgs\n format.html { redirect_to @incidente, notice: @@msgs }\n format.json { render :show, status: :created, location: @incidente }\n else\n flash[:danger] = @@msge\n format.html { render :new }\n format.json { render json: @incidente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alert = Alert.find(params[:id])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estadium = Estadium.new(estadium_params)\n\n respond_to do |format|\n if @estadium.save\n format.html { redirect_to @estadium, notice: 'Estadium was successfully created.' }\n format.json { render :show, status: :created, location: @estadium }\n else\n format.html { render :new }\n format.json { render json: @estadium.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_alert\n @alert = @current_event.alerts.find(params[:id])\n authorize(@alert)\n end", "def new\n @item_alert = ItemAlert.new(author: current_user)\n authorize! :create, @item_alert\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_alert }\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @alert }\n else\n format.html { render action: 'edit' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user\n load_alert\n return if (@alert.blank?)\n\n @user = User.where(:_id => params[:user_id]).first\n\n # Do the user exists?\n if (@user.blank?)\n flash[:error] = t(\"alerts.error.user_not_found\")\n redirect_to alert_users_path()\n return\n end\n\n # is already subscribed?\n if (@alert.user_ids.include?(@user.id))\n flash[:notice] = t(\"alerts.notice.user_already_added\", :name => @user.name, :alert => @alert.name)\n redirect_to alert_users_path()\n return\n end\n\n # Subscribe it\n @alert.users << @user\n\n respond_to do |format|\n format.html{\n if (@alert.save)\n flash[:notice] = t(\"alerts.notice.user_added\", :name => @user.name, :alert => @alert.name)\n else\n flash[:error] = t(\"alerts.error.user_not_added\", :name => @user.name, :alert => @alert.name)\n end\n redirect_to alert_users_path()\n return\n }\n end\n end", "def create\n @rescue = Rescue.new(rescue_params)\n @emergency = Emergency.find(@rescue.emergency_id)\n respond_to do |format|\n if @rescue.save\n format.html { redirect_to @rescue, notice: 'La informacion del formulario de rescate fue creada con exito.' }\n format.json { render :show, status: :created, location: @rescue }\n else\n format.html { render :new }\n format.json { render json: @rescue.errors, status: :unprocessable_entity }\n end\n end\n end", "def alert(user, alert, tweet)\n @tweet = tweet\n @alert = alert\n mail to: user.email, subject: \"You have a new alert from Give Me Notice\"\n end", "def create\n @enterprise = Enterprise.new(params[:enterprise])\n\n respond_to do |format|\n if @enterprise.save\n format.html { redirect_to \"/enterprises\", notice: 'Enterprise was successfully created.' }\n format.json { render json: @enterprise, status: :created, location: @enterprise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enterprise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ess = Esse.new(ess_params)\n\n respond_to do |format|\n if @ess.save\n format.html { redirect_to esses_url, notice: 'Esse was successfully created.' }\n format.json { render :show, status: :created, location: @ess }\n else\n format.html { render :new }\n format.json { render json: @ess.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @essay = Essay.new(params[:essay])\n\n respond_to do |format|\n if @essay.save\n format.html { redirect_to @essay, notice: 'Essay was successfully created.' }\n format.json { render json: @essay, status: :created, location: @essay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @essay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n @patient_alert = PatientAlert.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @patient_alert }\r\n end\r\n end", "def create\n @eve_notification = EveNotification.new(params[:eve_notification])\n\n respond_to do |format|\n if @eve_notification.save\n format.html { redirect_to @eve_notification, notice: 'Eve notification was successfully created.' }\n format.json { render json: @eve_notification, status: :created, location: @eve_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @eve_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def alerts=(value)\n @alerts = value\n end", "def sms_alert_params\n params.require(:sms_alert).permit(:alertType, :frequency, :account_id, :next_alert, :trigger_criteria, :trigger_amount)\n end", "def create_old\n @alarm_notification = AlarmNotification.new(params[:alarm_notification])\n\n respond_to do |format|\n if @alarm_notification.save\n format.html { redirect_to @alarm_notification, notice: 'Alarm notification was successfully created.' }\n format.json { render json: @alarm_notification, status: :created, location: @alarm_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @alarm_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def alert=(message)\n self[:alert] = message\n end" ]
[ "0.80237335", "0.7841779", "0.77494395", "0.75376034", "0.74906987", "0.7240869", "0.71494323", "0.71256834", "0.711372", "0.7078331", "0.7041308", "0.703248", "0.67905915", "0.6673066", "0.6661133", "0.6660909", "0.6658149", "0.664778", "0.66343194", "0.65970427", "0.6585386", "0.64657116", "0.63994294", "0.63897777", "0.634931", "0.63453114", "0.6309628", "0.6298496", "0.6295894", "0.62722206", "0.6246778", "0.6199823", "0.6178737", "0.6150275", "0.61374706", "0.61109287", "0.61109287", "0.61109287", "0.61109287", "0.61109287", "0.61109287", "0.61109287", "0.61109287", "0.61109287", "0.61109287", "0.60910946", "0.60577315", "0.6023979", "0.6005768", "0.5998879", "0.59417486", "0.59405375", "0.59086984", "0.59086734", "0.5891225", "0.5874028", "0.58492786", "0.5820217", "0.5788874", "0.5787563", "0.5787062", "0.575196", "0.5745913", "0.5743966", "0.5734675", "0.5713227", "0.56829053", "0.56769", "0.5660635", "0.5639883", "0.5634298", "0.5627868", "0.56226933", "0.56216127", "0.5618056", "0.5608886", "0.5600467", "0.5597027", "0.55963767", "0.55698884", "0.5569162", "0.55457723", "0.55433226", "0.55388176", "0.5527613", "0.55147", "0.55044174", "0.54997486", "0.5485895", "0.54856837", "0.5474041", "0.5473371", "0.5469445", "0.54673195", "0.5461427", "0.5461263", "0.54265124", "0.5420914", "0.54132044", "0.5406776" ]
0.7783944
2
Action to show a the information about an existing alert. [URL] GET /alerts/:id [Parameters] id The identificator of the alert.
def show load_alert return if (@alert.blank?) respond_to do|format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @alert = Alert.find(params[:id])\n end", "def get_single_alert(alert_id)\n ret = http_get('/alert/' + alert_id)\n val = Alert.new(ret)\n val\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert }\n end\n end", "def set_alert\n @alert = ::Alert::Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = alert.find(params[:id])\n end", "def new_alert\n@alert = Alert.new(params[:id])\nend", "def set_alert\n@alert = Alert.find(params[:id])\nend", "def alert(id)\n slurp_stream(\"alert/#{id}\") do |data|\n yield data\n end\n end", "def get_alert(identifier, opts = {})\n data, _status_code, _headers = get_alert_with_http_info(identifier, opts)\n return data\n end", "def get_site_alerts(id, opts = {})\n data, _status_code, _headers = get_site_alerts_with_http_info(id, opts)\n data\n end", "def get_site_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_site_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_site_snmp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = get_site_snmp_alert_with_http_info(id, alert_id, opts)\n data\n end", "def show\n if current_user.is_admin\n @user_alert = UserAlert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_alert }\n end\n else\n redirect_to new_session_path\n end\n end", "def get_site_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_site_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @alert_email = AlertEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_email }\n end\n end", "def set_alert\n unless params[:alert].blank?\n # remove single/double quotes from name to avoid display error:\n params[:alert][:name] = params[:alert][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:alert][:name].blank?\n end\n @alert = current_user.alerts.find(params[:id])\n end", "def get_site_alerts(id, opts = {})\n data, _status_code, _headers = get_site_alerts_with_http_info(id, opts)\n return data\n end", "def load_alert(redirect = true)\n if (params[:id].blank?)\n @alert = nil\n return @alert\n end\n\n @alert = Alert.where(:_id => params[:id]).first\n\n if (@alert.blank? && redirect)\n # If not found, show an error and redirect\n flash[:error] = t(\"alerts.error.not_found\")\n redirect_to alerts_path()\n end\n\n return @alert\n end", "def show\r\n @patient_alert = PatientAlert.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @patient_alert }\r\n end\r\n end", "def get_site_snmp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = get_site_snmp_alert_with_http_info(id, alert_id, opts)\n return data\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html\n end\n end", "def show\n # authorize! :read, @item_alert\n # @item_alert = ItemAlert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_alert }\n end\n end", "def show\n @alert_trigger_type = AlertTriggerType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_trigger_type }\n end\n end", "def show\n begin\n @incident = Incident.find(params[:id])\n rescue\n logger.error \"Attempt to access unknown incident report #{params[:id]}\"\n redirect_to incidents_url, notice: 'Sorry, invalid Incident ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident }\n end\n end\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to user_path(current_user), notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_alerta }\n end\n end", "def show\n\n if !params[:id].nil?\n report = Report.find_by_id(params[:id])\n if report\n render json: report, status: :ok\n else\n render json: {message: 'Report doesn\\'t exist'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error getting report detail, please try it again'}, status: :bad_request\n end\n end", "def get_alert_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.get_alert ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.get_alert\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'GetAlertResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#get_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_site_snmp_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.create_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @alert = Alert.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def edit\n load_alert\n return if (@alert.blank?)\n\n respond_to do|format|\n format.html\n end\n end", "def create_site_snmp_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.create_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def get_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = get_site_snmp_alerts_with_http_info(id, opts)\n data\n end", "def create_site_snmp_alert(id, opts = {})\n data, _status_code, _headers = create_site_snmp_alert_with_http_info(id, opts)\n data\n end", "def create_site_snmp_alert(id, opts = {})\n data, _status_code, _headers = create_site_snmp_alert_with_http_info(id, opts)\n return data\n end", "def alert\n self[:alert]\n end", "def show\n\t\t\t\"nothing to show for id - #{params[:id]} - with parameters: #{params.to_s}\"\n\t\tend", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to [:admins, @current_event, @alert], notice: t(\"alerts.updated\") }\n format.json { render json: @alert, status: :ok, location: [:admins, @current_event, @alert] }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.get_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp/{alertId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SnmpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.get_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp/{alertId}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SnmpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @alerts = Alert.all\n end", "def index\n @alerts = Alert.all\n end", "def index\n @alerts = Alert.all\n end", "def set_alert\n @alert = @current_event.alerts.find(params[:id])\n authorize(@alert)\n end", "def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to alerts_path, notice: 'Alert was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @alert }\n else\n format.html { render action: 'new' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_site_snmp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_site_snmp_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_snmp_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesSnmpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_snmp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = get_site_snmp_alerts_with_http_info(id, opts)\n return data\n end", "def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to root_path, notice: \"Has creado una nueva alerta. Pronto te avisaremos cuando encontremos lo que buscas\" }\n format.json { render :show, status: :created, location: @alert }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_site_snmp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_site_snmp_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_snmp_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesSnmpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_snmp_alerts\\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 @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @alert }\n else\n format.html { render action: 'edit' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alert = Alert.new(alert_params)\n if @alert.save!\n redirect_to alerts_path(@alert)\n else \n render 'new', :notice => \"Uh Oh\"\n end\n end", "def get_site_syslog_alert(id, alert_id, opts = {})\n data, _status_code, _headers = get_site_syslog_alert_with_http_info(id, alert_id, opts)\n data\n end", "def get(id)\n Event.new(self, @connection.request(:show, {:id => id}))\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def alert\n Alert.new(self)\n end", "def set_site_snmp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.set_site_snmp_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.set_site_snmp_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#set_site_snmp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def info(id)\n http.get(\"/nfse/#{id}\") do |response|\n respond_with_entity(response)\n end\n end", "def set_site_snmp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.set_site_snmp_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.set_site_snmp_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#set_site_snmp_alerts\\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 @alert.update(alert_params)\n format.html { redirect_to @alert, notice: \"Alert was successfully updated.\" }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.update_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.update_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp/{alertId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def entry(id)\n LiveJournal::Request::GetEvents.new(@user, :itemid => id, :strict => false).run ||\n raise(NoSuchEntry, \"There is no entry with that id.\")\n end", "def update_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.update_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.update_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp/{alertId}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @alert = Alert.new\n @selected = params[:alert_ids]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def get_site_syslog_alert(id, alert_id, opts = {})\n data, _status_code, _headers = get_site_syslog_alert_with_http_info(id, alert_id, opts)\n return data\n end", "def show\n\t\t\"I'd love to show you object with id: #{params[:id]}\"\n\tend", "def report(id)\n get(\"reports/#{id}\")\n end", "def get_site_smtp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_site_smtp_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_smtp_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/smtp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesSmtpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_smtp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_site_smtp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = get_site_smtp_alert_with_http_info(id, alert_id, opts)\n data\n end", "def create_site_syslog_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.create_site_syslog_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_syslog_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/syslog\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_syslog_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_site_syslog_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.create_site_syslog_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_syslog_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/syslog'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_syslog_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end", "def get_site_smtp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_site_smtp_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_smtp_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/smtp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesSmtpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_smtp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def snooze_alert(identifier, body, opts = {})\n data, _status_code, _headers = snooze_alert_with_http_info(identifier, body, opts)\n return data\n end", "def set_email_alert\n @email_alert = EmailAlert.find(params[:id])\n end", "def alert\n state[\"alert\"]\n end", "def new\n @show = @ticketalert.show\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticketalert }\n end\n end", "def create_site_smtp_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.create_site_smtp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_smtp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/smtp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_smtp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def episode_by_id(id)\n episode = $delivery.entry(id, include: 2)\n halt 404 if episode.nil?\n Episode.new(episode)\n end", "def create_site_smtp_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.create_site_smtp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_smtp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/smtp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_smtp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def entry(id)\n LiveJournal::Request::GetEvents.new(@user, :itemid => id, :strict => false).run || raise(\"There is no entry with that id.\")\n rescue exception_block\n end", "def show\n @id = params[:id]\n end", "def show\n @id = params[:id]\n end", "def show\n @employee = Employee.find[params[:id]]\n end", "def show\n @panic_alarm = PanicAlarm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @panic_alarm }\n end\n end", "def show\n submenu_item 'applications-index'\n @app = App.find(params[:id], query)\n @alerts = Alert.all({\n :conditions => [\"source_type = 2 and source_id = ? and severity <> 0\", @app.id]\n })\n @services = @app.services\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end" ]
[ "0.79979634", "0.7519175", "0.7086312", "0.70855886", "0.70855886", "0.70668525", "0.6982814", "0.69535065", "0.69535065", "0.69535065", "0.69535065", "0.69535065", "0.69535065", "0.69535065", "0.69535065", "0.69535065", "0.69535065", "0.6932156", "0.690927", "0.67605275", "0.67518646", "0.6481956", "0.6448187", "0.634623", "0.6344878", "0.6329306", "0.63237625", "0.63146734", "0.6299661", "0.62879866", "0.62862396", "0.62721026", "0.6264937", "0.62602663", "0.62126553", "0.614564", "0.61450064", "0.61332536", "0.6117599", "0.6080996", "0.60637957", "0.59979004", "0.5993381", "0.5993208", "0.5985014", "0.59842014", "0.5983593", "0.5982487", "0.5941695", "0.59396106", "0.59214854", "0.59187657", "0.5910363", "0.58969057", "0.58849883", "0.5865614", "0.5865614", "0.5865614", "0.5857521", "0.58554333", "0.5852997", "0.5845605", "0.58404845", "0.5836609", "0.5825569", "0.5820556", "0.58160543", "0.5776416", "0.5772767", "0.57523143", "0.5747827", "0.5735237", "0.5729826", "0.5707629", "0.5706372", "0.57013065", "0.57008404", "0.56972045", "0.56858796", "0.5675714", "0.5666224", "0.56585026", "0.5655397", "0.5652898", "0.56498367", "0.56401306", "0.5640079", "0.56334406", "0.5629257", "0.5626476", "0.562395", "0.56117827", "0.5607953", "0.56058586", "0.56017566", "0.55974543", "0.55974543", "0.5596314", "0.5595845", "0.5583167" ]
0.5847941
61
Action to show a form to edit an existing alert. [URL] GET /alerts/:id/edit [Parameters] id The identificator of the alert.
def edit load_alert return if (@alert.blank?) respond_to do|format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(id)\n @post = flash[:form_data] || Post[id]\n\n # Make sure the post is valid\n if @post.nil?\n flash[:error] = 'The specified post is invalid'\n redirect_referrer\n end\n\n @title = \"Edit #{@post.title}\"\n\n render_view(:form)\n end", "def edit(id)\n @user = flash[:form_data] || User[id]\n\n if @user.nil?\n flash[:error] = 'The specified user is invalid'\n redirect_referrer\n end\n\n @title = \"Edit #{@user.username}\"\n\n render_view(:form)\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit(id)\n @lwidth = '20%'\n @rwidth = '0'\n @account = flash[:form_data] || Account[id]\n @tasks = Task.filter(:account_id => id)\n @opports = Opport.filter(:account_id => id)\n session[:method] = 'edit'\n\n # Make sure the item exists\n if @account.nil?\n flash[:error] = 'The specified Account is invalid'\n redirect_referrer\n end\n @name = \"Edit #{@account.name}\"\n Action.add_record(@account.id, session[:email], 'updated', 'account', @account.name)\n @items = Action.recent_items\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to user_path(current_user), notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @employee = Employee.find(params[:id])\n end", "def set_edit\n @edit = Edit.find_by_id(params[:id])\n end", "def edit\n @record = Record.find(params[:id])\n end", "def edit(id)\n records = Base.where(_id: id)\n if records.count > 0 and @user != nil and @user.admin?(@routes)\n info = Base64.encode64 records.first.id.to_s.encrypt\n\n show :edit, {views: File.join(Classiccms::ROOT, 'views/cms')}, {encrypteddata: info}\n end\n end", "def set_edit\n @edit = Edit.find(params[:id])\n end", "def set_edit\n @edit = Edit.find(params[:id])\n end", "def set_edit\n\t @edit = Edit.find(params[:id])\n\t end", "def edit\n\t\tif params[:id].nil?\n\t\t\tflash[:error] = 'The password reset code was missing.'\n\t\t\tredirect_to root_path\n\t\tend\n end", "def edit\n\t\t@event = Event.find(params[:id])\n\tend", "def edit\n message = Message.find(params[:id])\n end", "def edit\n id = params[:id].presence || 0 \n @element = @@model.find(id)\n end", "def edit\n # Renders the edit form\n end", "def edit\n @item = Item.find_by_id( params[:id] )\n render :layout => 'form'\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to [:admins, @current_event, @alert], notice: t(\"alerts.updated\") }\n format.json { render json: @alert, status: :ok, location: [:admins, @current_event, @alert] }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @event = Event.find(params[:id])\n end", "def edit\n @event = Event.find(params[:id])\n end", "def edit\n @grade_entry_form = GradeEntryForm.find(params[:id])\n end", "def edit\n @note = Note.find(params[:id])\n end", "def edit\n @resource = Admin.find(params[:id])\n end", "def edit(id)\n @lwidth = '20%'\n @rwidth = '0'\n @contact = flash[:form_data] || Contact[id]\n @tasks = Task.filter(:contact_id => id)\n @task_count = @tasks.count\n session[:method] = 'edit'\n # Make sure the item exists\n if @contact.nil?\n flash[:error] = 'The specified Contact is invalid'\n redirect_referrer\n end\n @name = \"Edit #{@contact.last_name}\"\n @campaign_name = Array.new(1,@contact.campaign.name)\n Action.add_record(@contact.id, session[:email], 'updated', 'contact', @contact.last_name)\n @items = Action.recent_items\n end", "def edit\n\n @event = Event.find(params[:id])\n\n # Edit\n if params[:event]\n if @event.update_attributes(params[:event])\n flash[:notice] = t(:events_edit_succ)\n redirect_to(:action => :index)\n else\n render(:action => :edit)\n end\n\n end\n end", "def edit\n @post = PostService.getPostById(params[:id])\n @post_form = PostForm.new(PostForm.initialize(@post))\n end", "def edit\n\n end", "def edit \n @article = Article.find(params[:id])\n end", "def edit # Showing edit form\n @post = Post.find(params[:id])\n end", "def edit\n\t\t@post = Post.find(params[:id])\n\t\trender layout: \"admin_layout\"\n\tend", "def edit\n @admin = Admin.find(params[:id])\n end", "def edit\n @admin = Admin.find(params[:id])\n end", "def edit\n @admin = Admin.find(params[:id])\n end", "def edit\n\t\t@article = Article.find(params[:id])\n\tend", "def edit\n @event = Event.find(params[:id])\n\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @alert }\n else\n format.html { render action: 'edit' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @post = Post.find_by(id: params[:id])\n end", "def edit\n new\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @article = Article.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @offer = Offer.find(params[:id])\n end", "def show\n @alert = Alert.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\r\n @post = Post.find(params[:id])\r\n end", "def edit\n resource.before_actions[:edit].call(@record) if resource.before_actions[:edit]\n end", "def edit\n Log.add_info(request, params.inspect)\n\n mail_account_id = params[:id]\n\n begin\n @mail_account = MailAccount.find(mail_account_id)\n rescue => evar\n Log.add_error(request, evar)\n redirect_to(:controller => 'login', :action => 'logout')\n return\n end\n render(:layout => (!request.xhr?))\n end", "def edit\n Log.add_info(request, params.inspect)\n\n mail_account_id = params[:id]\n\n begin\n @mail_account = MailAccount.find(mail_account_id)\n rescue => evar\n Log.add_error(request, evar)\n redirect_to(:controller => 'login', :action => 'logout')\n return\n end\n render(:layout => (!request.xhr?))\n end", "def edit\n # Mostra la form per modificare un evento\n render \"edit\"\n end", "def edit\r\n @article = Article.find_by_id(params[:id]);\r\n if !@article\r\n redirect_to welcome_index_path\r\n end\r\n end", "def edit\n \t@message = Message.find(params[:id])\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_alert\n @alert = alert.find(params[:id])\n end", "def update\n @alert_email = AlertEmail.find(params[:id])\n\n respond_to do |format|\n if @alert_email.update_attributes(params[:alert_email])\n format.html { redirect_to(@alert_email, :notice => 'Alert email was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @alert_email.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @article = Article.find params[:id]\n end", "def edit\n @loc = Loc.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n begin\n @entry = @current_user.log_entries.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n flash[:error] = \"Unable to find log entry with id #{params[:id]}\"\n return redirect_to(:action => :index)\n end\n\n respond_to {|format| format.html}\n end", "def edit\n @cause = Cause.find(params[:id])\n end", "def edit\n @invite = Invite.find(params[:id])\n end", "def edit\n @info = Info.find(params[:id])\n end", "def edit \n @article=Article.find(params[:id])\n end", "def edit \n @article=Article.find(params[:id])\n end", "def edit\n @article= Article.find(params[:id])\n end", "def edit\n @current_event = Event.find(params[:id])\n # render html: 'edit!'\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def edit\n \t\t@post = Post.find(params[:id])\n\tend", "def edit\n\t\t@post = Post.find(params[:id])\n\tend", "def edit\n\t\t@post = Post.find(params[:id])\n\tend", "def update\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n if @tipo_alerta.update_attributes(params[:tipo_alerta])\n format.html { redirect_to @tipo_alerta, notice: 'Tipo alerta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_alerta.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n#\t\t@event = Event.find(params[:id])\n\tend", "def edit\n @contact = Contact.find(params[:id])\n end" ]
[ "0.72797257", "0.6862649", "0.6750023", "0.658629", "0.64910907", "0.6414594", "0.6365494", "0.63514763", "0.6281163", "0.6280584", "0.6280584", "0.6260584", "0.6255183", "0.6244062", "0.6214726", "0.6209062", "0.6200263", "0.61911684", "0.61878026", "0.6187618", "0.61816365", "0.61816365", "0.6163718", "0.61596173", "0.61485094", "0.61468655", "0.6135014", "0.6129822", "0.61266893", "0.6121118", "0.60954106", "0.6083559", "0.60829914", "0.60829914", "0.60829914", "0.6081529", "0.6080138", "0.60644716", "0.6043507", "0.6041276", "0.60411346", "0.60411346", "0.60411346", "0.60411346", "0.60411346", "0.60411346", "0.60411346", "0.60411346", "0.60411346", "0.60411346", "0.60411346", "0.6033603", "0.6033603", "0.6033603", "0.60334605", "0.60313684", "0.60023236", "0.5997687", "0.5995264", "0.5994475", "0.5994475", "0.59900445", "0.5990034", "0.59864", "0.5980242", "0.5978461", "0.5969022", "0.5967592", "0.59607565", "0.5960749", "0.5960749", "0.5960749", "0.5960749", "0.5960749", "0.5960749", "0.5960749", "0.59509903", "0.5936414", "0.59349495", "0.59347886", "0.59295756", "0.59295756", "0.5925973", "0.5925806", "0.59238756", "0.59238756", "0.59238756", "0.59238756", "0.59238756", "0.59238756", "0.59238756", "0.59238756", "0.59238756", "0.59238756", "0.59219193", "0.5920891", "0.5920891", "0.5916067", "0.59155005", "0.59143436" ]
0.6528518
4
Action to update an existing alert with the data received from the form. [URL] PUT /alerts/:id PATCH /alerts/:id [Parameters] id The identificator of the alert. alert The data recolected for the alert.
def update load_alert return if (@alert.blank?) parameters = alert_params parameters[:service] = Service.where(:_id => parameters[:service_id]).first if (!parameters[:service_id].blank?) if (!parameters[:host_ids].blank?) # Remove removed hosts @alert.hosts.select{|h| parameters[:host_ids].include?(h.id.to_s) == false}.each{|h| @alert.hosts.delete(h)} # Add the new hosts host_ids_add = parameters[:host_ids].select{|h| @alert.host_ids.include?(h) == false} Host.where(:_id.in => host_ids_add, :service_ids => parameters[:service_id]).to_a.each do |h| @alert.hosts << h end else # Empty the hosts array parameters[:hosts] = [] end respond_to do|format| format.html{ # The alert can be updated? if (@alert.update_attributes(parameters)) flash[:notice] = t("alerts.notice.updated", :name => @alert.name) redirect_to alert_path(@alert) else # If an error raises, show the form again render :action => :edit end return } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to user_path(current_user), notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to [:admins, @current_event, @alert], notice: t(\"alerts.updated\") }\n format.json { render json: @alert, status: :ok, location: [:admins, @current_event, @alert] }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @alert }\n else\n format.html { render action: 'edit' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: \"Alert was successfully updated.\" }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n if @tipo_alerta.update_attributes(params[:tipo_alerta])\n format.html { redirect_to @tipo_alerta, notice: 'Tipo alerta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_alerta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @email_alert.update(email_alert_params)\n format.html { redirect_to @email_alert, notice: 'Email alert was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_alert }\n else\n format.html { render :edit }\n format.json { render json: @email_alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alert_email = AlertEmail.find(params[:id])\n\n respond_to do |format|\n if @alert_email.update_attributes(params[:alert_email])\n format.html { redirect_to(@alert_email, :notice => 'Alert email was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @alert_email.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticketalert.update_attributes(params[:ticketalert])\n flash[:notice] = 'Ticketalert was successfully updated.'\n format.html { redirect_to(@ticketalert) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticketalert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]'\n\t\targs[:query]['Action'] = 'UpdateAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :alert\n\t\t\targs[:body]['Alert'] = optional[:alert]\n\t\tend\n\t\tself.run(args)\n\tend", "def update\n @item_alert = ItemAlert.find(params[:id])\n authorize! :create, @item_alert\n\n respond_to do |format|\n # if @item_alert.update_attributes(params[:item_alert])\n if @item_alert.update_attributes(item_alert_params)\n format.html do\n redirect_to @item_alert, notice: 'Item alert was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json do\n render json: @item_alert.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @security_alert.update(security_alert_params)\n format.html { redirect_to home_path, notice: 'Security alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @security_alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @patient_alert = PatientAlert.find(params[:id])\r\n respond_to do |format|\r\n if @patient_alert.update_attributes(params[:patient_alert])\r\n get_patient_by_alert\r\n APP_LOGGER_LOG.info \"ALERT UPDATED - for PATIENT ID \" + \r\n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\r\n \r\n flash[:notice] = 'PatientAlert was successfully updated.'\r\n format.html { redirect_to(@patient_alert) }\r\n format.xml { render :xml => @patient_alert }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @patient_alert.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def set_alert\n @alert = alert.find(params[:id])\n end", "def update\n @alert_trigger_type = AlertTriggerType.find(params[:id])\n\n respond_to do |format|\n if @alert_trigger_type.update_attributes(params[:alert_trigger_type])\n flash[:notice] = 'AlertTriggerType was successfully updated.'\n format.html { redirect_to(admin_alert_trigger_type_path(@alert_trigger_type)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @alert_trigger_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(session[:id])\n alert = {:title => alert_params[:title], :city_name => alert_params[:city_name], :alert_time => alert_params[:alert_time], :user => user }\n respond_to do |format|\n if @alert.update(alert)\n format.html { redirect_to('/alerts', notice: 'Alert was successfully updated.')}\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_alert\n @alert = ::Alert::Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def update\n @alert = Alert.find(params[:id])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @price_alert.update(price_alert_params)\n format.html { redirect_to @price_alert, notice: 'Price alert was successfully updated.' }\n format.json { render :show, status: :ok, location: @price_alert }\n else\n format.html { render :edit }\n format.json { render json: @price_alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_site_snmp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = update_site_snmp_alert_with_http_info(id, alert_id, opts)\n data\n end", "def update_site_snmp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = update_site_snmp_alert_with_http_info(id, alert_id, opts)\n return data\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to(alerts_path, :notice => 'Alert was successfully updated.') }\n format.xml { head :ok }\n else\n if @alert.alert_uploads.count != NO_OF_IMAGES\n @alert.alert_uploads.count + ( NO_OF_IMAGES - @alert.alert_uploads.count).times{@alert.alert_uploads.build}\n end\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @alert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_site_smtp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = update_site_smtp_alert_with_http_info(id, alert_id, opts)\n data\n end", "def update\n @user_alert = UserAlert.find(params[:id])\n if current_user.is_admin || current_user == @user_alert.user\n respond_to do |format|\n if @user_alert.update_attributes(params[:user_alert])\n flash[:notice] = 'UserAlert was successfully updated.'\n format.html { redirect_to(@user_alert) }\n format.xml { head :ok }\n format.js { render :partial => '/users/user', :object => current_user }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_alert.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to new_session_path\n end\n end", "def set_alert\n unless params[:alert].blank?\n # remove single/double quotes from name to avoid display error:\n params[:alert][:name] = params[:alert][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:alert][:name].blank?\n end\n @alert = current_user.alerts.find(params[:id])\n end", "def update_site_smtp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = update_site_smtp_alert_with_http_info(id, alert_id, opts)\n return data\n end", "def update!(**args)\n @alerts = args[:alerts] if args.key?(:alerts)\n end", "def set_alert\n@alert = Alert.find(params[:id])\nend", "def update\n if @alarm.update(alarm_params)\n respond_with(@alarm, location: alarms_path, notice: 'Alarm was successfully updated.')\n else\n respond_with(@alarm)\n end\n end", "def update_site_smtp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.update_site_smtp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_smtp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.update_site_smtp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/smtp/{alertId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_smtp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_site_smtp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.update_site_smtp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_smtp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.update_site_smtp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/smtp/{alertId}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_smtp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.update_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.update_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp/{alertId}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.update_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.update_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp/{alertId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_alert\n @alert = @current_event.alerts.find(params[:id])\n authorize(@alert)\n end", "def update_alert_policy(policy_id, body, opts = {})\n data, _status_code, _headers = update_alert_policy_with_http_info(policy_id, body, opts)\n return data\n end", "def update\n @alarm_task = AlarmTask.find(params[:id])\n\n respond_to do |format|\n if @alarm_task.update_attributes(params[:alarm_task])\n format.html { redirect_to @alarm_task, notice: 'Alarm task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alarm_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notice = Notice.find(params[:id])\n\n respond_to do |format|\n if @notice.update_attributes(params[:notice])\n format.html { redirect_to @notice, notice: 'Notice was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notice = Notice.get(params[:id])\n\n respond_to do |format|\n if @notice.save(params[:notice])\n format.html { redirect_to(@notice) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notice.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @weather_station_alert.update(weather_station_alert_params)\n # format.html { redirect_to @weather_station_alert, notice: 'Weather station alert was successfully updated.' }\n # format.json { render :show, status: :ok, location: @weather_station_alert }\n # else\n # format.html { render :edit }\n # format.json { render json: @weather_station_alert.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @alarm_action.update(alarm_action_params)\n format.html { redirect_to @alarm_action, notice: 'Alarm action was successfully updated.' }\n format.json { render :show, status: :ok, location: @alarm_action }\n else\n format.html { render :edit }\n format.json { render json: @alarm_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_single_alert(alert_id)\n ret = http_get('/alert/' + alert_id)\n val = Alert.new(ret)\n val\n end", "def update\n @dashboard = Dashboard.find(params[:id])\n\n respond_to do |format|\n if @dashboard.update_attributes(params[:dashboard])\n format.html { redirect_to(@dashboard, :notice => 'Dashboard was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dashboard.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_site_syslog_alert(id, alert_id, opts = {})\n data, _status_code, _headers = update_site_syslog_alert_with_http_info(id, alert_id, opts)\n data\n end", "def update\n @emergency = Emergency.find(@rescue.emergency_id)\n respond_to do |format|\n if @rescue.update(rescue_params)\n format.html { redirect_to @rescue, notice: 'La informacion del formulario de rescate fue actualizada con exito.' }\n format.json { render :show, status: :ok, location: @rescue }\n else\n format.html { render :edit }\n format.json { render json: @rescue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alarm_notification = AlarmNotification.find(params[:id])\n\n respond_to do |format|\n if @alarm_notification.update_attributes(params[:alarm_notification])\n format.html { redirect_to @alarm_notification, notice: 'Alarm notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alarm_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @catch = Catch.find(params[:id])\n\n respond_to do |format|\n if @catch.update_attributes(params[:catch])\n format.html { redirect_to @catch, notice: 'Catch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @catch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n \n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to [:admins,@offer], notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dashboard = Dashboard.find(params[:id])\n\n respond_to do |format|\n if @dashboard.update_attributes(params[:dashboard])\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_site_syslog_alert(id, alert_id, opts = {})\n data, _status_code, _headers = update_site_syslog_alert_with_http_info(id, alert_id, opts)\n return data\n end", "def update\n respond_to do |format|\n if @alarm.update(alarm_params)\n format.html { redirect_to group_alarms_path, notice: 'アラームを更新しました' }\n format.json { render :show, status: :ok, location: @alarm }\n else\n format.html { render :edit }\n format.json { render json: @alarm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_email_alert\n @email_alert = EmailAlert.find(params[:id])\n end", "def alert=(alert)\n @alert = alert\n end", "def update\n @employee = Employee.find(params[:id])\n flash[:success] = \"Empleado editado exitosamente\" if @employee.update_attributes(params[:employee])\n respond_with(@employee)\n end", "def update\n @reporte = Reporte.find(params[:id])\n\n respond_to do |format|\n if @reporte.update_attributes(params[:reporte])\n format.html { redirect_to @reporte, notice: 'Reporte fue actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reporte.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employee = Employee.find(params[:id])\n flash[:notice] = 'Employee was successfully updated.' if @employee.update_attributes(params[:employee])\n respond_with(@employee)\n end", "def show\n @alert = Alert.find(params[:id])\n end", "def update\n @inventory_report = InventoryReport.find(params[:id])\n\n respond_to do |format|\n if @inventory_report.update_attributes(params[:inventory_report])\n format.html { redirect_to @inventory_report, notice: 'Inventory report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_jobalert\n @jobalert = JobAlert.find(params[:id])\n end", "def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @portal = Portal.find(params[:id])\n\n respond_to do |format|\n if @portal.update_attributes(params[:portal])\n flash[:notice] = 'Portal was successfully updated.'\n format.html { redirect_to(@portal) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @portal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to(@report, :notice => 'Report was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n flash[:notice] = 'Se ha modificado su oferta'\n format.html { redirect_to @offer }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @essay = Essay.find(params[:id])\n\n respond_to do |format|\n if @essay.update_attributes(params[:essay])\n format.html { redirect_to @essay, notice: 'Essay was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @essay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @energy = Energy.find(params[:id])\n\n respond_to do |format|\n if @energy.update_attributes(params[:energy])\n format.html { redirect_to @energy, notice: 'Energy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @energy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sleep = Sleep.find(params[:id])\n\n respond_to do |format|\n if @sleep.update_attributes(params[:sleep])\n format.html { redirect_to @sleep, notice: 'Sleep was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sleep.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @avert = Avert.find(params[:id])\n\n respond_to do |format|\n if @avert.update_attributes(params[:avert])\n format.html { redirect_to @avert, notice: 'Avert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @avert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to edit_offer_path(@offer), notice: 'Oferta a fost updatata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @daily_data_delivery_exception = DailyDataDeliveryException.find(params[:id])\n\n respond_to do |format|\n if @daily_data_delivery_exception.update_attributes(params[:daily_data_delivery_exception])\n format.html { redirect_to @daily_data_delivery_exception, notice: 'Daily data delivery exception was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daily_data_delivery_exception.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @alarm.update(alarm_params)\n render json: {\n message: 'Alarm was successfully updated.',\n alarm: @alarm\n }\n else\n render json: {\n message: 'Alarm updated.',\n alarm: @alarm\n }\n end \n end", "def update_site_syslog_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.update_site_syslog_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_syslog_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.update_site_syslog_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/syslog/{alertId}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_syslog_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_site_syslog_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.update_site_syslog_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_syslog_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.update_site_syslog_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/syslog/{alertId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_syslog_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n #authenticate admin\n @employee = Employee.find(params[:id])\n\n if @employee.update_attributes(update_params)\n flash[:success] = \"successful update of employee\"\n redirect_to admin_employee_path(@employee)\n else\n flash.now[:danger] = \"employee update failed\"\n render \"edit\"\n end\n end", "def update\n respond_to do |format|\n if @audit.update(audit_params)\n format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit }\n else\n format.html { render :edit }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(@employee, :notice => 'Employee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @attendee = Attendee.find(params[:id])\n\n respond_to do |format|\n if @attendee.update_attributes(attendee_params)\n format.html { redirect_to @attendee, :notice => 'Attendee was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @attendee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t\n\t\tif @article.update(article_params)\n\t\t\tflash[:success] = \"Article was successfully updated\"\n\t\t\tredirect_to article_path(@article)\n\t\telse\t\n\t\t\trender 'edit'\n\t\tend\n\tend", "def update(model, id, opts = {})\n name = model_name(model)\n do_restful_action(\"update\", name) do\n self.nagyo[\"#{name}/#{URI.encode(id)}/edit\"].put(:format => :js, name => opts)\n end\n end", "def new_alert\n@alert = Alert.new(params[:id])\nend", "def update\n @id = Id.find(params[:id])\n\n respond_to do |format|\n if @id.update_attributes(params[:id])\n format.html { redirect_to @id, :notice => 'Id was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @hive_event = HiveEvent.find(params[:id])\n\n respond_to do |format|\n if @hive_event.update_attributes(params[:hive_event])\n format.html { redirect_to @hive_event, notice: 'Hive event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hive_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dashboard = Account.find(session[:account_id]).dashboards.find(params[:id])\n\n respond_to do |format|\n if @dashboard.update_attributes(params[:dashboard])\n format.html { redirect_to(@dashboard, :notice => 'Dashboard was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dashboard.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to root_path, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.81832534", "0.80246913", "0.7664461", "0.76615584", "0.76027447", "0.75688535", "0.7137397", "0.7094946", "0.70573235", "0.69820243", "0.6944312", "0.6930605", "0.68623674", "0.6847843", "0.6759337", "0.6756105", "0.67323685", "0.6707822", "0.6655359", "0.6655359", "0.6655359", "0.6655359", "0.6655359", "0.6655359", "0.6655359", "0.6655359", "0.6655359", "0.6655359", "0.6649907", "0.65909725", "0.64607453", "0.6441862", "0.6333725", "0.6322487", "0.63004315", "0.6280923", "0.6253907", "0.62520665", "0.6140312", "0.6107468", "0.60307956", "0.60283697", "0.5991051", "0.5984022", "0.59744024", "0.5929581", "0.59118164", "0.5886659", "0.5860105", "0.58387613", "0.5831162", "0.5817047", "0.58073", "0.5801288", "0.5798981", "0.5776819", "0.5772764", "0.57687104", "0.5737382", "0.57176054", "0.56996757", "0.5693602", "0.5693064", "0.568911", "0.56659555", "0.5665594", "0.5661459", "0.5661459", "0.5660211", "0.56475496", "0.5641897", "0.56394666", "0.5623901", "0.5615397", "0.5615397", "0.5607907", "0.56075406", "0.5602989", "0.559119", "0.55909306", "0.55724156", "0.5567252", "0.556566", "0.5561593", "0.5560347", "0.55497515", "0.5549742", "0.55439764", "0.55419517", "0.553277", "0.55279374", "0.5518081", "0.55175525", "0.55174357", "0.5517421", "0.5516403", "0.5515848", "0.5514742", "0.5511133", "0.55106395" ]
0.6299407
35
Action to destroy an existing alert in the database. [URL] DELETE /alerts/:id [Parameters] id The identificator of the alert.
def destroy load_alert return if (@alert.blank?) respond_to do|format| format.html{ # The alert can be destroyed? if (@alert.destroy) flash[:notice] = t("alerts.notice.destroyed", :name => @alert.name) redirect_to alerts_path() else flash[:error] = t("alerts.error.not_destroyed", :name => @alert.name) redirect_to alert_path(@alert) end return } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to(alerts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to alerts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to alerts_url }\n format.json { head :no_content }\n end\n end", "def delete_alert(identifier, opts = {})\n data, _status_code, _headers = delete_alert_with_http_info(identifier, opts)\n return data\n end", "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to admins_event_alerts_path(@current_event), notice: t(\"alerts.destroyed\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user) }\n format.json { head :no_content }\n end\n end", "def delete_site_snmp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_snmp_alert_with_http_info(id, alert_id, opts)\n data\n end", "def destroy\n @alert.destroy\n end", "def delete_site_snmp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_snmp_alert_with_http_info(id, alert_id, opts)\n return data\n end", "def destroy\n @alert.destroy(alert_params)\n redirect_to alerts_url, :notice => \"Alert Deleted!\"\nend", "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_url, notice: 'Alert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_url, notice: 'Alert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_url, notice: \"Alert was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_path }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.is_admin\n @user_alert = UserAlert.find(params[:id])\n @user_alert.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_alerts_url) }\n format.xml { head :ok }\n end\n else\n redirect_to new_session_path\n end\n end", "def destroy\n @alert_email = AlertEmail.find(params[:id])\n @alert_email.destroy\n\n respond_to do |format|\n format.html { redirect_to(alert_emails_url) }\n format.xml { head :ok }\n end\n end", "def delete_site_smtp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_smtp_alert_with_http_info(id, alert_id, opts)\n data\n end", "def destroy\n @agendasalerta = Agendasalerta.find(params[:id])\n @agendasalerta.destroy\n\n respond_to do |format|\n format.html { redirect_to(agendasalertas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @patient_alert = PatientAlert.find(params[:id])\r\n @patient_alert.destroy\r\n get_patient_by_alert\r\n APP_LOGGER_LOG.info \"ALERT DELETED - for PATIENT ID \" + \r\n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\r\n \r\n respond_to do |format|\r\n format.html { redirect_to(patient_alerts_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete_site_smtp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_smtp_alert_with_http_info(id, alert_id, opts)\n return data\n end", "def delete_site_syslog_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_syslog_alert_with_http_info(id, alert_id, opts)\n data\n end", "def destroy\n @email_alert.destroy\n respond_to do |format|\n format.html { redirect_to email_alerts_url, notice: 'Email alert was successfully destroyed.' }\n format.json { head :no_content }\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 @alert_trigger_type = AlertTriggerType.find(params[:id])\n @alert_trigger_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_alert_trigger_types_path) }\n format.xml { head :ok }\n end\n end", "def delete_site_syslog_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_syslog_alert_with_http_info(id, alert_id, opts)\n return data\n end", "def delete_all_site_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_alerts_with_http_info(id, opts)\n data\n end", "def delete(id)\n self.find(id).delete_\n end", "def destroy(id)\n Ribs.with_handle(self.database) do |h|\n h.delete(get(id))\n end\n end", "def destroy(id = nil)\n new(__record_id: id).destroy\n end", "def destroy\n @sms_alert.destroy\n redirect_to account_path(@account), notice: 'Sms alert was successfully destroyed.'\n end", "def destroy\n @item_alert = ItemAlert.find(params[:id])\n @item_alert.destroy\n authorize! :delete, @item_alert\n\n respond_to do |format|\n format.html { redirect_to item_alerts_url }\n format.json { head :no_content }\n end\n end", "def delete_all_site_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_alerts_with_http_info(id, opts)\n return data\n end", "def destroy\n fail \"No id; can't delete #{self.inspect}!\" unless id\n Connection.delete(create_route(:delete))\n end", "def delete(id)\n # The call uses a begin/rescue block so any errors can be handled properly\n begin\n Account.filter(:id => id).destroy\n flash[:success] = 'The specified Account has been removed'\n rescue => e\n Ramaze::Log.error(e.message)\n flash[:error] = 'The specified Account could not be removed'\n end\n Action.add_record(@account.id, session[:email], 'deleted', 'account', @account.name)\n redirect(Accounts.r(:index))\n end", "def delete_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]'\n\t\targs[:query]['Action'] = 'DeleteAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def destroy\n @alarm.destroy\n\n respond_with(@alarm, location: alarms_path, notice: 'Alarm was successfully deleted.')\n end", "def delete_all_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_snmp_alerts_with_http_info(id, opts)\n data\n end", "def delete(id)\n call(:delete, path(id))\n end", "def delete(id)\n # The call is wrapped in a begin/rescue block so any errors can be handled\n # properly. Without this the user would bump into a nasty stack trace and\n # probably would have no clue as to what's going on.\n begin\n Post.filter(:id => id).destroy\n flash[:success] = 'The specified post has been removed'\n rescue => e\n Ramaze::Log.error(e.message)\n flash[:error] = 'The specified post could not be removed'\n end\n\n redirect(Posts.r(:index))\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n flash[:notice] = 'Resource was successfully deleted.'\n redirect_to resources_url\n end", "def delete_all_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_snmp_alerts_with_http_info(id, opts)\n return data\n end", "def delete(id)\n path(id).delete\n clean(id) if clean?\n end", "def destroy\n @price_alert.destroy\n respond_to do |format|\n format.html { redirect_to price_alerts_url, notice: 'Price alert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alarm.destroy\n render json: {message: 'Alarm Not Deleted'}\n end", "def destroy\n \n\t_destroy( params[:id] )\n\n respond_to do |format|\n format.html { redirect_to({:action=>:index}, notice: t(\"helpers.notice.update\")) }\n end\n end", "def delete_alert_policy(policy_id, opts = {})\n data, _status_code, _headers = delete_alert_policy_with_http_info(policy_id, opts)\n return data\n end", "def destroy(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :delete)\n end", "def delete_article(id)\n response = delete(\"articles/#{id}\")\n response\n end", "def delete_report(id, opts = {})\n data, _status_code, _headers = delete_report_with_http_info(id, opts)\n data\n end", "def DeleteTrigger id\n \n APICall(path: \"triggers/#{id}.json\",method: 'DELETE')\n \n end", "def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end", "def destroy\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.destroy\n format.html { redirect_to offers_url,\n notice: (crud_notice('destroyed', @offer) + \"#{undo_link(@offer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to offers_url, alert: \"#{@offer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @audit_log = AuditLog.find(params[:id])\n @audit_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(audit_logs_url) }\n format.xml { head :ok }\n end\n end", "def delete_all_site_smtp_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_smtp_alerts_with_http_info(id, opts)\n data\n end", "def destroy(id, params = {})\n path = build_request_path(params.merge(primary_key => id))\n request(params.merge(:_method => :delete, :_path => path)) do |response|\n new(parse(response.body).merge(:_destroyed => true))\n end\n end", "def delete_alert_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.delete_alert ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.delete_alert\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n query_params[:'user'] = opts[:'user'] if !opts[:'user'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#delete_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n self.class.delete(id)\n end", "def destroy\n @alarm_action.destroy\n respond_to do |format|\n format.html { redirect_to alarm_actions_url, notice: 'Alarm action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n event = Event.find(params[:id])\n event.destroy!\n end", "def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to(dashboards_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n redirect_to root_path, :notice => \"Successfully deleted event\"\n end", "def destroy\n expense = Expense.destroy(params[\"id\"])\n\n if expense\n render json: {\n status: \"SUCCESS\",\n message: \"Expense deleted\",\n }, status: :ok\n else\n render json: {\n status: \"ERROR\",\n message: \"Invalid id\",\n }, status: 400\n end\n end", "def destroy\n @show = @ticketalert.show\n @ticketalert.destroy\n\n respond_to do |format|\n format.html { redirect_to(@show) }\n format.xml { head :ok }\n end\n end", "def destroy\n @echo = Echo.find(params[:id])\n @echo.destroy\n\n respond_to do |format|\n format.html { redirect_to(echoes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end", "def webhook_delete(id, opts = {})\n data, _status_code, _headers = webhook_delete_with_http_info(id, opts)\n return data\n end", "def destroy(id)\n http.delete(\"/nfse/#{id}\") do |response|\n response.code == 204\n end\n end", "def delete_all_site_smtp_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_smtp_alerts_with_http_info(id, opts)\n return data\n end", "def destroy\n @action_log = ActionLog.find(params[:id])\n @action_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@event = Event.find(params[:id])\n\t\[email protected]\n\t\tredirect_to root_path\n\tend", "def delete_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.delete_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.delete_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp/{alertId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_all_site_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.delete_all_site_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end", "def destroy\n @sale_offer = SaleOffer.find(params[:id])\n\n respond_to do |format|\n if @sale_offer.destroy\n format.html { redirect_to sale_offers_url,\n notice: (crud_notice('destroyed', @sale_offer) + \"#{undo_link(@sale_offer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to sale_offers_url, alert: \"#{@sale_offer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete_email(id, opts = {})\n delete_email_with_http_info(id, opts)\n nil\n end", "def delete_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.delete_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.delete_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp/{alertId}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_all_site_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.delete_all_site_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy #:nodoc:\n\t\tRequest.find(params[:id]).destroy\n\t\tflash[:notice] = \"La solicitud de servicio se ha eliminado\"\n\t\tredirect_to :action => 'index'\n\tend", "def destroy\n @alarm_notification = AlarmNotification.find(params[:id])\n @alarm_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to alarm_notifications_url }\n format.json { head :no_content }\n end\n end", "def delete_vuln_exception(id)\n xml = make_xml('VulnerabilityExceptionDeleteRequest',\n { 'exception-id' => id })\n execute(xml, '1.2').success\n end", "def delete_vuln_exception(id)\n xml = make_xml('VulnerabilityExceptionDeleteRequest',\n { 'exception-id' => id })\n execute(xml, '1.2').success\n end", "def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n \n respond_to do |format|\n format.html { redirect_to admins_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy(id)\n self.class.delete(worksheet_url + \"/\" + id).parsed_response\n end", "def destroy\n params.require(%i[id])\n beverage = Beverage.find_by!(id: params[:id])\n beverage.destroy!\n head :no_content\n end", "def destroy\n @trigger = Trigger.find(params[:id])\n @trigger.destroy\n\n respond_to do |format|\n format.html { redirect_to(triggers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @trigger = Trigger.find(params[:id])\n @trigger.destroy\n\n respond_to do |format|\n format.html { redirect_to(triggers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Article.find(params[:id]).delete\n redirect_to articles_path, :notice => \"Your article has been deleted.\"\n end", "def destroy\n # @weather_station_alert.destroy\n # respond_to do |format|\n # format.html { redirect_to weather_station_alerts_url, notice: 'Weather station alert was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def delete(id)\n # TODO: Implement this for Stripe webhooks\n end", "def destroy\n @reporte = Reporte.find(params[:id])\n @reporte.destroy\n\n respond_to do |format|\n format.html { redirect_to reportes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @email = Email.destroy(params[:id])\n redirect_to root_path \n end", "def destroy\n\n flash[:notice] = \"Event #{@event.name} removed.\"\n @event = Event.find(params[:id])\n @event.destroy\n\n redirect_to(events_path)\n end", "def destroy\n \n @notice = Notice.get(params[:id])\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_notices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \n @notice = Notice.get(params[:id])\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_notices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n url = Url.find(params[:id])\n\n # If it is successful return a success message with flash\n # If not return error message. Sysadmin should check error.\n # TODO: Write I18n for 19 and 22.\n if url.destroy\n flash[:success] = t 'dashboard.successfully_deleted'\n else\n flash[:danger] = t 'error.check_logs'\n end\n redirect_to admin_index_path\n end", "def delete(id)\n @item = Item.find_by_id(id)\n \n begin\n item.destroy!\n say 'Item Deleted'\n rescue StandardError => e\n say e.message\n end\n end", "def destroy\n @script = Script.where(id: params[:id]).first\n @script.destroy\n respond_to do |format|\n format.html { redirect_to scripts_url, notice: 'Script was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete_user\n load_alert\n return if (@alert.blank?)\n\n @user = User.where(:_id => params[:user_id]).first\n\n # Does the user exist?\n if (@user.blank?)\n flash[:error] = t(\"alerts.error.user_not_found\")\n redirect_to alert_users_path()\n return\n end\n\n # Disassociate the user from the alert\n @alert.users.delete(@user)\n\n respond_to do |format|\n format.html{\n if (@alert.save)\n flash[:notice] = t(\"alerts.notice.user_deleted\", :name => @user.name, :alert => @alert.name)\n else\n flash[:error] = t(\"alerts.error.user_not_deleted\", :name => @user.name, :alert => @alert.name)\n end\n redirect_to alert_users_path()\n return\n }\n end\n end", "def destroy\n Hill.find(params[:id]).destroy\n flash[:success] = \"Hill deleted.\"\n respond_to do |format|\n format.html { redirect_to hills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url,\n notice: (crud_notice('destroyed', @ticket) + \"#{undo_link(@ticket)}\").html_safe }\n format.json { head :no_content }\n end\n end" ]
[ "0.7401773", "0.7220935", "0.7220762", "0.7020628", "0.6977127", "0.6844175", "0.6808137", "0.67487633", "0.6742521", "0.6682758", "0.66427904", "0.66427904", "0.6622791", "0.6617259", "0.6518994", "0.6513909", "0.645848", "0.6434973", "0.63731253", "0.6353115", "0.63018507", "0.6276245", "0.623779", "0.6209173", "0.61835265", "0.6171113", "0.61589307", "0.6138872", "0.60828376", "0.6081197", "0.6075647", "0.60532486", "0.604605", "0.6041695", "0.59874153", "0.5984004", "0.5955083", "0.5945032", "0.5929447", "0.5881883", "0.5849683", "0.58443445", "0.58311784", "0.57874894", "0.5783338", "0.57773125", "0.5775865", "0.57646215", "0.5755416", "0.5749368", "0.5738677", "0.57252675", "0.5722005", "0.57161593", "0.57132506", "0.57061267", "0.57056767", "0.57054883", "0.5678868", "0.5667611", "0.563293", "0.5631264", "0.5618783", "0.56187344", "0.5614379", "0.5604111", "0.55992526", "0.5592468", "0.55919665", "0.5590219", "0.5586801", "0.557301", "0.55716145", "0.55682814", "0.55654186", "0.55598867", "0.55548644", "0.55513656", "0.55503", "0.5542514", "0.5542514", "0.5540635", "0.55383843", "0.5533118", "0.5529868", "0.5529868", "0.55291224", "0.55063003", "0.5503688", "0.5493245", "0.54873466", "0.54846174", "0.5483307", "0.5483307", "0.54774284", "0.5473102", "0.5472868", "0.5472249", "0.5471286", "0.5470863" ]
0.6313611
20
Action to get a selector of hosts to monitor. [URL] GET /alerts/:id/service_hosts/:service_id GET /alerts/new/service_hosts/:service_id [Parameters] id The identificator of the alert. service_id The id of the service selected.
def get_service_hosts if ((!params[:id].blank?) && (params[:id] != "new")) load_alert return if (@alert.blank?) else @alert = Alert.new() end @service = Service.where(:_id => params[:service_id]).first respond_to do |format| format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n parameters = alert_params\n parameters[:service] = Service.where(:_id => parameters[:service_id]).first\n parameters[:hosts] = Host.where(:_id.in => parameters[:host_ids]).to_a if (!parameters[:host_ids].blank?)\n\n # Delete string'd id's\n parameters.delete(:service_id)\n parameters.delete(:host_ids)\n\n # Apply the params received\n @alert = Alert.new(parameters)\n\n respond_to do|format|\n format.html{\n # Can be saved?\n if (@alert.save)\n flash[:notice] = t(\"alerts.notice.created\", :name => @alert.name)\n redirect_to alert_path(@alert)\n else\n # If an error raises, show the form again.\n render :action => :new\n end\n return\n }\n end\n end", "def index_hosts\n load_service\n return if (@service.blank?)\n\n # Preload hosts\n @hosts = Host.where(:_id.in => @service.host_ids)\n\n respond_to do |format|\n format.html\n end\n end", "def new_host\n load_service\n return if (@service.blank?)\n\n @host = Host.where(:_id => params[:host_id]).first\n\n # Does the host exists?\n if (@host.blank?)\n flash[:error] = t(\"services.error.host_not_found\")\n redirect_to service_hosts_path()\n return\n end\n\n # is the host already assigned?\n if (@service.host_ids.include?(@host.id))\n flash[:notice] = t(\"services.notice.host_already_added\", :name => @host.name, :service => @service.name)\n redirect_to service_hosts_path()\n return\n end\n\n # Assign it\n @service.hosts << @host\n\n respond_to do |format|\n format.html{\n if (@service.save)\n flash[:notice] = t(\"services.notice.host_added\", :name => @host.name, :service => @service.name)\n else\n flash[:error] = t(\"services.error.host_not_added\", :name => @host.name, :service => @service.name)\n end\n redirect_to service_hosts_path()\n return\n }\n end\n end", "def select_hosts(hosts)\n title = \"Select host(s) to run cloudera-scm-agent:\\n\".red\n table = build_host_table(hosts)\n fzfopt = \"--header='#{title}'\"\n\n selected = Utils.fzf(list: table, opt: fzfopt)\n Utils.exit_if_empty(selected, 'No items selected')\n selected.map(&:split)\n end", "def update\n load_alert\n return if (@alert.blank?)\n\n parameters = alert_params\n parameters[:service] = Service.where(:_id => parameters[:service_id]).first if (!parameters[:service_id].blank?)\n\n if (!parameters[:host_ids].blank?)\n # Remove removed hosts\n @alert.hosts.select{|h| parameters[:host_ids].include?(h.id.to_s) == false}.each{|h| @alert.hosts.delete(h)}\n\n # Add the new hosts\n host_ids_add = parameters[:host_ids].select{|h| @alert.host_ids.include?(h) == false}\n Host.where(:_id.in => host_ids_add, :service_ids => parameters[:service_id]).to_a.each do |h|\n @alert.hosts << h\n end\n else\n # Empty the hosts array\n parameters[:hosts] = []\n end\n\n respond_to do|format|\n format.html{\n # The alert can be updated?\n if (@alert.update_attributes(parameters))\n flash[:notice] = t(\"alerts.notice.updated\", :name => @alert.name)\n redirect_to alert_path(@alert)\n else\n # If an error raises, show the form again\n render :action => :edit\n end\n return\n }\n end\n end", "def list_hosts( zone_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::ListHosts.new,\n :path => \"/api/1.1/zones/#{zone_id}/hosts.xml\"\n )\n end", "def report_hosts(report_id)\n\t\t\tpost= { \"token\" => @token, \"report\" => report_id }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('report/hosts', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\thosts=Array.new\n\t\t\tdocxml.elements.each('/reply/contents/hostList/host') do |host|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['hostname'] = host.elements['hostname'].text if host.elements['hostname']\n\t\t\t\tentry['severity'] = host.elements['severity'].text if host.elements['severity']\n\t\t\t\tsevs=Array.new\n\t\t\t\thost.elements.each('severityCount/item') do |item|\n\t\t\t\t\tsevs.push item.elements['count'].text if item.elements['count']\n\t\t\t\tend\n\t\t\t\tentry['sev0'] = sevs[0] if sevs[0]\n\t\t\t\tentry['sev1'] = sevs[1] if sevs[1]\n\t\t\t\tentry['sev2'] = sevs[2] if sevs[2]\n\t\t\t\tentry['sev3'] = sevs[3] if sevs[3]\n\t\t\t\tentry['current'] = host.elements['scanProgressCurrent'].text if host.elements['scanProgressCurrent']\n\t\t\t\tentry['total'] = host.elements['scanProgressTotal'].text if host.elements['scanProgressTotal']\n\t\t\t\thosts.push(entry)\n\t\t\tend\n\t\t\treturn hosts\n\t\tend", "def select_hosts(hosts)\n title = \"Press ctrl-p to open preview window.\\n\\n\" \\\n \"Select host(s) to login:\\n\".red\n table = build_host_table(hosts)\n fzfopt = \" #{@opt[:query]} --header='#{title}'\" \\\n \" --bind 'ctrl-p:toggle-preview'\" \\\n \" --preview 'cmux list-hosts --preview 1 -q {}'\" \\\n ' --preview-window right:35%:hidden'\n\n selected = Utils.fzf(list: table, opt: fzfopt)\n Utils.exit_if_empty(selected, 'No items selected')\n selected.map(&:split)\n end", "def get_vcenter_hosts(vcenter_id=nil, auth=nil, cert=nil)\n check_vcenter(vcenter_id)\n rest_get(\"#{@base_url}/compute/vcenters/#{vcenter_id}/hosts\", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)\n end", "def host_results\n # Load the service from the database\n load_service\n return if (@service.blank?)\n\n # Find the host between the service's associated\n @host = Host.where(:_id => params[:host_id], :service_ids => @service.id).first\n\n if (@host.blank?)\n # If not found, show an error and redirect\n flash[:error] = t(\"services.error.host_service_not_found\")\n redirect_to services_path()\n return\n end\n\n # Alert records of this service and host\n @alert_records = AlertRecord.where(:service_id => @service.id, :host_ids => @host.id).desc(:open).desc(:updated_at).limit(8)\n\n respond_to do |format|\n format.html\n format.js\n end\n end", "def servers(service_id)\n request :get, \"/services/#{service_id}/servers\"\n end", "def report_hosts(report_id)\r\n\t\tpost= { \"token\" => @token, \"report\" => report_id } \r\n\t\tdocxml=nessus_request('report/hosts', post)\r\n\t\tlist = Array.new\r\n\t\tdocxml.root.elements['contents'].elements['hostList'].each_element('//host') { |host| \r\n\t\t\tlist.push host.elements['hostname'].text\r\n\t\t}\r\n\t\treturn list\r\n\tend", "def index\n @event_hosts = EventHost.where(event_id: @event.id)\n end", "def find_host_by_id(id)\n begin\n json_response = servers_interface.get(id.to_i)\n return json_response['server']\n rescue RestClient::Exception => e\n if e.response && e.response.code == 404\n print_red_alert \"Host not found by id #{id}\"\n exit 1\n else\n raise e\n end\n end\n end", "def get_host( host_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::GetHost.new,\n :path => \"/api/1.1/hosts/#{host_id}.xml\"\n )\n end", "def select(params = {})\n if params.has_key?(:path)\n path_regex = params[:path]\n path_regex = Regexp.new(path_regex.to_s) unless path_regex.is_a?(Regexp)\n selector = lambda {|agent| agent.config_path && path_regex.match(agent.config_path) }\n notify(:msg => \"[#{@name}] Selecting all services for path #{path_regex.inspect}\",\n :tags => [:galaxy, :trace])\n elsif params.has_key?(:type)\n type_regex = params[:type]\n type_regex = Regexp.new(type_regex.to_s) unless type_regex.is_a?(Regexp)\n selector = lambda {|agent| agent.config_path && type_regex.match(agent.type) }\n notify(:msg => \"[#{@name}] Selecting all services of type #{type_regex.inspect}\",\n :tags => [:galaxy, :trace])\n elsif params.has_key?(:core_type)\n core_type_regex = params[:core_type]\n core_type_regex = Regexp.new(core_type_regex.to_s) unless core_type_regex.is_a?(Regexp)\n selector = lambda {|agent| agent.config_path && core_type_regex.match(agent.core_type) }\n notify(:msg => \"[#{@name}] Selecting all services of core type #{core_type_regex.inspect}\",\n :tags => [:galaxy, :trace])\n elsif params.has_key?(:host) || params.has_key?(:hosts)\n host_names = arrayify(params[:host]) & arrayify(params[:hosts])\n selector = lambda {|agent| host_names.include?(agent.host) }\n notify(:msg => \"[#{@name}] Selecting all services for hosts #{host_names.inspect}\",\n :tags => [:galaxy, :trace])\n else\n notify(:msg => \"[#{@name}] Selecting all services\",\n :tags => [:galaxy, :trace])\n end\n command = ::Galaxy::Commands::ShowCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment)\n agents = command.select_agents({})\n agents.each { |agent| agent.proxy = ::Galaxy::Transport.locate(agent.url) if agent.url }\n command.execute(agents)\n command.report.results.select {|result| selector.nil? || selector.call(result) }\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def new_hosts\n \tself.hosts.where(\"created_at >= ?\", Time.zone.now.beginning_of_day)\n end", "def api_v11_hosts_host_id_get(host_id, opts = {})\n api_v11_hosts_host_id_get_with_http_info(host_id, opts)\n return nil\n end", "def hypervisors(id)\n response = request(:get, \"/settings/hypervisor_zones/#{id}/hypervisors.json\")\n response.collect { |hv| hv['hypervisor'] }\n end", "def delete_host\n load_service\n return if (@service.blank?)\n\n @host = Host.where(:_id => params[:host_id]).first\n\n # Does the host exist?\n if (@host.blank?)\n flash[:error] = t(\"services.error.host_not_found\")\n redirect_to service_hosts_path()\n return\n end\n\n # Disassociate the host from the service\n @service.hosts.delete(@host)\n\n respond_to do |format|\n format.html{\n if (@service.save)\n flash[:notice] = t(\"services.notice.host_deleted\", :name => @host.name, :service => @service.name)\n else\n flash[:error] = t(\"services.error.host_not_deleted\", :name => @host.name, :service => @service.name)\n end\n redirect_to service_hosts_path()\n return\n }\n end\n end", "def api_v11_hosts_get(opts = {})\n api_v11_hosts_get_with_http_info(opts)\n return nil\n end", "def get_host( name )\n @hosts[ name ]\n end", "def report_get_host(report_id,host)\r\n\t\tpost= { \"token\" => @token, \"report\" => report_id } \r\n\t\tdocxml=nessus_request('report/hosts', post)\r\n\t\tdocxml.root.elements['contents'].elements['hostList'].each_element('//host') { |host| \r\n\t\t\tif host.elements['hostname'].text == host\r\n\t\t\t\tretval={}\r\n\t\t\t\tretval[:severity] = host.elements['severity'].text\r\n\t\t\t\tretval[:current] = host.elements['scanProgressCurrent'].text\r\n\t\t\t\tretval[:total] = host.elements['scanProgressTotal'].text\r\n\t\t\t\treturn retval\r\n\t\t\tend\r\n\t\t}\r\n\tend", "def hosts(opts)\n ::ApplicationRecord.connection_pool.with_connection {\n # If we have the ID, there is no point in creating a complex query.\n if opts[:id] && !opts[:id].to_s.empty?\n return Array.wrap(Mdm::Host.find(opts[:id]))\n end\n\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n\n conditions = {}\n conditions[:state] = [Msf::HostState::Alive, Msf::HostState::Unknown] if opts[:non_dead]\n conditions[:address] = opts[:address] if opts[:address] && !opts[:address].empty?\n\n if opts[:search_term] && !opts[:search_term].empty?\n column_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Mdm::Host, opts[:search_term])\n tag_conditions = Arel::Nodes::Regexp.new(Mdm::Tag.arel_table[:name], Arel::Nodes.build_quoted(\"(?mi)#{opts[:search_term]}\"))\n search_conditions = column_search_conditions.or(tag_conditions)\n wspace.hosts.where(conditions).where(search_conditions).includes(:tags).references(:tags).order(:address)\n else\n wspace.hosts.where(conditions).order(:address)\n end\n }\n end", "def get_host_by_hostname(hostname, collector)\n host = nil\n if collector\n hosts_json = rpc(\"getHosts\", {\"hostGroupId\" => 1})\n hosts_resp = JSON.parse(hosts_json)\n# p hosts_resp\n collector_resp = JSON.parse(rpc(\"getAgents\", {}))\n if hosts_resp[\"status\"] == 200\n hosts_resp[\"data\"][\"hosts\"].each do |h|\n if h[\"hostName\"].eql?(hostname)\n # puts(\"Found host with matching hostname: #{resource[:hostname]}\")\n # puts(\"Checking agent match\")\n if collector_resp[\"status\"] == 200\n collector_resp[\"data\"].each do |c|\n if c[\"description\"].eql?(collector)\n host = h\n end\n end\n else\n puts(\"Unable to retrieve collector list from server\")\n end\n end\n end\n else\n puts(\"Unable to retrieve host list from server\" )\n end\n end\n host\nend", "def set_host\n @host = Host.find(params[:id])\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def set_host\n @host = Host.find(params[:id])\n end", "def api_v11_hosts_host_id_config_get(host_id, opts = {})\n api_v11_hosts_host_id_config_get_with_http_info(host_id, opts)\n return nil\n end", "def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end", "def hosts(key)\n unless @@vendors[key].nil?\n @@vendors[key][:hosts].collect { |id| @@hosts[id] }\n else\n []\n end\n end", "def report_get_host(report_id,hostname)\n\t\t\tpost= { \"token\" => @token, \"report\" => report_id }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('report/hosts', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tdocxml.elements.each('/reply/contents/hostList/host') do |host|\n\t\t\t\tif host.elements['hostname'].text == hostname\n\t\t\t\t\tseverity = host.elements['severity'].text\n\t\t\t\t\tcurrent = host.elements['scanProgressCurrent'].text\n\t\t\t\t\ttotal = host.elements['scanProgressTotal'].text\n\t\t\t\t\treturn severity, current, total\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def find_triggers_by_service(id)\n self.class.get(\"/services/#{id}/triggers.json?apikey=#{apikey}\")\n end", "def service_groups\n hosts.joins(:host_service_groups)\n end", "def list_hosts(folder = '')\n rows = JSON.parse(http_request(@uri + '/view.py', {\n wato_folder: folder,\n\tsearch: 'Search',\n\tfilled_in: 'filter',\n\thost_address_prefix: 'yes',\n\tview_name: 'searchhost',\n\toutput_format: 'json',\n\t}))\n rows.shift # skip the header\n rows.map { |r| r[1] }\n end", "def print_hosts\n\t\[email protected] do |id,values|\n\t\t\tFile.open(@options[:output] + \"/host_\" + id.to_s + \".html\", 'w') do |f|\n\n\t\t\t\thtml_header(f,values[:ip])\n\n\t\t\t\tif values[:total_excl_info] == 0\n\t\t\t\t\tpie_js(f,\"pie_graph\",\"Criticality Breakdown\",\"Criticality Breakdown\",[['Informational ONLY',values[:info].to_i,'blue']])\n\t\t\t\telse\n\t\t\t\t\tpie_data = []\n\t\t\t\t\tpie_data << ['Info',values[:info].to_i,'blue'] if @options[:severity] <= 0 and values[:info].to_i >= 0\n\t\t\t\t\tpie_data << ['Low',values[:low].to_i,'green'] if @options[:severity] <= 1 and values[:low].to_i > 0\n\t\t\t\t\tpie_data << ['Medium',values[:med].to_i,'orange'] if @options[:severity] <= 2 and values[:med].to_i > 0\n\t\t\t\t\tpie_data << ['High',values[:high].to_i,'red'] if @options[:severity] <= 3 and values[:high].to_i > 0\n\t\t\t\t\tpie_data << ['Critical',values[:crit].to_i,'purple'] if @options[:severity] <= 4 and values[:crit].to_i > 0\n\t\t\t\t\tpie_js(f,\"pie_graph\",\"Criticality Breakdown\",\"Criticality Breakdown\",pie_data,\"document.location.href = '#' + event.point.name;\")\n\t\t\t\tend\n\n\t\t\t\tclose_html_header(f)\n\n\t\t\t\tbody = '<a href=\"index.html\">Home</a><br /><div id=\"host\" style=\"font-family: Arial, Helvetica, sans-serif\"><div id=\"overview\">Hostname: ' + values[:hostname] + '<br />IP: ' + values[:ip] + '<br />OS: ' + values[:os] + '<br /></div>'\n\t\t\t\tbody += '<div id=\"graphs\"><h2>Overview</h2>'\n\t\t\t\tbody += '<div id=\"pie_graph\" style=\"min-width: 400px; height: 400px; margin: 0 auto\"></div>'\n\t\t\t\tbody += '</div>'\n\n\t\t\t\tbody += '<div id=\"vulns\"><h2>Vulnerabilities</h2>'\n\n\n\t\t\t\tif @options[:severity] <= 4 and values[:crit].to_i > 0\n\t\t\t\t\tbody += '<div id=\"critical\"><a name=\"Critical\"></a><h3>Critical</h3>'\n\n\t\t\t\t\tbody += '<table id=\"critical_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 4\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 3 and values[:high].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"high\"><a name=\"High\"></a><h3>High</h3>'\n\n\t\t\t\t\tbody += '<table id=\"high_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 3\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 2 and values[:med].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"medium\"><a name=\"Medium\"></a><h3>Medium</h3>'\n\n\t\t\t\t\tbody += '<table id=\"medium_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 2\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 1 and values[:low].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"low\"><a name=\"Low\"></a><h3>Low</h3>'\n\n\t\t\t\t\tbody += '<table id=\"low_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 1\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 0 and values[:info].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"informational\"><a name=\"Informational\"></a><h3>Informational</h3>'\n\n\t\t\t\t\tbody += '<table id=\"informational_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\[email protected]_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 0\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\n\t\t\t\tbody += \"<script>$(document).ready(function() {\\n \";\n\t\t\t\tbody += \"$('#critical_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 4\n\t\t\t\tbody += \"$('#high_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 3\n\t\t\t\tbody += \"$('#medium_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 2\n\t\t\t\tbody += \"$('#low_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 1\n\t\t\t\tbody += \"$('#informational_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 0\n\t\t\t\tbody += \"});</script>\"\n\n\t\t\t\tbody += '</div></div>'\n\n\t\t\t\tbody_text(f,body)\n\n\t\t\t\tclose_all(f)\n\t\t\tend\n\t\tend\n\n\tend", "def get(host_id, source=nil, by_source=false)\n extra_params = {}\n if source\n extra_params['source'] = source\n end\n if by_source\n extra_params['by_source'] = 'true'\n end\n\n request(Net::HTTP::Get, '/api/' + API_VERSION + '/tags/hosts/' + host_id.to_s, extra_params, nil, false)\n end", "def by_selector\n @by_selector ||= Hash.new {|h,k| h[k] = ServiceGroup.new}\n end", "def list\n unless hosts.empty?\n format hosts\n else\n \"No custom hosts found.\\nYou can add some using:\\n\\thoust add [alias] [address]\\n\"\n end\n end", "def index\n @services = Service.all\n\n # If a type of host is passed, check if it's a number and a valid host type.\n check_priority_param\n @services = @services.where(:priority => @priority) if ([email protected]?)\n\n # If a search query is received, filter the results\n if (!params[:q].blank?)\n # Do the search\n @query = params[:q]\n @services = @services.where(\"$or\" => [{:name => /#{@query}/i}, {:description => /#{@query}/i}, {:probe => /#{@query}/i}])\n end\n\n # If a page number is received, save it (if not, the page is the first)\n if (!params[:page].blank?)\n page = params[:page].to_i\n page = 1 if (page < 1)\n else\n page = 1\n end\n \n # Paginate!\n @services = @services.page(page)\n\n respond_to do |format|\n format.html\n end\n end", "def get_foreman_hosts(per_page = 10000)\n curl = setup_curl(\"#{@foreman_url}/api/hosts?per_page=#{per_page}\", true)\n curl.perform\n servers_junk = JSON.parse(curl.body_str)\n servers_array = []\n servers_junk.each { |server| servers_array << server['host']['name'] }\n @foreman_hosts = servers_array\n end", "def set_event_host\n @event_host = EventHost.find(params[:id])\n end", "def api_v11_hosts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_hosts_get ...\"\n end\n \n # resource path\n path = \"/api/v11/hosts\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'view'] = opts[:'view'] if opts[:'view']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_hosts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def hypervisors(id)\n response = request(:get, \"/users/#{id}/hypervisors.json\")\n response.collect { |vm| vm['hypervisor']}\n end", "def find_hosts( fqdn, zone_id = nil)\n if zone_id.nil?\n #look for matching host across all zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::FindHosts.new,\n :path => \"/api/1.1/hosts.xml?fqdn=#{fqdn}\"\n )\n else\n #look for hosts in a specific zone\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::FindHosts.new,\n :path => \"/api/1.1/zones/#{zone_id}/hosts.xml?fqdn=#{fqdn}\"\n )\n end\n end", "def contains_host?(id)\n contains_resource?('HOSTS/ID', id)\n end", "def hosts\n Put.warn \"\\nStarted configuring ansible hosts.......\\n\"\n @ansible.groups.each do |group|\n Put.info \"Adding group [#{group['name']}]\"\n\n response = Rest::SubutaiConsole.command(\"echo [#{group['name']}] >> /etc/ansible/hosts\", @environment.ansible_host_id, \"/root\",\"1000\", @url, @token)\n status(response)\n\n group['hostnames'].each do |hostname|\n container = find(hostname)\n Put.info \"Adding hosts #{container.containerName} to group [#{group['name']}]\"\n\n if group.key?('python-interpreter')\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip} ansible_python_interpreter=#{group['python-interpreter']}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\n \"360000\",\n @url, @token)\n status(response)\n else\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\"360000\",\n @url, @token)\n status(response)\n end\n end\n end\n end", "def show\n @service = Service.find(params[:id])\n end", "def show\n @service = Service.find(params[:id])\n end", "def set_service\n @service = @enterprise.services.find(params[:id])\n end", "def create\n return unless restrict_to_admin\n\n @event_host = @event.event_hosts.new(event_host_params)\n\n respond_to do |format|\n if @event_host.save\n format.html { redirect_to [@event, @event_host], notice: 'Event host was successfully created.' }\n format.json { render :show, status: :created, location: [@event, @event_host] }\n else\n format.html { render :new }\n format.json { render json: @event_host.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @service = Service.new\n\n # If a valid type is received, apply to the host to create.\n check_priority_param\n @service.priority = @priority if([email protected]?)\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n respond_to do |format|\n format.html\n end\n end", "def api_v11_hosts_host_id_get_with_http_info(host_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_hosts_host_id_get ...\"\n end\n \n # verify the required parameter 'host_id' is set\n fail \"Missing the required parameter 'host_id' when calling api_v11_hosts_host_id_get\" if host_id.nil?\n \n # resource path\n path = \"/api/v11/hosts/{hostId}\".sub('{format}','json').sub('{' + 'hostId' + '}', host_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_hosts_host_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def services_for(node)\n # This info is taken from our JSON inventory file\n [JSON.parse(File.read(\"#{repository_path}/hosts.json\"))[\"#{node}.hpc_tutorial.org\"]]\n end", "def get_hosts_by_group(name)\n begin\n groupid = get_group_by_name(name)[0][\"groupid\"].to_i\n hosts = @zbx.query( method: \"host.get\", params: {\"output\" => \"extend\", \"groupids\" => [groupid] } )\n rescue Exception => error\n return nil\n end\n end", "def list_of_hosts\n super\n end", "def count_hosts( zone_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::CountHosts.new,\n :path => \"/api/1.1/zones/#{zone_id}/hosts/count.xml\"\n )\n end", "def visit_hosts\n @host_rules.accept\n end", "def list_xpn_hosts request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_list_xpn_hosts_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::XpnHostList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def collectHosts(rf, db)\n\trf.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|\n\t\tprogressbar = ProgressBar.create(:title => \"Hosts\", :format => '%t |%b>>%i| %p%% %a')\n\t\tprogressbar.total = counter(dc, \"h\")\n\t\tdc.hostFolder.childEntity.each do |cluster|\n\t\t\tcluster.host.each do |host|\n\t\t\t\tdb.select(2)\n\t\t\t\tdb.hset(\"#{host.name}\", \"Status\", \"#{host.summary.overallStatus}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"PowerStatus\", \"#{host.summary.runtime.powerState}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"Connection\", \"#{host.summary.runtime.connectionState}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"OverallCpu\", \"#{host.summary.quickStats.overallCpuUsage}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"OverallMem\", \"#{host.summary.quickStats.overallMemoryUsage}\") \n\t\t\t\t#db.hset(\"#{host.name}\", \"SystemSensor\", \"#{host.summary.runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo.name}\")\n\t\t\t\tprogressbar.increment\n\t\t\tend\n\t\tend\n\tend\nend", "def get_all(source=nil)\n extra_params = {}\n if source\n extra_params['source'] = source\n end\n\n request(Net::HTTP::Get, '/api/' + API_VERSION + '/tags/hosts', extra_params, nil, false)\n end", "def service_description_for_host(host)\n response = self.class.get(@base_uri + \"config/host/#{host}?format=json\",\n basic_auth: @auth, verify: false)\n raise ApiError unless response.code == 200\n host_config = JSON.parse!(response.body)\n if host_config['services'].nil?\n services = []\n else\n services = host_config['services'].map { |s| s['service_description'] }\n end\n host_config['hostgroups'].each do |hg|\n services += hostgroup_services(hg)\n end\n services.nil? ? [] : services\n end", "def show\n @host = Host.find_by(id: current_host.id)\n end", "def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasmap[\"localhost\"].nil? ? [\"http://localhost:8080\"] : aliasmap[\"localhost\"]\n else\n hostname = args.shift()\n @hosts = (aliasmap[hostname] || hostname).split(',').map() {|host| host.strip()};\n end\n \n return @hosts\n end", "def list_service_offering_node_service_credentials(id, opts = {})\n data, _status_code, _headers = list_service_offering_node_service_credentials_with_http_info(id, opts)\n data\n end", "def show\n @host = Host.find(params[:id])\n\n render json: @host\n end", "def get_host(name)\n # create a host object to work with\n host_obj = Com::Vmware::Vcenter::Host.new(vapi_config)\n\n if name.nil?\n host = host_obj.list\n else\n filter = Com::Vmware::Vcenter::Host::FilterSpec.new(names: Set.new([name]))\n host = host_obj.list(filter)\n end\n\n raise format(\"Unable to find target host: %s\", name) if host.empty?\n\n host[0]\n end", "def service(id)\n request :get, \"/services/#{id}\"\n end", "def service(id)\n ss = services\n ss.keep_if {|s| s.id == id}.first unless ss.nil?\n end", "def read_hosts(file)\n hosts = Array.new\n File.open(file,'r') do |f|\n f.each_line do |line|\n if line[0] != \"#\" and line!=\"\"\n parts = line.split()\n if parts.size==4\n hosts << {:host => parts[0], :ps => parts[1].to_i, :user => parts[3]}\n end\n end\n end\n end\n hosts\n end", "def api_v11_cm_all_hosts_config_get(opts = {})\n api_v11_cm_all_hosts_config_get_with_http_info(opts)\n return nil\n end", "def selected_host\n\t\tselhost = Target.find(:first, :conditions => [\"selected > 0\"] )\n\t\tif selhost\n\t\t\treturn selhost.host\n\t\telse\n\t\t\treturn\n\t\tend\t\n\tend", "def delete_all_site_smtp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.delete_all_site_smtp_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_smtp_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/smtp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_smtp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_hosts\n\t\t#all_hosts={}\n\t\t#config=self.load_config\n\t\t#config['hosts'].each do |section|\n\t\t#\tsection.each do |host_section, host_values|\n\t\t#\t\thost_values.each do |host|\n\t\t#\t\t\tall_hosts[host['title']] = host['sshparams'] unless host['sshparams'].nil?\n\t\t#\t\tend\n\t\t#\tend\n\t\t#end\n\t\t#return all_hosts\n all_hosts={}\n config=self.load_config\n\t\tbegin \n config['hosts'].each do |section|\n section.each do |host_section, host_values|\n all_hosts[host_section] = host_values unless host_section.nil?\n end\n end\n\t\trescue Exception => e\n\t\t\tputs \"Your hosts.yml file is empty?: #{e}\"\n\t\t\texit\n\t\tend\n return all_hosts\n\tend", "def hosts\n @hosts.values\n end", "def set_service\n @service = Service.find_by_hashid(params[:id])\n end", "def report_service(opts)\n\t\treturn if not active\n\t\taddr = opts.delete(:host) || return\n\t\thname = opts.delete(:host_name)\n\t\thmac = opts.delete(:host_mac)\n\n\t\twait = opts.delete(:wait)\n\t\twspace = opts.delete(:workspace) || workspace\n\n\t\thopts = {:workspace => wspace, :host => addr}\n\t\thopts[:name] = hname if hname\n\t\thopts[:mac] = hmac if hmac\n\t\treport_host(hopts)\n\n\t\tret = {}\n\n\t\ttask = queue(Proc.new {\n\t\t\thost = get_host(:workspace => wspace, :address => addr)\n\t\t\tif host\n\t\t\t\thost.updated_at = host.created_at\n\t\t\t\thost.state = HostState::Alive\n\t\t\t\thost.save!\n\t\t\tend\n\n\t\t\tproto = opts[:proto] || 'tcp'\n\t\t\topts[:name].downcase! if (opts[:name])\n\n\t\t\tservice = host.services.find_or_initialize_by_port_and_proto(opts[:port].to_i, proto)\n\t\t\topts.each { |k,v|\n\t\t\t\tif (service.attribute_names.include?(k.to_s))\n\t\t\t\t\tservice[k] = v\n\t\t\t\telse\n\t\t\t\t\tdlog(\"Unknown attribute for Service: #{k}\")\n\t\t\t\tend\n\t\t\t}\n\t\t\tif (service.state == nil)\n\t\t\t\tservice.state = ServiceState::Open\n\t\t\tend\n\t\t\tif (service and service.changed?)\n\t\t\t\tmsfe_import_timestamps(opts,service)\n\t\t\t\tservice.save!\n\t\t\tend\n\t\t\tret[:service] = service\n\t\t})\n\t\tif wait\n\t\t\treturn nil if task.wait() != :done\n\t\t\treturn ret[:service]\n\t\tend\n\t\treturn task\n\tend", "def delete_all_site_smtp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.delete_all_site_smtp_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_smtp_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/smtp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_smtp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def mongo_hosts=(h)\n @mongo_hosts = h.to_a\n end", "def api_v11_cm_all_hosts_config_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_cm_all_hosts_config_get ...\"\n end\n \n # resource path\n path = \"/api/v11/cm/allHosts/config\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'view'] = opts[:'view'] if opts[:'view']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_cm_all_hosts_config_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @host_group = HostGroup.new\n @hosts = Host.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host_group }\n end\n end", "def all_hosts_in(file)\n servers = []\n file.each do |line|\n if line.include?('Host ')\n servers << line.sub('Host ', '').strip\n end\n end\n servers\n end", "def api_v11_hosts_host_id_config_get_with_http_info(host_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_hosts_host_id_config_get ...\"\n end\n \n # verify the required parameter 'host_id' is set\n fail \"Missing the required parameter 'host_id' when calling api_v11_hosts_host_id_config_get\" if host_id.nil?\n \n # resource path\n path = \"/api/v11/hosts/{hostId}/config\".sub('{format}','json').sub('{' + 'hostId' + '}', host_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'view'] = opts[:'view'] if opts[:'view']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_hosts_host_id_config_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\r\n @stacks = ServiceStack.where(service_id: @service.id)\r\n end", "def get_site_alerts(id, opts = {})\n data, _status_code, _headers = get_site_alerts_with_http_info(id, opts)\n data\n end", "def api_v11_cm_commands_inspect_hosts_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_cm_commands_inspect_hosts_post ...\"\n end\n \n # resource path\n path = \"/api/v11/cm/commands/inspectHosts\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_cm_commands_inspect_hosts_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_all_site_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.delete_all_site_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def mcServiceAction(host, service, cmd)\n mc = rpcclient \"service\"\n\n h = Socket.gethostbyname(host)\n mc.identity_filter \"#{h[1][0]}\"\n\n mc.progress = false\n if cmd == 'start'\n res = mc.start(:service => service)\n else\n res = mc.stop(:service => service)\n end\n mc.disconnect\n end", "def host_detail(scan_id, host_id)\n res = http_get(:uri=>\"/scans/#{scan_id}/hosts/#{host_id}\", :fields=>x_cookie)\n end", "def hosts\n if @hosts\n @hosts\n elsif @host\n [@host]\n else\n self.class.hosts\n end\n end", "def delete_all_site_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.delete_all_site_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def hosts\n @hosts ||= []\n end", "def host_id(sys_id, name)\n response = request(:get, \"/devmgr/v2/storage-systems/#{sys_id}/hosts\")\n status(response, 200, 'Failed to get host id')\n hosts = JSON.parse(response.body)\n hosts.each do |host|\n return host['id'] if host['label'] == name\n end\n nil\n end", "def host_id(sys_id, name)\n response = request(:get, \"/devmgr/v2/storage-systems/#{sys_id}/hosts\")\n status(response, 200, 'Failed to get host id')\n hosts = JSON.parse(response.body)\n hosts.each do |host|\n return host['id'] if host['label'] == name\n end\n nil\n end", "def show\n\t\t@group = Hostgroup.find params[:id]\n\t\t@members = Host.find_all_by_hostgroup_id params[:id]\n\tend", "def hosts\n\t\tHost.find(:all)\n\tend", "def service_addresses!(service, index = nil)\n meta = {}\n resp = _service.get(service, :all, {index: index, wait: '2s'}, meta)\n\n if (nindex = meta[:index]) != index\n addresses = resp.map do |address|\n {\n id: address.ServiceID,\n ip: address.ServiceAddress,\n node: address.Node,\n port: address.ServicePort\n }\n end\n\n [addresses, nindex]\n end\n end", "def servicio # :doc\n id = params[:service_id]\n if id.present?\n \t\tService.find(params[:service_id]) \n \tend \n end" ]
[ "0.6298764", "0.6190481", "0.586121", "0.57544637", "0.5661274", "0.55310845", "0.55279905", "0.5453879", "0.5428977", "0.53472716", "0.534589", "0.53301156", "0.5321866", "0.5316694", "0.52578276", "0.51061404", "0.50250846", "0.5005147", "0.49949074", "0.4982914", "0.49765873", "0.49723116", "0.49603847", "0.4945569", "0.49403477", "0.49360728", "0.49306256", "0.49306256", "0.49306256", "0.49306256", "0.49241883", "0.49170968", "0.4913246", "0.49125752", "0.49042335", "0.4894725", "0.48876116", "0.4811826", "0.48108926", "0.47934553", "0.47846407", "0.47813427", "0.47380862", "0.47277024", "0.4713901", "0.47126296", "0.4712393", "0.4688535", "0.4666661", "0.46661302", "0.4647503", "0.4644112", "0.46436405", "0.4625339", "0.461964", "0.46187463", "0.46173114", "0.46118927", "0.45999557", "0.45942402", "0.4590656", "0.45869935", "0.45806292", "0.45653743", "0.4563652", "0.45599625", "0.4554632", "0.45541713", "0.45538214", "0.45535445", "0.45473158", "0.45448264", "0.45437363", "0.4539267", "0.4536675", "0.45357028", "0.45354667", "0.45250693", "0.45195383", "0.4517422", "0.4517224", "0.4502168", "0.45007932", "0.4487646", "0.44855726", "0.44839638", "0.44799948", "0.44778237", "0.44749674", "0.44681236", "0.44576555", "0.44519496", "0.44516674", "0.44428933", "0.44413725", "0.44413725", "0.4438176", "0.44340447", "0.44266", "0.44235623" ]
0.72990716
0
Action to index the users subscribed to an alert. [URL] GET /alerts/:id/users [Parameters] id The identificator of the alert.
def index_users load_alert return if (@alert.blank?) # Preload the users @users = User.where(:_id.in => @alert.user_ids) respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def list_users_assigned_to_application(id, options = {})\n get(\"/apps/#{id}/users\", options)\n end", "def index\n r = @api.get_users\n response = JSON.parse(r.body)\n if r.code == 200\n @users = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def users\n get('get_users')\n end", "def users\n @users = Event.find(params[:id]).users\n end", "def get_users(account_id, v, opts = {})\n data, _status_code, _headers = get_users_with_http_info(account_id, v, opts)\n return data\n end", "def index\n @users = User.all\n end", "def users\n channel = Channel.find(params[:id])\n users = ChannelJoined.where(channel_id: params[:id])\n return json_response({\n users: users.map{|j| j.user}\n })\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def list\n get('users')['users']\n end", "def index\n unless user_signed_in?\n flash[:notice]= \"You must be signed in to see other users\"\n redirect_to root_path\n end\n @users = User.all\n end", "def users_index\n\t\[email protected]_list($users)\n\t\[email protected]_view(@current_user, @current_user.actions)\n\tend", "def show\n @users = User.all.index_by(&:id)\n end", "def users(list_id)\n Iterable.request(conf, '/lists/getUsers', listId: list_id).get\n end", "def index\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['index']) do\n if params[:ids]\n ids = params[:ids].split(\",\")\n if ids.length <= 10\n @users = User.find(ids)\n @status = 200\n else\n render_error(400, \"too many ids included (max 10)\")\n end\n elsif user_signed_in?\n @status = 200\n @user = current_user\n @user_personal_roll_subdomain = (@user.public_roll and @user.public_roll.subdomain)\n render 'v1/user/show'\n else\n render_error(401, \"current user not authenticated\")\n end\n end\n end", "def index\n @users = current_user.users\n end", "def index\n @users = User.all\n @notifications = Notification.where(recipient: current_user).unread\n end", "def show\n @users = User.find(params[:id])\n end", "def show\n @users = User.find(params[:id])\n end", "def show\n @users = User.find(params[:id])\n end", "def index\n @users = UserService.all_users\n end", "def users_by_name\n if in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def show\n @users = User.find (params[:id])\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\r\n @users = User.all\r\n end", "def index\r\n @users = User.all\r\n end", "def index\r\n @users = User.all\r\n end", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n @users = ::FindUsersForDestinationService.call(destination_id_params)\n end", "def get_site_users(id, opts = {})\n data, _status_code, _headers = get_site_users_with_http_info(id, opts)\n data\n end", "def index\n @users = User.find(:all)\n end", "def index\n @users = User.find(:all)\n end", "def index\n @users = User.find(:all)\n end", "def index\n @message = \"User List\"\n @users = [{name: \"Nitesh\", age: 12},\n {name: \"Nilesh\", age: 14},\n {name: \"Anil\", age: 14}]\n end", "def show_users\n @users = User.all\n end", "def index\n\t\t@users = User.all\n\t\thide_view_action\n\t\tsetup_remove_confirm_message 'users.confirm_delete'\n\t\tsetup_index_title 'users.index.title'\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @users }\n\t\tend\n\tend", "def list_users\n @users = User.find(:all)\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def for_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").get\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end" ]
[ "0.6632567", "0.6505015", "0.6478609", "0.6368161", "0.63468176", "0.62839633", "0.6229164", "0.6226088", "0.6219819", "0.61918676", "0.61918676", "0.61918676", "0.6167833", "0.61538696", "0.61467445", "0.61335003", "0.61173123", "0.6112554", "0.610501", "0.60903084", "0.6085832", "0.6085832", "0.6085832", "0.6047511", "0.6040117", "0.6033578", "0.6031642", "0.6031642", "0.6031642", "0.6031642", "0.6031642", "0.6031642", "0.6031642", "0.6029476", "0.6029476", "0.6029476", "0.6021105", "0.6021105", "0.6021105", "0.6021105", "0.6021105", "0.6021105", "0.59979534", "0.5994294", "0.5989447", "0.5989447", "0.5989447", "0.597489", "0.5973796", "0.59569263", "0.59367114", "0.5933922", "0.5933922", "0.59298676", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187", "0.59157187" ]
0.7120552
0
Action to subscribe a user to an alert. [URL] POST /alerts/:id/users/new [Parameters] id The identificator of the alert. user_id The identificator of the user.
def new_user load_alert return if (@alert.blank?) @user = User.where(:_id => params[:user_id]).first # Do the user exists? if (@user.blank?) flash[:error] = t("alerts.error.user_not_found") redirect_to alert_users_path() return end # is already subscribed? if (@alert.user_ids.include?(@user.id)) flash[:notice] = t("alerts.notice.user_already_added", :name => @user.name, :alert => @alert.name) redirect_to alert_users_path() return end # Subscribe it @alert.users << @user respond_to do |format| format.html{ if (@alert.save) flash[:notice] = t("alerts.notice.user_added", :name => @user.name, :alert => @alert.name) else flash[:error] = t("alerts.error.user_not_added", :name => @user.name, :alert => @alert.name) end redirect_to alert_users_path() return } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe! (user_id)\n check_auth :subscribe\n \n response = connection.post do |req|\n req.url \"/user/subscribe/#{user_id}\"\n req.body = { :format => @format }\n end\n response\n end", "def create\n @user = User.new(params[:name])\n\n respond_to do |format|\n if @user.save\n\n\t\tdata = {'message' => 'New User Created!'}\n\t\tPusher['my_notifications'].trigger('notification', data)\n\t\tPusher['new_invitations'].trigger('data-changed', @user.id)\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.invite!(user_params, current_user)\n\n if @user.errors.present?\n respond_failure I18n.t('integral.backend.users.notification.creation_failure'), 'new'\n else\n respond_successfully I18n.t('integral.backend.users.notification.creation_success'), backend_user_path(@user)\n end\n end", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def create\n @user = User.new(params[:user])\n @user.locale = I18n.locale\n AccountNotifier.confirm(@user).deliver\n respond_to do |format|\n if @user.save\n format.html { redirect_to root_url, notice: I18n.t(:users_create) }\n format.json { render json: @user, status: :created, location: @user }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_user(user)\n self.users.create(id: user.id)\n end", "def users_id_user_recipients_post(id_user, opts = {})\n data, _status_code, _headers = users_id_user_recipients_post_with_http_info(id_user, opts)\n data\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:notices] = ['User Created!']\n redirect_to users_path\n else\n \tflash[:alerts] = @user.errors.full_messages\n render 'new'\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n flash[:notice] = \"#{@user.full_name} invited successfully\"\n redirect_to admin_users_path\n else\n msg = []\n flash[:error] = @user.errors.full_messages.each{|e| msg << \"#{e}\" unless msg.include?(e)}\n render 'new'\n end\n end", "def create\n @user = User.new(params[:user])\n\n Notifier.signup_email(@user).deliver\n\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n session[:user_id] = @user.id\n ::NotifierMailer.sign_up_mail(@user).deliver\n status = :ok\n else\n status = :unprocessable_entity\n end\n respond_with(@user, :status => status, :content_type => \"text/plain\")\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n flash[:notice] = t('users.create.notice')\n redirect_to users_path\n else\n render :action => \"new\"\n end\n end", "def create\n @user = User.new(user_to_be_created)\n\n error = @user.validate_user?\n\n if error.nil? && @user.save\n handler_notice('Usuário cadastrado com sucesso!', login_path)\n else\n handler_notice_error(error, new_user_path)\n end\n end", "def create\n @user = User.new params[:user]\n\n if @user.save\n flash[:notice] = t :registered, :scope => :flash\n redirect_to root_url\n else\n render :action => \"new\"\n end\n end", "def create\n if current_user.is_admin\n @user_alert = UserAlert.new(params[:user_alert])\n\n respond_to do |format|\n if @user_alert.save\n flash[:notice] = 'UserAlert was successfully created.'\n format.html { redirect_to(@user_alert) }\n format.xml { render :xml => @user_alert, :status => :created, :location => @user_alert }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_alert.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to new_session_path\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n UserMailer.account_activation(@user).deliver_now\n flash[:info] = \"Proszę sprawdź swój email, aby aktywować konto\"\n redirect_to root_url\n else\n render 'new'\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to admin_users_path, :notice => t('flash.admin.users.create')\n else\n render :action => \"new\"\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "def create\n @title = t('admin.users.new.title')\n @user = User.new(params[:user])\n\n if @user.save\n js_notify message: t('admin.users.create.success'), type: 'alert-success', time: 2500\n render partial: 'user', content_type: 'text/html', locals: { user: @user }\n else\n render partial: 'new', status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n \n if @user.create_first\n flash[:message] = \"<h2>#{t('welcome', :scope => 'refinery.users.create', :who => @user.username).gsub(/\\.$/, '')}.</h2>\".html_safe\n\n sign_in(@user)\n redirect_back_or_default(refinery.admin_root_path)\n else\n render :new\n end\n end", "def perform(user_id)\n user = User.find(user_id)\n Notifier.email_meed_fair_new_users(user).deliver\n end", "def create_user(user)\n new_user = SftpgoClient::User.new(user)\n response = wrap_response(@connection.post(USERS_PATH, new_user))\n\n response.fmap { |r| SftpgoClient::User.new(r.body) }\n end", "def create\n @user_id = UserId.new(user_id_params)\n\n respond_to do |format|\n if @user_id.save\n format.html { redirect_to @user_id, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user_id }\n else\n format.html { render :new }\n format.json { render json: @user_id.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n User.transaction do\n if @user.save\n # create a primary channel\n @channel = @user.channels.create(:title => @user.username, :slug => @user.username)\n @user.primary_channel = @channel\n @user.save\n\n # subscribe user; happens last because it is the subscriber\n Channel.default.subscribed_by(@user)\n end\n end\n\n respond_to do |format|\n if @user.valid?\n auto_login(@user)\n flash[:new_user] = true\n format.html { redirect_back_or_to(welcome_path, :notice => 'Registration successful.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user_id = UserId.new(params[:user_id])\n\n respond_to do |format|\n if @user_id.save\n format.html { redirect_to @user_id, notice: 'User was successfully created.' }\n format.json { render json: @user_id, status: :created, location: @user_id }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_id.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n # UserMailer.welcome_email(@user).deliver\n session[:user_id] = @user.id.to_s\n redirect_to user_path(@user)\n else\n flash[:danger] = \"Looks like that didn't work\"\n redirect_to('/')\n end\n end", "def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create\n\t\t@user = User.new(params[:user])\n\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\t\t\t\tformat.html { redirect_to(@user, :notice => 'User was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @user, :status => :created, :location => @user }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def subscribe\n if User.exists?(email: params[:user][:email])\n render json: { status: 'The email is already taken' }, status: :bad_request\n else\n subscribed_user = SubscribedUser.create!(user_params)\n render json: { status: 'Created' }, status: :created if subscribed_user\n render json: { status: 'Something wrong happened' }, status: :bad_request unless subscribed_user\n end\n rescue\n render json: { status: 'Something wrong happened' }, status: :bad_request\n end", "def create\n @user = user.new(params[:user])\n\n respond_to do |format|\n if @user.save\n\t\t# Tell the UserMailer to send a welcome Email after save\n UserMailer.welcome_email(@user).deliver\n\t\t\n format.html { redirect_to @user, notice: 'user was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n #Sends email to user when user is created.\n UserNotifier.send_signup_email(@user).deliver_now\n format.html { redirect_to @user }\n flash[:success] = 'Usuário criado com sucesso, os dados foram enviados para o email informado.'\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n # For now there is no +user+ management page.\n # So we are activating, approving and confirming them by default!\n @user.active = true\n @user.approved = true\n @user.confirmed = true\n\n if @user.save\n flash[:notice] = I18n.t('user.registered')\n redirect_to surveys_path\n else\n render :action => :new\n end\n end", "def create\n @user = current_restaurant.users.new(params[:user])\n\n respond_to do |format|\n if @user.signup!(params)\n @user.deliver_invited_activation_instructions!(current_restaurant)\n current_restaurant.users << @user\n current_restaurant.save\n flash[:notice] = t('users.create.success')\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\tif @user.save\n\t\t\tflash[:notice] = \"Your account has been successfully created!\"\n\t\t\tUserMailer.welcome_email(@user).deliver!\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\tflash[:error] = get_all_errors\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n user = build_resource\n\n if user.save\n set_flash_message :notice, :signed_up\n sign_in('user', user)\n respond_with user, :location => after_sign_up_path_for(user)\n else\n clean_up_passwords user\n respond_with user\n end\n end", "def create\n\t\t@user = User.new params[:user]\n\t\tif @user.save\n\t\t\tsession[:user] = nil\n\t\t\tflash[:success] = \"Thank you, we will send you a link to verify we have the correct email address.\"\n\t\t\tsign_into_session @user, permanently: false\t\t\n\t\t\tUserMailer.delay.email_confirmation(@user)\t\n\t\t\tredirect_to dashboard_path\n\t\telse\n\t\t\tsession[:user] = @user\n\t\t\tredirect_to signup_path\n\t\tend\n\tend", "def create\n user = User.force_create(email: params[:user][:email], zip_code: params[:user][:zip_code], sign_up_at: Time.now, subscription_from: params[:user][:subscription_from])\n UserMailer.delay(queue: 'mailers').subscribed_to_newsletter(user) if params[:user][:subscription_from] == 'newsletter' and user.persisted?\n respond_to do |format|\n format.js\n format.html { redirect_to params[:redirect_to] || root_path }\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n\tUserMailer.welcome_email(@user).deliver\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n\t\t@user = User.new(user_params)\n\t\t\n\t\tif @user.save\n\t\t\tredirect_to users_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n @user.skip_confirmation!\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to admin_user_path(@user), notice: t('views.admin.users.user_created_successfully') }\n else\n flash.now[:alert] = @user.errors.full_messages\n format.html { render :new }\n end\n end\n end", "def apply_to_user(user_id)\n params = {:user_id => user_id}\n post(:apply_to_user, params)\n end", "def create\n\t\t@user = User.new(params[:user])\n\t\tif @user.save\n\t\t\tredirect_to root_url, notice: \"Added new user to the database\"\n\t\telse\n\t\t\trender \"new\"\n\t\tend\n\tend", "def users_id_user_terms_post(id_user, opts = {})\n data, _status_code, _headers = users_id_user_terms_post_with_http_info(id_user, opts)\n data\n end", "def create\n @user = User.new(params[:user], :as => :admin)\n respond_to do |format|\n if @user.save\n flash[:notice] = flash[:notice].to_a.concat @user.errors.full_messages\n format.html { redirect_to admin_users_path, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n flash[:notice] = flash[:notice].to_a.concat @user.errors.full_messages\n format.html { render :action => \"new\"}\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n UserMailer.registration_confirmation(@user).deliver\n redirect_to root_url, notice: \"Thank-you for enrolling!\"\n else\n render \"new\"\n end\n end", "def create\n params[:user][:admin] = 0\n @user = User.new(params[:user])\n @user.meals_remaining = 0\n if @user.save\n UserMailer.welcome_email(@user).deliver\n respond_to do |format|\n format.html { render :controller => \"users\", :action => \"show\" }\n format.js { render :action => \"user_create_success\" }\n end\n else\n @errors = @user.errors.full_messages\n @errors.uniq!\n flash[:error_header] = \"Something went wrong.\"\n flash[:error_subheader] = \"The email address or password you entered was incorrect.\"\n respond_to do |format|\n format.html { redirect_to account_url }\n format.js { render :action => \"user_create_failure\" }\n end\n end\n end", "def create\n @user = User.create(user_params)\n @users = User.all\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to admin_user_path(@user), notice: 'User was successfully created.' }\n format.js { render :create }\n else\n format.html { render :new }\n format.js { render :create }\n end\n end\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n @subsuser = Subsuser.new(subsuser_params)\n\n respond_to do |format|\n if @subsuser.save\n format.html { redirect_to @subsuser, notice: 'Subsuser was successfully created.' }\n format.json { render :show, status: :created, location: @subsuser }\n else\n format.html { render :new }\n format.json { render json: @subsuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n session[:user_id] = @user.id\n redirect_to main_dashboard_url, :notice => \"Thank you for signing up!\"\n else\n redirect_to root_path\n end\n end", "def create\n params[\"user\"].each {|key, value| value.strip!}\n params[\"user\"][\"email\"].downcase!\n \n new_user = User.new(params[\"user\"])\n new_user.password = params[\"user\"][\"password_hash\"]\n\n if new_user.save\n flash[:message] = \"New administrator successfully created:<br>\n <ul><li><strong>Name:</strong> #{new_user.user_name}</li>\n <li><strong>Email:</strong> #{new_user.email}</li>\n <li><strong>ID:</strong> #{new_user.id}</li>\n <li><strong>Privilege Level:</strong> #{new_user.privilege}</li></ul>\"\n redirect_to \"/admin/update_library\"\n \n else \n @error_messages = new_user.errors.to_a\n @user = User.new\n @users_array = User.select(\"email\")\n render \"new\"\n end\n end", "def create\n @subscription_user = SubscriptionUser.new(subscription_user_params)\n\n respond_to do |format|\n if @subscription_user.save\n format.html { redirect_to @subscription_user, notice: 'Subscription user was successfully created.' }\n format.json { render :show, status: :created, location: @subscription_user }\n else\n format.html { render :new }\n format.json { render json: @subscription_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(user)\n open_canvas_http\n\n # the v1 is API version, only one option available in Canvas right now\n # accounts/1 refers to the Beyond Z account, which is the only one\n # we use since it is a custom installation.\n request = Net::HTTP::Post.new('/api/v1/accounts/1/users')\n request.set_form_data(\n 'access_token' => Rails.application.secrets.canvas_access_token,\n 'user[name]' => user.name,\n 'user[short_name]' => user.first_name,\n 'user[sortable_name]' => \"#{user.last_name}, #{user.first_name}\",\n 'user[terms_of_use]' => true,\n 'pseudonym[unique_id]' => user.email,\n 'pseudonym[send_confirmation]' => false\n )\n response = @canvas_http.request(request)\n\n new_canvas_user = JSON.parse response.body\n\n # this will be set if we actually created a new user\n # reasons why it might fail would include existing user\n # already having the email address\n\n # Not necessarily an error but for now i'll just make it throw\n raise \"Couldn't create user #{user.email} in canvas #{response.body}\" if new_canvas_user['id'].nil?\n\n user.canvas_user_id = new_canvas_user['id']\n\n user\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"正常に保存されました。\"\n redirect_to users_url\n else\n render 'new'\n end\n end", "def activate_user(user_id)\n post(\"/users/#{user_id}/activate\")\n end", "def assign_user_to_application_for_sso_provisioning(id, options = {})\n post(\"/apps/#{id}/users\", options)\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n unless Rails.env.test?\n UserMailer.activation(@user).deliver\n end\n redirect_to(login_path, :notice => t(\"successfully_created\", :scope => 'users.controller'))\n else\n render :action => \"new\"\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password)\n .call\n # send email using welcome template\n UserMailer.welcome_email(user).deliver_now\n response = { message: Message.account_created, token: auth_token }\n json_response(response, :created)\n else\n json_response(user.errors, :unprocessable_entity)\n end\n end", "def register\n\t\t@user = User.new(user_params)\n\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\t\t\t\t# Send user welcome email\n\t\t\t\tUserNotification.welcome_email(@user).deliver\n\n\t\t\t\tformat.js { @errors = [] }\n\t\t\telse\n\t\t\t\tformat.js { @errors = @user.errors }\n\t\t\tend\n\t\tend\n\tend", "def create(id, password)\n params = {:id => id, :password => password}\n response = @client.post(\"/users\", params)\n # TODO: strip protocol and host from uri\n User.new(@client, params.merge(:uri => response.headers['location'].first))\n end", "def create(params = {})\n response = Tiptaplab.api.make_call('users', {:user => params}, 'POST')\n dup_params = params.dup\n dup_params[:ttl_id] = response['id']\n u = self.new(dup_params)\n end", "def create\n\t\t@user = User.new(user_params)\n\t if @user.save\n\t \tsession[:user_id] = @user.id\n\t \tredirect_to user_url(@user)\n\t else\n\t \tflash.notice = \"User Registration failed. Try again.\"\n\t \trender 'new'\n\t end\n\tend", "def user_new(user)\n @user = user\n\n mail to: \"[email protected]\" ,\n subject: \"New User Created!!\"\n end", "def create\n @user = user_from_params\n if @user.save\n sign_in @user\n redirect_back_or url_after_create\n else\n render template: \"users/new\"\n end\n end", "def create\n @user = ::User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to admincp_user(@user), notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n auto_login(@user)\n format.html { redirect_to notify_path, notice: \"Your account has been created. However, you must verify your account with an administrator to complete activation. You may do so by connecting to <span class='highlight'>petyard.net</span> in Minecraft.<br /><br /><a href='#{user_path(@user)}'>Continue to your profile</a>\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(user_id:, email: nil, phone: nil, password: nil, name: nil)\n path = '/users'\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n userId: user_id,\n email: email,\n phone: phone,\n password: password,\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def create\n\t\t@user = User.new(user_params)\n\t\t# If user was save with succes, then sign in automaticly, else, render new.\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t \tflash[:sucess] = \"Seja bem-vindo!\"\n\t\t\tredirect_to :action => :show, :id => @user.id\n\t\t\tCUSTOM_LOGGER.info(\"Created and associated user to params #{@user.to_yaml}\")\n\t\telse\n\t\t\trender 'new'\n\t\t\tCUSTOM_LOGGER.error(\"Not created and associated user to params #{@user.to_yaml}\")\n\t\tend\n\tend", "def notify_conierges_about_new_user(user)\n User.concierges.each do |concierge|\n Notification.create(\n user: concierge,\n object: user,\n name: 'user_created'\n )\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n @user.send_activation_email\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to root_url\n else\n render \"users/new\"\n end\n end", "def new_user_subscribe_alert_to_grp_users_email\n group = self.group\n user_who_subscribed = self.user\n UserMailer.new_user_subscribe_alert_to_grp_users_email(group, user_who_subscribed).deliver_now\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n @user = current_user.users.new(user_params)\n if @user.save\n @users = current_user.users\n end\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save_without_session_maintenance\n @user.deliver_activation_instructions!\n flash[:notice] = \"Your account has been created. Please check your email for your account activation instructions!\"\n redirect_to root_url\n else\n render :action => :new\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:user] = t('user_create')\n redirect_to user_path(@user)\n else\n render 'new'\n end\n end", "def create\n # @user holds values from submitted form\n @user = User.new(user_params)\n \n # attempt to save the new user, log the user in if successful and redirect\n # to user details page\n if @user.save\n @user.send_activation_email\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to root_url\n else\n # something went wrong, re-render the new user form with previously entered\n # information, errors will be displayed above form\n render 'new'\n end # if\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n UserMailer.user_activate(@user, @user.activation_token).deliver_later\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\t\t\t\tformat.html {redirect_to @user, notice: 'User was successfully created.'}\n\t\t\t\tformat.json {render :show, status: :created, location: @user}\n\t\t\telse\n\t\t\t\tformat.html {render :new}\n\t\t\t\tformat.json {render json: @user.errors, status: :unprocessable_entity}\n\t\t\tend\n\t\tend\n\tend", "def create_new\n @user = User.new(params[:user])\n @university = University.find(params[:university])\n \n if @user.save\n @university.users << @user\n record_activity(\"created new user: \" + @user.email)\n # Send an email notification to the user\n UserMailer.welcome_email(@user).deliver\n redirect_to add_user_path, :notice => \"User created successfully\"\n else\n render 'add'\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path\n else\n redirect_to new_user_path\n end\n end", "def create\n if params[\"id\"] == \"_empty\" || params[\"id\"].blank?\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.json {\n @message[\"status\"] << ('add ok')\n render json: [true,@message]\n }\n else\n format.json {\n @message[\"status\"] << @user.errors.full_messages.join(\"<br />\")\n render json: @message,status: :unprocessable_entity\n }\n\n end\n end\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to :controller => 'welcome', :action => 'index'\n\t\t\tflash[:info] = 'Wait until admin enables your account'\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def existing_user\n user = User.find_by(id: params[:notification][:user_id])\n\n if user.nil?\n flash[:danger] = \"User not found.\"\n redirect_to invite_band_url\n end\n end", "def create\n @user = User.new(user_params)\n politician = Politician.find(params[:politician_id])\n\n respond_to do |format|\n if @user.save\n NotificationMailer.notify(@user, politician.notifications.last).deliver\n # send_twilio(@user, politician.notifications.last)\n format.html { redirect_to root_path, notice: 'Agora você receberá as novidades desse candidato' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user user\n @user = user\n mail to: (Rails.env.production? ? @@address : \"[email protected]\"), subject: \"New User\"\n end", "def create\n @user = User.new params[:user]\n if @user.save\n flash[:notice] = \"#{@user.full_name} was successfully added.\"\n redirect_to users_path\n else\n render :action => :new\n end\n end", "def create\n @user = User.new(params[:user])\n \n if @user.save_without_confirmation!\n flash[:notice] = t 'users.flash.user_created', :email => @user.email\n # Can't mass-assign role_ids - want to protect this from regular users.\n @user.role_ids = params[:user][:role_ids]\n \n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def publish_to_users\n data = { users: users }.merge!(payload)\n client.post('publishes/users', data)\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n Mailer.deliver_registration_confirmation(@user)\n format.html { redirect_to( admin_users_path, :notice => 'User was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => admin_users_path }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => admin_users_path.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n # Tell the User1Mailer to send a welcome email after save\n User1Mailer.welcome_email(@user).deliver_now\n format.html{redirect_to(@user, notice: 'El usuario fue creado correctamente.') }\n format.json {render json: @user, status: :created, location: @user}\n else\n #format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n session[:user_id] = user.id\n redirect_to dashboard_index_path\n else\n flash[:danger] = user.errors.full_messages\n redirect_to :back\n end\n end", "def create_user\n @user = User.new(params[:user])\n @user.save\n \n redirect_to :action => :users\n end", "def create\n \n # Remove any remember me cookies\n cookies.delete :auth_token\n \n # Create new user and populate with data\n @user = User.new(params[:user])\n \n # Check that captcha solution was correct\n if verify_recaptcha(@user)\n \n # Save new user\n if @user.save\n \n # Send activation email to user's email address\n UserMailer.deliver_activate(@user)\n \n # Redirect to activation instructions\n redirect_to :action => 'activation', :user_login => @user.login\n else\n \n # Create message containing any errors that occurred while trying to\n # create the new user\n flash[:error] = ''\n @user.errors.each do |attribute, message|\n flash[:error] += \"<div>#{attribute.capitalize} #{message}.</div>\"\n end\n \n # Redirect to new user action\n render :action => 'new', :layout => 'standard'\n end\n else\n flash[:error] = 'You failed the prove you are not a robot test.'\n render :action => 'new', :layout => 'standard'\n end\n end", "def create\n\t\t@user = User.new(:email => params[:user][:email], :password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])\n\t\t#save the new user\n\t\tif @user.save\n\t\t\t#If successfully created, stay on the newuser page and flashmessage success. \n\t \t\tredirect_to newusers_path\n \t\t\tflash[:notice] = \"#{ @user.email } created.\"\n \t\telse\n \t\t\t#if the new user was not able to be created, flash message all errors that made it unsuccessful \n \t\t\t#and stay on the newuserpage\n \t \t\t@messages = \"User was not able to be created. \"\n \t \t\t#parse the error messages and put it into a user readable version\n \t \t\[email protected]_messages.each do |message|\n \t \t\t\t@messages = @messages + message + \". \"\n \t \t\tend\n \t \t\tflash[:notice] = @messages\n \t\t\tredirect_to newusers_path\n \t\tend\n \tend", "def create\n respond_to do |format|\n if @user.save\n @user.sendmail_register_notify_user!\n @user.sendmail_register_notify_admins!\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user(user)\n @user = user\n @url = PIENSAQUE_PATH + user_nick_path(@user.nick)\n\n mail(to: \"[email protected]\", subject: \"Nuevo Usuario Registrado\", from: \"PiensaQue <[email protected]>\")\n end", "def create\n user = User.create(user_params)\n\n if user.save\n # After save sending a mail to user email\n user.send_confirmation_email\n user.mark_as_confirmated!\n render json: { status: { created: I18n.t('user_created.successfully') } }\n else\n render json: { errors: user.errors, status: 422 }\n end\n end" ]
[ "0.66719395", "0.6199178", "0.6140618", "0.6124611", "0.6028716", "0.59936076", "0.5986068", "0.5929735", "0.5923294", "0.5898534", "0.5898151", "0.587678", "0.5876318", "0.58615786", "0.5856243", "0.5836502", "0.58362", "0.5819785", "0.58182454", "0.5796434", "0.5792951", "0.57924825", "0.57755685", "0.57751566", "0.5764013", "0.5740584", "0.573534", "0.5728968", "0.572721", "0.5725108", "0.5719391", "0.57185334", "0.5712508", "0.57058656", "0.56887174", "0.5687173", "0.56868863", "0.56846756", "0.5663042", "0.5657109", "0.5640809", "0.5638315", "0.5635178", "0.5627986", "0.56187505", "0.56186724", "0.5618571", "0.5610114", "0.5605302", "0.5602055", "0.5597344", "0.55942905", "0.5588347", "0.5585158", "0.5581965", "0.55749136", "0.55737585", "0.5569348", "0.55659837", "0.5565523", "0.5563643", "0.5559021", "0.55566794", "0.55544", "0.5548214", "0.55461615", "0.5546031", "0.5545296", "0.5545184", "0.55418414", "0.5541159", "0.55367684", "0.5528028", "0.55257505", "0.55233693", "0.55196047", "0.55162376", "0.55112493", "0.55046976", "0.5502974", "0.5501739", "0.55016214", "0.5499481", "0.54987013", "0.54977417", "0.54950976", "0.5494172", "0.54939777", "0.5493555", "0.5490491", "0.5484915", "0.54833794", "0.54746455", "0.5474616", "0.5474002", "0.54730797", "0.54714847", "0.5470848", "0.54699147", "0.5464617" ]
0.76909804
0
Action to desubscribe a user to an alert. [URL] DELETE /alerts/:id/users/:user_id [Parameters] id The identificator of the alert. user_id The identificator of the user.
def delete_user load_alert return if (@alert.blank?) @user = User.where(:_id => params[:user_id]).first # Does the user exist? if (@user.blank?) flash[:error] = t("alerts.error.user_not_found") redirect_to alert_users_path() return end # Disassociate the user from the alert @alert.users.delete(@user) respond_to do |format| format.html{ if (@alert.save) flash[:notice] = t("alerts.notice.user_deleted", :name => @user.name, :alert => @alert.name) else flash[:error] = t("alerts.error.user_not_deleted", :name => @user.name, :alert => @alert.name) end redirect_to alert_users_path() return } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe! (user_id)\n check_auth :unsubscribe\n \n response = connection.post do |req|\n req.url \"/user/unsubscribe/#{user_id}\"\n req.body = { :format => @format }\n end\n response\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n UserMailer.delete_account_notification(user).deliver_later\n end", "def delete(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def delete(user_id)\n self.class.delete(\"/#{@api_ver}/users/#{user_id}\", default_options_to_merge_with)\n end", "def delete_user(user_id:, params:)\n connection.delete(\"users/#{user_id}\", params).body\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n record_activity(\"deleted user: \" + @user.email)\n redirect_to users_path, :notice => \"User deleted\"\n end", "def delete_user(user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n path = \"#{users_path}/#{user_id}\"\n delete(path)\n end", "def delete_user(id)\r\n # Prepare query url.\r\n _path_url = '/users/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.delete(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Message.from_hash(decoded)\r\n end", "def delete_by_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").delete\n end", "def destroy\r\n @user = User.find(params[:id])\r\n @user.delete!\r\n track_activity @user\r\n\r\n redirect_to users_path, only_path: true \r\n end", "def delete_user\n client.delete(user)\n end", "def unsubscribe(user)\n @clients.delete(user.signature)\n self.class.remove_channel(self) if empty?\n end", "def destroy\n @user = User.find(params[:id])\n #@user.alerts.destroy_all # achived by seting \",:dependent => :destroy\" to has_many :alerts in User model, this automatically destroy user's alerts when user is deleted.\n @user.destroy\n redirect_to genres_path\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete(id)\n begin\n User.filter(:id => id).destroy\n flash[:success] = 'The specified user has been removed'\n rescue => e\n Ramaze::Log.error(e)\n flash[:error] = 'The specified user could not be removed'\n end\n\n redirect_referrer\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def user_delete(user_id)\n res = http_delete(:uri=>\"/users/#{user_id}\", :fields=>x_cookie)\n return res.code\n end", "def remove_user(user)\n self.users.destroy(id: user.id)\n end", "def remove_user(user)\n self.users.destroy(id: user.id)\n end", "def delete_account_user(id)\n post(\"accountuser/#{id}?_method=DELETE\")\n end", "def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end", "def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end", "def destroy\n @user = User.find(params[:id])\n\n UserMailer.delay({ run_at: 1.minutes.from_now }).user_deleted(@user) \n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to :users, notice: 'Пользователь успешно удален.' }\n end\n end", "def delete_user(id)\n get_user_byid(id).destroy\n end", "def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end", "def destroy\n @user = User.find(params[:id])\n \n if admon_user\n flash[:notice] = 'La cuenta ha sido eliminada'\n redirect_to users_path\n else\n flash[:notice] = 'Su cuenta ha sido eliminada'\n redirect_to signup_path\n current_user_session.destroy\n end\n\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n\n if @user.destroy\n js_notify message: t('admin.users.destroy.success'), type: 'alert-error', time: 2500\n render nothing: true, content_type: 'text/html'\n else\n message = \"#{t('admin.users.destroy.error')}: #{@user.errors[:base].last}\"\n js_notify message: message, type: 'alert-info', time: 2500\n render nothing: true\n end\n end", "def delete_user(user)\n delete user_path(user)\n end", "def destroy\n if current_user.is_admin\n @user_alert = UserAlert.find(params[:id])\n @user_alert.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_alerts_url) }\n format.xml { head :ok }\n end\n else\n redirect_to new_session_path\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n begin\n @user.destroy\n flash[:alert] = \"User #{@user.name} deleted\"\n rescue Exception => e\n flash[:alert] = e.message\n end\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 @user = User.find(params[:id])\n @user.delete\n flash[:notice] = t('users.destroyed')\n redirect_to admin_users_url\n end", "def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end", "def destroy\n userToBeRemoved = User.find(params[:id])\n userToBeRemoved.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def user_user_id_delete(user_id, opts = {})\n user_user_id_delete_with_http_info(user_id, opts)\n nil\n end", "def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end", "def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end", "def delete_email(id, user_id = nil)\n url = user_id.to_i.zero? ? \"/user/emails/#{id}\" : \"/users/#{user_id}/emails/#{id}\"\n delete(url)\n end", "def destroy\n @user = User.find(params[:id])\n\n if @user.destroy\n flash[:notice] = \"User was deleted\"\n else\n flash[:alert] = \"User could not be deleted\"\n end\n\n redirect_to users_path\n end", "def delete_user(id)\n @user = User.destroy(id)\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path, :notice => \"User deleted.\"\n end", "def destroy\n @user = User.find(params.require(:id))\n\n # delete user from zabbix\n z = @zabbix\n begin\n z.delete_user(@user.email)\n rescue => ex\n flash[:alert] = \"Zabbix 処理中にエラーが発生しました #{ex.message}\"\n redirect_to(action: :index) and return\n end\n\n #delete user from SkyHopper\n @user.destroy\n\n flash[:notice] = I18n.t('users.msg.deleted')\n redirect_to(action: :index)\n end", "def remove(address_or_id)\n delete(\"#{domain}/unsubscribes/#{address_or_id}\")\n end", "def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend", "def users_id_user_delete(id_user, opts = {})\n data, _status_code, _headers = users_id_user_delete_with_http_info(id_user, opts)\n data\n end", "def unsubscribe(user, target)\n user.personal_subscriptions.where(target_id: target.id, target_type: target.class).destroy_all\n end", "def destroy\n\t\t@user = User.find(params[:id])\n\t\[email protected]_delete!\n\t\tUserMailer.delete_email(@user).deliver_now\n\t\trender json: {}, status: 200\n\tend", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n flash[:notice] = \"Account has been deleted successfully\"\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def remove_user(user)\n self.users.destroy(user)\n end", "def deactivate_user(user_id)\n post(\"/users/#{user_id}/deactivate\")\n end", "def destroy\n @user = User.find(params[:id]) rescue nil\n\n if [email protected]?\n @user.destroy\n redirect_to users_path\n else\n redirect_to users_path, alert: 'Erro ao deletar usuário'\n end\n end", "def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:success] = \"User has been deleted!\"\n redirect_to users_url\n end\n end", "def destroy\n @user = User.find(params.require(:id))\n\n if @user == current_user\n flash[:alert] = t('users.msg.cannot_delete_yourself')\n raise 'Cannot delete yourself'\n end\n\n # delete user from zabbix\n begin\n @user.zabbix_servers.each do |s|\n z = Zabbix.new(s.fqdn, current_user.email, current_user.encrypted_password)\n z.delete_user(@user.email)\n end\n rescue StandardError => ex\n flash[:alert] = I18n.t('users.msg.error', msg: ex.message)\n raise\n end\n\n # delete user from SkyHopper\n @user.destroy\n\n flash[:notice] = t('users.msg.deleted', name: @user.email)\n redirect_to(action: :index)\n end", "def unsubscribe\n \n @conversation.subscriptions.delete(@user) if @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now no longer receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n \n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n flash[:delete] = \"We hate to see you go! Cycle safe!\"\n redirect_to root_path\n end", "def destroy\n @user = User.find(params[:id])\n begin\n @user.destroy\n flash[:notice] = \"User was deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def delete(user_id)\n\t\t\tkparams = {}\n\t\t\t# The user's unique identifier in the partner's system\n\t\t\tclient.add_param(kparams, 'userId', user_id);\n\t\t\tclient.queue_service_action_call('user', 'delete', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def remove_user(user)\n\t\traise Exceptions::InvalidParameter unless user.kind_of? User\n\t\t$redis.multi do\n\t\t\tusers.delete(user.guid)\n\t\t\tuser.events.delete(@guid)\n\t\t\t$redis.publish(kify(:topic, :user, user.guid), {:notification => :user_left_event, :user => user.guid, :event => @guid }.to_json)\n\t\tend\n\tend", "def destroy\n @user = User.find(params[:id]).destroy\n flash[:success] = \"User deleted!\"\n redirect_to users_url\n end", "def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end", "def destroy\n @user = User.find(params[:id])\n @user.delete!\n\n redirect_to admin_users_path\n end", "def destroy\n @user = User.find(params[:id])\n @user.delete!\n\n redirect_to admin_users_path\n end", "def delete_user(id)\n # accept an id input parameter\n # use the User Model class to remove the User associated with the `id` primary key from the database\n # (no return is required)\n (User.find_by(id: id)).destroy\n end", "def delete\n @event = Event.find(params[:id])\n @user = current_user\n @event.users.delete(@user) \n \tredirect_to reminders_path(:id => current_user.id), :notice => I18n.t(:reminders_delete)\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to users_path, :notice => 'User was successfully deleted.'\n end", "def destroy\n if @user.destroy\n redirect_to :attendees, flash: { warning: 'User was deleted.' }\n else\n msg = if @user.errors.present?\n @user.errors.full_messages.join(\".\\n\") + \".\"\n else \"User could not be deleted.\" end\n redirect_to @user, alert: msg\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n if @user.errors.empty?\n flash[:notice] = 'User was successfully deleted.'\n else\n flash[:notice] = \"WARNING: Couldn't delete user because:\"\n @user.errors.full_messages.each { |m| flash[:notice] << \"<br/>\" << m }\n end\n\n format.html { redirect_to(accountadmin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n head :no_content\n end", "def destroy\n @user = get_user(params[:id])\n begin\n @user.destroy\n flash[:notice] = \"User #{@user.login_name} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n user = User.find(params[:id])\n\tuser.destroy\n\tflash[:success] = \"User #{user.name} was deleted\"\n\tredirect_to users_url\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def deactivation(user)\n @user = user\n mail(to: @user.email, subject: \"Your CASA volunteer account has been deactivated\")\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_path, notice: 'The user and all associated events were successfully deleted.'}\n format.json { head :no_content }\n end\n\n end", "def destroy\n @user.destroy\n redirect_to users_path, notice: (I18n.t :act_delete)\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n flash[:alert] = \"Your account has been deleted\"\n session.clear\n redirect_to root_path\n end", "def destroy\n @user = User.find(params[:id])\n begin\n @user.delete\n flash[:notice] = \"User #{@user.fullname} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def delete_user_by_id_v2(user_id, opts = {})\n delete_user_by_id_v2_with_http_info(user_id, opts)\n nil\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"Пользователь удален\"\n redirect_to users_path\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted user #{@user.name}\")\n end", "def destroy\n User.find_by(id: params[:id]).destroy\n flash.now[:succes] = \"User was succesfully deleted\"\n redirect_to users_url\n end", "def destroy\n\t\t@user = User.find(params[:id])\n\t\[email protected]\n\n\t\tredirect_to users_path\n\tend", "def destroy\n\t\tUser.find(params[:id]).destroy\n\t\tflash[:success] = \"User deleted\"\n\t\tredirect_to users_url\n\tend", "def unregister\n \n @event = Event.find(params[:id])\n #@user = User.find(params[:userid])\n @event.users.delete(@current_user)\n\n # Redirect to the action \"show\"\n redirect_to :action => :show, :id => @event\n # Redirect to the action \"users\"\n # Redirect to /event/1/users for event id 1\n #redirect_to :action => :users, :id => @event\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to administrators_url, notice: 'User was successfully deleted.' }\n format.json { head :ok }\n end\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n flash[:notice] = 'User was successfully deleted.'\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n flash[:notice] = \"User deleted successfully.\"\n redirect_to admin_user_path\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id])\n begin\n @user.destroy\n flash[:notice] = \"User #{@user.name} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def unregister_user(user)\n username = Digest::MD5.hexdigest(user.id.to_s)\n begin\n response = RestClient.delete(\"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\",\n \"Authorization\" => \"Bearer #{access_token}\",\n :accept => :json\n )\n if response.code == 200\n body = JSON.parse(response.body)\n if body[\"action\"] == \"delete\"\n user.username_huanxin = nil\n user.register_huanxin = false\n\n #skip validate for pre reg users\n user.save(validate: false)\n end\n end\n rescue => e\n puts e.response\n end\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:notice] = \"Destroyed succesfully\"\n redirect_to 'http://localhost:3000/utotal/index'\n end\n end", "def destroy\n @user = User.find(params[:id])\n authorize_action_for(@user)\n @user.destroy\n flash[:success] = I18n.t('controllers.users.flash.destroy.success', name: @user.name)\n redirect_to users_path\n end", "def delete_user( user_id )\n\n raise ArgumentError.new(format('wrong type. user \\'user_id\\' must be an String (for an User name) or an Integer (for an User Id), given \\'%s\\'', user_id.class.to_s)) \\\n if( user_id.is_a?(String) && user_id.is_a?(Integer) )\n raise ArgumentError.new('missing \\'user_id\\'') if( user_id.size.zero? )\n\n if(user_id.is_a?(String))\n usr = user(user_id)\n user_id = usr.dig('id')\n end\n\n return { 'status' => 404, 'message' => format( 'No User \\'%s\\' found', user_id) } if( user_id.nil? )\n return { 'status' => 403, 'message' => format( 'Can\\'t delete user id %d (admin user)', user_id ) } if( user_id.is_a?(Integer) && user_id.to_i.zero? )\n\n endpoint = format('/api/admin/users/%d', user_id )\n logger.debug( \"Deleting user id #{user_id} (DELETE #{endpoint})\" ) if @debug\n\n delete( endpoint )\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to(users_url)\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_path\n end" ]
[ "0.7552905", "0.70392185", "0.7001693", "0.6896013", "0.6823183", "0.6727134", "0.6705892", "0.67053705", "0.6678748", "0.6648549", "0.6636253", "0.6633762", "0.6619307", "0.65837765", "0.6578347", "0.65695596", "0.6569365", "0.65563995", "0.65563995", "0.6555059", "0.6543067", "0.6543067", "0.65384823", "0.6509291", "0.6505952", "0.6492809", "0.64728653", "0.64680773", "0.6455152", "0.6435535", "0.64265484", "0.6425052", "0.64196754", "0.63965684", "0.6394838", "0.6394838", "0.63890177", "0.6383003", "0.6377926", "0.6369251", "0.6362769", "0.63581836", "0.63527405", "0.6350045", "0.6349713", "0.6349579", "0.6349077", "0.63393354", "0.63210124", "0.6309236", "0.6298791", "0.6297483", "0.6293615", "0.6290201", "0.62885135", "0.62847364", "0.62765247", "0.6272918", "0.62596565", "0.6255231", "0.6255231", "0.6248633", "0.6242946", "0.6238569", "0.62366706", "0.62271893", "0.62215424", "0.6220664", "0.6208453", "0.620637", "0.62046397", "0.62037987", "0.62032574", "0.62002087", "0.61989915", "0.61934316", "0.6191634", "0.618925", "0.6189224", "0.6181973", "0.6174677", "0.61726975", "0.6169993", "0.61692613", "0.61692613", "0.61692613", "0.61692613", "0.6168386", "0.6165027", "0.6164037", "0.6163507", "0.61600393", "0.61511946", "0.615004", "0.615004", "0.61479974", "0.61413103", "0.6137652", "0.6137645", "0.61354923" ]
0.69371045
3
Action to index the alert records of an alert. [URL] GET /alerts/records/:id [Parameters] id The identificator of the alert.
def index_records # If there is an ID passed, try to load the alert if (!params[:id].blank?) && (params[:id] != "all") load_alert return if (@alert.blank?) end # if there is an alert loaded, filter the results if ([email protected]?) @alert_records = AlertRecord.where(:alert_id => @alert.id) else @alert_records = AlertRecord.all end # Ordering results @alert_records = @alert_records.desc(:open).desc(:updated_at) # If a page number is received, save it (if not, the page is the first) if (!params[:page].blank?) page = params[:page].to_i page = 1 if (page < 1) else page = 1 end # Paginate! @alert_records = @alert_records.page(page) respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @records = Record.all\n end", "def index\n @records = Record.all\n end", "def index\n @records = Record.all\n end", "def index\n @records = Record.all\n end", "def index\n @records = Record.all\n end", "def index\n @records = record_class.all\n end", "def show\n report_id = params[:id]\n render json: Record.where(report_id: report_id)\n end", "def index\n @record_set = RecordSet.find_by_id(params[:record_set_id].to_i)\n can? :read, @record_set\n @records = Record.find_all_by_record_set_id(@record_set.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @records.collect {|r| r.to_jq_record }.to_json }\n end\n end", "def index\n @alerts = Alert.all\n end", "def index\n @alerts = Alert.all\n end", "def index\n @alerts = Alert.all\n end", "def find(id)\n @records.find { |record| record.id == id }\n end", "def index\n @file_records = FileRecord.all\n end", "def index\n @file_records = FileRecord.all\n end", "def index\n # In case the user clicks the search button on a Records page\n unless params[:q].nil?\n redirect_to :controller => 'catalog', action: \"index\", q: params[:q]\n end\n\n @records = Record.order('id ASC').all()\n end", "def index\n @reading_records = ReadingRecord.all\n end", "def records(opts = {})\n opts = opts.merge(@opts)\n client.list_records(opts).full.lazy.flat_map do |rec|\n @record_class.build(mint_id(rec.header.identifier),\n record_xml(rec))\n\n end\n end", "def index\n @record_objects = RecordObject.all\n end", "def index\n @account_records = AccountRecord.all\n end", "def show\n render json: Record.where(employee_id: params[:id])\n end", "def index\n # For URL like /employees/1/leave_records\n # Get the employee with id=1\n @employee = Employee.find(params[:employee_id])\n\n # Access all leave_records for that employee\n @leave_records = @employee.leave_records\n end", "def get_alerts_for_trigger(trigger_id)\n # TODO: add additional filters\n return [] unless trigger_id\n\n url = '/?triggerIds=' + trigger_id\n ret = http_get(url)\n val = []\n ret.each { |a| val.push(Alert.new(a)) }\n val\n end", "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "def records(options = {})\n records_base(options)\n end", "def records\n doc = @session.request(:get, @records_url)\n return doc.css(\"entry\").map(){ |e| Record.new(@session, e) }\n end", "def find(id)\n result = self.class.get(worksheet_url + \"/\" + id).parsed_response\n Record.new(result_attributes(result)) if result.present? && result[\"id\"]\n end", "def report(id)\n get(\"reports/#{id}\")\n end", "def get_site_alerts(id, opts = {})\n data, _status_code, _headers = get_site_alerts_with_http_info(id, opts)\n data\n end", "def index\n @alerts = Alert.all\n\n # If an activation status is passed, get the specified alerts\n check_active_param\n @alerts = @alerts.where(:active => @active) if (@active != nil)\n\n # If a search query is received, filter the results\n if (!params[:q].blank?)\n # Do the search\n @query = params[:q]\n @alerts = @alerts.where(\"$or\" => [{:name => /#{@query}/i}, {:description => /#{@query}/i}])\n end\n\n # If a page number is received, save it (if not, the page is the first)\n if (!params[:page].blank?)\n page = params[:page].to_i\n page = 1 if (page < 1)\n else\n page = 1\n end\n \n # Paginate!\n @alerts = @alerts.page(page)\n\n respond_to do |format|\n format.html\n end\n end", "def index\n if params[:id].nil?\n @applicant_reports = ApplicantReport.all\n else\n @applicant_reports = ApplicantReport.where(applicant_id: params[:id])\n end\n end", "def list\n websites = @logs.records\n @view.show(websites)\n end", "def index(id = nil)\n if id\n # Redirect to show\n #\n # This way, you can (assuming your name doesn't conflict with an\n # existing action) tell people to visit /journals/my-cool-event, and\n # it will go to /journals/show/my-cool-event.\n raw_redirect rs(:show, id), :status => 301\n else\n # Display index\n page :last\n end\n end", "def records(opts = {})\n view = opts[:view] || @opts[:view]\n client.view(view, include_docs: true, stream: true).docs.lazy.map do |r|\n @record_class.build(mint_id(r['_id']), r.to_json, 'application/json')\n end\n end", "def index\n @health_records = HealthRecord.all\n end", "def index\n patient = Patient.find(params[:patient_id])\n @patientrecords = patient.patientrecords\n end", "def index\r\n if params[:patient_id]\r\n @patient_alerts = @patient.patient_alerts\r\n @patient_alerts.sort! {|x, y| x.alert_date <=> y.alert_date} \r\n else\r\n @patient_alerts = PatientAlert.find(:all, :order => \"alert_date\")\r\n end\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @patient_alerts }\r\n end\r\n end", "def index\n @daily_records = DailyRecord.all\n end", "def index\n @sleep_alerts = SleepAlert.all\n end", "def index\n @mailrecords = Mailrecord.all\n end", "def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n end\n end", "def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n end\n end", "def index\n @server_records = ServerRecord.all\n end", "def find(id)\n response = get(\"/domains/#{@@parent_id}/records/#{id}\")[\"record\"]\n response or return nil\n Record.new response\n end", "def show\n send_record_data(TaliaCore::DataTypes::DataRecord.find(params[:id]))\n end", "def records\n live_lookup_service.new(@ids).records\n end", "def index\n @recordpleits = Recordpleit.all\n end", "def index\n @recordspreannts = Recordspreannt.all\n end", "def fetch(id)\n search(id: id)[:records].first\n end", "def index\n @recs = Rec.all\n end", "def get_site_alerts(id, opts = {})\n data, _status_code, _headers = get_site_alerts_with_http_info(id, opts)\n return data\n end", "def show\n __log_activity(anonymous: true)\n __debug_route\n err = nil\n @item = index_record(record_id: @record_id)\n err = @item.exec_report if @item.error?\n respond_to do |format|\n format.html\n format.json { render_json show_values }\n format.xml { render_xml show_values }\n end\n rescue => error\n err = error\n ensure\n failure_status(err)\n end", "def index\n @audit_logs = AuditLog.all\n end", "def records(_options = {})\n if defined?(_resource_klass.records)\n _resource_klass.records(_options)\n else\n _resource_klass._model_class.all\n end\n end", "def records\n @records ||= search.records\n end", "def index\n @logs = Log.all\n end", "def show\n render json: Record.find(params[\"id\"])\n end", "def list_logs_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_logs ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.list_logs\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n if @api_client.config.client_side_validation && opts[:'direction'] && !['next', 'prev'].include?(opts[:'direction'])\n fail ArgumentError, 'invalid value for \"direction\", must be one of next, prev'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_logs, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_logs, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && opts[:'order'] && !['asc', 'desc'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of asc, desc'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/logs\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListAlertLogsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fetch_records(ids)\n model.where(id: ids)\n end", "def index\n @ee_reports = EeReport.all\n end", "def index\n @ee_reports = EeReport.all\n end", "def index\n # @alerts = Alert.all\n @user = User.find(session[:id])\n @alerts = @user.alerts\n end", "def index\n @answer_records = AnswerRecord.all \n end", "def index\n @email_alerts = EmailAlert.order(\"id desc\").limit(300)\n end", "def records\n @records ||= []\n end", "def index\n @transaction_records = TransactionRecord.all\n end", "def list_alerts(opts = {})\n data, _status_code, _headers = list_alerts_with_http_info(opts)\n return data\n end", "def index\n filter_params = params[\"#{model.name.underscore}_filter\"].try(:first)\n @records = process_filters(model, filter_params)\n # page resources if the request is for html. For JSON and XML we will\n # return the entire recordset\n @records = @records.page(get_page)\n respond_with(@records)\n end", "def index\n @audits = Audit.all\n respond_with @audits\n end", "def index\n @audits = Audit.all\n end", "def index\n @audits = Audit.all\n end", "def index\n @record_expenses = RecordExpense.all\n end", "def index\n date = Date.today - 2.weeks\n @records = []\n [Page, Event, Message, Newsletter, Style, Audio, Video, Document, Form].each do |model|\n @records += model.where(\"updated_at > ?\", date).order(\"updated_at DESC\")\n end\n @records.sort!{|a, b| b.updated_at <=> a.updated_at}\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @audit_logs }\n end\n end", "def index\n @empathy_map_records = EmpathyMapRecord.all\n end", "def get_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = get_site_snmp_alerts_with_http_info(id, opts)\n data\n end", "def get_records(*identifiers, **opt)\n get_relation(*identifiers, **opt).records\n end", "def get_records(*identifiers, **opt)\n get_relation(*identifiers, **opt).records\n end", "def index\n @price_alerts = PriceAlert.all\n end", "def index\n @data_logs = DataLog.all\n end", "def index\n @vital_records = VitalRecord.all\n end", "def index\n @recordtltkts = Recordtltkt.all\n end", "def index\n authorize! :read, ItemAlert\n @item_alerts = ItemAlert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_alerts }\n end\n end", "def index\n @record_scores = RecordScore.all\n end", "def index\n # limit all queries\n @audits = query_limit_all(AUDIT, :login, :message).reverse\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @audits }\n end\n end", "def index\n @pay_records = PayRecord.all\n end", "def index\n @weather_records = WeatherRecord.all\n end", "def index\r\n\t\t@employees = Employee.all\r\n\tend", "def index\n @recordspltknnts = Recordspltknnt.all\n end", "def index\n @entry_logs = EntryLog.all\n end", "def index\n @events = Event.getRecords(params[:page])\n end", "def index\n @audit_trails = AuditTrail.all\n end", "def index\n @auditvs = Auditv.all.page(params[:page]).per(10)\n end", "def index\n @all_records = index_scope(policy_scope(resource_class))\n @records = apply_page_query_parameters(@all_records)\n\n respond_to do |format|\n format.html { render_records(@records) }\n format.json { render_records(@records) }\n format.csv {\n # This encode call for now just deletes all funky UTF-8 characters that we have not yet\n # accounted for. If this causes the loss of any relevant data, we may have to just change\n # this to an excel output rather than csv\n send_data index_csv(@all_records).encode('iso-8859-1',\n {invalid: :replace, undef: :replace, replace: ''}),\n type: 'text/csv; charset=iso-8859-1; header=present',\n filename: \"#{self.controller_name}_#{Date.today.to_s}.csv\"\n }\n end\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end" ]
[ "0.6688546", "0.6688546", "0.6688546", "0.6688546", "0.6688546", "0.6526417", "0.6182347", "0.6173468", "0.6105308", "0.6105308", "0.6105308", "0.604903", "0.59701204", "0.59701204", "0.59078777", "0.5891616", "0.58842576", "0.5834743", "0.5792145", "0.5773748", "0.5769474", "0.57491577", "0.5722106", "0.5722106", "0.56830424", "0.5645581", "0.56276757", "0.5618864", "0.5618235", "0.56144106", "0.56063884", "0.55994844", "0.5597513", "0.5597267", "0.5596139", "0.5591873", "0.5589535", "0.55791396", "0.5574838", "0.55543053", "0.55173904", "0.55173904", "0.5508408", "0.5502661", "0.55010116", "0.54985815", "0.54981244", "0.5494277", "0.54708046", "0.54686654", "0.54675066", "0.54483795", "0.54344314", "0.5430155", "0.5429667", "0.54213995", "0.54213095", "0.5419548", "0.5416748", "0.5414985", "0.5414985", "0.5391194", "0.5390957", "0.5357026", "0.53534555", "0.53419685", "0.5339277", "0.53287715", "0.53198075", "0.5316816", "0.5316816", "0.53037995", "0.530036", "0.52996486", "0.52935886", "0.5291941", "0.5291941", "0.5290043", "0.52892756", "0.5266122", "0.5262407", "0.5259467", "0.5256762", "0.5251174", "0.52508104", "0.5247885", "0.52377236", "0.523694", "0.5233969", "0.5231696", "0.5225292", "0.5219578", "0.5218346", "0.5211445", "0.5211036", "0.5211036", "0.5211036", "0.5211036", "0.5211036", "0.5211036" ]
0.74467623
0
Action to show a the information about an existing alert record. [URL] GET /alerts/record/:id [Parameters] id The identificator of the alert record.
def show_record load_alert_record return if (@alert_record.blank?) respond_to do|format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @alert = Alert.find(params[:id])\n end", "def load_alert_record(redirect = true)\n if (params[:id].blank?)\n @alert_record = nil\n return @alert_record\n end\n\n @alert_record = AlertRecord.where(:_id => params[:id]).first\n\n if (@alert_record.blank? && redirect)\n # If not found, show an error and redirect\n flash[:error] = t(\"alerts.error.record_not_found\")\n redirect_to alert_records_path()\n end\n\n return @alert_record\n end", "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "def edit\n @record = Record.find(params[:id])\n end", "def show\n send_record_data(TaliaCore::DataTypes::DataRecord.find(params[:id]))\n end", "def show\n @title = 'View Health Record'\n # only select from records that are associated with current user\n @record = current_user.health_records.find_by_id(params[:id])\n unless @record\n flash[:error] = \"The selected health record doesn't belong to you\"\n redirect_to :action => 'index'\n end\n end", "def show\n render json: Record.find(params[\"id\"])\n end", "def show\n report_id = params[:id]\n render json: Record.where(report_id: report_id)\n end", "def get_single_alert(alert_id)\n ret = http_get('/alert/' + alert_id)\n val = Alert.new(ret)\n val\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert }\n end\n end", "def find(id)\n result = self.class.get(worksheet_url + \"/\" + id).parsed_response\n Record.new(result_attributes(result)) if result.present? && result[\"id\"]\n end", "def edit\n @title = 'Edit Health Record'\n # only select from records that are associated with current user\n @record = current_user.health_records.find_by_id(params[:id])\n unless @record\n flash[:error] = \"The selected health record doesn't belong to you\"\n redirect_to :action => 'index'\n end\n end", "def find_record\n @record ||= model.find_by_id(params[:id])\n end", "def show\n @record = Record.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @record }\n end\n end", "def show\n @record = Record.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @record }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def find(id)\n @records.find { |record| record.id == id }\n end", "def new_alert\n@alert = Alert.new(params[:id])\nend", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n raise RequestError.new(404) if @record.nil?\n end", "def show\n render json: Record.find(params[:id])\n end", "def show\n\n if !params[:id].nil?\n report = Report.find_by_id(params[:id])\n if report\n render json: report, status: :ok\n else\n render json: {message: 'Report doesn\\'t exist'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error getting report detail, please try it again'}, status: :bad_request\n end\n end", "def show\r\n @patient_alert = PatientAlert.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @patient_alert }\r\n end\r\n end", "def record_not_found\n\t\tflash[:alert] = \"Cannot find record number \" + params[:id] + \". Displaying all records.\"\n\t\tredirect_to root_path \n\tend", "def edit\n @healthrecord = Healthrecord.find(params[:id])\n \n end", "def show\n @record_status = RecordStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @record_status }\n end\n end", "def id\n @record.id\n end", "def show\n @record = Umbra::Record.find(params[:id])\n\n respond_with(@record)\n end", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n not_found if @record.nil?\n end", "def find(id)\n response = get(\"/domains/#{@@parent_id}/records/#{id}\")[\"record\"]\n response or return nil\n Record.new response\n end", "def set_alert\n@alert = Alert.find(params[:id])\nend", "def set_alert\n @alert = alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def show\n @alert_trigger_type = AlertTriggerType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_trigger_type }\n end\n end", "def show\n render json: Record.where(employee_id: params[:id])\n end", "def set_alert\n @alert = ::Alert::Alert.find(params[:id])\n end", "def show\n @monitor_record = MonitorRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @monitor_record }\n end\n end", "def set_record\n begin\n found_record = Record.find(params[:id])\n @record = found_record\n rescue\n raise ActionController::RoutingError.new('Not Found')\n end\n end", "def show\n #@record = Record.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @record }\n end\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def show\n @employee = Employee.find[params[:id]]\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def fetch(id)\n search(id: id)[:records].first\n end", "def load_alert(redirect = true)\n if (params[:id].blank?)\n @alert = nil\n return @alert\n end\n\n @alert = Alert.where(:_id => params[:id]).first\n\n if (@alert.blank? && redirect)\n # If not found, show an error and redirect\n flash[:error] = t(\"alerts.error.not_found\")\n redirect_to alerts_path()\n end\n\n return @alert\n end", "def show\n @health_record = HealthRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @health_record }\n end\n end", "def show\n @status_record = StatusRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_record }\n end\n end", "def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end", "def show\n @healthrecord = Healthrecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @healthrecord }\n end\n end", "def show\n\t\t@employee = Employee.find(params[:id])\n\tend", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def show\n @record = user_records.find(params[:id])\n respond_with(@record)\n end", "def show\n\t\t\t\"nothing to show for id - #{params[:id]} - with parameters: #{params.to_s}\"\n\t\tend", "def show\n @breadcrumb = 'read'\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end", "def show\n @report = Report.find(params[:id])\n end", "def find(record_id)\n result = DATABASE.execute(\"SELECT * FROM #{table} WHERE id = #{record_id}\").first\n\n self.new(result)\n end", "def show\n @title = 'Personal Record'\n @personal_record = current_user.personal_records.find_by_id(params[:id])\n unless @personal_record\n flash[:error] = 'You are not permitted to access this record'\n redirect_to :action => 'index'\n return\n end\n end", "def show\n @alert_email = AlertEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_email }\n end\n end", "def show\n @audit_log = AuditLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @audit_log }\n end\n end", "def find_record\n self.class.resource_model.find(params[:id])\n end", "def show\n @report = Report.find(params[:id])\n end", "def show\n @report = Report.find(params[:id])\n end", "def id\n @record.Id\n end", "def show\n @log_entry = LogEntry.find(params[:id])\n end", "def update\n @record = Record.find(params[:id])\n if @record.update(record_params)\n render json: {message: \"Record updated\"}, status: :ok\n else\n render json: {error: \"Unable to update the record\"}, status: :400\n end\n end", "def show\n begin\n @update = DatabaseUpdate.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n #flash[:error] = \"Invalid URL.\"\n redirect_to :action => 'index'\n end\n end", "def delete\n @record = Record.find(params[:id])\n end", "def update\n @record = Umbra::Record.find(params[:id])\n\n flash[:notice] = t(\"records.update_success\") if @record.update_attributes(record_params)\n respond_with(@record)\n end", "def show\n begin\n @incident = Incident.find(params[:id])\n rescue\n logger.error \"Attempt to access unknown incident report #{params[:id]}\"\n redirect_to incidents_url, notice: 'Sorry, invalid Incident ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident }\n end\n end\n end", "def show\n @edetail = Edetail.find_by(id: params[:id])\n end", "def find(id)\n find_by_id(id).tap { |result|\n if result.nil?\n raise RecordNotFound, \"#{self.class.name}#find with ID #{id.inspect} was not found\"\n end\n }\n end" ]
[ "0.69684535", "0.6802821", "0.664518", "0.664518", "0.64987755", "0.64867157", "0.6376431", "0.63601536", "0.63330734", "0.6276694", "0.6204151", "0.6193815", "0.6184122", "0.61518466", "0.6122632", "0.6107283", "0.60924226", "0.60923046", "0.60923046", "0.60543096", "0.60519385", "0.6051672", "0.6047308", "0.60079545", "0.6005976", "0.600432", "0.5998223", "0.5979074", "0.59761024", "0.5967244", "0.5957919", "0.59488255", "0.5927573", "0.59235764", "0.59195876", "0.59195876", "0.59195876", "0.59195876", "0.59195876", "0.59195876", "0.59195876", "0.59195876", "0.59195876", "0.59195876", "0.5914821", "0.59118325", "0.58907187", "0.5886839", "0.58849394", "0.58728933", "0.58661455", "0.5857273", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.58470577", "0.5822637", "0.58173454", "0.5794147", "0.579395", "0.5793544", "0.5790396", "0.57903016", "0.5757595", "0.5757595", "0.5753477", "0.57469785", "0.57365406", "0.57343626", "0.5733848", "0.57029206", "0.5699706", "0.56952393", "0.5687915", "0.56829244", "0.56829244", "0.56695664", "0.5656333", "0.5644766", "0.5644311", "0.5644197", "0.5637459", "0.5622517", "0.5592007", "0.55883104" ]
0.6636534
4
Function to check the existence of the active parameter in the URL. Also checks if the activation status is valid.
def check_active_param if (!params[:active].blank?) if (params[:active] == true || params[:active] == "true") @active = true elsif (params[:active] == false || params[:active] == "false") @active = false end end return @active end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_active?\n begin\n response = Net::HTTP.get_response URI.parse(self.url)\n active_status = %w(200 301 302)\n active_status.include? response.code\n rescue\n false\n end \n end", "def active?\n activation_code.nil?\n end", "def active?\n activation_code.nil?\n end", "def active?\n activation_code.nil?\n end", "def active?\n # the existence of an activation code means they have not activated yet\n activation_code.nil?\n end", "def active?\n return true if status == 'active'\n\n false\n end", "def active?\n status == 'active'\n end", "def active?\n status == 'active'\n end", "def active?\n status == 'active'\n end", "def active?\n status == STATUS[:active]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active?\n status.downcase == 'active'\n end", "def active?\n\t\t@activation_count > 0\n\tend", "def active_tab?\n url.path.split('/')[2] == attrs.href.split('/')[2]\n end", "def url_params\n params.require(:url).permit(:active)\n end", "def is_active?(slug)\n slug.gsub!(/\\//, '')\n \"active\" if params[:page] == slug || params[:category] == slug\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active?\n (status == ACTIVE)\n end", "def active?\n (status == ACTIVE)\n end", "def active?\n\t\tstatus == STATUSES[2]\n\tend", "def active?\n\t \tstatus.to_s == 'active'\n\tend", "def active?\n ['active', 'trialing'].include?(status)\n end", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def is_active_link?(url, condition = nil)\n @is_active_link ||= {}\n @is_active_link[[url, condition]] ||= begin\n original_url = url\n url = Addressable::URI::parse(url).path\n path = request.original_fullpath\n case condition\n when :inclusive, nil\n !path.match(/^#{Regexp.escape(url).chomp('/')}(\\/.*|\\?.*)?$/).blank?\n when :exclusive\n !path.match(/^#{Regexp.escape(url)}\\/?(\\?.*)?$/).blank?\n when :exact\n path == original_url\n when Regexp\n !path.match(condition).blank?\n when Array\n controllers = [*condition[0]]\n actions = [*condition[1]]\n (controllers.blank? || controllers.member?(params[:controller])) &&\n (actions.blank? || actions.member?(params[:action])) ||\n controllers.any? do |controller, action|\n params[:controller] == controller.to_s && params[:action] == action.to_s\n end\n when TrueClass\n true\n when FalseClass\n false\n when Hash\n condition.all? do |key, value|\n params[key].to_s == value.to_s\n end\n end\n end\n end", "def active_url?(request)\n\t\t\t\t\treturn false if !request || !self.url\n\t\t\t\t\tcurrent_locale, current_path = RicWebsite::Helpers::LocaleHelper.disassemble(request.fullpath)\n\t\t\t\t\tif self.url == \"/\"\n\t\t\t\t\t\treturn current_path == \"/\"\n\t\t\t\t\telse\n\t\t\t\t\t\treturn current_path.start_with?(self.url)\n\t\t\t\t\tend\n\t\t\t\tend", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def active?\n end", "def active?\n end", "def activatable?\n token = activation_token\n !!(token && !token.expired? && !token.confirmed?)\n end", "def active?\n return false if self.new_record?\n !! activation_code.nil?\n end", "def active?\n\t\t\tstate == 'active'\n\t\tend", "def is_activated?\n self.activation_token.nil?\n end", "def active?(route)\n match_href? && attributes[:href] == route ||\n active_expressions.any? do |exp|\n if exp.is_a?(Regexp)\n route =~ exp\n else\n route == exp\n end\n end\n end", "def activepath?(test_path)\n return 'active' if (request.path == test_path)\n # return 'active' if (request.path == test_path and !current_user.nil?)\n end", "def active?\n self.internal_object['status'] == 'Active'\n end", "def is_active_link?(url, options = {})\n case options[:when]\n when :self, nil\n !request.fullpath.match(/^#{Regexp.escape(url)}(\\/.*|\\?.*)?$/).blank?\n when :self_only\n !request.fullpath.match(/^#{Regexp.escape(url)}\\/?(\\?.*)?$/).blank?\n when Regexp\n !request.fullpath.match(options[:when]).blank?\n when Array\n controllers = options[:when][0]\n actions = options[:when][1]\n (controllers.blank? || controllers.member?(params[:controller])) &&\n (actions.blank? || actions.member?(params[:action]))\n when TrueClass\n true\n when FalseClass\n false\n end\n end", "def registered_only?(params)\n (params && params[:status] && params[:status].downcase) == 'registered'\n end", "def is_active?\n\t\tactive\n\tend", "def valid_url?\n !Sailpoint.config.url.blank?\n end", "def active?; status == :active; end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def isActive()\n return @activationCount > 0\n end", "def active?\n !!@active\n end", "def active?\n\t\tactive\n\tend", "def active?\n @active.value\n end", "def require_activation?\n !self.enabled? and !self.activation_code.blank?\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def is_active_link?(condition = nil)\n case condition\n when Regexp\n !request.fullpath.match(condition).blank?\n when Array\n controllers = [*condition[0]]\n actions = [*condition[1]]\n (controllers.blank? || controllers.member?(controller_name)) &&\n (actions.blank? || actions.member?(action_name))\n when TrueClass\n true\n when FalseClass, nil\n false\n end\n end", "def active?\n ACTIVE_STATUSES.include?(self.status.to_sym)\n end", "def active?\n !activated_at.blank?\n end", "def is_active?(link_path)\n link_path.include?(request.path) ? \"active\" : \"\"\n end", "def is_active?(link_path)\n link_path.include?(request.path) ? \"active\" : \"\"\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n @active != false\n end", "def active?\n @_active_status ||= ( attributes.include?('active') ? !!self.active : true )\n end", "def active?\n @active\n end", "def check_active\n if ([email protected]? || @post.expired)\n render :inactive\n end\n end", "def active?\n @data[:active]\n end", "def active?\n !inactive\n end", "def active?\n self.status == \"Active\"\n end", "def active_api?\n uri = URI('https://api.bitcoinvenezuela.com/')\n res = Net::HTTP.get_response(uri)\n return res.is_a?(Net::HTTPSuccess) \n end", "def active?\n !expired? && !revoked?\n end", "def is_active?\n is_active\n end", "def is_active?\n is_active\n end", "def active?\n @status == :established\n end", "def active?\n true\n end", "def activated?\n activation_token && activation_token.confirmed?\n end", "def active?\n activated == true\n end", "def active?\n self.class.active_statuses.include?(status)\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def is_page_active(page)\n current_page.url == page\n end", "def active?\n true\n end", "def active?\n 'Active' == self.status\n end", "def active?(env)\n env['QUERY_STRING'] =~ %r{__mp__=counts}\n end", "def active?(name)\n name = name.to_sym\n parameter = @global_parameters[name]\n parameter = @current_command.parameters[name] if parameter.nil?\n return false if parameter.nil?\n parameter.send(:active?)\n end", "def currently_active\n # check if tag is active\n if self.active == false\n return false\n end\n \n # check if time based activation is active\n if self.active_time\n unless current_time_active\n return false\n end\n end\n \n # check if date based activation is action\n if self.active_date\n unless current_date_active\n return false\n end\n end\n \n return true\n end", "def is_current_uri?(string)\n\t string == request.env['PATH_INFO'] ? \"'active'\" : \"'inactive'\"\n end", "def active?\n [\"trialing\", \"active\", \"canceled\"].include?(status) &&\n (!(canceled? || paused?) || on_trial? || on_grace_period?)\n end", "def is_pending_activation?\n ! self.activated? and self.verification_key ? true : false\n end", "def verify_page?\n current_url.include?('Google')\n end", "def pro?\n base_url =~ /invoc.us/\n end" ]
[ "0.7326444", "0.6742991", "0.6742991", "0.6742991", "0.6733753", "0.6563503", "0.65603346", "0.6546986", "0.6473968", "0.6429444", "0.6364737", "0.6364737", "0.6364737", "0.6364737", "0.6364737", "0.6364737", "0.6364737", "0.6364737", "0.6364737", "0.63614964", "0.6357283", "0.6349463", "0.63279635", "0.63189256", "0.6288059", "0.6288059", "0.6288059", "0.6288059", "0.62632954", "0.62632954", "0.6261205", "0.6197991", "0.6195472", "0.61946404", "0.61871403", "0.6159905", "0.6157013", "0.61415267", "0.61415267", "0.6135388", "0.61257637", "0.61247605", "0.61184883", "0.60966355", "0.60942364", "0.6091838", "0.6079907", "0.60628295", "0.60597044", "0.60580784", "0.6042338", "0.6034958", "0.6034958", "0.6034958", "0.60321087", "0.60289055", "0.6024344", "0.6023768", "0.6005974", "0.6003151", "0.6003151", "0.6003151", "0.5994693", "0.5993393", "0.59933674", "0.59683484", "0.59683484", "0.5962169", "0.5957698", "0.59559536", "0.59506345", "0.59500057", "0.59482235", "0.5947772", "0.5947214", "0.5946356", "0.5921128", "0.5919643", "0.5912631", "0.5912631", "0.59065914", "0.59048885", "0.5904515", "0.5904459", "0.5895322", "0.5894074", "0.5894074", "0.5894074", "0.5894074", "0.5875739", "0.5869237", "0.5864097", "0.58585256", "0.58409894", "0.5828943", "0.58204323", "0.5818195", "0.58134496", "0.5809158", "0.5809047" ]
0.71533406
1
Function lo load an alert from the database using id parameter in the URL.
def load_alert(redirect = true) if (params[:id].blank?) @alert = nil return @alert end @alert = Alert.where(:_id => params[:id]).first if (@alert.blank? && redirect) # If not found, show an error and redirect flash[:error] = t("alerts.error.not_found") redirect_to alerts_path() end return @alert end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_alert\n@alert = Alert.find(params[:id])\nend", "def show\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = alert.find(params[:id])\n end", "def set_alert\n @alert = ::Alert::Alert.find(params[:id])\n end", "def get_single_alert(alert_id)\n ret = http_get('/alert/' + alert_id)\n val = Alert.new(ret)\n val\n end", "def new_alert\n@alert = Alert.new(params[:id])\nend", "def load_alert_record(redirect = true)\n if (params[:id].blank?)\n @alert_record = nil\n return @alert_record\n end\n\n @alert_record = AlertRecord.where(:_id => params[:id]).first\n\n if (@alert_record.blank? && redirect)\n # If not found, show an error and redirect\n flash[:error] = t(\"alerts.error.record_not_found\")\n redirect_to alert_records_path()\n end\n\n return @alert_record\n end", "def set_d_alert\n @recurring_alert = RecurringAlert.find(params[:id])\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert }\n end\n end", "def set_jobalert\n @jobalert = JobAlert.find(params[:id])\n end", "def set_sleep_alert\n @sleep_alert = SleepAlert.find(params[:id])\n end", "def alert(id)\n slurp_stream(\"alert/#{id}\") do |data|\n yield data\n end\n end", "def set_alert\n unless params[:alert].blank?\n # remove single/double quotes from name to avoid display error:\n params[:alert][:name] = params[:alert][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:alert][:name].blank?\n end\n @alert = current_user.alerts.find(params[:id])\n end", "def set_email_alert\n @email_alert = EmailAlert.find(params[:id])\n end", "def set_alert\n @alert = @current_event.alerts.find(params[:id])\n authorize(@alert)\n end", "def load_datafile(id)\n begin \n Datafile.find(id)\n rescue Exception => e\n HoptoadNotifier.notify(\n :error_class => \"Invalid Datafile\", \n :error_message => \"Datafile Load Error: #{e.message}\", \n :request => { :params => id }\n )\n nil\n end\n end", "def set_price_alert\n @price_alert = PriceAlert.find(params[:id])\n end", "def show\n if current_user.is_admin\n @user_alert = UserAlert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_alert }\n end\n else\n redirect_to new_session_path\n end\n end", "def set_sms_alert\n @sms_alert = SmsAlert.find(params[:id])\n end", "def set_security_alert\n @security_alert = SecurityAlert.find(params[:id])\n end", "def show_record\n load_alert_record\n return if (@alert_record.blank?)\n\n respond_to do|format|\n format.html\n end\n end", "def show\n @alert_email = AlertEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_email }\n end\n end", "def new\n @alert = Alert.new\n @selected = params[:alert_ids]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_alerta }\n end\n end", "def edit\n load_alert\n return if (@alert.blank?)\n\n respond_to do|format|\n format.html\n end\n end", "def load(id)\n @details.load id\n render!\n end", "def show\n @alert_trigger_type = AlertTriggerType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_trigger_type }\n end\n end", "def set_loan\n unless @load = Loan.find_by_id(params[:id])\n flash[:alert] = I18n.t('views.loan.not_found')\n redirect_to :root\n end\n end", "def set_infection_alert\n @infection_alert = InfectionAlert.find(params[:id])\n end", "def show\n load_alert\n return if (@alert.blank?)\n\n respond_to do|format|\n format.html\n end\n end", "def load_job(id)\n begin \n Job.find(id)\n rescue Exception => e\n HoptoadNotifier.notify(\n :error_class => \"Invalid Job\", \n :error_message => \"Job Load Error: #{e.message}\", \n :request => { :params => id }\n )\n nil\n end\n end", "def load(id)\n #find connction by identifier from .gift\n end", "def load_search_database(id)\n begin \n SearchDatabase.find(id)\n rescue Exception => e\n HoptoadNotifier.notify(\n :error_class => \"Invalid Search Database\", \n :error_message => \"Search Database Load Error: #{e.message}\", \n :request => { :params => id }\n )\n nil\n end\n end", "def show\n #begin\n #@lien = Lien.find(params[:id])\n @liens = Lien.find_by_sql(\"SELECT a.titre_lien, a.url_lien, a.description_lien, a.image_lien, a.created_at, b.lien_id, c.pseudo_auteur, c.prenom_auteur, c.nom_auteur, d.sum_lien_votes_positifs FROM liens a LEFT JOIN liens_auteurs b ON (b.lien_id = a.id) LEFT OUTER JOIN liens_votes d ON (d.lien_id = a.id) LEFT JOIN auteurs c ON (b.auteur_id = c.id) WHERE a.id=#{params[:id].to_i}\") \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lien }\n end\n #rescue\n #flash[:notice] = \"Désolé monsieur ou madame !!\"\n #redirect_to '/'\n #end\n end", "def show\n begin\n @update = DatabaseUpdate.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n #flash[:error] = \"Invalid URL.\"\n redirect_to :action => 'index'\n end\n end", "def show\r\n @patient_alert = PatientAlert.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @patient_alert }\r\n end\r\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html\n end\n end", "def set_admin_monitor_alert\n @admin_monitor_alert = AdminMonitorAlert.find(params[:id])\n end", "def get_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]'\n\t\targs[:query]['Action'] = 'GetAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def entry(id)\n LiveJournal::Request::GetEvents.new(@user, :itemid => id, :strict => false).run || raise(\"There is no entry with that id.\")\n rescue exception_block\n end", "def show\n # authorize! :read, @item_alert\n # @item_alert = ItemAlert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_alert }\n end\n end", "def get_by_id(id)\n if @data == nil\n url = make_url(:fq => \"id:#{id}\")\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n \n return @data\n end", "def get_alert_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.get_alert ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.get_alert\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'GetAlertResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#get_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load_entry\n\t\t@entry = Entry.find(params[:id])\n\tend", "def get_entry(id)\n prepare_entry(LiveJournal::Request::GetEvents.new(@user, :itemid => id, :strict => false).run || raise(\"There is no entry with that id.\"))\n rescue exception_block\n end", "def new\n @alert = Alert.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def load_event\n @event = Event.find(params[:id])\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def show(table, id)\n self.get(\"/#{table}/show/#{id}\")\n end", "def show\n @notification = Notification.find_by(id: params[:id])\n end", "def get_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.get_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp/{alertId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SnmpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_alert\n if params[:url]\n # redirect to scraper if we don't have an api for it\n temp_host = get_host(clean_url(params[:url]))\n if BLACKLIST.include? temp_host\n # TODO could be more customizable messages\n flash[:danger] = \"Please Use a Shopping Website.\"\n redirect_to root_url\n return\n end\n\n temp_api = categorize_api(temp_host)\n if temp_api == \"scrape\" && !params[:xpath] && !params[:input_price]\n redirect_to results_path url: params[:url]\n return\n end\n\n @tracker = current_user.trackers.new(url: params[:url])\n if @tracker.save\n if @tracker.product.current_price == 1 || @tracker.product.current_price == 0\n flash[:danger] = \"Sorry, we are unable to track your product at this time due to company policies.\"\n redirect_to dashboard_url\n return\n end\n redirect_to edit_tracker_path(@tracker, first_time: true)\n else\n # TODO could be more customizable messages\n logger.error \"creation failed for bookmarklet with url: #{params[:url]}\"\n flash[:danger] = \"Sorry, we are unable to support this website at this time.\"\n redirect_to root_url\n end\n else\n flash[:danger] = \"Sorry, please try using the bookmarklet again.\"\n redirect_to dashboard_path\n end\n end", "def show\n @id = params[:id]\n end", "def show\n @id = params[:id]\n end", "def get_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.get_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp/{alertId}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SnmpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load_efi_banners\n if params[:id].presence\n @banner = current_user_efi.efi.banners.find(params[:id])\n else\n @banners = current_user_efi.efi.banners\n end\n end", "def index\n # @alerts = Alert.all\n @user = User.find(session[:id])\n @alerts = @user.alerts\n end", "def set_weather_station_alert\n @weather_station_alert = WeatherStationAlert.find(params[:id])\n end", "def load_list(id)\n list_to_load = @lists.find { |list| list[:id] == id }\n if !list_to_load\n session[:error] = \"The specified list was not found.\"\n redirect \"/lists\"\n else\n list_to_load\n end\nend", "def show\n begin\n balloon = Balloon.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n balloon = nil\n end\n if balloon == nil\n render json: {status: 'ERROR', message:'That Balloon doesnt exist', data:\"@Balloon.errors\"},status: :unprocessable_entity\n else \n render json: {status: 'SUCCESS', message:'Loaded balloon', data:balloon},status: :ok\n end\n end", "def meal_by_id(id)\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/lookup.php?i=52772\n raise \"id is not an Integer (#{id.class})\" unless id.is_a?(Integer)\n\n content = api_call(\"lookup.php?i=#{id}\")\n validate(content)\n content\n end", "def set_alert_station\n @alert_station = AlertStation.find(params[:id])\n end", "def set_alarm\n @alarm = Alarm.find(params[:id])\n end", "def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to root_path, notice: \"Has creado una nueva alerta. Pronto te avisaremos cuando encontremos lo que buscas\" }\n format.json { render :show, status: :created, location: @alert }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def load_by_id(name = nil)\n load_by(:id, name)\n end", "def set_alarm\n @alarm = Alarm.find(params[:id])\n end", "def get_event\n begin\n @noticia = Event.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to(events_path(:page => params[:page]), :error => t(\"event.not_exist\"))\n end\n end", "def show\n hash = params[:id]\n if hash.nil?\n redirect_to '/'\n else\n id = Base32::Crockford.decode(hash.upcase)\n begin \n @link = Link.find(id)\n @link.count = @link.count + 1\n impressionattributes = Hash.new\n \n impression = Impression.new;\n impression.attributes.each_key { |key|\n impressionattributes[key] = request.env[key.upcase]\n }\n \n impression.attributes = impressionattributes\n @link.impressions << impression\n @link.save\n redirect_to @link.url\n rescue ActiveRecord::RecordNotFound => ex\n logger.error \"Error!\" << ex.message\n found = false\n flash[:error] = 'Sorry! We don\\'t know about that URL'\n redirect_to '/'\n end\n end\n \n \n end", "def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end", "def find(id)\n end", "def new\n @show = @ticketalert.show\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticketalert }\n end\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @dashboard = Dashboard.find_by(:website_id => params[:id]) || Dashboard.find(params[:id])# this show gets the params when there is not ID ( websites/index => dashbaord_new)\n # @dashboard = Dashboard.find(params[:id]) if params[:id].blank? # gets ID when the params is created with an ID\n find_params_for_data_dashboard # calls @dashboard params to Application\n \n end", "def get_alert(identifier, opts = {})\n data, _status_code, _headers = get_alert_with_http_info(identifier, opts)\n return data\n end", "def update\n @alert = Alert.find(params[:id])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_abra_notice\n @abra_notice = AbraNotice.find(params[:id])\n end", "def alert; end", "def alert; end", "def load_event\n @event = Event.find(params[:event_id])\n end", "def create_site_snmp_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.create_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def alert(x, status:200, type:\"request\", title:\"Alert\", message:\"\", args: [])\n x.res.status = status\n App[:app_error][type.to_sym][:get][x, title, message, *args]\n end", "def get( id )\n resource = begin # this is just in case the developer has already escaped the name\n CouchDB.get( \"#{database.uri}/#{CGI.escape(id)}\" )\n rescue\n CouchDB.get( \"#{database.uri}/#{id}\" ) \n end\n new( resource ) \n end", "def show\n submenu_item 'applications-index'\n @app = App.find(params[:id], query)\n @alerts = Alert.all({\n :conditions => [\"source_type = 2 and source_id = ? and severity <> 0\", @app.id]\n })\n @services = @app.services\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def find_by_id_or_name_with_flash_alert\n find_by_id_or_name(lambda do |msg|\n flash_message :alert, msg\n redirect_back(:action=>:index)\n end)\n end", "def create_site_snmp_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.create_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def callback_alert\n Alert.show_popup( :message => \"Wollen Sie wirklich abbrechen?\\n\\n Ihre Eingaben gehen dabei verloren.\", :icon => :alert,\n :buttons => [\"Ok\", \"Cancel\"], :callback => url_for(:action => :popup_callback) )\n end", "def update_load_voyage\n begin\n\n\t id = params[:load_voyage][:id]\n\t if id && @load_voyage = LoadVoyage.find(id)\n\t\t if @load_voyage.update_attributes(params[:load_voyage])\n\t\t\tflash[:notice] = 'record saved'\n render :inline => %{\n <script>\n window.opener.frames[1].frames[1].location.reload(true);\n alert('load voyage edited');\n window.close();\n </script>\n }\n\n\t else\n\t render_edit_load_voyage\n\n\tend\n end\nrescue\n\t handle_error('record could not be saved')\nend\n end" ]
[ "0.7227944", "0.7226281", "0.7105152", "0.7105152", "0.7105152", "0.7105152", "0.7105152", "0.7105152", "0.7105152", "0.7105152", "0.7105152", "0.7105152", "0.709702", "0.69173455", "0.6835383", "0.680298", "0.6508832", "0.63834715", "0.6239125", "0.6238793", "0.6238793", "0.6201499", "0.61604965", "0.6159719", "0.6101608", "0.61007005", "0.6045974", "0.59634", "0.5870084", "0.584636", "0.57995003", "0.5787327", "0.5735852", "0.5707402", "0.56802106", "0.5641487", "0.56364185", "0.5634714", "0.563444", "0.5624172", "0.56152374", "0.5610321", "0.5579146", "0.5555757", "0.5552622", "0.55459225", "0.55439556", "0.5533308", "0.5527885", "0.55222267", "0.5507052", "0.54971504", "0.545581", "0.5451788", "0.5436024", "0.5435765", "0.5419905", "0.5381241", "0.5374547", "0.5367663", "0.53468394", "0.5340416", "0.5300027", "0.52709556", "0.5266428", "0.5264367", "0.5264367", "0.52495414", "0.52449787", "0.5239645", "0.5234226", "0.52330065", "0.52186155", "0.5213944", "0.5212029", "0.52044207", "0.5202659", "0.52023005", "0.5200705", "0.5191311", "0.5186894", "0.51829803", "0.5178874", "0.51763344", "0.5171043", "0.51685834", "0.5165832", "0.51612353", "0.51420987", "0.5136938", "0.5136938", "0.51302445", "0.5125531", "0.5120101", "0.51123154", "0.5109265", "0.5108386", "0.5107234", "0.51068664", "0.51065993" ]
0.7132379
2
Function lo load an alert from the database using id parameter in the URL.
def load_alert_record(redirect = true) if (params[:id].blank?) @alert_record = nil return @alert_record end @alert_record = AlertRecord.where(:_id => params[:id]).first if (@alert_record.blank? && redirect) # If not found, show an error and redirect flash[:error] = t("alerts.error.record_not_found") redirect_to alert_records_path() end return @alert_record end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_alert\n@alert = Alert.find(params[:id])\nend", "def show\n @alert = Alert.find(params[:id])\n end", "def load_alert(redirect = true)\n if (params[:id].blank?)\n @alert = nil\n return @alert\n end\n\n @alert = Alert.where(:_id => params[:id]).first\n\n if (@alert.blank? && redirect)\n # If not found, show an error and redirect\n flash[:error] = t(\"alerts.error.not_found\")\n redirect_to alerts_path()\n end\n\n return @alert\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = alert.find(params[:id])\n end", "def set_alert\n @alert = ::Alert::Alert.find(params[:id])\n end", "def get_single_alert(alert_id)\n ret = http_get('/alert/' + alert_id)\n val = Alert.new(ret)\n val\n end", "def new_alert\n@alert = Alert.new(params[:id])\nend", "def set_d_alert\n @recurring_alert = RecurringAlert.find(params[:id])\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert }\n end\n end", "def set_sleep_alert\n @sleep_alert = SleepAlert.find(params[:id])\n end", "def set_jobalert\n @jobalert = JobAlert.find(params[:id])\n end", "def alert(id)\n slurp_stream(\"alert/#{id}\") do |data|\n yield data\n end\n end", "def set_alert\n unless params[:alert].blank?\n # remove single/double quotes from name to avoid display error:\n params[:alert][:name] = params[:alert][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:alert][:name].blank?\n end\n @alert = current_user.alerts.find(params[:id])\n end", "def set_email_alert\n @email_alert = EmailAlert.find(params[:id])\n end", "def set_alert\n @alert = @current_event.alerts.find(params[:id])\n authorize(@alert)\n end", "def load_datafile(id)\n begin \n Datafile.find(id)\n rescue Exception => e\n HoptoadNotifier.notify(\n :error_class => \"Invalid Datafile\", \n :error_message => \"Datafile Load Error: #{e.message}\", \n :request => { :params => id }\n )\n nil\n end\n end", "def set_price_alert\n @price_alert = PriceAlert.find(params[:id])\n end", "def show\n if current_user.is_admin\n @user_alert = UserAlert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_alert }\n end\n else\n redirect_to new_session_path\n end\n end", "def set_sms_alert\n @sms_alert = SmsAlert.find(params[:id])\n end", "def set_security_alert\n @security_alert = SecurityAlert.find(params[:id])\n end", "def show_record\n load_alert_record\n return if (@alert_record.blank?)\n\n respond_to do|format|\n format.html\n end\n end", "def show\n @alert_email = AlertEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_email }\n end\n end", "def new\n @alert = Alert.new\n @selected = params[:alert_ids]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def show\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_alerta }\n end\n end", "def edit\n load_alert\n return if (@alert.blank?)\n\n respond_to do|format|\n format.html\n end\n end", "def load(id)\n @details.load id\n render!\n end", "def show\n @alert_trigger_type = AlertTriggerType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_trigger_type }\n end\n end", "def set_loan\n unless @load = Loan.find_by_id(params[:id])\n flash[:alert] = I18n.t('views.loan.not_found')\n redirect_to :root\n end\n end", "def set_infection_alert\n @infection_alert = InfectionAlert.find(params[:id])\n end", "def show\n load_alert\n return if (@alert.blank?)\n\n respond_to do|format|\n format.html\n end\n end", "def load_job(id)\n begin \n Job.find(id)\n rescue Exception => e\n HoptoadNotifier.notify(\n :error_class => \"Invalid Job\", \n :error_message => \"Job Load Error: #{e.message}\", \n :request => { :params => id }\n )\n nil\n end\n end", "def load(id)\n #find connction by identifier from .gift\n end", "def load_search_database(id)\n begin \n SearchDatabase.find(id)\n rescue Exception => e\n HoptoadNotifier.notify(\n :error_class => \"Invalid Search Database\", \n :error_message => \"Search Database Load Error: #{e.message}\", \n :request => { :params => id }\n )\n nil\n end\n end", "def show\n #begin\n #@lien = Lien.find(params[:id])\n @liens = Lien.find_by_sql(\"SELECT a.titre_lien, a.url_lien, a.description_lien, a.image_lien, a.created_at, b.lien_id, c.pseudo_auteur, c.prenom_auteur, c.nom_auteur, d.sum_lien_votes_positifs FROM liens a LEFT JOIN liens_auteurs b ON (b.lien_id = a.id) LEFT OUTER JOIN liens_votes d ON (d.lien_id = a.id) LEFT JOIN auteurs c ON (b.auteur_id = c.id) WHERE a.id=#{params[:id].to_i}\") \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lien }\n end\n #rescue\n #flash[:notice] = \"Désolé monsieur ou madame !!\"\n #redirect_to '/'\n #end\n end", "def show\n begin\n @update = DatabaseUpdate.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n #flash[:error] = \"Invalid URL.\"\n redirect_to :action => 'index'\n end\n end", "def show\r\n @patient_alert = PatientAlert.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @patient_alert }\r\n end\r\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html\n end\n end", "def set_admin_monitor_alert\n @admin_monitor_alert = AdminMonitorAlert.find(params[:id])\n end", "def get_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]'\n\t\targs[:query]['Action'] = 'GetAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def entry(id)\n LiveJournal::Request::GetEvents.new(@user, :itemid => id, :strict => false).run || raise(\"There is no entry with that id.\")\n rescue exception_block\n end", "def show\n # authorize! :read, @item_alert\n # @item_alert = ItemAlert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_alert }\n end\n end", "def get_alert_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.get_alert ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.get_alert\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'GetAlertResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#get_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_by_id(id)\n if @data == nil\n url = make_url(:fq => \"id:#{id}\")\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n \n return @data\n end", "def load_entry\n\t\t@entry = Entry.find(params[:id])\n\tend", "def get_entry(id)\n prepare_entry(LiveJournal::Request::GetEvents.new(@user, :itemid => id, :strict => false).run || raise(\"There is no entry with that id.\"))\n rescue exception_block\n end", "def new\n @alert = Alert.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def load_event\n @event = Event.find(params[:id])\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def show(table, id)\n self.get(\"/#{table}/show/#{id}\")\n end", "def show\n @notification = Notification.find_by(id: params[:id])\n end", "def get_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.get_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp/{alertId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SnmpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_alert\n if params[:url]\n # redirect to scraper if we don't have an api for it\n temp_host = get_host(clean_url(params[:url]))\n if BLACKLIST.include? temp_host\n # TODO could be more customizable messages\n flash[:danger] = \"Please Use a Shopping Website.\"\n redirect_to root_url\n return\n end\n\n temp_api = categorize_api(temp_host)\n if temp_api == \"scrape\" && !params[:xpath] && !params[:input_price]\n redirect_to results_path url: params[:url]\n return\n end\n\n @tracker = current_user.trackers.new(url: params[:url])\n if @tracker.save\n if @tracker.product.current_price == 1 || @tracker.product.current_price == 0\n flash[:danger] = \"Sorry, we are unable to track your product at this time due to company policies.\"\n redirect_to dashboard_url\n return\n end\n redirect_to edit_tracker_path(@tracker, first_time: true)\n else\n # TODO could be more customizable messages\n logger.error \"creation failed for bookmarklet with url: #{params[:url]}\"\n flash[:danger] = \"Sorry, we are unable to support this website at this time.\"\n redirect_to root_url\n end\n else\n flash[:danger] = \"Sorry, please try using the bookmarklet again.\"\n redirect_to dashboard_path\n end\n end", "def show\n @id = params[:id]\n end", "def show\n @id = params[:id]\n end", "def get_site_snmp_alert_with_http_info(id, alert_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_snmp_alert\"\n end\n # verify the required parameter 'alert_id' is set\n if @api_client.config.client_side_validation && alert_id.nil?\n fail ArgumentError, \"Missing the required parameter 'alert_id' when calling SiteApi.get_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp/{alertId}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'alertId' + '}', alert_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SnmpAlert')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load_efi_banners\n if params[:id].presence\n @banner = current_user_efi.efi.banners.find(params[:id])\n else\n @banners = current_user_efi.efi.banners\n end\n end", "def index\n # @alerts = Alert.all\n @user = User.find(session[:id])\n @alerts = @user.alerts\n end", "def set_weather_station_alert\n @weather_station_alert = WeatherStationAlert.find(params[:id])\n end", "def load_list(id)\n list_to_load = @lists.find { |list| list[:id] == id }\n if !list_to_load\n session[:error] = \"The specified list was not found.\"\n redirect \"/lists\"\n else\n list_to_load\n end\nend", "def show\n begin\n balloon = Balloon.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n balloon = nil\n end\n if balloon == nil\n render json: {status: 'ERROR', message:'That Balloon doesnt exist', data:\"@Balloon.errors\"},status: :unprocessable_entity\n else \n render json: {status: 'SUCCESS', message:'Loaded balloon', data:balloon},status: :ok\n end\n end", "def meal_by_id(id)\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/lookup.php?i=52772\n raise \"id is not an Integer (#{id.class})\" unless id.is_a?(Integer)\n\n content = api_call(\"lookup.php?i=#{id}\")\n validate(content)\n content\n end", "def set_alert_station\n @alert_station = AlertStation.find(params[:id])\n end", "def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to root_path, notice: \"Has creado una nueva alerta. Pronto te avisaremos cuando encontremos lo que buscas\" }\n format.json { render :show, status: :created, location: @alert }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_alarm\n @alarm = Alarm.find(params[:id])\n end", "def set_alarm\n @alarm = Alarm.find(params[:id])\n end", "def load_by_id(name = nil)\n load_by(:id, name)\n end", "def get_event\n begin\n @noticia = Event.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to(events_path(:page => params[:page]), :error => t(\"event.not_exist\"))\n end\n end", "def show\n hash = params[:id]\n if hash.nil?\n redirect_to '/'\n else\n id = Base32::Crockford.decode(hash.upcase)\n begin \n @link = Link.find(id)\n @link.count = @link.count + 1\n impressionattributes = Hash.new\n \n impression = Impression.new;\n impression.attributes.each_key { |key|\n impressionattributes[key] = request.env[key.upcase]\n }\n \n impression.attributes = impressionattributes\n @link.impressions << impression\n @link.save\n redirect_to @link.url\n rescue ActiveRecord::RecordNotFound => ex\n logger.error \"Error!\" << ex.message\n found = false\n flash[:error] = 'Sorry! We don\\'t know about that URL'\n redirect_to '/'\n end\n end\n \n \n end", "def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end", "def new\n @show = @ticketalert.show\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticketalert }\n end\n end", "def find(id)\n end", "def update\n @alert = Alert.find(params[:id])\n\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_alert(identifier, opts = {})\n data, _status_code, _headers = get_alert_with_http_info(identifier, opts)\n return data\n end", "def show\n @dashboard = Dashboard.find_by(:website_id => params[:id]) || Dashboard.find(params[:id])# this show gets the params when there is not ID ( websites/index => dashbaord_new)\n # @dashboard = Dashboard.find(params[:id]) if params[:id].blank? # gets ID when the params is created with an ID\n find_params_for_data_dashboard # calls @dashboard params to Application\n \n end", "def update\n @alert = Alert.find(params[:id])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_abra_notice\n @abra_notice = AbraNotice.find(params[:id])\n end", "def alert; end", "def alert; end", "def create_site_snmp_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.create_site_snmp_alert ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_snmp_alert\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load_event\n @event = Event.find(params[:event_id])\n end", "def alert(x, status:200, type:\"request\", title:\"Alert\", message:\"\", args: [])\n x.res.status = status\n App[:app_error][type.to_sym][:get][x, title, message, *args]\n end", "def callback_alert\n Alert.show_popup( :message => \"Wollen Sie wirklich abbrechen?\\n\\n Ihre Eingaben gehen dabei verloren.\", :icon => :alert,\n :buttons => [\"Ok\", \"Cancel\"], :callback => url_for(:action => :popup_callback) )\n end", "def create_site_snmp_alert_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.create_site_snmp_alert ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.create_site_snmp_alert\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'alert'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithAlertIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site_snmp_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_by_id_or_name_with_flash_alert\n find_by_id_or_name(lambda do |msg|\n flash_message :alert, msg\n redirect_back(:action=>:index)\n end)\n end", "def get( id )\n resource = begin # this is just in case the developer has already escaped the name\n CouchDB.get( \"#{database.uri}/#{CGI.escape(id)}\" )\n rescue\n CouchDB.get( \"#{database.uri}/#{id}\" ) \n end\n new( resource ) \n end", "def show\n submenu_item 'applications-index'\n @app = App.find(params[:id], query)\n @alerts = Alert.all({\n :conditions => [\"source_type = 2 and source_id = ? and severity <> 0\", @app.id]\n })\n @services = @app.services\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def update_load_voyage\n begin\n\n\t id = params[:load_voyage][:id]\n\t if id && @load_voyage = LoadVoyage.find(id)\n\t\t if @load_voyage.update_attributes(params[:load_voyage])\n\t\t\tflash[:notice] = 'record saved'\n render :inline => %{\n <script>\n window.opener.frames[1].frames[1].location.reload(true);\n alert('load voyage edited');\n window.close();\n </script>\n }\n\n\t else\n\t render_edit_load_voyage\n\n\tend\n end\nrescue\n\t handle_error('record could not be saved')\nend\n end" ]
[ "0.7229217", "0.72268593", "0.7131562", "0.7107516", "0.7107516", "0.7107516", "0.7107516", "0.7107516", "0.7107516", "0.7107516", "0.7107516", "0.7107516", "0.7107516", "0.7099633", "0.69197506", "0.68382335", "0.68033385", "0.6385434", "0.62401956", "0.6239859", "0.6239859", "0.62021714", "0.6162547", "0.61621827", "0.6106462", "0.6103267", "0.60479265", "0.59663785", "0.5867936", "0.58480686", "0.5800244", "0.5789839", "0.57379353", "0.5706976", "0.5680303", "0.5641422", "0.56365633", "0.56350565", "0.5630746", "0.5624539", "0.5613445", "0.561343", "0.55806625", "0.5554561", "0.55497557", "0.554305", "0.55415386", "0.5531331", "0.5527916", "0.5522595", "0.55094594", "0.54981166", "0.5456624", "0.5451875", "0.5438892", "0.5433723", "0.541573", "0.53815204", "0.5375307", "0.53638995", "0.5347594", "0.53381824", "0.52989864", "0.5272777", "0.5269599", "0.52616113", "0.52616113", "0.525141", "0.52428967", "0.5239298", "0.523704", "0.52287877", "0.52179074", "0.52145404", "0.5214036", "0.5205388", "0.520517", "0.5201455", "0.5197809", "0.5188672", "0.51842755", "0.5181338", "0.5176533", "0.51758975", "0.51735103", "0.5169663", "0.51656127", "0.5164815", "0.51434493", "0.5142347", "0.5142347", "0.5128694", "0.5126325", "0.51234853", "0.5111861", "0.51104474", "0.51091945", "0.5108936", "0.51086295", "0.51060236" ]
0.6506354
17
Function to check if there is any existing service before executing the create/update actions that require at least a service.
def check_service_existence if (Service.all.count == 0) flash[:error] = t("alerts.error.services_not_exist") redirect_to :back end return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exist?(service)\n !service_list[service].nil?\n end", "def dt_service_exist?\n pattern = /#{DT_SERVICE_NAME}/\n candidates = @services.select do |candidate|\n (\n (candidate['label'] == 'user-provided' && candidate['name'] =~ pattern) ||\n candidate['label'] =~ pattern ||\n (!candidate['tags'].nil? && candidate['tags'].any? { |tag| tag =~ pattern })\n ) &&\n !candidate[CREDENTIALS_KEY].nil? &&\n candidate[CREDENTIALS_KEY][SERVER_KEY] &&\n !candidate[CREDENTIALS_KEY]['environmentid']\n end\n\n raise 'Multiple valid dynatrace services exist.' if candidates.length > 1\n\n candidates.one?\n end", "def has_services\n if self.services != []\n return true\n else\n return false\n end\n end", "def ensure_service!\n service = params[:service] or raise \"no service given\"\n @service = Service(service, @realm) or raise \"invalid service\"\n end", "def dynatrace_service_exist?\n @services.one_service? DYNATRACE_SERVICE_NAME, [ENVIRONMENTID, TENANT], [APITOKEN, TENANTTOKEN]\n end", "def dynamic_service?\n missing_fields_for_dynamic_service.empty?\n end", "def ensure_service!\n fail \"Must have active connection\" unless service\n end", "def ensure_service!\n fail \"Must have active connection\" unless service\n end", "def service_check(service_id)\n check(\"service:#{service_id}\")\n end", "def ensure_service!\n raise \"Must have active connection\" unless service\n end", "def ensure_service!\n raise \"Must have active connection\" unless service\n end", "def ensure_service!\n raise \"Must have active connection\" unless service\n end", "def ensure_service!\n raise \"Must have active connection\" unless @service\n end", "def ensure_service!\n raise \"Must have active connection\" unless @service\n end", "def ensure_service!\n raise \"Must have active connection\" unless @service\n end", "def ensure_service!\n raise \"Must have active connection\" unless @service\n end", "def ensure_service!\n raise \"Must have active connection\" unless @client.service\n end", "def ensure_prerequisites\n return false unless command_found('netsh')\n return false unless command_found('net')\n return false unless command_found('reg')\n\n unless wired_autoconfig_service_running?\n info('starting \\'Wired AutoConfig\\' service')\n if admin_mode?\n `net start dot3svc`\n else\n require 'win32ole'\n shell = WIN32OLE.new('Shell.Application')\n shell.ShellExecute('net', 'start dot3svc', nil, 'runas', 1)\n end\n service_has_started = Landrush::Util::Retry.retry(tries: 5, sleep: 1) do\n wired_autoconfig_service_running?\n end\n unless service_has_started\n info('Unable to start \\'Wired AutoConfig\\' service. Unable to configure DNS on host. Try manual configuration.')\n return false\n end\n info('\\'Wired AutoConfig\\' service has started.')\n end\n true\n end", "def has_service?(service_name)\n\n service_name = service_name.to_s\n service_name = \"s_#{service_name}\" if ! SERVICE_PREFIX.match(service_name)\n\n @services.has_key?(service_name)\n end", "def checkExists(name)\n if name == nil || name == \"\"\n # Error message.\n # %1 is a name of an init script in /usr/lib/systemd/system,\n # eg. nfsserver\n @error_msg = Builtins.sformat(_(\"Empty service name: %1.\"), name)\n Builtins.y2error(1, @error_msg)\n return false\n end\n\n service_exists = false\n\n possible_service_locations = Builtins.add(\n # all known $service.service locations\n Builtins.maplist(@systemd_dirs) do |directory|\n Builtins.sformat(\"%1/%2.service\", directory, name)\n end,\n # init.d fallback, see bnc#795929 comment#20\n Builtins.sformat(\"%1/%2\", @INITD_DIR, name)\n )\n\n target_dir = Builtins.find(possible_service_locations) do |service_file|\n FileUtils.Exists(service_file)\n end\n\n if target_dir != nil\n return true\n else\n possible_locations = Builtins.add(@systemd_dirs, @INITD_DIR)\n # Error message.\n # %1 is a name of an init script in /usr/lib/systemd/system,\n # eg. nfsserver\n @error_msg = Builtins.sformat(\n _(\"Service %1 does not exist in %2.\"),\n name,\n Builtins.mergestring(possible_locations, \", \")\n )\n Builtins.y2milestone(1, @error_msg)\n return false\n end\n end", "def check_services(claim)\n if claim.services.count < 1 \n flash[:error] = \"Kindly add a service to this claim to continue\"\n redirect_to addService_insurer_claim_path(claim)\n end\n\n end", "def service_with_id_exists?(app, id)\n app = getTableValue(app)\n id = getTableValue(id)\n json = CC.CLI.get_json(\"%{serviced} service list -v\")\n json.each do |service|\n return true if service[\"Name\"] == app && service[\"DeploymentID\"] == id\n end\n return false\n end", "def check_for_proposals\n if ProposalDetail.where(\"service_id = ?\", self.id).exists? \n errors.add(:base,\"You can't delete a service once it's been used in a proposal\")\n return false\n end\n end", "def services_available?(*services)\n api_status = self.api_status\n if api_status.is_a?(Hash)\n api_ok = true\n services.each do |service|\n if api_status['systems'].present? && api_status['systems'][service].present? && api_status['systems'][service]['ok']\n next\n else\n api_ok = false\n break\n end\n end\n api_ok\n else\n false\n end\n end", "def ensure_service!\n raise \"Must have active connection\" unless zone&.service\n end", "def exists?(service_name)\n open_service(service_name, SC_MANAGER_CONNECT, SERVICE_QUERY_STATUS) do |_|\n true\n end\n rescue Puppet::Util::Windows::Error => e\n return false if e.code == ERROR_SERVICE_DOES_NOT_EXIST\n raise e\n end", "def exists?\n prepare_environment\n load_template(@data['serverProfileTemplateUri'], 'new_profile')\n return @resource_type.find_by(@client, @data).any? if resource['ensure'].to_sym == :absent\n super([nil, :found, :get_available_targets, :get_available_networks, :get_available_servers, :get_compliance_preview,\n :get_messages, :get_profile_ports, :get_transformation, :absent])\n end", "def valid_service?\n raise NotImplementedError.new(\"#{self.class.name}#valid_service?\")\n end", "def validate_only_one_active_service?\n if Provider.is_service_present(self.provider_id,self.service_type)\n local_message = \"The provider is currently providing this service\"\n self.errors[:base] << local_message\n return false\n else\n return true\n end\n end", "def session_has_services_depend?\n\t\tbegin\n\t\t\treturn !!(session.sys.registry and session.railgun)\n\t\trescue NoMethodError\n\t\t\treturn false\n\t\tend\n\tend", "def exists_bulk_method(states = [nil, :found])\n prepare_environment\n @item = @resource_type.new(@client, @data)\n return true if empty_data_check(states)\n @property_hash[:ensure] == :present\nend", "def version_has_service(version, service)\n version = version.to_sym\n service = service.to_sym\n (!service_config[version].nil? and\n service_config[version].include?(service))\n end", "def account_has_no_service?\n account = Account.find(current_user)\n account.no_services?\n end", "def retirement_potential?\n retirement_jt_exists = resource_actions.where(:action => 'Retirement').where.not(:configuration_template_id => nil).present?\n retirement_jt_exists && services.where(:retired => false).exists?\n end", "def hcp_services?\n !hcp_proc_codes.empty?\n end", "def windows_service_exists?(service)\n if defined?(Win32)\n ::Win32::Service.exists?(service)\n else\n false\n end\n end", "def ensure_dependencies\n\t\tunless !self.date_of_booking.blank?\n\t\t\tself.errors[:date_of_booking] << \"=> Date of booking can't be empty\"\n\t\t\treturn false\n\t\tend\n\t\tunless ( self.company.resources.find_by_id(self.resource_id) )\n\t\t\tself.errors[:resource_not_present] << \"=> Requested resource is not available.\"\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend", "def service_is_registered?(service_hash)\n system_registry_client.service_is_registered?(service_hash)\n end", "def require_service_role!\n unless current_user.try(:service?)\n raise ::Access::NotAuthorized\n end\n end", "def service_entry?\n @service_entry == true\n end", "def resource_exists?\n reload!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end", "def account_has_service?(service)\n account = Account.find(current_user)\n account.service?(service)\n end", "def check_service_and_buildings_present\n errors.add(:base, :services_incomplete) unless services_status == :completed\n errors.add(:base, :buildings_incomplete) unless buildings_status == :completed\n end", "def running?\n result = true\n SERVICES.each do |_, check|\n result &&= check.call\n end\n result\n end", "def sanity_check\n if resource_exists?(\"nodes/#{node_name}\")\n ui.confirm(\"Node #{node_name} exists, overwrite it\")\n rest.delete(\"nodes/#{node_name}\")\n end\n if resource_exists?(\"clients/#{node_name}\")\n ui.confirm(\"Client #{node_name} exists, overwrite it\")\n rest.delete(\"clients/#{node_name}\")\n end\n end", "def email_required?\n self.services.empty?\n end", "def complete_service?\n unless supports_incomplete_services?\n raise Puppet::Error, _(\"Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine.\") % { service: @resource[:name], release: Puppet.runtime[:facter].value(:operatingsystemrelease) }\n end\n\n return @complete_service if @complete_service\n\n # We need to use the service's FMRI when querying its config. because\n # general/complete is an instance-specific property.\n fmri = service_fmri\n\n # Check if the general/complete property is defined. If it is undefined,\n # then svccfg will not print anything to the console.\n property_defn = svccfg(\"-s\", fmri, \"listprop\", \"general/complete\").chomp\n @complete_service = ! property_defn.empty?\n end", "def no_services?\n # taxes is a array which contains services if allocated by back-office\n taxes.empty?\n end", "def exists?\n Puppet.debug \"using provider action_record\"\n Puppet.debug \"starting exists? #{self.class.to_s}\"\n Puppet.debug \"check name => #{get_fqdn}\"\n Puppet.debug \"check type => #{get_type}\"\n dns_service = get_dns_service(get_fqdn)\n return false if dns_service == nil\n return dns_service.record_exist?(get_fqdn, get_type)\n end", "def exists?\n if resource[:force] == true\n false\n else\n package = client(resource).package(resource[:group], resource[:name], resource[:version])\n package.is_installed.data\n end\n end", "def find(service_name)\n return @services if service_name == :all\n \n service = @services[service_name]\n return service unless service.nil? \n \n ContainerLogger.warn \"Unexisting service called: #{@name}::#{service_name}\", 1\n nil\n end", "def service_is_nuniverse?(params = {})\n\t\tif params[:service]\n\t\t\t@user = User.find(:first, :conditions => ['login = ?', params[:service]] )\n\t\tend\n\t\treturn false if [email protected]? && @user.role == \"service\"\n\t\treturn true\n\tend", "def bad_service?\n\t\tService.find_by(name: self.service_name).traffic != \"GOOD SERVICE\"\n\tend", "def bad_service?\n\t\tService.find_by(name: self.service_name).traffic != \"GOOD SERVICE\"\n\tend", "def has_dependencies?\n update_for.length > 0 or requires.length > 0\n end", "def exist?\n @resource.exist?\n end", "def create_or_update_service_info(opts = {})\n component_defs_exist = Info::Component.component_defs_exist?(self.parsed_common_module)\n Info::Service.new(self, opts.merge(component_defs_exist: component_defs_exist)).create_or_update_from_parsed_common_module?\n end", "def check!\n Capistrano::Deploy::Dependencies.new(configuration) do |d|\n d.remote.file(Capistrano::Puppet::Service::Webrick::SERVICE_INIT).or(\"`#{Capistrano::Puppet::Service::Webrick::SERVICE_INIT}' does not exist. Please run `cap deploy:setup'.\")\n end\n end", "def exist?\n request(:get)\n true\n rescue Stretcher::RequestError::NotFound\n false\n end", "def service_running?\n _status == ACTS_AS_SERVICE_RUNNING || _status == ACTS_AS_SERVICE_OTHER_RUNNING\n end", "def add_service\n service = Service.find(service_params[:id])\n if service.nil? || service.versions.empty?\n msg = \"No versions of #{service.name} available\"\n Rails.logger.error msg\n link = \"Please add versions to #{view_context.link_to(service.name, service_path(service))}\"\n redirect_to edit_deployment_url(@deployment), flash: { error: \"#{msg}, #{link}\" }\n else\n version = service.versions.first\n @deployment.versions << version\n @deployment.save\n redirect_to edit_deployment_url(@deployment)\n end\n end", "def update_required?\n any?(&:update_required?)\n end", "def known_service? url\n !!service_endpoint(url)\n end", "def exists?\n context.count > 0\n end", "def one_service?(filter, *required_credentials)\n select(&service?(filter))\n .select(&credentials?(required_credentials))\n .one?\n end", "def check_dependencies\n !RouteStop.exists?(:vehicle_stop_id => id)\n end", "def has_resources?\n return resources.count > 0\n end", "def verify_operation_exists!(service_name, port_name, operation_name)\n operations = operations(service_name, port_name)\n\n unless operations.include? operation_name\n raise ArgumentError, \"Unknown operation #{operation_name.inspect} for \" \\\n \"service #{service_name.inspect} and port #{port_name.inspect}.\\n\" \\\n \"You may want to try one of #{operations.inspect}.\"\n end\n end", "def exists?\n Puppet.debug(self.class.to_s.split('::').last + ': Calling exists method : ')\n @property_hash[:ensure] == :present\n end", "def isEndpointPresent?\n endpoint = Endpoint.find_by_id(params[:id])\n if endpoint.nil?\n render json: { errors:[\n {\n \"code\": \"not_found\",\n \"detail\": \"Requested Endpoint with ID `#{params[:id]}` does not exist\"\n }\n ]\n } , status: :not_found\n end\n end", "def check_models_presence\n return unless depricated_page?\n return unless signed_in? && !current_user\n\n create_user_if_absent\n create_reader_set_if_absent\n create_mailer_set_if_absent\n end", "def manages_kubernetes_service?\n return true unless kubernetes_service&.active?\n\n kubernetes_service.api_url == api_url\n end", "def check_if_deployment_exists\n @api.account_id = @options[:src]\n @old_deployment = @api.deployments(:id => @options[:deployment], :view => \"inputs_2_0\").show\n\n @api.account_id = @options[:dst]\n if @api.deployments.index(:filter => [\"name==#{@old_deployment.name}\"]).length != 0\n $stderr.puts \"ERROR: Deployment with name \\\"#{@old_deployment.name}\\\" already exists in account #{@options[:dst]}\\n\"\n exit 1\n end\nend", "def allow_service_check_state\n super\n end", "def supports_incomplete_services?\n Puppet::Util::Package.versioncmp(Puppet.runtime[:facter].value(:operatingsystemrelease), '11.1') >= 0\n end", "def check_services(first_file)\n if first_file.start_with?('service:')\n service = first_file.sub(/service:/, '')\n SERVICES.each do |k,v|\n if k == service\n @files = v\n end\n end\n end\n end", "def exists?\n @property_hash and [:running, :pending].include?(@property_hash[:ensure])\n end", "def config_service?\n true\n end", "def test_missing_service_group_ignored\n # Not raise\n service_list = @service_store.determine_services %w{non_existing_group}\n end", "def exists?\n self.ensure == :present\n end", "def check_host_existence\n if (Host.all.count == 0)\n flash[:error] = t(\"services.error.hosts_not_exist\")\n redirect_to :back\n end\n \n return\n end", "def exists? force: false\n return resource_exists? if force\n # If we have a value, return it\n return @exists unless @exists.nil?\n # Always true if we have a gapi_json object\n return true if resource?\n resource_exists?\n end", "def exists?\n begin\n url_for(:resources_resource, credentials, id).head\n true\n rescue RestClient::Forbidden\n true\n rescue RestClient::ResourceNotFound\n false\n end\n end", "def minting_service_defined?\n Rails.configuration.x.madmp.enable_dmp_id_registration && minter.present? &&\n minter.api_base_url.present?\n end", "def collection_handle_exists?(handle:)\n variables = FastLand::Shopify::Variables.collection_by_handle(handle: handle)\n collection = ShopifyAPIRetry.retry(2) { get_collection_by_handle(variables: variables, with_products: false) }\n collection.present?\n end", "def exists?\n @actionable_vibs = [] # List of VIBs which are either a) fully qualified paths for VIBs to install,\n # OR b) VIB package name to remove\n @mounted_nfs_shares = {} # Map of NFS shares that are mounted on the ESX\n # key: \"nfs_hostname:/share\" representing NFS mounted share\n # value: Hash\n # :volume_name corresponding volume name\n # :new_mount boolean indicating if it was mounted by us\n @processed_vibs = {} # Map {id => true} of all installed, or to-be installed VIBs on the ESX host\n\n fetch_mounted_nfs_shares\n\n fetch_installed_vibs\n\n vibs = resource[:vibs].is_a?(Array) ? resource[:vibs] : [resource[:vibs]]\n Puppet.debug(\"VIBs to query : #{vibs}...\")\n\n # The type validation already validates proper format of fields for either install or uninstall\n # To determine the install mode, we simply need to do check if first element hash or not\n is_install = vibs.first.is_a?(Hash)\n\n vibs.each do |vib_data|\n unless is_install\n # For uninstall, add the VIB name to the actionable_vibs list\n @actionable_vibs.push(vib_data)\n else\n prepare_vib_for_install(vib_data)\n end\n end\n\n # For install mode: if there are any actionable VIBs, return false to invoke \"create\"\n # For uninstall mode: if there are any actionable VIBs, return true to invoke \"destroy\"\n is_install ? @actionable_vibs.length == 0 : @actionable_vibs.length > 0\n end", "def exists?\n if performed?\n total != 0\n else\n limit(0).terminate_after(1).total != 0\n end\n end", "def any_enterprise_exists?\n return @enterprises unless @enterprises.nil?\n enterprises = ctl_command([\"list\", \"enterprises\"])\n @enterprises = (enterprises.chomp.length > 0)\n rescue Setup::Exceptions::EnterpriseCtlCommandFailed\n # Most likely to occur if the server is not yet configured or is shut down\n # Future iterations will add more granularity so that we can report\n # meaningful next steps (complete setup first, start services, etc)\n false\n end", "def exists?\n @provider.get(:ensure) != :absent\n end", "def exist?(key)\n [primary, *secondaries].any? { |svc| svc.exist?(key) }\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def valid_delivery_service?\n self.delivery_service ? self.available_delivery_services.include?(self.delivery_service) : !self.delivery_required?\n end", "def wait_for_monit_service_to_exist(service_name)\n require 'waitutil'\n WaitUtil.wait_for_condition(\n \"#{service_name} to show up in the output of 'monit status'\",\n delay_sec: 1,\n timeout_sec: 120\n ) do\n p = shell_out(\"#{node['monit']['executable']} status\")\n stdout_stderr_combined = \"stdout:\\n#{p.stdout}\\nstderr:#{p.stderr}\"\n if p.stderr.include?('Status not available -- the monit daemon is not running')\n # Monit might have crashed on the \"monit reload\" command. Restart it as a temporary\n # workaround.\n ensure_monit_daemon_is_running\n [false, stdout_stderr_combined]\n else\n if p.exitstatus != 0\n Chef::Log.fatal(\"Command '#{p.command}' failed\\n\" +\n \"stdout:\\n#{p.stdout}\\nstderr:\\n#{p.stderr}\")\n fail\n end\n [p.stdout.split(\"\\n\").include?(\"Process '#{service_name}'\"),\n stdout_stderr_combined]\n end\n end\n end", "def is_dependency_installed?\n if self.dependable\n $db.services.each do |service|\n if service[:service_type] == self.type\n return true\n end\n end\n end\n false\n end", "def include?(key)\n @services.key?(key)\n end", "def is_valid_service\n if (self.status == \"active\" and (self.is_schedulelater == true or (self.is_schedulelater == false and self.end_date >= Date.today)))\n return true\n else\n return false\n end\n end", "def found?\n request.put? || request.post? || @current.exist?\n end" ]
[ "0.7057028", "0.6763985", "0.6672849", "0.6668222", "0.655131", "0.6508932", "0.6483152", "0.6483152", "0.6400949", "0.638322", "0.638322", "0.6380864", "0.6376785", "0.6376785", "0.6376785", "0.6376785", "0.6279583", "0.6257389", "0.6219823", "0.6202116", "0.61907536", "0.6162602", "0.61559075", "0.6098402", "0.60572445", "0.60501057", "0.6012367", "0.5988271", "0.5964581", "0.59564996", "0.5949117", "0.5937393", "0.59359765", "0.59231734", "0.5886776", "0.58660966", "0.58659923", "0.58255917", "0.5789853", "0.5786693", "0.57714915", "0.5769665", "0.57517296", "0.57369775", "0.57305175", "0.572545", "0.56844014", "0.56820285", "0.56658006", "0.56320053", "0.56152934", "0.5604666", "0.55994403", "0.55994403", "0.5589703", "0.5559635", "0.5557553", "0.55571395", "0.5548836", "0.55404395", "0.55286384", "0.55266106", "0.5521945", "0.5501466", "0.5491625", "0.54911757", "0.5488552", "0.54852027", "0.5476007", "0.5465117", "0.54548603", "0.54544795", "0.5453829", "0.5451019", "0.5448985", "0.5441887", "0.54417396", "0.5435459", "0.5431716", "0.5428708", "0.54233783", "0.5417151", "0.54166484", "0.5409583", "0.5393083", "0.5381412", "0.53760123", "0.53720295", "0.537146", "0.5359666", "0.53502244", "0.53502244", "0.53502244", "0.53502244", "0.53388864", "0.5331483", "0.5329363", "0.53284854", "0.53268635", "0.5322806" ]
0.72131056
0
Strong parameters method to prevent from massive assignment in the _Alert_ model. [Returns] The filtered version of params[:alert].
def alert_params params.require(:alert).permit(:name, :description, :active, :service_id, :condition, :limit, :condition_target, :error_control, :host_ids => []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alert_params\n params.require(:alert).permit(\n :search_id, :active, :description, :last_run, :last_status_change, :name, :status,\n :threshold_count, :threshold_operator, :threshold_time_seconds, :logs_in_email,\n :history\n )\n end", "def alert_params\n params.require(:alert).permit(:resolved, :priority)\n end", "def alert_params\n {\n description: description&.truncate(::AlertManagement::Alert::DESCRIPTION_MAX_LENGTH),\n ended_at: ends_at,\n environment: environment,\n fingerprint: gitlab_fingerprint,\n hosts: truncate_hosts(Array(hosts).flatten),\n monitoring_tool: monitoring_tool&.truncate(::AlertManagement::Alert::TOOL_MAX_LENGTH),\n payload: payload,\n project_id: project.id,\n prometheus_alert: gitlab_alert,\n service: service&.truncate(::AlertManagement::Alert::SERVICE_MAX_LENGTH),\n severity: severity,\n started_at: starts_at,\n title: title&.truncate(::AlertManagement::Alert::TITLE_MAX_LENGTH)\n }.transform_values(&:presence).compact\n end", "def alert_params\n params.require(:alert).permit(:title, :message, :begins, :ends)\n end", "def alert_params\n params.fetch(:alert_alert, {}).permit(:id, :apiotics_instance, :led_attributes => [\"led_state\", \"id\"], :button_attributes => [\"safe\", \"id\"])\n end", "def alert_params\n params.require(:alert).permit(:the_type, :description, :time, :merchant, :amount)\n end", "def alert_params\n params.require(:alert).permit(:start, :end, :last_sent, :sms, :email, :user_id, :line_id, :service_name, :recipient_id)\n end", "def alert_params\n params.permit(:alert_type,:value,:status)\n end", "def alert_params\n params.require(:alert).permit(:user_id, :content)\n end", "def admin_monitor_alert_params\n admin_monitor_alert = params[:admin_monitor_alert]\n raise \"Params missing error\" if admin_monitor_alert.blank?\n \n if params[:action].eql?('update') && !admin_monitor_alert[:backtrace].blank?\n admin_monitor_alert[:backtrace] = admin_monitor_alert[:backtrace].split(\"\\r\\n\")\n elsif admin_monitor_alert[:backtrace].blank?\n admin_monitor_alert[:backtrace] = []\n end \n \n {:user_id => admin_monitor_alert[:user_id] , :project_id => admin_monitor_alert[:project_id] , :issue_id => admin_monitor_alert[:issue_id] ,\n :alert_type => admin_monitor_alert[:alert_type] , :source => admin_monitor_alert[:source] , :action => admin_monitor_alert[:action] ,\n :message => admin_monitor_alert[:message] , :backtrace => admin_monitor_alert[:backtrace] ,\n :handle_flag => admin_monitor_alert[:handle_flag] ,:silent_flag => admin_monitor_alert[:silent_flag] }\n\n end", "def set_alert\n unless params[:alert].blank?\n # remove single/double quotes from name to avoid display error:\n params[:alert][:name] = params[:alert][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:alert][:name].blank?\n end\n @alert = current_user.alerts.find(params[:id])\n end", "def alert_params\n params.require(:alert).permit(:id, :name, :created_at, :updated_at, :date_requested, :last_seen, :last_known_address, :last_known_city, :last_known_state, :last_known_zip, :last_known_county, :site_of_incident, :nic, :agency_name, :agency_phone, :reporting_agency_phone, :reporting_agency_email, :investigating_officer_name, :investigating_officer_title, :investigating_officer_phone,\n victims_attributes: [:id, :last_name, :first_name, :birth_date, :gender, :hair_color, :height_ft, :height_inch, :weight, :eye_color, :race, :type, :age, :age_unit, :additional_info, :alert_id, :_destroy],\n suspects_attributes: [:id, :last_name, :first_name, :birth_date, :gender, :hair_color, :height_ft, :height_inch, :weight, :eye_color, :race, :type, :age, :age_unit, :additional_info, :alert_id, :_destroy],\n vehicles_attributes: [:id, :make, :model, :style, :year, :color, :license_plate_number, :license_plate_state, :additional_info, :alert_id, :_destroy])\n end", "def alert_params\n params.require(:alert).permit(:city_name, :alert_time, :title)\n end", "def alert_params\n params.require(:alert).permit(:alert_type, :latitude, :longitude,:email, :harrasment_type)\n end", "def filter_params(params)\n AsanaExceptionNotifier::UnsafeFilter.new(params, @options.fetch(:unsafe_options, [])).arguments\n end", "def sms_alert_params\n params.require(:sms_alert).permit(:alertType, :frequency, :account_id, :next_alert, :trigger_criteria, :trigger_amount)\n end", "def email_alert_params\n params.require(:email_alert).permit(:subject, :machine_group, :machine_name, :all_params)\n end", "def jobalert_params\n params.require('message')\n end", "def security_alert_params\n params.require(:security_alert).permit(:ruby_gem_id, :ruby_application_id, :desc, :version_fix, :status, :comment)\n end", "def anonymous_filter_params\n p = params.required('payload')\n # p.permit!('controls_params')\n # p.permit!('columns_params')\n # p.permit!('sorting')\n # p.permit!('global_config')\n p.permit(\n 'name',\n 'controls_list' => [],\n 'controls_hl_mode' => [],\n 'controls_params' => {},\n 'columns_list' => [],\n 'columns_params' => {},\n 'sorting' => {},\n 'global_config' => {}\n ).merge(permit_hashes(p, [\n 'controls_params',\n 'columns_params',\n 'sorting',\n 'global_config'\n ]))\n end", "def sleep_alert_params\n params.require(:sleep_alert).permit(:user_id, :bed_time, :wake_time)\n end", "def update alert_params \n\n # Update the normal attributes\n self.update_attributes(alert_params)\n\n # Pop out the translation attributes before you attempt to run update_attributes\n if alert_params[\"translations\"]\n alert_params[\"translations\"].each do |key, value|\n self.set_translation(key.to_s.split('_').first, key.to_s.split('_').last, value)\n end\n end\n\n # Deal with setting up alerts for specific users.\n warnings = self.handle_specific_users\n unless warnings.nil?\n warnings = \"No users found with the following emails #{warnings}\"\n end \n return warnings\n\n end", "def alert_params\n params.require(:alert).permit(:department,:course_number)\n end", "def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end", "def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end", "def notice_params\n params.fetch(:notice, {})\n end", "def alert_params\n params.permit(:name, :time_from, :time_to, :description, :user_id, :latitude, :longitude, :region_id, :author,\n pictures_attributes: [:id, :source, :picturable_id, :picturable_type, :_destroy, :main],\n addresses_attributes: [:id, :city, :addressable_id, :addressable_type, :_destroy])\n end", "def params_with_flash\n params.merge(flash.\n select { |k, v| k.ends_with?('_id') && !params.has_key?(k) })\n end", "def set_alert\n @alert = @current_event.alerts.find(params[:id])\n authorize(@alert)\n end", "def set_alert\n @alert = alert.find(params[:id])\n end", "def price_alert_params\n params.require(:price_alert).permit(:name, :type, :symbol, :current_price, :cap_price, :floor_price, :expected_alert_till_date, :mobile_number, :phone_alert, :message_alert)\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def set_alert\n @alert = Alert.find(params[:id])\n end", "def filter_params\n params[:f] || {}\n end", "def set_alert\n@alert = Alert.find(params[:id])\nend", "def filtering_params\n params.permit(:email)\n end", "def filter_params\n @filter_params_cache ||= clean_hash(params[:filter]).with_indifferent_access\n end", "def alerts\n #checking to see if params hash in flash msg has a value\n alert = (flash[:alert] || flash[:error] || flash[:notice])\n\n if alert\n alert_generator alert\n end\n end", "def set_alert\n @alert = ::Alert::Alert.find(params[:id])\n end", "def sanitized_params\n document = resource_params[:document]\n\n if document.present?\n document = document.gsub(/\\D/,'')\n old_params = resource_params\n resource_params = ActionController::Parameters.new(document: document, email: old_params[:email])\n #resource.document = document if resource\n end\n end", "def weather_station_alert_params\n params.require(:weather_station_alert).permit(:latitude, :longitude, :alert_for, :level)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def filter\n # #YELLOW\n if @event['check']['alert'] == false # rubocop:disable GuardClause\n puts 'alert disabled -- filtered event ' + [@event['client']['name'], @event['check']['name']].join(' : ')\n exit 0\n end\n end", "def filtered_params\n params.permit(:to_email, :from_email, :body, :subject, :provider)\n end", "def recurring_alert_params\n params.require(:recurring_alert).permit(:alert_interval, :start_date, :name, :alert_category, :contact_name, :number_of_alerts)\n end", "def filtering_params(params)\n params.slice(:id, :email, :password, :admin)\n end", "def parse_filter_params(permitted:)\n # Symbolize the keys so the values can be used with keyword arguments in the filter scopes.\n filter_params = params[:filter].try(:permit, permitted).try(:to_h)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to [:admins, @current_event, @alert], notice: t(\"alerts.updated\") }\n format.json { render json: @alert, status: :ok, location: [:admins, @current_event, @alert] }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: \"Alert was successfully updated.\" }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render :show, status: :ok, location: @alert }\n else\n format.html { render :edit }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def notice_params\n params.require(:notice).permit(:title, :to, :from, :auther, :greet, :content)\n end", "def infection_alert_params\n params.require(:infection_alert).permit(:infected_user_id, :reporter_user_id)\n end", "def emergency_params(action = :update)\n permitted = [:fire_severity, :police_severity, :medical_severity]\n permitted << :resolved_at if action == :update\n permitted << :code if action == :create\n params.require(:emergency).permit(permitted)\n end", "def filter_params( *allowed )\n\n # grab params\n filtered = params.permit( allowed ).to_h.symbolize_keys.select{ |k,v| v.match( FILTERS[ BASE_PARAMS[ k ]]) }\n\n # do any necessary parsing\n filtered.update( filtered ) do |k,v|\n\n v = Date.parse( v ).at_midnight.utc if BASE_PARAMS[ k ] == :date\n\n v\n\n end\n\n end", "def report_params\n # fields = Topic::Field.joins(:topic).where(:sensit_topics => {:slug => params[:topic_id]}).map(&:key)\n params.require(:report).permit(:name).tap do |whitelisted|\n whitelisted[:query] = params[:report][:query] if params[:report].has_key?(:query)\n end\n end", "def activity_notice_params\n params[:activity_notice]\n end", "def filtered_parameters; end", "def throwable_params\n params[:throwable]\n end", "def clean_params(params)\n params.slice()\n end", "def audit_params\n params.require(:audit).permit(:user_id, :project_id, :document_id, :annotation_id, :relation_id, :message)\n end", "def alert=(alert)\n @alert = alert\n end", "def update\n respond_to do |format|\n if @alert.update(alert_params)\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @alert }\n else\n format.html { render action: 'edit' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n parameters = alert_params\n parameters[:service] = Service.where(:_id => parameters[:service_id]).first\n parameters[:hosts] = Host.where(:_id.in => parameters[:host_ids]).to_a if (!parameters[:host_ids].blank?)\n\n # Delete string'd id's\n parameters.delete(:service_id)\n parameters.delete(:host_ids)\n\n # Apply the params received\n @alert = Alert.new(parameters)\n\n respond_to do|format|\n format.html{\n # Can be saved?\n if (@alert.save)\n flash[:notice] = t(\"alerts.notice.created\", :name => @alert.name)\n redirect_to alert_path(@alert)\n else\n # If an error raises, show the form again.\n render :action => :new\n end\n return\n }\n end\n end", "def trim_params(params)\n Hash[*(params.select { |k,v| new.attributes.keys.include? k.to_s}.flatten)] \n end", "def vk_params\n params.except(*RAILS_PARAMS)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def filter_parameters; end", "def filter_parameters; end", "def notice_params\n params.require(:notice).permit(:title, :category_id, :text)\n end", "def alert\n self[:alert]\n end", "def update\n @alert = Alert.find(params[:id])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def notice_params\n params.require(:notice).permit(:title, :description, :public, :d_publish, :d_remove, :sort,:image)\n end", "def applicant_params\n if admin?\n params.require(:applicant).permit(:name, :email, :essay, :message_sent)\n else\n params.require(:applicant).permit(:essay)\n end\n end", "def filter_params\n @_filter_params ||=\n case params[:filter]\n when Hash, ActionController::Parameters\n default_filters.each_with_object({}) do |field, hash|\n unformatted_field = @request.unformat_key(field)\n hash[unformatted_field] = params[:filter][field]\n end\n end\n end", "def new_alert\n@alert = Alert.new(params[:id])\nend", "def filtering_params(params)\n params.slice(:shortlist, :client, :category, :updated_at, :costmodel, :state, :prio)\n end", "def filter_params\n params.permit(\n type: [],\n id: []\n ).to_h.symbolize_keys.merge!(project_id: sessions_current_project_id)\n end", "def audit_params\n params.require(:audit).permit(:user_id, :mod_action_id, :obj_id, :interactionDate)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def applicant_params\n params.fetch(:applicant, {})\n end", "def notification_params\n params[:notification].permit(:send_id, :recv_id, :action)\n end", "def filter_params\n\t\treturn params[:voter].permit(:name_for_filter, :election_id_for_filter)\n\tend", "def show\n @alert = Alert.find(params[:id])\n end", "def audit_params\n params.require(:audit).permit(:name, :reoccuring, :onsite, :notes, :audit_type_id, :interval, :period_start, :period_end)\n end", "def filter_model_params(model_module, params)\n params\n end", "def event_rule_params\n params.require(:event_rule)\n .permit(:position, :action, :severity, :valid_until, :description,\n filter: EventRule::FILTER_ATTRIBUTES)\n end", "def sanitize_params\n begin\n return params = params.slice(:search) if params[:search]\n return params = params.slice(:search_location) if params[:search_location]\n rescue NoMethodError\n return params\n end\n end", "def parameters_to_filter\n @parameters_to_filter ||= []\n end", "def rescue_action_area_rescuer_params\n params.fetch(:rescue_action_area_rescuer, {})\n end", "def inspection_filter_params\n params.require(:inspection_filter).permit(\n :scope, :definition, :description, :enable\n )\n end" ]
[ "0.7241244", "0.7027012", "0.7007138", "0.6972872", "0.6972617", "0.66816443", "0.66768223", "0.6660256", "0.66550475", "0.6582182", "0.6510155", "0.6508593", "0.64569014", "0.64548236", "0.6332735", "0.62669295", "0.62542444", "0.6226492", "0.620233", "0.5973892", "0.59392786", "0.58974475", "0.58925307", "0.58226967", "0.58226967", "0.5814668", "0.5813597", "0.5757604", "0.5745306", "0.5734285", "0.5719724", "0.5694639", "0.5694639", "0.5694639", "0.5694639", "0.5694639", "0.5694639", "0.5694639", "0.5694639", "0.5694639", "0.5694639", "0.5679636", "0.5671063", "0.5601977", "0.5577794", "0.5558028", "0.5557895", "0.55567026", "0.555505", "0.5543893", "0.55262953", "0.5513625", "0.5505679", "0.549402", "0.54852813", "0.5472812", "0.5471115", "0.5465014", "0.54568595", "0.5449431", "0.54391", "0.5437762", "0.54296637", "0.54189163", "0.5415916", "0.54049355", "0.5400507", "0.53923464", "0.5377149", "0.53763634", "0.5348699", "0.5348561", "0.5339968", "0.5327742", "0.53243774", "0.5313252", "0.5289438", "0.5289438", "0.52825093", "0.5275427", "0.5273433", "0.5231969", "0.52315557", "0.52266735", "0.5225788", "0.52210724", "0.52190346", "0.5218986", "0.5215778", "0.5205872", "0.52008015", "0.5199512", "0.51981807", "0.519804", "0.51888686", "0.51748633", "0.5165005", "0.51638585", "0.5154921", "0.515298" ]
0.7070925
1
every consonant character is doubled. Vowels (a,e,i,o,u), digits, punctuation, and whitespace should not be doubled.
def double_consonants(str) result = "" str.chars.each do |ch| result << if ch.downcase.match?(/[a-z&&[^aeiou]]/) ch * 2 else ch end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_consonants(str)\n str.chars.each_with_object('') do |c, double_str|\n if c =~ /[^(aeiouAEIOU)|\\W|\\d]/\n double_str << c * 2\n else\n double_str << c\n end\n end\nend", "def double_consonants(str)\n str.chars.each_with_object('') do |char, new_str|\n if char =~ /[^aeiou]/ && char =~ /[A-z]/\n new_str << char * 2\n else\n new_str << char\n end\n end\nend", "def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend", "def double_consonants(str)\n results = \"\"\n str.each_char do |char| \n if char.downcase =~ /[a-z&&[^aeiou]]/\n results << char * 2 \n else\n results << char\n end\n end\n results\nend", "def double_consonants(string)\n output = \"\"\n single_chars = string.chars\n single_chars.each do |char|\n if char.match(/[[a-z]&&[^aeiou]]/i)\n output << char * 2\n else\n output << char \n end\n end\n output\nend", "def double_consonants(str)\n new_str = ''\n str.each_char do |char|\n if char =~ /[-!aeiou0-9' ']/i\n new_str << char\n else\n new_str << char.concat(char)\n end\n end\n new_str\nend", "def double_consonants(string)\n new_string = ''\n string.each_char do |char|\n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n new_string << char << char\n else\n new_string << char\n end\n end\n new_string\nend", "def double_consonants(string)\n doubled_string = ''\n string.each_char do |char|\n char.match(/[a-z&&[^aeiou]]/i) ? doubled_string << char << char : doubled_string << char\n end\n doubled_string\nend", "def double_consonants(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char\n doubled_string << char if consonant?(char.downcase)\n end\n\n doubled_string\nend", "def double_consonants(str)\n\n new_string = []\n\n str.chars.each do |char|\n if ('aeiouAEIOU').include?(char) == false\n new_string << char*2 \n else \n new_string << char\n end\n end\n\n new_string.join\nend", "def double_consonants(string)\n result = ''\n string.chars.each do |char|\n result += char\n result += char if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n end\n result\nend", "def double_consonants(string)\n doubled_chars = string.chars.map do |char|\n if char =~ /[A-Za-z]/ && !VOWELS.include?(char)\n char + char\n else\n char\n end\n end\n doubled_chars.join\nend", "def double_consonants(str)\n repeater_chars = str.chars.map do |char| \n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n char * 2\n else\n char\n end\n end\n repeater_chars.join\nend", "def double_consonants(string)\n string.chars.inject('') do |str, char|\n char.downcase.count(\"a-z\", \"^aeiou\") > 0 ? str + char * 2 : str + char\n end\nend", "def double_consonants(string)\n double_con_string = []\n string.chars.each do |char|\n if char.match?(/[aeiouAEIOU]/)\n double_con_string << char\n elsif char.match?(/[a-zA-Z]/)\n double_con_string << char << char\n else\n double_con_string << char\n end\n end\n double_con_string.join\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |letter|\n (letter =~ /[b-df-hj-np-tv-z]/i) == 0 ? result_string << letter << letter : result_string << letter\n end\n result_string\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |char|\n if char =~ /[a-z&&[^aeiou]]/i\n result_string << char << char\n else\n result_string << char\n end\n end\n result_string\nend", "def double_consonants(string)\n chars_array = string.chars.map do |x|\n if x =~ /[^AEIOUaeiou0-9\\W]/\n x*2\n else\n x\n end\n end\n \n chars_array.join\nend", "def double_consonants(str)\n str.gsub(/([a-z&&[^aeiou]])/i,'\\1\\1')\nend", "def double_consonants(string)\n final = string.chars.map do |el|\n if %w[a e i o u].include?(el)\n el\n elsif ('a'..'z').include?(el.downcase)\n el * 2\n else\n el\n end\n end\n final.join\nend", "def double_consonants(string)\n result = []\n string.each_char do |char|\n result << char_value(char)\n end\n p result.join\nend", "def double_consonants(str)\n str.split(//).map { |chr| chr.match?(/[^aeiou\\d\\W]/i) ? chr + chr : chr }.join\nend", "def double_consonants(string)\n string.chars.map { |chr| chr.match(/[bcdfghj-np-tvwxyz]/i) ? chr * 2 : chr }.join\nend", "def double_consonants(string)\n results = []\n\n string.chars.each do |char|\n if char =~ /[\"AEIOUaeiou\"]/ || \n char =~ /\\W/ ||\n char =~ /\\d/\n results << char\n else\n results << char << char\n end\n end\n\n results.join\nend", "def double_consonants(string)\n string.gsub(/([b-df-hj-np-tv-z])/i, '\\1\\1')\nend", "def double_consonants(str)\n str.gsub(/([bcdfghjklmnpqrstvwxyz])/i, '\\1\\1')\nend", "def double_consonants(string)\n consonants = %(bcdfghjklmnpqrstvwxyz)\n string.chars.map{ |char| consonants.include?(char.downcase)? char * 2 : char}.join\nend", "def double_consonants(string)\n result = string.split(//).map do |char|\n char =~ /[b-df-hj-np-tv-z]/i ? char * 2 : char\n end\n result.join\nend", "def consonants # :nodoc:\n /^(y|[bcdfghjklmnprstvwxz]+|qu)/\n end", "def isConsonant letter\n\tvowels = ['a', 'e', 'i', 'o', 'u']\n\treturn !(vowels.include?(letter))\nend", "def translate_two_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def vowel_consonant_adv(str)\r\n \t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n \t\tstr = str.split('')\r\n \t\tstr_new = str.map do |letter|\r\n if vowels.include?(letter)\r\n \tvowels.rotate(1)[vowels.index(letter)]\r\n else\r\n \tletter.next\r\n end\r\n \tend\r\n \t\tstr_new.join\r\n\tend", "def double_char(str)\n str.chars.map{|e|e *2}.join\nend", "def translate_one_consonant( s )\n\n\t\t# store the letters in an array\n\t\tch_array = s.chars\n\n\t\t# then grab the first letter from the array\n\t\tfirst_letter = ch_array.shift\n\n\t\t# put that letter at the back with push and add 'ay'\n\t\tch_array << first_letter + \"ay\"\n\n\t\t# bring it back together\n\t\tch_array.join\n\n\tend", "def double_char(str)\n str.chars.map { |letter| letter * 2 }.join\nend", "def double_char(str)\n characters = []\n str.split(\"\").each do |x|\n characters << x*2\n end\n p characters.join\nend", "def double_characters(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char * 2\n end\n doubled_string\nend", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def consonant_changer(letter)\r\n\tif letter == \"z\"\r\n\t\tnew_letter = \"b\"\r\n\telsif letter == \" \"\r\n\t \tnew_letter = \" \"\r\n\telse\r\n\t\tconsonant_index = \"bcdfghjklmnpqrstvwxyz\".index(letter)\r\n \tnew_letter =\"bcdfghjklmnpqrstvwxyz\"[consonant_index.next]\r\n\tend\r\nend", "def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n str = str.downcase\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend", "def consonant_cancel(sentence)\n\tarry = sentence.split(\" \")\n \tfinal = []\n \tvowel = \"aeiou\"\n \tarry.each do |word|\n len = word.length\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n final << word[i..-1]\n break\n end\n end\n end\n return final.join(\" \")\nend", "def consonant_cancel(sentence)\n vowel = \"aeiou\"\n new_arr = []\n sentence.split(\" \").each do |word|\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n new_word = word[i..-1]\n new_arr << new_word\n break\n end\n end\n end\n new_arr.join(\" \")\nend", "def double_char(str)\n str = \"String\"\n arr = str.split('')\n arr.map do |letter|\n letter * 2\n end.join\n \nend", "def double_letters(word)\n str = word.squeeze\n str.size != word.size\nend", "def count_consonants(str)\n str.chars.map do |letter|\n if consonant? letter\n letter = 1\n else\n letter = 0\n end\n end.reduce(0, :+)\nend", "def count_consonants\n text.scan(/[bcdfghjklmnpqrstvwxyz]/).length\n end", "def consonant(letter)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\talphabet2 = alphabet.chars.rotate.join('')\n\teach_id = alphabet.index(letter.downcase)\n\tnext_consonant = alphabet2[each_id]\nend", "def consonant(letter)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\talphabet2 = alphabet.chars.rotate.join('')\n\teach_id = alphabet.index(letter.downcase)\n\tnext_consonant = alphabet2[each_id]\nend", "def consonant_advance(letter)\r\nconsonant = \"abcdefghijklmnopqrstuvwxyz\".delete(\"aeiou\")\r\n if letter == \"z\"\r\n letter = \"b\"\r\n else\r\n letter = consonant[consonant.index(letter) +1]\r\n end \r\nend", "def double_char(str)\n\tarr = str.split('')\n\tnew_arr = []\n\tarr.each do |i| \n\t\t2.times {new_arr.push(i)}\n\tend\n\tstr = new_arr.join()\n\treturn str;\nend", "def next_consonant(string)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t#set index of string \n\tindex = 0\n\t#set index of vowels\n\ti = 0\n\t#create an empty string\n\tconverted_string = \"\"\n\t#for each index of the string, checks if equal to corresponding consonant and if so goes to the next consonant by adding one to the index\n\twhile index < string.length\n\t\t#start with if string has \"z\", converts to \"b\"\n\t\tif string[index] == consonants[20]\n\t\t\tconverted_string += \"b\"\n\t\t#if the string has any consonant besides \"z\"\n\t\telsif string[index] == consonants[i]\n\t\t\tconverted_string += consonants[i+1]\n\t\t#if string has vowels doesnt change character\n\t\telse \n\t\t\tconverted_string += string[index]\n\t\tend\n\t\t#go to next index in string\n\t\tindex += 1\n\t\t#reset vowel index to zero\n\t\ti += 1\n\tend\n\tconverted_string\nend", "def consonant(letter)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n alphabet2 = alphabet.chars.rotate.join('')\n each_id = alphabet.index(letter.downcase)\n next_consonant = alphabet2[each_id]\n end", "def consonant_changer(name)\n consonant_string = \"bcdfghjklmnpqrstvwxyz\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"z\"\n character = \"b\"\n new_name << character\n elsif consonant_string.include? character\n character = consonant_string[consonant_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n p new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend", "def crunch(double_string)\n current_character = ''\n new_string = ''\n double_string.each_char do |character|\n if character != current_character\n new_string += character\n current_character = character\n end\n end\n new_string\nend", "def consonant_rep(array_of_char)\n array_of_char.map! do | char |\n consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\n if consonants.include? char\n consonant_index = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'b']\n i = consonant_index.index(char) + 1\n char = consonant_index[i] \n else char = char\n end\n end\n array_of_char\nend", "def consonant_converter(string)\r\n name_array = string\r\n consonant = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n counter = 0\r\n consonant_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of consonants, compares them with name, and changes consonants in name\r\n \twhile consonant_counter < consonant.length\r\n \t\tif name_array[counter] == consonant[consonant_counter]\r\n if name_array[counter] == 'z'\r\n \tname_array[counter] = 'b'\r\n break\r\n else\t\r\n \t\t name_array[counter] = consonant[consonant_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n consonant_counter += 1\r\n end\r\n counter += 1\r\n consonant_counter = 0\r\n end \r\n new_name = name_array.join('')\r\n new_name = new_name.split(' ')\r\n new_name.map! { |word| word.capitalize! }\r\n new_name = new_name.join(' ')\r\n return new_name\r\nend", "def vowel_censor(string)\n\n string.tr('aeiou', 'X')\nend", "def consonant_cancel(sentence)\n result = []\n arr = sentence.split(\" \")\n\n arr.each do |i|\n cancelled = []\n i.each_char.with_index do |ch, idx|\n if ch == 'a' || ch == \"e\" || ch == \"i\" || ch == \"o\" || ch == \"u\"\n cancelled << i[idx..-1]\n break\n end\n end\n result << cancelled.join\n end\n\n return result.join(\" \")\n\nend", "def translate_three_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# then grab the third letter from the array\n\t\t\t\tthird_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + third_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def next_consonant(char)\n char = char.downcase\n compare = \"bcdfghjklmnpqrstvwxyz\"\n\n # not a consonant, i.e., no instance of the variable\n if compare.count(char) == 0\n # puts \"Not a consonant\"\n return nil\n end\n\n consonant_index = compare.index(char)\n\n if consonant_index == compare.length - 1 # end edge case\n return 'b'\n else\n return compare[consonant_index + 1]\n end\nend", "def starts_with_consonant? s\n first = s[0,1].downcase\n vowels = ['a', 'e', 'i', 'o', 'u']\n \n if vowels.include?(first)\n return false\n end\n if first =~ /[[:alpha:]]/\n return true\n end\nend", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def consonant_swap (secret_name)\n\t\n\tsecret_name.map do |letters|\n\t\t\n\t\tif letters == \" \"\n\t\t\tletters\n\t\telsif letters == \"z\"\n\t\t\tletters.gsub!(/[z]/, \"a\")\n\t\telsif letters =~ /[aeiou]/\n\t\t\tletters\n\t\telse \n\t\t\tletters.next!\n\t\t\tif letters =~ /[aeiou]/\n\t\t\t\tletters.next!\n\t\t\tend\n\t\tend\n\n\tend\n\tsecret_name\nend", "def next_vowel_consonant(str) \r\n #create an array with only vowels or consonants\r\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\",\"a\"]\r\n\tconsonants = (\"a\"..\"z\").to_a\r\n consonants.reject! { |letter| vowels.include?(letter)}\r\n consonants << \"b\" #for looping back to b when z is the letter\r\n\t\r\n\t#convert input into an array of each letter\r\n\tname_array = str.split(\"\")\r\n\t\r\n\t#iterate through each letter\r\n\tname_array.each_with_index do |letter,index|\r\n\t \r\n\t #if it is a vowel, find and replace with next\r\n\t if vowels.include?(letter)\r\n\t vowel_index = vowels.index(letter) + 1\r\n\t str[index] = vowels[vowel_index]\r\n\t \r\n \t #if it is a consonant, find and replace with next\r\n\t elsif consonants.include?(letter)\r\n\t \tc_index = consonants.index(letter) + 1\r\n\t str[index] = consonants[c_index]\r\n\t end\r\n\tend\r\n\tstr\r\nend", "def starts_with_consonant? s\n s !~ /^[AEIOU]/i && s =~ /^\\w/i\nend", "def starts_with_consonant?(s)\n first_symbol = s[0]\n return false if first_symbol.nil?\n\n if %w(a e i o u A E I O U).include? first_symbol\n false # vowels\n elsif ('a'..'z').include? first_symbol.downcase\n true #consolants\n else\n false #nonletters\n end\nend", "def consonant?\n self != 'ㅇ' && kor.chosung?(self)\n end", "def next_consonant (last_first)\n last_first.map! do |word|\n word.gsub(/[zdhntbcfgjklmpqrsvwxy]/, 'z' => 'b', 'd' => 'f', 'h' => 'j', 'n' => 'p', 't' => 'v', 'b' => 'c', 'c' => 'd', 'f' => 'g', 'g' => 'h', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z')\n end\nend", "def asterisked(word)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n new_word = \"\"\n word.each_char do |c|\n if vowels.include?(c)\n new_word << \"*\"\n else\n new_word << c\n end\n end\n new_word\nend", "def max_consonant_value(s)\n s.scan(/[^aeiou]+/).map {|ss| ss.sum - (ss.size * 96)}.max\nend", "def vowel_censor(string)\n\n string.gsub(/[aeiou]/, 'X') \n p string \n \nend", "def const_adv(str)\n consonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n str = str.split('')\n str_new = str.map do |char|\n if consonants.include?(char)\n consonants.rotate(1)[consonants.index(char)]\n else\n char\n end\n end\n str_new.join\nend", "def disemvowel str\n\n\tstr.gsub(/[aeiou]/,'')\n\nend", "def vowel_censor(string)\n vowels=[\"a\",\"e\",\"i\",\"o\",\"u\"]\n new_string=\"\"\n string.each_char do |char|\n if vowels.include? char\n new_string << \"X\"\n else\n new_string << char\n end\n\n # while i<=string.length\n # if char==string[i]\n # new_string+=\"X\"\n # added = true\n # else\n # new_string+=char\n # end\n # i+=1\n # end\n end\n puts new_string\n return new_string\nend", "def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend", "def translateForOneWord(msg)\n aryChar = msg.split(\"\")\n if aryChar[0].match(/a|e|i|o|u/)\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && aryChar[1] == \"q\" && aryChar[2] == \"u\" # consonant + q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif aryChar[0] == \"q\" && aryChar[1] == \"u\" # q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) && (not aryChar[2].match(/a|e|i|o|u/)) # if 3 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) #if it starts with 2 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n\n elsif not aryChar[0].match(/a|e|i|o|u/)\n aryChar << aryChar[0]\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n end\n aryChar.join(\"\")\nend", "def max_consonant_value_x(s)\n s.split(/[aeiou]/).map {|ss| ss.sum - (ss.length * 96)}.max\nend", "def consonant_changer(name)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n name.map! do |chars|\n counter = 0\n while counter < consonant_guide.length\n if chars == consonant_guide[counter]\n chars = consonant_guide[counter += 1]\n counter += 1\n elsif chars == \"z\"\n chars = \"b\"\n counter += 1\n else\n chars\n counter += 1\n end\n end\n chars\n end\n name\n name.join('').capitalize!\nend", "def next_consonant(letter)\n\tc_alphabet = \"bcdfghjklmnpqrstvqwxyzb\"\n \tx = c_alphabet.index(letter)\n \tx += 1\n\t c_alphabet[x]\n\nend", "def next_consonant(letter)\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\ncurrent_index = consonant.index(letter)\nconsonant[current_index + 1]\n\tif letter == \"z\"\n\t\tprint \"b\"\n\telse letter == \" \"\n\t\tprint \" \"\n\tend\nend", "def letter_change(letter)\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"a\"]\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\",\"b\"]\n\n\tif vowels.include? letter\n\t\tvowels[vowels.index(letter)+1]\n\t\telsif consonants.include? letter\n\t\t\tconsonants[consonants.index(letter)+1]\n\t\telsif letter == \" \"\n\t\t\t\" \"\n\t\telse\n\tend\nend", "def double(string)\n result = []\n string.chars.each do |char|\n result << char * 2\n end\n result.join\nend", "def is_special?\n # Only consonants\n return true if self =~ /^[bcdfghjklmnpqrstvwxz]+$/i\n\n # Not a word\n return false if self =~ /[^\\s]\\s[^\\s]/;\n return false if self.length < 3;\n # Alphanumeric\n return true if self =~ /[0-9]/ && self =~ /[a-z]/i\n # All Caps\n return true if self =~ /[A-Z]{2,}/;\n # Caps Mix\n return true if self =~ /[a-z][A-Z]/;\n # All consonants\n return true if self =~ /^[a-z]$/i && self !~ /[aeiou]/i\n # Dashed word\n return true if self =~ /(^\\w-|-\\w$)/\n # To many consonants (very heuristic)\n if self =~ /([^aeiouy]{3,})/i && !CONSONANTS.include?($1.downcase)\n return true\n end\n\n return false\n end", "def vowel_obfuscate(word)\n word.tr('aeiou', '*')\n end", "def staggered_case(string)\n iterator = 0\n characters = string.chars.map do |char|\n iterator += 1 if char =~ /[a-zA-Z]/\n #if char =~ /[a-z]/i <--LS\n if iterator.odd?\n char.upcase\n elsif iterator.even?\n char.downcase\n else\n char\n end\n end\n characters.join\nend", "def next_consonant(name)\n name = name.downcase\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n i = 0\n consonants_changed = \"\"\n\n until i == name.length\n consonants_index = consonants.index(name[i])\n if consonants_index == nil\n consonants_changed += name[i]\n elsif consonants_index == 20\n consonants_changed += \"b\"\n else\n consonants_changed += consonants[consonants_index+1]\n end\n i = i + 1\n end\n return consonants_changed\n end", "def disemvowel(string)\n\nend", "def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n letter_match = /^[a-zA-Z]+/.match(word) #Match letters only\n other_chars = word[letter_match.to_s.length..-1]\n if const_match.to_s.length > 0\n return const_trans(letter_match.to_s, const_match) + other_chars\n else\n return vowel_trans(letter_match.to_s) + other_chars \n end\n \n end", "def starts_with_consonant?(s)\n\tif s.downcase =~ /\\A(?=[^aeiou])(?=[a-z])/i\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def starts_with_consonant? s\n\n s[0] =~ /[^aeiou\\W]/i\n \nend", "def double_letter_count(string)\r\n repeats = 0\r\n oldChar = ''\r\n string.each_char do |char|\r\n if oldChar == char\r\n repeats += 1\r\n end\r\n oldChar = char\r\n end\r\n return repeats\r\nend", "def starts_with_consonant? s\n return false if s == ''\n return false if !s[0].match(/^[[:alpha:]]$/)\n s[0] =~ /[AaEeIiOoUu]/ ? false : true\nend", "def starts_with_consonant? s\n cond1 = /[[:alpha:]]/ =~ s\n cond2 = /[^aeiouAEIOU]/ =~ s\n if cond1 != 0 \n return false\n else\n if cond2 == 0\n return true\n else\n return false\n end\n end\n return false\nend", "def starts_with_consonant? s\n # If empty, return false\n if s.size == 0\n return false\n end\n # Check if first character matches a consonant\n if s[0].match(/[[a-zA-Z]&&[^aeiouAEIOU]]/)\n return true\n else\n return false\n end\nend", "def starts_with_consonant?(s)\n !!(s =~ /\\A[^aeiou\\W].*/i)\nend", "def starts_with_consonant? s\n return false if s.empty?\n return true if s[0] =~ /[^\\Waeiou]/i\n return false\nend", "def starts_with_consonant? (s)\n start = false\n if ((s =~ /\\A(?=[^aeiou])(?=[a-z])/i) == 0)\n start = true\n end\n return start\nend", "def translate str\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(str[0])\n str + 'ay'\n elsif consonants.include?(str[0]) && consonants.include?(str[1])\n str[2..-1] + str[0..1] + 'ay'\n elsif consonants.include?(str[0])\n str[1..-1] + str[0] + 'ay'\n else\n str # return unchanged\n end\nend", "def starts_with_consonant? s\n s =~ /^[^aeiou\\W]/i\nend", "def translate word\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(word[0])\n word + 'ay'\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + 'ay'\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + 'ay'\n else\n word # return unchanged\n end\nend" ]
[ "0.78938305", "0.77814555", "0.7697116", "0.7647818", "0.7641288", "0.76198786", "0.74884564", "0.748378", "0.7477863", "0.7475337", "0.74550897", "0.7429336", "0.7425032", "0.74052304", "0.73873353", "0.73710424", "0.7307461", "0.72561395", "0.7253952", "0.724991", "0.7232624", "0.72265667", "0.72124666", "0.7196551", "0.71778417", "0.7096332", "0.7088826", "0.7025856", "0.6889664", "0.6711406", "0.655226", "0.64862996", "0.6477476", "0.64453423", "0.64338267", "0.6395494", "0.6360226", "0.63314164", "0.63159794", "0.6207661", "0.6167771", "0.6127071", "0.61125624", "0.610593", "0.6096455", "0.6084968", "0.60820997", "0.60820997", "0.60791326", "0.60429007", "0.602894", "0.6007199", "0.6002059", "0.5999197", "0.59942424", "0.59808075", "0.5967879", "0.59529537", "0.5927486", "0.5927419", "0.59120846", "0.5899438", "0.5896918", "0.5875344", "0.58642983", "0.5831691", "0.57761693", "0.57627934", "0.5728194", "0.5726897", "0.57227963", "0.57134956", "0.57059175", "0.5693427", "0.5693032", "0.5692123", "0.56912696", "0.5678785", "0.5677277", "0.5661381", "0.56480473", "0.56371", "0.5627496", "0.5612778", "0.5579179", "0.55745023", "0.5563927", "0.5563852", "0.55568147", "0.55560607", "0.55552447", "0.55499035", "0.55453146", "0.55350643", "0.5531504", "0.5531494", "0.5523559", "0.55185413", "0.55074215", "0.5498478" ]
0.76830995
3
GET /customers GET /customers.json
def index @customers = Customer.where(:warehouse_id=>current_user.parent_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def get_customers\n return ShopifyAPI::Customer.all\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customers\n ShopifyAPI::Customer.all\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def list\n @customers = Customer.all\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @customers }\n end\n end", "def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end", "def index\n @customers = Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def index\n if params[:search_term]\n customers = Customer.search_customer(params[:search_term])\n else\n if read_from_cache(\"customers\")\n customers = read_from_cache(\"customers\")\n else\n customers = apply_scopes(Customer).all\n write_to_cache(\"customers\", customers)\n end\n end\n\n if params[:page_no]\n result = pagy(customers)\n else\n result = customers\n end\n render :json => result\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end", "def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n return data\n end", "def show\r\n @customer = Customer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render :json => @customer }\r\n end\r\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: CustomersDatatable.new(view_context) }\n end\n @customers = Customer.all\n end", "def customers\n Easybill::Api::Customers\n end", "def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end", "def index\n respond_to do |format|\n format.html { @customers = Customer.all }\n format.json { @customers = Customer.order(:name) }\n end\n end", "def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end", "def show\n @customers = Customer.all\n end", "def show\n @customers = Customer.all\n end", "def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.get_customers ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/customer\"\n\n # query parameters\n 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[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CustomerSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def show\n customer = Customer.find(params[:id])\n authorize! :read, customer\n render json: customer\n end", "def list_customers(opts = {})\n operation('ListCustomers')\n .add(opts)\n\n run\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end", "def index\n\t@customers = Customer.all()\n end", "def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def all(options = { page: 1, page_size: 10 })\n response = JSON.parse(@client.get('Customers', options).body)\n customers = response.key?('Items') ? response['Items'] : []\n customers.map { |attributes| Unleashed::Customer.new(@client, attributes) }\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def get_customer(opts = {})\n data, _status_code, _headers = get_customer_with_http_info(opts)\n data\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def show\n @customer = customers.find(params[:id])\n end", "def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def index\n @my_customers = MyCustomer.all\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def index\n @customers = Customer.where(user_id: current_user.id)\n end", "def get_customer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCustomer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def all_customers\n if @customer_records_file.nil? || !File.exist?(@customer_records_file)\n raise ArgumentError, 'Customer records file must be provided'\n end\n\n File.open(@customer_records_file, 'r') do |f|\n f.each_line.map do |line|\n JSON.parse(line)\n end\n end\n end", "def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n \n render json: {farmers: Farmer.all, customers: CustomerUser.all} #User.all #CustomerUser.all #{users: User.all, customers: Customer_User.all}\n end", "def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end", "def index\n @users = User.fetch_all_customers\n end", "def index\n @customer_infos = CustomerInfo.all\n end", "def show\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potential_customer }\n end\n end", "def list_customers_with_http_info(authorization, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.list_customers ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.list_customers\" if authorization.nil?\n # resource path\n local_var_path = \"/v2/customers\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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[:'Authorization'] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListCustomersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#list_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @customers = get_customers(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @customers }\n end\n end", "def find(id)\n response = JSON.parse(@client.get(\"Customers/#{id}\").body)\n Unleashed::Customer.new(@client, response)\n end", "def index\n @customers = current_user.customers.paginate(:per_page => 20, :page => params[:page], :order => 'name', :include => :transactions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @customers }\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end", "def customers\r\n @customers ||= CustomersController.new(configuration: @configuration)\r\n end", "def list\n display_customers\n end", "def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end\n end", "def show\n @user = User.find(params[:user_id])\n @customer = @user.customers.find(params[:id])\n @album = Album.new\n @albums = @customer.albums\n @notes = @customer.notes.order(\"created_at DESC\")\n @note = Note.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end", "def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end", "def show\n @customer = current_user.customers.find(params[:id], :include => :orders)\n @orders = @customer.orders.paginate(:per_page => current_user.profile.orders_per_page, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer }\n end\n end", "def customerGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end" ]
[ "0.80477434", "0.7958279", "0.78736347", "0.7785999", "0.7759871", "0.7743631", "0.7737657", "0.7650475", "0.7650475", "0.7644552", "0.76392215", "0.7563173", "0.7439835", "0.74304175", "0.74225414", "0.7395726", "0.72824943", "0.72764957", "0.7261613", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.7246176", "0.7164159", "0.71540767", "0.71252036", "0.70998544", "0.7064369", "0.7044635", "0.704376", "0.7032128", "0.70233333", "0.701189", "0.701189", "0.7005285", "0.70026886", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6963286", "0.69387186", "0.69202554", "0.68890417", "0.6884998", "0.68841976", "0.68797255", "0.68703926", "0.68688864", "0.6851613", "0.6848811", "0.68399435", "0.6809864", "0.6809864", "0.6806203", "0.6769007", "0.67645335", "0.6760816", "0.6709328", "0.6703903", "0.6700306", "0.6696879", "0.6674654", "0.66438556", "0.6619208", "0.66068345", "0.6605628", "0.6602157", "0.65904576", "0.65882844", "0.6588044", "0.65839577", "0.6561115", "0.6544067", "0.6523796", "0.6518941", "0.650751", "0.6504687", "0.65005046", "0.6484343", "0.64840835", "0.6483176", "0.64816195", "0.6471336", "0.64588046", "0.64588046", "0.64588046", "0.6435654", "0.6434578", "0.64324784" ]
0.0
-1
GET /customers/1 GET /customers/1.json
def show @user=User.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def list\n @customers = Customer.all\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @customers }\n end\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def customers\n ShopifyAPI::Customer.all\n end", "def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end", "def show\r\n @customer = Customer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render :json => @customer }\r\n end\r\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def index\n @customers = Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end", "def get_customers\n return ShopifyAPI::Customer.all\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def index\n if params[:search_term]\n customers = Customer.search_customer(params[:search_term])\n else\n if read_from_cache(\"customers\")\n customers = read_from_cache(\"customers\")\n else\n customers = apply_scopes(Customer).all\n write_to_cache(\"customers\", customers)\n end\n end\n\n if params[:page_no]\n result = pagy(customers)\n else\n result = customers\n end\n render :json => result\n end", "def show\n customer = Customer.find(params[:id])\n authorize! :read, customer\n render json: customer\n end", "def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = customers.find(params[:id])\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: CustomersDatatable.new(view_context) }\n end\n @customers = Customer.all\n end", "def index\n respond_to do |format|\n format.html { @customers = Customer.all }\n format.json { @customers = Customer.order(:name) }\n end\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end", "def show\n @customers = Customer.all\n end", "def show\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.get_customers ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/customer\"\n\n # query parameters\n 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[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CustomerSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def show\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potential_customer }\n end\n end", "def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def index\n\t@customers = Customer.all()\n end", "def find(id)\n response = JSON.parse(@client.get(\"Customers/#{id}\").body)\n Unleashed::Customer.new(@client, response)\n end", "def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end", "def show\n @credit = Credit.find_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n end", "def show\n @customer = Customer.find(params[:id])\n end", "def index\n @my_customers = MyCustomer.all\n end", "def show\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_customer }\n end\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def show\n @customer_bill = CustomerBill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_bill }\n end\n end", "def index\n @customers = get_customers(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @customers }\n end\n end", "def show\n @customer = Customer.find(params[:id])\t\n end", "def customers\n Easybill::Api::Customers\n end", "def show\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @appointments = Appointment.where(:company_id => current_user.company.id, :customer_id => @customer.id).order('starts_at DESC').paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end", "def show_customer\n @customer = Customer.find(params[:id])\n end", "def show\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_customer }\n end\n end", "def index\n @single_customers = SingleCustomer.managed_by_users(current_user.direct_subordinates_with_self.collect(&:id)).page params[:page]\n end", "def index\n @customer_infos = CustomerInfo.all\n end", "def get_customer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCustomer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "def show\n @user = User.find(params[:user_id])\n @customer = @user.customers.find(params[:id])\n @album = Album.new\n @albums = @customer.albums\n @notes = @customer.notes.order(\"created_at DESC\")\n @note = Note.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def index\n @customers = Customer.where(user_id: current_user.id)\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end", "def show\n @customer_asset = CustomerAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_asset }\n end\n end", "def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.78559196", "0.78559196", "0.7680941", "0.7600807", "0.75337946", "0.75153816", "0.7500419", "0.7383616", "0.73375285", "0.73375285", "0.73375285", "0.73375285", "0.73375285", "0.73375285", "0.7316646", "0.7307954", "0.728091", "0.7196688", "0.7188413", "0.71713734", "0.7169135", "0.71642244", "0.71566325", "0.71286035", "0.7063205", "0.7049028", "0.70398027", "0.7010237", "0.6968482", "0.69484067", "0.6923446", "0.6914429", "0.689907", "0.68945163", "0.6875481", "0.6874177", "0.6847633", "0.6834545", "0.6787283", "0.6743417", "0.6743417", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.6736244", "0.67160463", "0.6715335", "0.67016345", "0.66988164", "0.66886985", "0.66414297", "0.6638505", "0.6637961", "0.6626343", "0.661281", "0.659052", "0.6586015", "0.6586015", "0.658538", "0.65799165", "0.6563894", "0.6548229", "0.65371066", "0.6533796", "0.6533796", "0.65184665", "0.65035415", "0.6501083", "0.64947236", "0.6492157", "0.64803594", "0.64755607", "0.6469628", "0.6462197", "0.6450305", "0.6413969", "0.6412564", "0.64104474", "0.64093596", "0.6399718", "0.63971394", "0.6389919", "0.6389177", "0.6388296", "0.63804287", "0.63468784", "0.6345561", "0.6339592", "0.6339592", "0.6339592", "0.6339592", "0.6339592", "0.632443" ]
0.0
-1
POST /customers POST /customers.json
def create @customer = Customer.new(customer_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge)) respond_to do |format| if @customer.save format.html { redirect_to @customer, notice: 'Customer was successfully created.' } format.json { render :show, status: :created, location: @customer } else format.html { render :new } format.json { render json: @customer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n end", "def create_customer(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"customers\",options)\n if response['success']\n return response['results']['customer']\n else\n return response\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n if @customer.save\n render json: @customer, status: :created, location: @customer\n else\n ap errors(@customer.errors)\n render json: errors(@customer.errors), status: :unprocessable_entity\n end\n end", "def create(payload)\n client.post(make_path('/customers'), payload)\n end", "def send_customer(customer)\n request(customer, \"customer\", :post, {method: \"add\"})\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully added.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :index }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to action: \"index\", notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(options = {})\n perform_post_with_object('/customers', options, Epages::Customer)\n end", "def create_customer(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(customer_info, password)\n post_wrapper('/V1/customers',\n { customer: customer_info,\n password: password }.to_json,\n admin_headers)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: \"Customer was successfully created.\" }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n \n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # whitelist params\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path }\n format.json { render :show, status: :ok, location: @customer }\n format.json { render :json => @objects.map(&:attributes) }\n else\n format.html { render :new, warning: \"Customer record was NOT saved.\"}\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def createCustomer(customer_properties)\n url_data = \"/api/customers/\"\n @json_customer_properties = customer_properties.to_json\n options = {\n :digest_auth => @auth_digest,\n :body => @json_customer_properties\n }\n url_request = \"#{url_data}\"\n postData(url_request, options)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, Customer\n @customer = Customer.new(customer_params)\n @customer.customer_admin = current_user\n\n if @customer.save\n render json: nil, status: :created\n else\n render json: @customer.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @customer = Customer.new(params[:customer])\r\n\r\n respond_to do |format|\r\n if @customer.save\r\n format.html { redirect_to '/auth/identity/register', :notice => 'Customer was successfully created.' }\r\n format.json { render :json => @customer, :status => :created, :location => @customer }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create_customer\n begin\n customer = Stripe::Customer.create\n # Create customer successful - return its id\n log_info(\"Customer created with ID #{customer[:id]}\")\n rescue Stripe::StripeError => e\n return_error 402, \"Error creating customer #{e.message}\"\n end\n status 201\n { customer_id: customer.id }.to_json\n end", "def create\n #@customer = Customer.new(params[:customer].merge(:user_id => current_user.id))\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer.company = Company.find(current_user.company.id)\n\n respond_to do |format|\n if @customer.save\n format.html {\n flash[:notice] = I18n.t(:successfully_created, :model_name => Customer.model_name.human)\n redirect_to action: 'index'\n }\n format.json {\n render :json => {\n :listPartial => render_to_string(\n 'customers/_list',\n :formats => [:html],\n :layout => false,\n :locals => {\n :customers => Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n }\n ),\n status: :created,\n location: @customer\n }\n }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to admin_customer_path(@customer), notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @customer = Customer.new(customer_params)\n @user = current_user\n respond_to do |format|\n if @customer.save\n @customer.update!(user_id: @user.id)\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.created\", :default => 'Customer was successfully created.') }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully created.\" }\n format.json { render action: \"show\", status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_customer = Customer::Customer.new(customer_customer_params)\n @customer_customer.admin = current_admin\n\n respond_to do |format|\n if @customer_customer.save\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer_customer }\n else\n format.html { render :new }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to [:admin, @customer], notice: t('messages.created', model:Customer.model_name.human) }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n @customer.user = current_user\n authorize @customer, :create?\n\n respond_to do |format|\n if @customer.save\n @customer.works.create!(trackable_url: \"#{customer_path(@customer)}\", action: :create, user: current_user, \n parameters: @customer.to_json(except: {customer: [:fullname_and_address_and_pesel_nip_and_birth_date]}, \n include: { \n user: {\n only: [:id, :name, :email] } \n }))\n\n flash_message :success, t('activerecord.messages.successfull.created', data: @customer.fullname)\n format.html { redirect_to @customer }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = current_user.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @cust = Cust.new(params[:cust])\n\n respond_to do |format|\n if @cust.save\n format.html { redirect_to @cust, notice: 'Cust was successfully created.' }\n format.json { render json: @cust, status: :created, location: @cust }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = current_user\n @customer = @user.customers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n #format.html { redirect_to new_work_servey_path(:customer_id => @customer.id), notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer_using_post_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.create_customer_using_post ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomerApi.create_customer_using_post\"\n end\n # resource path\n local_var_path = '/customer'\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(['*/*'])\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 = @api_client.object_to_http_body(customer)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Customer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#create_customer_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_create_customer()\n # Parameters for the API call\n body = APIHelper.json_deserialize(\n '{\"given_name\":\"Amelia\",\"family_name\":\"Earhart\",\"email_address\":\"Amelia.Ear'\\\n '[email protected]\",\"address\":{\"address_line_1\":\"500 Electric Ave\",\"address_l'\\\n 'ine_2\":\"Suite 600\",\"locality\":\"New York\"},\"phone_number\":\"1-212-555-4240\",\"'\\\n 'reference_id\":\"YOUR_REFERENCE_ID\",\"note\":\"a customer\"}'\n )\n\n # Perform the API call through the SDK function\n result = @controller.create_customer(body: body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n end", "def create\n @customer = Customer.new(customer_params)\n @projects = Project.all\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_create\n @customer = Person.new(person_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to new_customer_path, notice: 'データが新規作成されました。' }\n format.json { render :customer_show, status: :created, location: @customer }\n else\n format.html { redirect_to new_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def create_customer_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomersApi.create_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers'\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.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.create_customer\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#create_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @customer = Customer.where(:fullname => params[:customer][:fullname], :phone => params[:customer][:phone]).first\n\n if @customer\n respond_to do |format|\n #format.html { redirect_to :back }\n format.json { render :json => @customer, :status => 200 }\n end\n else\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n #format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :json=> @customer, :status=> :created }\n else\n #format.html { render action: \"new\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end\n end", "def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end", "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n # render json: {name:@customer.name,mobile:@customer.mobile,email:@customer.email,state_name:@customer.state.name,\n # city_name:@customer.city.name,state_id:@customer.state_id,city_id:@customer.city_id}\n render json: @customer.attributes.merge(state_name:@customer.state.name,city_name:@customer.city.name,customer_count:Customer.count);\n else\n render json:{error: @customer.errors.full_messages}\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n UserMailer.welcome_customer(@customer).deliver\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_add = CustomerAdd.new(customer_add_params)\n\n respond_to do |format|\n if @customer_add.save\n format.html { redirect_to @customer_add, notice: 'Customer add was successfully created.' }\n format.json { render :show, status: :created, location: @customer_add }\n else\n format.html { render :new }\n format.json { render json: @customer_add.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(cust_token, data = {})\n pdata = build_payment_info(data)\n data = FiveDL.build_params(data.merge!(transtype: 'updatecustomer', token: cust_token).merge!(pdata))\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def create\n @customer = customer_scope.new(customer_params)\n @customer.company_type_name = :customer\n\n puts \">>>>> Customer params\"\n puts customer_params.inspect\n\n respond_to do |format|\n if @customer.save\n CompanyRegisterMailer.send_request(@customer.id).deliver\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n\n format.html {\n redirect = customer_path(@customer)\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = root_path() if params[:registration]\n redirect_to redirect, notice: I18n.t('customers.successfully_created')\n }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n session[:customer_id] = @customer.id\n format.html { redirect_to new_order_path, method: :get, notice: \"Your account was successfully created.\" }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @address_customer = AddressCustomer.new(params[:address_customer])\n\n respond_to do |format|\n if @address_customer.save\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully created.' }\n format.json { render json: @address_customer, status: :created, location: @address_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body)\r\n begin\r\n @logger.info(\"create_customer called.\")\r\n\r\n # validate required parameters\r\n @logger.info(\"Validating required parameters for create_customer.\")\r\n validate_parameters({\r\n 'body' => body\r\n })\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for create_customer.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for create_customer.\")\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for create_customer.')\r\n _request = @http_client.post _query_url, headers: _headers, parameters: body.to_json\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'create_customer')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for create_customer.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return CustomerModel.from_hash(decoded)\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def create\n @customer = User.new(customer_params)\n @customer.authority = 'customer'\n respond_to do |format|\n if @customer.save\n if !current_user\n log_in @customer, :customer\n end\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully created.'}\n format.json {render :show, status: :created, location: @customer}\n else\n format.html {render :new}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end", "def add_customer_data(post, options)\n a = options[:address] || {} # shipping address\n \n phone = get_phone_number(a[:phone])\n \n c = {\n :firstname => options[:first_name],\n :lastname => options[:last_name],\n :email => options[:email],\n :zippostal => a[:zip],\n :city => a[:city],\n :address1 => a[:address1],\n :address2 => nil,\n :stateregioniso => a[:state],\n :countryiso => iso_code_for(a[:country]),\n \n :phone1phone => phone[:number],\n :phone1country => phone[:country],\n :phone1area => phone[:area],\n \n :phone2phone => nil,\n :phone2country => nil,\n :phone2area => nil,\n \n :birthday => options[:birth_day] || 01,\n :birthmonth => options[:birth_month] || 01,\n :birthyear => options[:birth_year] || 1980,\n :ipaddress => options[:ip],\n :accountid => options[:id]\n }\n\n post[:customer] = c\n post\n end", "def create_customer_phone(customer_id, data)\n post(\"customers/#{customer_id}/phones\", { body: data })\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n # When we make a new CustomerDetail, also make a Customer to go with it, using the Email from CustomerDetail\n customer_info = customer_detail_params['customer_attributes']\n customer_info['email'] = customer_detail_params['email']\n @customer = Customer.create(customer_info)\n @customer_detail.customer = @customer\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to wines_url,\n notice: \"User #{@customer_detail.email} was successfully created. Please proceed to Login.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to @customer_detail, notice: \"Customer detail was successfully created.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = customers.new(params[:customer])\n\n if @customer.save\n redirect_to customers_path, notice: '客户信息保存成功' \n else\n render action: \"new\" \n end\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customers\n ShopifyAPI::Customer.all\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n set_favorite\n format.html { redirect_to @customer,\n notice: I18n.t('saved') }\n format.json { render action: 'show',\n status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def create\n @customer = @representative.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente registrado exitosamente.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @customer_info = CustomerInfo.new(customer_info_params)\n\n respond_to do |format|\n if @customer_info.save\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully created.' }\n format.json { render :show, status: :created, location: @customer_info }\n else\n format.html { render :new }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def create\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to new_customer_path }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:user_id, :company_name, requests_attributes: [:id, :customer_id, :contact_firstname, :contact_lastname, :title, :email, :phone, :street_address, :city, :date, :zip_code])\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_params\n params.require(:customer).permit(:title, :first_name, :last_name, :email, :phone, :address, :city, :state, :zip, :country, :reservation_ids => [])\n end", "def search_customers(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers/search',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create_customer_using_post(customer, opts = {})\n data, _status_code, _headers = create_customer_using_post_with_http_info(customer, opts)\n data\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n UserMailer.activation_email(@customer.user).deliver_now\n format.html { redirect_to home_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:code, :name, :customer_category_id, :user_id, :notes,\n {customer_branches_attributes: [:_destroy, :id, :name, :address, :notes]},\n {customer_contacts_attributes: [:_destroy, :id, :name, :phones, :email, :notes]})\n end", "def create(options = {})\n post(\"customers/#{customer_id}/deliveries\", options)\n end", "def create\n @customer_account = CustomerAccount.new(customer_account_params)\n\n respond_to do |format|\n if @customer_account.save\n flash[:success] = \"Customer account was successfully created!\"\n format.html { redirect_to @customer_account }\n format.json { render :show, status: :created, location: @customer_account }\n else\n format.html { render :new }\n format.json { render json: @customer_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #render :text => params.inspect and return false\n params[:customer][:country] = params[:country]\n params[:customer][:status] = params[:status]\n @customer = Customer.new(params[:customer])\n \n # render :text => @customer.inspect and return false\n respond_to do |format|\n if @customer.save\n flash[:msg] = 'Customer was successfully created.'\n format.html { redirect_to :controller => 'customers', :action => 'index' }\n #format.json { render json: @customer, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:name, :phone_1, :phone_2, :email, :notes)\n end", "def customer_params\n params.require(:customer).permit(:name, :company_name, :address1, :address2, :postal_code)\n end", "def new\n @customer = Customer.new\n @customer_types = [CustomerType.new]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(attributes)\n id = attributes[:Guid].present? ? attributes[:Guid] : ''\n response = JSON.parse(@client.post(\"Customers/#{id}\", attributes).body)\n Unleashed::Customer.new(@client, response)\n end", "def customer_params\n params.require(:customer).permit(:first_name, :last_name, :phone, :query, :email,\n :street_address, :city, :acct_open_date, :agreement_status, :trans_type,\n :last_trans_date, :street_address2, :postal, :province, :notes)\n end" ]
[ "0.7583831", "0.7370059", "0.7276722", "0.7225282", "0.7225083", "0.71425253", "0.7117077", "0.7109782", "0.70759284", "0.7067933", "0.70547545", "0.7036328", "0.7036328", "0.7035178", "0.7033539", "0.7017762", "0.70175195", "0.70175195", "0.70175195", "0.70175195", "0.70175195", "0.70175195", "0.7011526", "0.6994435", "0.6984694", "0.69544137", "0.6951777", "0.6950992", "0.6938759", "0.6918207", "0.6903247", "0.6896558", "0.68948084", "0.6893548", "0.6885439", "0.681985", "0.67357326", "0.6730922", "0.6722702", "0.66994196", "0.6675646", "0.66629565", "0.66560125", "0.6639456", "0.66308355", "0.65946233", "0.659152", "0.65897596", "0.6580673", "0.6563506", "0.65591425", "0.6558929", "0.65566486", "0.6539613", "0.65248835", "0.6520045", "0.6519573", "0.6510937", "0.64978534", "0.64899963", "0.6483909", "0.64546597", "0.6449098", "0.6447206", "0.6440258", "0.6438678", "0.6432176", "0.64082813", "0.64007497", "0.64005166", "0.6388461", "0.6381645", "0.6377132", "0.63663036", "0.63558626", "0.6351108", "0.63452405", "0.6344866", "0.6343588", "0.6333345", "0.63300544", "0.6327725", "0.6322587", "0.63213104", "0.6313116", "0.63018125", "0.6280204", "0.6267333", "0.6259559", "0.62557316", "0.62465554", "0.62456506", "0.62426037", "0.623938", "0.62174755", "0.6215764", "0.62146497", "0.621325", "0.6212039", "0.6211272" ]
0.71037143
8
PATCH/PUT /customers/1 PATCH/PUT /customers/1.json
def update respond_to do |format| if @customer.update(customer_params.keep_if{|p,q| q.class != ActionController::Parameters}) @customer.address.update(customer_params[:address_attributes]) @customer.contact.update(customer_params[:contact_attributes]) format.html { redirect_to @customer, notice: 'Customer was successfully updated.' } format.json { render :show, status: :ok, location: @customer } else format.html { render :edit } format.json { render json: @customer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #format.html { redirect_to customers_path }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n if @customer.update(customer_params)\n head :no_content\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to action:\"index\", notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully updated.'}\n format.json {render :show, status: :ok, location: @customer}\n else\n format.html {render :edit}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.json { render action: 'show', status: :created, location: @customer }#format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to customers_path, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n\n respond_to do |format|\n if @customer.update(customer_params)\n @@current_customer = @customer.id\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to [:admin, @customer], notice: t('messages.updated', model:Customer.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @customer\n update_customer_params = ( current_user.role == 'kanari_admin' ? admin_customer_params : customer_params)\n if @customer.update(update_customer_params)\n render json: nil, status: 200\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #@customer.progress!\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n if @cust.update_attributes(params[:cust])\n format.html { redirect_to @cust, notice: 'Cust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # it is impossible for a customer to update a referral, so no need to modify.\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to [@selector, @customer], :notice => 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_customer.update(customer_customer_params)\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_customer }\n else\n format.html { render :edit }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: \"Customer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n if @cust_contact.update_attributes(params[:cust_contact])\n format.html { redirect_to customer_path(@customer), :notice => 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :show }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @Customer = Customer.find params[:id]\n if @Customer.update_attributes (customer_params)\n render :json => { :success => true, :Customer => @Customer, :message => 'customer add ok ' }\n else\n render :json => {:success => false, :message => \"Existe un error\"}\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.updated\", :default => 'Customer was successfully updated.') }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to customer_path(session[:customer_id]), notice: 'Your account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_customer.update(my_customer_params)\n format.html { redirect_to @my_customer, notice: 'My customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_customer }\n else\n format.html { render :edit }\n format.json { render json: @my_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado com sucesso!' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n set_favorite\n format.html { redirect_to @customer,\n notice: I18n.t('updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html {\n redirect_to @customer,\n notice: I18n.t(:successfully_updated, :model_name => Customer.model_name.human)\n }\n format.json { head :no_content }\n else\n @customer.errors.each do |name, error|\n flash[name] = error\n end\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_update\n respond_to do |format|\n if @customer.update(person_params)\n format.html { redirect_to customer_path, notice: 'データが更新されました。' }\n format.json { render :customer_show, status: :ok, location: @customer }\n else\n format.html { redirect_to edit_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer, id)\n request(customer, \"customer\", :post, {id: id, method: \"edit\"})\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Your Customer Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_set.update(customer_set_params)\n format.html { redirect_to @customer_set, notice: 'Customer set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n @customer = Customer.find(params[:id])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(@customer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = current_user.customers.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.xml { head :ok }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @self_service_customer = SelfService::Customer.find(params[:id])\n\n respond_to do |format|\n if @self_service_customer.update_attributes(params[:self_service_customer])\n format.html { redirect_to(@self_service_customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @self_service_customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(@customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(:action => 'index', :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Personendaten wurden erfolgreich aktualisiert.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(params = {})\n req = WebPay::CustomerRequestUpdate.create(params)\n raw_response = @client._request(:post, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to customers_path, success: \"Customer record updated\"}\n else\n format.html { render :edit }\n end\n end\n end", "def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end", "def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end", "def update\n @customer.user = current_user\n authorize @customer, :update?\n\n respond_to do |format|\n if @customer.update(customer_params)\n @customer.works.create!(trackable_url: \"#{customer_path(@customer)}\", action: :update, user: current_user, \n parameters: @customer.to_json(except: {customer: [:fullname_and_address_and_pesel_nip_and_birth_date]}, \n include: { \n user: {\n only: [:id, :name, :email] } \n }))\n\n flash_message :success, t('activerecord.messages.successfull.updated', data: @customer.fullname)\n format.html { redirect_to @customer }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @cPhone = CustomerPhone.where('customer_id=? and phone_id=?', params[:customer_id], phone_params[:id]).first \n @phone = @cPhone.phone\n \n respond_to do |format|\n if @phone.update(phone_params)\n format.json { head :no_content }\n else\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = customer_scope.find(params[:id])\n\n respond_to do |format|\n if params[:company][:avatar] && @customer.update_attribute(:avatar, params[:company][:avatar])\n format.html { render action: \"edit\" }\n format.js #\n elsif @customer.update_attributes(customer_params)\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n format.html {\n redirect = customer_path(@customer)\n redirect = root_path if current_company.is_customer?\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = company_reseller_customer_path(current_company, @customer.parent_id, @customer) if session[:by_reseller] && @customer.parent && @customer.parent.is_partner?\n redirect = step3_homes_path if session['homes.step'] == 2\n redirect_to redirect, notice: I18n.t('commons.successfully_updated')\n }\n format.json { head :no_content }\n format.js #\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_detail.update(customer_detail_params)\n format.html { redirect_to @customer_detail, notice: \"Customer detail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer_detail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer, options = {})\n id = epages_id(customer)\n perform_patch_with_object(\"/customers/#{id}\", options, Epages::Customer)\n end", "def update\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n if @address_customer.update_attributes(params[:address_customer])\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to([@contact.customer, @contact], :notice => t('forms.update.sucess')) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @customer_add.update(customer_add_params)\n format.html { redirect_to @customer_add, notice: 'Customer add was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_add }\n else\n format.html { render :edit }\n format.json { render json: @customer_add.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_info.update(customer_info_params)\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_info }\n else\n format.html { render :edit }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n if @potential_customer.update_attributes(params[:potential_customer])\n format.html { redirect_to @potential_customer, notice: 'Potential customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @potential_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado exitosamente.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n if @custo.update_attributes(params[:custo])\n format.html { redirect_to @custo, notice: 'Custo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @custo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: t('views.flash_update_message') }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n migrate_to_dropbox\n format.html { redirect_to @customer, notice: \"Customer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n @user = User.find(session[:user_id])\n @customer.modified_by = @user.name\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(customers_path, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n if @customer.update customer_params\n redirect_to @customer\n else\n render 'edit'\n end\n end", "def update\n @customer_bill = CustomerBill.find(params[:id])\n\n respond_to do |format|\n if @customer_bill.update_attributes(params[:customer_bill])\n format.html { redirect_to @customer_bill, notice: 'Customer bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def update_customer_with_http_info(id, update_customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.update_customer ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CustomersApi.update_customer\"\n end\n # verify the required parameter 'update_customer' is set\n if @api_client.config.client_side_validation && update_customer.nil?\n fail ArgumentError, \"Missing the required parameter 'update_customer' when calling CustomersApi.update_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(update_customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.update_customer\",\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: CustomersApi#update_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n if @offer_customer.update_attributes(params[:offer_customer])\n format.html { redirect_to @offer_customer, notice: 'Offer customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n if @type_customer.update_attributes(params[:type_customer])\n format.html { redirect_to @type_customer, notice: 'Type customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n if @customers_address.update_attributes(params[:customers_address])\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n respond_to do |format|\n if @service.update_attributes(service_params)\n format.html { redirect_to @customer, success: 'Service was successfully updated.' }\n format.json { respond_with_bip(@service) }\n else\n format.html { render action: 'edit'}\n format.json { respond_with_bip(@service) }\n end\n end\n end", "def update\n respond_to do |format|\n if @customerservice.update(customerservice_params)\n format.html { redirect_to @customerservice, notice: 'Customerservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @customerservice }\n else\n format.html { render :edit }\n format.json { render json: @customerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = customers.find(params[:id])\n\n if @customer.update_attributes(params[:customer])\n redirect_to customers_path, notice: '客户信息更新成功' \n else\n render action: \"edit\" \n end\n end", "def update\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug (fname) {\"params=#{params.inspect}\"}\n\t\t@customer = Customer.find(params[:id])\n\t\t@types = Typesobject.get_types(:customer)\n\t\t@status = Statusobject.find_for(@customer)\n\t\[email protected]_accessor(current_user)\n\t\tif commit_promote?\n\t\t\tctrl_promote(@customer)\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tif @customer.update_attributes(params[:customer])\n\t\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { redirect_to(@customer) }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = t(:ctrl_object_notupdated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { render :action => :edit }\n\t\t\t\t\tformat.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend" ]
[ "0.6988014", "0.6921667", "0.6921389", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.67379916", "0.6729548", "0.669213", "0.669213", "0.669213", "0.6614732", "0.66107404", "0.6601309", "0.6599307", "0.6581087", "0.65642476", "0.65528435", "0.65495336", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.65224195", "0.6521344", "0.6517462", "0.6504792", "0.6493295", "0.64776856", "0.6456203", "0.64549035", "0.64447165", "0.6439166", "0.64264", "0.6406883", "0.6396675", "0.6395213", "0.6387667", "0.63603675", "0.6351255", "0.6351143", "0.6297615", "0.62898433", "0.62882054", "0.6285952", "0.6271253", "0.6269422", "0.6253447", "0.6251907", "0.62460697", "0.6244198", "0.6244198", "0.6213548", "0.61861336", "0.61684984", "0.61539996", "0.61523414", "0.6127079", "0.6125767", "0.6121538", "0.61150646", "0.61145186", "0.6112347", "0.6089436", "0.6088314", "0.6070272", "0.60669667", "0.6055655", "0.6049337", "0.60488063", "0.6045963", "0.60332125", "0.6032371", "0.6016146", "0.60120237", "0.6011633", "0.60063666", "0.60063666", "0.59956974", "0.5966501", "0.59659606", "0.5965954", "0.5965705" ]
0.6457318
46
DELETE /customers/1 DELETE /customers/1.json
def destroy @customer.destroy respond_to do |format| format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @customer = Customer.find(params[:id])\r\n @customer.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to customers_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n head :no_content\n end", "def destroy\n \n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_customers_url(current_user) }\n format.json do\n render json: {\n customer: @customer,\n status: :deleted\n }.to_json\n end\n end\n end", "def destroy\n @single_customer.destroy\n respond_to do |format|\n format.html { redirect_to single_customers_url, notice: 'Single customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cust = Cust.find(params[:id])\n @cust.destroy\n\n respond_to do |format|\n format.html { redirect_to custs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n # @customer.destroy\n # respond_to do |format|\n # format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @customer_customer.destroy\n respond_to do |format|\n format.html { redirect_to customer_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to admin_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_customer_by_id(customer_id)\n host = Swagger.configuration.host\n api_key = Swagger.configuration.private_api_key\n\n conn = Faraday.new\n resp = conn.delete do |req|\n req.url \"https://#{host}/api/customer/#{customer_id}\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['Authorization'] = 'Basic ' + [\"#{api_key}:\"].pack('m').delete(\"\\r\\n\")\n end\n body = JSON.parse(resp.body)\n Swagger::Response.new(resp.status, body)\n return body\n end", "def delete_index\n @customer = Customer.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @customer.delete\n elsif params[:type]=='restore'\n @customer.restore\n @customer.update(deleted_at: nil)\n end\n\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def delete(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:delete, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def customer_destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @my_customer.destroy\n respond_to do |format|\n format.html { redirect_to my_customers_url, notice: 'My customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n #format.html { redirect_to customers_index_path }\n format.json { head :ok }\n format.js { render :nothing => true }\n end\n end", "def destroy\n authorize @customer, :destroy?\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.destroy\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n else\n format.html { redirect_to customer_url(@customer), :notice => \"customer can't be destroyed\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end \n end\n end", "def destroy\n find_customer\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to('/customers/overview') }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url,flash[:success] = \"Customer record successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Person wurde erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @self_service_customer = SelfService::Customer.find(params[:id])\n @self_service_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(self_service_customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @custo = Custo.find(params[:id])\n @custo.destroy\n\n respond_to do |format|\n format.html { redirect_to custos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer_add.destroy\n respond_to do |format|\n format.html { redirect_to customer_adds_url, notice: 'Customer add was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n @cust_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(@customer) }\n format.json { head :no_content }\n end\n end", "def delete_customer(customer_id:,\n version: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .query_param(new_parameter(version, key: 'version'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def destroy\n @address_customer = AddressCustomer.find(params[:id])\n @address_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to address_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type_customer = TypeCustomer.find(params[:id])\n @type_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to type_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Cliente eliminado exitosamente.' }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: t(\"activerecord.controller_msg.customer.destroyed\", :default => 'Customer was successfully destroyed.') }\n format.json { head :no_content }\n end\n end", "def delete(customer_id)\n response, status = BeyondApi::Request.delete(@session, \"/customers/#{customer_id}\")\n\n handle_response(response, status, respond_with_true: true)\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 delete\n request(:delete)\n end", "def destroy\n @customer.destroy\n redirect_to customers_url\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n Customer.destroy params #[not sure what to put in the params]\n redirect_to customers_path\n end", "def destroy\n @customer_detail.destroy\n respond_to do |format|\n format.html { redirect_to customer_details_url, notice: \"Customer detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_detail.destroy\n respond_to do |format|\n format.html { redirect_to customer_details_url, notice: 'Customer detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n redirect_to(action: \"index\")\n end", "def destroy\n @shop_customer.destroy\n respond_to do |format|\n format.html { redirect_to shop_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n end\n end", "def delete_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.delete(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def destroy\n @customerservice.destroy\n respond_to do |format|\n format.html { redirect_to customerservices_url, notice: 'Customerservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n sql = \"DELETE from customers WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n# => Deleting customer record, nothing to return\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n if params[:customers]\n customers.where(id: params[:customers].values).delete_all\n elsif params[:id]\n customers.find_by_id(params[:id]).try(:destroy)\n end\n redirect_to customers_url(search: params[:search])\n end", "def destroy\n @customer.destroy\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @customer_info.destroy\n respond_to do |format|\n format.html { redirect_to customer_infos_url, notice: 'Customer info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reach_out_to_customer.destroy\n respond_to do |format|\n format.html { redirect_to reach_out_to_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_set.destroy\n respond_to do |format|\n format.html { redirect_to customer_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n @sixmonth_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to sixmonth_customers_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7459522", "0.7459522", "0.74481064", "0.74481064", "0.74481064", "0.74481064", "0.74481064", "0.74481064", "0.74481064", "0.74353355", "0.7429028", "0.7429028", "0.7429028", "0.7429028", "0.7429028", "0.7429028", "0.7429028", "0.7429028", "0.73638636", "0.7328162", "0.7298184", "0.7282546", "0.7235665", "0.7166844", "0.714556", "0.7143996", "0.71430796", "0.71430796", "0.71356994", "0.7121209", "0.7119268", "0.71076006", "0.71005356", "0.7094747", "0.7094286", "0.7089949", "0.70786506", "0.70786506", "0.70786506", "0.70759696", "0.7075323", "0.7057431", "0.7056286", "0.7036345", "0.7027714", "0.7005342", "0.6980549", "0.6979957", "0.69777995", "0.6971577", "0.695538", "0.69440037", "0.6927322", "0.6922246", "0.68980277", "0.68974566", "0.6896783", "0.6892348", "0.6881913", "0.6867497", "0.68630034", "0.6862887", "0.6833522", "0.6829841", "0.6829729", "0.68235207", "0.6812566", "0.6811308", "0.6802703", "0.67693055", "0.6757154", "0.67570436", "0.67570436", "0.6755679", "0.6754891", "0.6741629", "0.6712067", "0.6709948", "0.6704028", "0.6700241", "0.6699905", "0.66990834" ]
0.7140883
43
Use callbacks to share common setup or constraints between actions.
def set_customer @customer = Customer.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup_handler\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def before_dispatch(env); end", "def process_action(...)\n send_action(...)\n end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def action\n end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def config(action, *args); end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def setup_signals; end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; end", "def around_hooks; end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def call\n setup_context\n super\n end", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.5328757", "0.5310255", "0.5300339", "0.5298796", "0.5295774", "0.5256034", "0.5243039", "0.5236007", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.52321917", "0.5227032", "0.52216744", "0.5216349", "0.52161187", "0.5210265", "0.5207244", "0.5177388", "0.5177142", "0.51747334", "0.516293", "0.51629275", "0.5155534", "0.51540613", "0.515197", "0.5151636", "0.5145279", "0.51380795", "0.5135777", "0.5117378", "0.5115066", "0.5115066", "0.5110235", "0.5106418", "0.50917816", "0.50909185", "0.50855017", "0.5082105", "0.506359", "0.5055345", "0.50546116", "0.50523037", "0.50523037", "0.50327307", "0.5024364", "0.5021113", "0.50174654", "0.50163317", "0.5000553", "0.50002855", "0.49991882", "0.49905527", "0.49905527", "0.49849054", "0.4982546", "0.4980941", "0.4979153", "0.49693102", "0.4967172", "0.49594432", "0.49564302", "0.49552485", "0.49533385", "0.49506924", "0.49452737", "0.49442786", "0.49347955", "0.49341312", "0.49295264", "0.49261844", "0.4925649", "0.49251428", "0.4920729", "0.49177617", "0.4916373", "0.49158472", "0.4915794", "0.49156648" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def customer_params params.require(:customer).permit(:customer_name, :customer_code, :warehouse_id, :warehouse_code, :office_id, contact_attributes:[:landline,:extension,:mobilenumber1,:mobilenumber2,:email],address_attributes:[:address1,:address2,:city,:state,:country]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def url_params\n params[:url].permit(:full)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69795185", "0.6782116", "0.6745877", "0.6742722", "0.67368543", "0.65932566", "0.65048057", "0.6497429", "0.6481512", "0.6478456", "0.6455591", "0.64391", "0.6379068", "0.6376498", "0.636542", "0.632084", "0.630046", "0.62998945", "0.62943697", "0.6293775", "0.629097", "0.62902015", "0.62826055", "0.6241474", "0.6239528", "0.62192595", "0.6213959", "0.6209968", "0.6195236", "0.6178428", "0.6174288", "0.61730385", "0.6162674", "0.615271", "0.6151781", "0.61483663", "0.6122072", "0.6118153", "0.61082", "0.61056745", "0.6092642", "0.60814065", "0.60712725", "0.6063699", "0.60218817", "0.60172415", "0.6014784", "0.60113716", "0.6007368", "0.6007368", "0.60013884", "0.6000211", "0.5997662", "0.5992346", "0.59923387", "0.59920985", "0.5979802", "0.5966599", "0.59599686", "0.5958859", "0.5958176", "0.59577733", "0.5953665", "0.59535724", "0.5944413", "0.5939227", "0.59389156", "0.59389156", "0.59350467", "0.5930765", "0.5926072", "0.5925355", "0.59176385", "0.5910344", "0.59092146", "0.5908764", "0.5904986", "0.5897739", "0.58974844", "0.58968824", "0.5894499", "0.5894097", "0.58928955", "0.58877337", "0.588388", "0.5880237", "0.5873962", "0.5869052", "0.58690286", "0.58670396", "0.5866859", "0.5866724", "0.58638793", "0.58630764", "0.5862874", "0.58606905", "0.58596873", "0.5854749", "0.58539575", "0.58516955", "0.5849963" ]
0.0
-1
Setup an authenticated connection to the OM Api
def initialize(opts = {}) @endpoint = opts[:endpoint] || 'https://app.organisedminds.com/' @client_id = opts[:client_id] || raise("We need a client-id") @client_secret = opts[:client_secret] || raise("We need a client-secret") @scopes = opts[:scopes] || [ :read ] @agent = Faraday.new(:url => @endpoint) do |faraday| faraday.use :cookie_jar faraday.request :url_encoded faraday.adapter *opts[:adapter] || Faraday.default_adapter faraday.headers['content-type'] = 'application/json' if opts[:debug] == true faraday.response :logger end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection\n @connection ||= if authenticated?\n RestClient::Resource.new(api_uri.to_s, @username, @password)\n else\n RestClient::Resource.new(api_uri.to_s)\n end\n end", "def temp_auth\n response = get \"authenticate/#{config['lims_default_user']}/#{config['lims_default_password']}\"\n\n @connection = OpenStruct.new(user: config['lims_default_user'], token: response['token'])\n end", "def initialize\n self.http_client = HTTPClient.new(:base_url => Rdioid::BASE_URL, :force_basic_auth => true)\n\n http_client.set_auth(Rdioid::OAUTH_TOKEN_ENDPOINT, Rdioid.config.client_id, Rdioid.config.client_secret)\n end", "def connect\n require 'restforce' unless defined?(::Restforce)\n username = additional_params[:username] || \"\"\n password = additional_params[:password] || \"\"\n security_token = additional_params[:security_token] || \"\"\n client_id = additional_params[:client_id] || \"\"\n client_secret = additional_params[:client_secret] || \"\"\n instance_url = additional_params[:instance_url] || \"\"\n\n @client = Restforce.new(\n username: username,\n password: password,\n security_token: security_token,\n client_id: client_id,\n client_secret: client_secret,\n instance_url: instance_url\n )\n\n @oauth = @client.authenticate!\n super\n end", "def initialize\n\t\t@auth = {\n\t\t\t:username=>ENV['impac_username'], \n\t\t\t:password=>ENV['impac_password']\n\t\t}\n\tend", "def connect(username, password, options = {})\n server = options[:server] || Helpers::AuthHelper.read_server\n @server = RestClient::Resource.new server, DEFAULT_LOGIN_PAYLOAD\n\n super\n end", "def setup_client\n @client = Viddler::Client.new(@api_key)\n @client.authenticate!(@username, @password)\n end", "def auth_connection(settings = FmRest.default_connection_settings)\n settings = ConnectionSettings.wrap(settings)\n\n if is_cloud_host = cloud_host?(settings)\n FmRest.require_cloud_support\n end\n\n base_connection(settings, headers: AUTH_CONNECTION_HEADERS) do |conn|\n conn.use Cloud::AuthErrorHandler, settings if is_cloud_host\n conn.use RaiseErrors\n\n if settings.fmid_token?\n conn.request :authorization, CLARIS_ID_HTTP_AUTH_TYPE, -> { settings.fmid_token }\n elsif is_cloud_host\n conn.request :authorization, CLARIS_ID_HTTP_AUTH_TYPE, -> { Cloud::ClarisIdTokenManager.new(settings).fetch_token }\n else\n conn.request :authorization, :basic, settings.username!, settings.password!\n end\n\n if settings.log\n conn.response :logger, FmRest.logger, bodies: true, headers: true, log_level: settings.log_level\n end\n\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end", "def connect(options)\n # @api_client = establish_remote_appliance_connection(options)\n @api_client = establish_remote_appliance_connection(options.merge({:skip_verify_access_token => true, :skip_login => true}))\n @whoami_interface = @api_client.whoami\n end", "def intialize_digital_ocean_api_connection\n if self.application_token.nil?\n raise \"Please assign opstime an application token. You can get an application token from https://cloud.digitalocean.com/settings/applications\"\n else\n self.do_client = DropletKit::Client.new(:access_token => self.application_token)\n end\n end", "def set_connection()\n ::Jenkins::Client.configure do |c|\n c.username = self[:username]\n c.password = self[:password]\n c.url = self[:url]\n end\n end", "def connect\n configuration = VSphereAutomation::Configuration.new.tap do |c|\n c.host = config[:vcenter_host]\n c.username = config[:vcenter_username]\n c.password = config[:vcenter_password]\n c.scheme = \"https\"\n c.verify_ssl = config[:vcenter_disable_ssl_verify] ? false : true\n c.verify_ssl_host = config[:vcenter_disable_ssl_verify] ? false : true\n end\n\n @api_client = VSphereAutomation::ApiClient.new(configuration)\n api_client.default_headers[\"Authorization\"] = configuration.basic_auth_token\n\n session_api = VSphereAutomation::CIS::SessionApi.new(api_client)\n session_id = session_api.create(\"\").value\n\n api_client.default_headers[\"vmware-api-session-id\"] = session_id\n end", "def configure(connection)\n connection.request :authorization, 'Bearer', @token\n end", "def set_connection(key, pwd, name)\n ShopifyAPI::Base.site = \"https://#{key}:#{pwd}@#{name}.myshopify.com/admin\"\n shop = ShopifyAPI::Shop.current\n\n $shop_name = name\n $currency = shop.money_with_currency_format\n\n session[:logged_in] = true\n open_connection\n rescue SocketError, ActiveResource::ResourceNotFound => e\n puts \"Exception: #{e}\"\n close_connection\n end", "def initialize(options = {})\n @username = options[:username]\n @password = options[:password]\n @connected = false\n @api = API.new\n end", "def connect!\n retrieve_auth_token unless connected?\n auth_token[:token]\n end", "def connect\n result = request(:endpoint => api_endpoint)[:body]\n unless(result[:metadata].any?{|s| s.end_with?(version.to_s)})\n raise InvalidVersionError\n end\n result = request(:endpoint => api_endpoint, :path => \"/#{version}\")[:body]\n if(result[:auth] != 'trusted' && password)\n authenticate_connection!\n end\n end", "def initialize_connection\n self.send(Response.new(action: 'init'))\n end", "def connection\n @connection ||= Faraday.new(\"#{URL_PREFIX}\", connection_options) do |conn|\n conn.basic_auth(api_key, nil)\n end\n end", "def auth\n @auth ||= Savon.client(\n wsdl: AUTH_WSDL,\n headers: { 'Authorization' => \"Basic #{@auth_code}\", 'SOAPAction' => [''] },\n env_namespace: :soapenv,\n logger:,\n log: true,\n log_level: @log_level,\n pretty_print_xml: true\n )\n end", "def initialize\n get_enterprise_token\n initialize_client\n end", "def set_auth(username, password)\r\n @http_client.http_adapter.set_auth(username, password)\r\n end", "def setup(\n url: nil,\n username: nil,\n token: nil,\n password: nil,\n enterprise: 'default',\n organization: nil,\n project: nil,\n pipeline: nil\n )\n @url = url\n @credentials = if token\n token_credentials(username, token)\n else\n password_credentials(username, password)\n end\n @api = AutomateSoup::API.new(self)\n @enterprise = enterprise\n @organization = organization\n @project = project\n @pipeline = pipeline\n self\n end", "def authenticate\n sleep(3600) unless $podio_flag == true\n $podio_flag = true\n Podio.setup(:api_key => @enum_robot[:api_key], :api_secret => @enum_robot[:api_secret])\n Podio.client.authenticate_with_credentials(@enum_robot[:username], @enum_robot[:password])\n end", "def test_connection\n args = get_connection_args(\"#{endpoint}/auth\")\n args[:raw_response] = true\n RestClient::Request.execute(args)\n end", "def setup\n @client = Pardot::Client.new ENV['PARDOT_EMAIL'], ENV['PARDOT_PASSWORD'], ENV['PARDOT_KEY']\n\n # will raise a Pardot::ResponseError if login fails\n # will raise a Pardot::NetError if the http call fails\n rs = @client.authenticate\n print rs\n end", "def initialize(username, password, auth_key) \n @username = username\n @password = password\n \n @uri = URI.parse(@@fonolo_uri)\n @headers = { \"Content-Type\" => \"application/json\",\n \"X-Fonolo-Auth\" => auth_key,\n \"X-Fonolo-Username\" => username, \n \"X-Fonolo-Password\" => password }\n \n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n end", "def identity_service_connection\n @identity_service_connection = HTTP::CardsServiceConnection.new(\n nil,\n self.identity_service_url\n )\n\n end", "def initialize(username, password)\n Connection.basic_auth username, password\n # get the API token\n response = Connection.get('/auth/token')\n Connection.default_params :api_token => response['api_token']\n\n @logger = ::Logger.new(STDOUT)\n @logger.level = ::Logger::DEBUG\n @logger.debug(\"Created logger\")\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(params = {})\n @endpoint = params.fetch(:endpoint, 'http://localhost:5820')\n @endpoint_uri = URI(@endpoint)\n @username = params.fetch(:username, 'admin')\n @password = params.fetch(:password, 'admin')\n end", "def authenticate_connection!\n request(\n :method => :post,\n :path => 'certificates',\n :json => {\n :type => :client,\n :name => name,\n :password => password\n }\n )\n end", "def initialize_connection(env)\n end", "def connect!\n @connection = user ? connection_for_user : connection_for_application\n @auth_token = @connection.token\n BeaconClient.logger.debug(\"Client token: #{@auth_token}\") if BeaconClient.config.debug?\n @auth_token\n rescue OAuth2::Error => error\n BeaconClient.logger.error(error.message)\n BeaconClient.logger.error(error.backtrace.join(\"\\n\"))\n end", "def configure_connection\n end", "def init(options={})\n self.application_token = options[:application_token] if options[:application_token].present?\n intialize_digital_ocean_api_connection\n end", "def establish_connection\n end", "def twilio_auth!\n Twilio::REST::Client.new(ACCOUNT_SID, AUTH_TOKEN)\n end", "def configure_connection\n end", "def api\n # Should return an instance of the API instantiated \n # with the credentials passed into the initialized.\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new \n end", "def setup_class\n _config = create_configuration\n @client = Client.new(config: _config)\n _auth_managers = @client.auth_managers\n end", "def initialize(api_key, username, password)\n @api_key, @username, @password = api_key, username, password\n setup_client\n end", "def conectar_ALM\n @alm_rest = ALM::REST.new('FIS_BRASIL', 'FIS_Brasil')\n\t @alm_rest.autenticar('LC5370407', 'FIS@FEV2018')\n end", "def initialize(server, username: nil, password: nil)\n self.class.base_uri(URI.join(server, '/v1/').to_s)\n\n auth = if username && password\n Base64.encode64(\"#{username}:#{password}\")\n else\n ENV['KINTO_API_TOKEN']\n end\n\n self.class.headers('Authorization' => \"Basic #{auth}\")\n\n @server = KintoServer.new(client: self)\n end", "def conn\n @conn ||= Faraday.new(url: authentication_uri.to_s) do |builder|\n builder.adapter Faraday.default_adapter\n end\n end", "def setup_or_refresh_rest_session\n # Once we add retry/timeout logic the content of this method will change\n return unless @session.nil?\n @session = PuppetX::Cisco::APICRestClient.new(url: @apicuri,\n user: @user,\n password: @password,\n format: 'json',\n debug: @debug)\n end", "def setup_credentials\n\n cmd = @config[:path] + @command_line_tool + \" \" + @@login_command\n\n Open3.popen3( cmd ) { |input, output, error|\n input.puts @config[:url]\n input.puts @config[:user]\n input.puts @config[:password]\n input.close\n } \n\n end", "def setup_api_client\n # see http://rubydoc.info/github/heroku/databasedotcom/master/Databasedotcom/Client:initialize\n # add :debugging => true to constructor hash to log API request/responses\n #u = current_user\n #debugger\n @client = Databasedotcom::Client.new({})\n @client.version = API_VERSION\n @client.authenticate :token => @current_user.access_token,\n :refresh_token => @current_user.refresh_token,\n :instance_url => @current_user.instance_url\n @client.materialize(\"Account\")\n end", "def initialize(options)\n raise ArgumentError, 'an options Hash is required' if !options.instance_of?(Hash)\n raise ArgumentError, ':username required' if options[:username].nil?\n raise ArgumentError, ':password required' if options[:password].nil?\n \n self.class.debug_output $stdout if options[:debug]\n self.class.base_uri options[:base_uri] || SMSIFIED_ONEAPI_PUBLIC_URI\n @auth = { :username => options[:username], :password => options[:password] }\n \n @destination_address = options[:destination_address]\n @sender_address = options[:sender_address]\n end", "def initialize(options)\n raise ArgumentError, 'an options Hash is required' if !options.instance_of?(Hash)\n raise ArgumentError, ':username required' if options[:username].nil?\n raise ArgumentError, ':password required' if options[:password].nil?\n \n self.class.debug_output $stdout if options[:debug]\n self.class.base_uri options[:base_uri] || SMSIFIED_ONEAPI_PUBLIC_URI\n @auth = { :username => options[:username], :password => options[:password] }\n \n @destination_address = options[:destination_address]\n @sender_address = options[:sender_address]\n end", "def initialize(opts = {})\n @user_id = opts[:user_id] || AddThis.configuration.user_id\n @password = opts[:password] || AddThis.configuration.password\n connection.basic_auth(@user_id, @password)\n end", "def config(username, password, headers)\n @resource = Resource.new(URI.join(BASE_URI, VERSION), :user => username, :password => password, :headers => headers)\n end", "def set_up_connection # :doc:\n uri = URI.parse(@config.host)\n @http = Net::HTTP.new(uri.host, uri.port, p_user = @config.proxy_user, p_pass = @config.proxy_pass)\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @http.use_ssl = @config.use_ssl\n if @config.ssl_verify_peer\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n @http.ca_file = @config.ssl_ca_file\n else\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n @http.open_timeout = @config.timeout\n @http.read_timeout = @config.timeout\n end", "def connect\n \t\t#Se sigue la convencion para la identificacion del usuario\n \t\t#y buscamos alusuario que se intenta conectar\n \t\tself.current_user = find_user\n \tend", "def init_client; end", "def setup\n open_session\n end", "def api_auth\n\t\tauth ::UApi\n\tend", "def initialize(username, password, sandbox = false, modern_endpoint = false)\n @modern_endpoint = modern_endpoint\n base_url = api_url sandbox\n conn = connection base_url\n\n response = conn.post do |req|\n set_auth_request_headers! req, username, password\n end\n\n case response.status\n when 200\n @auth_cookie = response.headers['set-cookie'].split(' ')[0]\n @connection = conn\n when 429\n sleep(Zuora::RETRY_WAITING_PERIOD)\n return initialize(username, password, sandbox, modern_endpoint)\n else\n raise Zuora::Rest::ConnectionError, response.body['reasons']\n end\n end", "def initialize\n ext_initialize\n @headers = {}\n @timeout = 5\n @connect_timeout = 1\n @max_redirects = 5\n @auth_type = :basic\n end", "def basic_auth(opts); end", "def set_no_auth\n FHIR.logger.info 'Configuring the client to use no authentication.'\n @use_oauth2_auth = false\n @use_basic_auth = false\n @security_headers = {}\n @client = RestClient\n @client.proxy = proxy unless proxy.nil?\n @client\n end", "def set_auth(uri, username = nil, password = nil)\n connection = Faraday.new url: uri, ssl: {verify: false} do |faraday|\n faraday.adapter http_engine\n faraday.proxy(ENV['http_proxy']) if ENV['http_proxy']\n end\n set_username_and_password connection, username, password if username\n connection\n end", "def create_openstack_connection\n Ankus::Openstack.new @credentials[:os_auth_url], @credentials[:os_username], @credentials[:os_password], @credentials[:os_tenant], @log, @mock\n end", "def connect\n self.current_user = find_verified_user # define current_user property once user sucessfully connected\n end", "def connect\n self.current_user = find_verified_user\n end", "def connect\n self.current_user = find_verified_user\n end", "def connect\n self.current_user = find_verified_user\n end", "def authenticate(request)\n return unless request['Authorization'].nil?\n\n confkey = credential_config_key\n\n token = config(\"#{confkey}.token\")\n user = config(\"#{confkey}.user\")\n pass = config(\"#{confkey}.password\")\n\n if token\n request['Authorization'] = \"token #{token}\"\n elsif user\n begin\n if $stdin.tty?\n pass = ask(\"Enter your password for #{api_url}: \") { |q| q.echo = '*' } if !pass\n else\n $stderr.puts \"STDIN not a TTY - cannot query for missing password.\"\n $stderr.puts \"Please add #{confkey}.password or #{confkey}.token to your gitconfig\"\n exit 1\n end\n rescue Interrupt\n warn \"attempting connection without authorization..\"\n return\n end\n request.basic_auth(user, pass)\n else\n $stderr.puts \"No currently configured username/password or token set for this API Provider.\"\n exit 1 unless $stdin.tty? && setup_credentials\n authenticate(request)\n end\n end", "def connection\n threaded[:connection] || raise('Please authenticate with GoodData.connect first')\n end", "def initialize(access_token)\n self.class.basic_auth access_token, nil\n end", "def connect\n unless connected?\n hostname = 'api.syncano.com'\n port = 8200\n\n sleep(3)\n\n Thread.new do\n begin\n EM.run do\n EM.connect(hostname, port, Syncano::SyncConnection)\n end\n rescue Exception => e\n p e.message\n p e.backtrace\n end\n end\n\n timeout = 30\n\n while connection.blank? && timeout > 0\n timeout -= 1\n sleep 1\n end\n\n raise ::Syncano::ConnectionError.new('Connection timeout') unless timeout > 0\n\n timeout = 300\n\n while (response = connection.get_response('auth')).blank? && timeout > 0\n timeout -= 1\n sleep 1.0/10.0\n end\n\n raise ::Syncano::ConnectionError.new(response.error) if response.status == 'NOK'\n end\n end", "def initialize(username, password)\n self.username = username\n self.password = password\n start_authentication_workflow\n end", "def initialize(username, password)\n @username = username\n @password = password\n @api_key = \"\"\n end", "def connect()\n # HTTP doesnt use a static connection, so there's really nothing to do then call the connect method of the Interface class:\n super()\n end", "def auth\n {:basic_auth => {:username => id, :password => password}}\n end", "def connect url, user = nil, pass = nil\n # WARNING do not use rewritten urls never ever...\n # url should be the base url so url/index.php url/api.php should be there\n @wiki_url = \"http://#{url}/api.php\"\n @client = Viziwiki::Mediawiki::API.new @wiki_url\n @client.log_in user, pass if @client and user and pass\n end", "def initialize(username=ENV['LOOMIO_USER'], password=ENV['LOOMIO_PASSWORD'])\n if !username || !password || !ENV['LOOMIO_GROUP_ID']\n raise ArgumentError, \"LOOMIO_USER, LOOMIO_PASSWORD, LOOMIO_GROUP_ID environment variables must be set\"\n end\n\n user = {user:{email:username,password:password}}\n security_response = self.class.post(@@base_uri + @@sessions_uri, body: user)\n puts(security_response.value) # raises error if the request failed\n\n # parse and set security cookies based on the post call\n @security_cookies = self.parse_set_cookie(security_response.headers['set-cookie'])\n self.class.default_cookies.add_cookies(@security_cookies)\n\n # set headers used for all requests\n @headers = {\n 'Content-Type': 'application/json'\n }\n end", "def auth\n end", "def auth\n end", "def create_authenticated_connection(options={})\n connect(options)\n server_cookies = options[:cookies]\n connection.merge_cookies!(server_cookies)\n connection.status = :logged_in\n connection\n end", "def initialize(user, password, application_name, host=\"192.168.0.8\", port=3790, mode='multiUser')\n @user = user\n @password = password\n @application_name = application_name\n @host = host\n @port = port\n @mode = mode\n @ticket = nil\n @soap_client = nil \n end", "def auth_setup\n service = Person::OmniauthService::SetupPhase.new(community: @current_community, params: params, request: request)\n service.run\n render :plain => \"Setup complete.\", :status => 404 #This notifies the ominauth to continue\n end", "def create_sesame_con\n @os_conn = EventMachine::HttpRequest.new($open_sesame_url)\n end", "def initialize( name, conn )\n @conn = conn\n # RestAuth >> Server: Bug #6\n # username owning properties is case-sensitive\n @name = name.downcase \n end", "def initialize_auth\n @conf[:use_user_pool_cache] = false\n end", "def authenticate\n raise Rackspace::NotInitialized unless self.initialized?\n headers = RestClient::Request.execute(:method => :get, :url => \"#{AUTH_URL}/#{self.api_version}\", :headers => {\"X-Auth-User\" => self.api_user, \"X-Auth-Key\" => self.api_key}, :raw_response => true).headers\n {:auth_token => headers[:x_auth_token], :storage_url => headers[:x_storage_url], :server_management_url => headers[:x_server_management_url], :cdn_management_url => headers[:x_cdn_management_url]}\n end", "def authenticate\n # :x_amee_source = \"X-AMEE-Source\".to_sym\n request = Typhoeus::Request.new(\"#{protocol}#{@server}/auth/signIn\", \n :method => \"post\",\n :verbose => DEBUG,\n :headers => {\n :Accept => content_type(:xml),\n },\n :body => form_encode(:username=>@username, :password=>@password)\n )\n\n hydra.queue(request)\n hydra.run\n response = request.response\n\n @auth_token = response.headers_hash['AuthToken']\n d {request.url}\n d {response.code}\n d {@auth_token}\n\n connection_failed if response.code == 0\n\n unless authenticated?\n raise AMEE::AuthFailed.new(\"Authentication failed. Please check your username and password. (tried #{@username},#{@password})\")\n end\n # Detect API version\n if response.body.is_json?\n @version = JSON.parse(response.body)[\"user\"][\"apiVersion\"].to_f\n elsif response.body.is_xml?\n @version = REXML::Document.new(response.body).elements['Resources'].elements['SignInResource'].elements['User'].elements['ApiVersion'].text.to_f\n else\n @version = 1.0\n end\n end", "def initialize username,password\n\t\t\t@api_url = \"http://api.zenfolio.com/api/1.7/zfapi.asmx\"\n\t\t\t@username = username\n\t\t\t@password = password\n\n\n\t\t\tconnection = ZenfolioAPI::HTTP.new()\n\t\t\t@response = connection.POST('AuthenticatePlain', [username, password])\n\t\t\t\n\t\t\t# Unable to authenticate the user. Return error code from server\n\t\t\traise ZenfolioAPI::ZenfolioAPIAuthenticationError, @response['error'] if !@response['error'].nil?\n\n\t\t\t@token = @response['result']\n\t\tend", "def connect\n @connection_manager.connect\n end", "def initialize\n @api_user = \"\"\n @api_key = \"\"\n end", "def setup_api\n if white_listed?(path)\n @api = Api.new\n return\n end\n\n email, password = http_basic_auth_info\n\n if !email.blank? and !password.blank?\n user = User.find_by_email(email)\n if user.password == password\n @api = Api.new(user)\n else\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n begin\n if current_user\n @api = Api.new(current_user)\n else\n render(:nothing => true, :status => :unauthorized)\n end\n rescue NameError\n @api = Api.new\n end\n end\n end", "def initialize(user, password)\n @user = user\n @password = password\n\n # In the constructor, try to authenticate and get the access_token and\n # client_id\n authenticate\n end", "def prepare\n # by default, do not push data (content entries and editable elements)\n self.parameters[:data] ||= false\n\n credentials = self.parameters.select { |k, _| %w(uri email password api_key).include?(k.to_s) }\n self.uri = credentials[:uri]\n\n begin\n Locomotive::Mounter::EngineApi.set_token(credentials)\n rescue Exception => e\n raise Locomotive::Mounter::WriterException.new(\"unable to get an API token: #{e.message}\")\n end\n end", "def authenticate(username, password)\n @client = Client.new username, password\n end", "def establish_connection(config=nil)\n super\n ensure_logger\n connection.connect\n # Make irb users happy with a 'true'\n true\n end", "def login\n @client = Octokit::Client.new(login: username, oauth_token: token)\n end", "def connection\n @options[:path] = API_VERSION2 + @options[:path]\n encoded_api_header = encode_header(@options)\n @options[:headers] = HEADERS.merge(X_Megam_HMAC => encoded_api_header[:hmac],\n X_Megam_DATE => encoded_api_header[:date], X_Megam_ORG => \"#{@org_id}\").merge(@options[:headers])\n @options[:headers] = @options[:headers].merge('X-Megam-PUTTUSAVI' => \"true\") unless (@password == \"\" || @password.nil?)\n Megam::Log.debug('HTTP Request Data:')\n Megam::Log.debug(\"> HTTP #{@options[:scheme]}://#{@options[:host]}\")\n @options.each do |key, value|\n Megam::Log.debug(\"> #{key}: #{value}\")\n end\n Megam::Log.debug('End HTTP Request Data.')\n if @options[:scheme] == 'https'\n @connection = Excon.new(\"#{@options[:scheme]}://#{@options[:host]}\", @options)\n else\n Excon.defaults[:ssl_verify_peer] = false\n @connection = Excon.new(\"#{@options[:scheme]}://#{@options[:host]}:9000\", @options)\n end\n @connection\n end", "def connect\n\n # Initialize the gem\n ShopifyAPI::Session.setup({api_key: @api_key, secret: @shared_secret})\n\n # Instantiate the session\n session = ShopifyAPI::Session.new(@url, @password)\n\n # Activate the Session so that requests can be made\n return ShopifyAPI::Base.activate_session(session)\n\n end", "def auth(username, password)\n @username, @password = username, password\n end", "def send_auth_request \n request = AuthorizeRequest.new(:get, action_to_call) do |req|\n req.request_params = params\n end\n request.send_request(Config.url)\n end", "def establish_connection(url, token)\n Faraday.new(url: url) do |faraday|\n faraday.request :json\n faraday.headers[\"Authorization\"] = token\n faraday.headers['Accept'] = 'application/json'\n faraday.response :json\n faraday.response :raise_error\n faraday.options.open_timeout = 2\n faraday.options.timeout = 100\n faraday.adapter Faraday.default_adapter\n end\n end" ]
[ "0.6731496", "0.67018193", "0.66278327", "0.65887547", "0.65502834", "0.6353731", "0.6318312", "0.630529", "0.62919354", "0.628642", "0.6220967", "0.6209995", "0.6208145", "0.6162073", "0.61418146", "0.61409074", "0.613969", "0.612585", "0.61213094", "0.6118448", "0.6112211", "0.6097645", "0.60942125", "0.60826516", "0.6067317", "0.6052241", "0.60477984", "0.6037762", "0.6017291", "0.5978659", "0.5976087", "0.59644437", "0.5960991", "0.59562993", "0.5950959", "0.59443337", "0.5936712", "0.59346104", "0.59308815", "0.59123075", "0.59001464", "0.5897744", "0.5897422", "0.58964586", "0.5894708", "0.58821493", "0.5870863", "0.5866549", "0.586295", "0.586295", "0.585599", "0.5855087", "0.58504134", "0.58466244", "0.5837336", "0.5832176", "0.58168226", "0.5816117", "0.5813174", "0.5800684", "0.5800327", "0.57968634", "0.5790025", "0.5784447", "0.5783456", "0.5783456", "0.5783456", "0.57734364", "0.5771594", "0.577001", "0.57604945", "0.57563365", "0.57554966", "0.5754155", "0.57536936", "0.57521594", "0.5751608", "0.5747094", "0.5747094", "0.57436097", "0.5741104", "0.57376146", "0.5729843", "0.57282335", "0.57215726", "0.57192034", "0.57159626", "0.5704147", "0.5703559", "0.5703498", "0.57021147", "0.5699793", "0.56849205", "0.5682423", "0.5673003", "0.56693876", "0.5664705", "0.565897", "0.5657267", "0.56571525", "0.5656208" ]
0.0
-1
Perform a GET request
def get(path, data={}) request(:get, path, data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "def get\n start { |connection| connection.request http :Get }\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def http( *args )\n p http_get( *args )\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n check_response( @httpcli.get(@endpoint) )\n end", "def perform_get(path, options = {})\n perform_request(:get, path, options)\n end", "def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end", "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "def get(url, headers={})\n do_request(\"get\", url, nil, headers)\n end", "def get endpoint\n do_request :get, endpoint\n end", "def get(url, args = {})\r\n make_request(:get, url, args)\r\n end", "def get(url='/', vars={})\n send_request url, vars, 'GET'\n end", "def _get\n http_method(:get)\n end", "def get(path)\n request 'GET', path\n end", "def get\n execute_request { faraday_connection.get(href || '') }\n end", "def get(*args)\n prepare_request(:get, args)\n @@client.add(:get, @path, *args)\n end", "def send_get(uri)\n _send_request('GET', uri, nil)\n end", "def get(path, options={})\n send_request 'get', path, options\n end", "def get(request)\n do_request(request) { |client| client.http_get }\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(uri, params = {})\n send_request(uri, :get, params)\n end", "def get(path, params, connection = CONNECTION)\n request = Net::HTTP::Get.new(to_url(path, params))\n process_request(request, connection)\nend", "def get\n\t\t\tself.make_request!({uri: self.to_uri, method: :get})\n\t\tend", "def get(url, headers = {})\n request(:get, url, headers)\n end", "def get(url, headers = {})\n request(:get, url, headers)\n end", "def get(url)\n request(:get, url, {}, nil)\n end", "def get(path, params = {})\n\t\trequest(path, :get, params)\n\tend", "def get(path, params = {}, request_options = {})\n request(:get, path, params)\n end", "def get(resource, **params)\n\n execute(Net::HTTP::Get, 'GET', resource, **params)\n\n end", "def get(params)\n request.method = :get\n execute(params)\n end", "def get(uri)\r\n request(Net::HTTP::Get.new(uri)) \r\n end", "def get(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Add parameters to URL query string\n get_params = {\n :method => \"get\", \n :verbose => DEBUG\n }\n get_params[:params] = data unless data.empty?\n # Create GET request\n get = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", get_params)\n # Send request\n do_request(get, format, :cache => true)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path)\n request(:get, path, {})\n end", "def get(path)\n req = Net::HTTP::Get.new(@base_url + path)\n response = handle_request(req)\n response.each {|k,v| puts \"#{k}: #{v}\"}\n response\n end", "def get\n @response = Net::HTTP.get_response(URI(@url))\n end", "def get_request(path, params={}, options={})\n request(:get, path, params, options)\n end", "def get(path, data=nil)\n request(:get, path, data)\n end", "def get(path, query_params={}, opts={})\n request(:get, path, query_params, opts)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def make_get_request url, headers = []\n make_request url, headers: headers\n end", "def get(url); end", "def get(url, headers={})\n RestClient.get url, headers\n end", "def get()\n return @http.request(@req)\n end", "def get(path, query={})\n request.get(path, query_options(query))\n end", "def get(path, options = {})\n request = Net::HTTP::Get.new(request_uri(path))\n make_request(request, options.merge(no_callbacks: true))\n end", "def get(uri, request_headers)\n request('get', uri, request_headers)\n end", "def get\n url = prefix + \"get\" + id_param\n return response(url)\n end", "def get url\n url = URI url\n request = HTTP::Get.new url.path\n\n dispatch request, to: url\n end", "def get(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end", "def get(path, arguments = {})\n perform_request { connection.get(path, arguments).body }\n end", "def get path, header={}, body_string_or_hash=\"\"\n env.http 'GET', path, header, body_string_or_hash\n end", "def get(options = {}, all = true)\n uri = URI.parse(request_path(options, all))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n puts \"Request URL (GET) is #{uri.request_uri}\" \n\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n response.body\n end", "def get(params={})\n rpc_call :get, params\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(path:, params: {})\n request(method: :get, path: path, params: params)\n end", "def get(path: nil, headers: {}, query: {}, auth_method: nil)\n execute(method: :get, path: path, query: query, headers: headers, auth_method: auth_method)\n end", "def get\n execute(:get)\n end", "def get\n execute(:get)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(uri, query = {}, &block) \n request(:get, uri, query, &block)\n end", "def get(path, query = {})\n make_call(mk_conn(path), :get, nil, query)\n end", "def get(*args)\n execute(:get, *args)\n end", "def get_request\n # Use our @http_object object's request method to call the\n # Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def get_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def get(params = {})\n request! do\n api[url.path + to_query(params)].get(API_HEADERS)\n end\n end", "def get url\n RestClient::Request.execute(:method => :get, :url => url, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def get(path, params={})\n RestClient.get request_base+path, {params: params}\n end", "def get(path, options = {}, &block)\n execute('GET', path, options, nil, &block)\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end", "def get(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :get,\n :url => \"#{self.uri}#{path}\",\n :headers => {\n :params => params\n },\n :verify_ssl=> @ssl_verify )\n end", "def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def get(url, params={})\n @agent.get(url,params)\n end", "def http_get(path, query, format = :json)\n uri = URI.parse(\"http://#{Jamendo::API_SERVER}/v#{Jamendo::API_VERSION}/#{path}#{query}\")\n puts uri.request_uri\n http = Net::HTTP.new(uri.host, uri.port) \n request = Net::HTTP::Get.new(uri.request_uri)\n begin\n response = http.request(request)\n result = parse_response(response)\n assert_response(result[:headers])\n return result[:results]\n rescue JamendoError => e\n e.inspect\n end\n end", "def get(path, options = {}, raw = false)\n request(:get, path, options, raw)\n end", "def get(url)\n call(url: url)\n end", "def get(path, params = {})\n execute :get, path, params\n end", "def http_method\n :get\n end", "def get(url, headers: {}, params: {}, options: {}, &block)\n url = encode_query(url, params)\n\n request = Net::HTTP::Get.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options, &block)\n end", "def do_get(uri = \"\", query = {})\n url_query = query.size > 0 ? \"?\" + query.map {|k, v| \"#{k}=#{v}\"}.join(\"&\") : \"\"\n @connection.get(uri + url_query)\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase connection\", \"Error trying to send a GET to #{uri + url_query}\"\n Faraday::Response.new\n end", "def get(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpGetWithEntity, url, options, &block\n end" ]
[ "0.8152758", "0.806111", "0.80539304", "0.79784244", "0.79784244", "0.7838251", "0.78354996", "0.78354996", "0.77927583", "0.77892256", "0.77778345", "0.77611405", "0.7745449", "0.77164996", "0.7672968", "0.7661916", "0.7595133", "0.75779617", "0.7576617", "0.756813", "0.75558615", "0.75547063", "0.75372565", "0.75173664", "0.75173664", "0.75173664", "0.75173664", "0.75173664", "0.75173664", "0.75173664", "0.75173664", "0.75173664", "0.75173664", "0.75158966", "0.7495489", "0.7494895", "0.74948907", "0.74724084", "0.7471998", "0.7471998", "0.7471717", "0.74600947", "0.7457992", "0.7455556", "0.74543", "0.74491847", "0.74382365", "0.7419233", "0.7419233", "0.7412056", "0.74081594", "0.7408027", "0.74046826", "0.73962337", "0.7387325", "0.7378454", "0.7378454", "0.73762333", "0.7362981", "0.7343502", "0.733776", "0.73325723", "0.7323588", "0.7318521", "0.7316829", "0.7314816", "0.73083514", "0.7304097", "0.73024976", "0.72868204", "0.7271466", "0.72514707", "0.72514707", "0.7236193", "0.72276026", "0.72251093", "0.72251093", "0.72199607", "0.72199607", "0.7217836", "0.72165215", "0.7209149", "0.72000545", "0.71890295", "0.7185753", "0.71814674", "0.7171742", "0.7170823", "0.7167022", "0.7166726", "0.71662605", "0.71624076", "0.7161158", "0.71605223", "0.71495515", "0.7147114", "0.7139737", "0.7138134", "0.7131461", "0.7126656" ]
0.73742414
58
Perform a POST request
def post(path, data={}) request(:post, path, data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_post_request url, body, headers = []\n make_request url, method: ::Rack::POST, body: body, headers: headers\n end", "def post\n resource.post(request, response)\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end", "def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end", "def post url, body, headers = {}\n http_request(url, Net::HTTP::Post, body, headers)\n end", "def post()\n return @http.request(@req)\n end", "def post(url, headers, body)\n request(:post, url, headers, body)\n end", "def post(request)\n do_request(request) { |client| client.http_post request.body }\n end", "def post(*args)\n request(:post, *args)\n end", "def post(params = nil)\n request.method = :post\n execute(params)\n end", "def post(url, body, headers = {})\n do_request Net::HTTP::Post, url, headers, body\n end", "def post url, object = nil\n request url, HTTP::Post, object\n end", "def post(*args)\n request :post, *args\n end", "def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def post(data = {})\n call data, method: :post\n end", "def POST; end", "def post(*args)\n Request.post(*args)\n end", "def post(uri, request_headers, body)\n request('post', uri, request_headers, body)\n end", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def post(url, args = {})\r\n make_request(:post, url, args)\r\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend", "def do_request\n\t\t\tself.response = post_request(options)\n\t\tend", "def post(request)\n _request(request) { |client, options| client.post options }\n end", "def perform_post(path, options = {})\n perform_request(:post, path, options)\n end", "def post!\n self.https.request self.http_request # Net::HTTPResponse object\n end", "def post(path, options={})\n request :post, path, options\n end", "def post\n uri = URI.parse(self.url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.open_timeout = 10\n http.read_timeout = 10\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n data = self.params.collect { |k, v| \"#{k}=#{CGI.escape(v.to_s)}\" }.join(\"&\")\n Freemium.log_test_msg(\"POST\\n url: #{self.url}\\n query: #{data}\")\n http.post(uri.request_uri, data).body\n end", "def post_request(url,args)\n uri = URI.parse(url)\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(args)\n request(uri,req)\n end", "def post(request)\n request.method = :post\n request.call\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, query_params={}, opts={})\n request(:post, path, query_params, opts)\n end", "def post(url, body = {})\n call(url: url, action: :post, body: body)\n end", "def post(url, data, headers = {})\n request(:post, url, headers, :data => data)\n end", "def post(path, params)\n request(:post, path, params)\n end", "def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end", "def post(path, options={})\n send_request 'post', path, options\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, data, params = {}, request_options = {})\n request(:post, path, data, params)\n end", "def post(uri, params = {})\n send_request(uri, :post, params)\n end", "def exec_post(req, data, exit_on_fail = false)\n response_hash = exec_api_call('POST', req, data, exit_on_fail)\n response_hash[:response]\n end", "def api_post(action, data)\n api_request(action, data, 'POST')\n end", "def post(path:, params: {})\n request(method: :post, path: path, params: params)\n end", "def post(url, req_hash={})\n res = nil\n res = perform_op(:post, req_hash) do\n res = @wrapper.post(url, req_hash)\n end\n return res\n end", "def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end", "def post query=nil, content_type='application/x-www-form-urlencoded'\n\t\treq = Net::HTTP::Post.new(@uri.path)\n\n\t\treq.body= make_query query if query\n\t\treq.content_type=content_type if query\n\t\treq.content_length=query ? req.body.length : 0\n\n\t\tdo_http req\n\tend", "def post(path, **args); end", "def post!\n request! :post\n end", "def post(options = {})\n url = build_url(options)\n ret = post_response(url, options)\n ret\n end", "def post(path, headers, body, &callback)\n request('POST', path, headers, body, &callback)\n end", "def post(payload)\n post_like payload, Net::HTTP::Post.new(@uri.path)\n end", "def http_post(uri, data)\n RestClient.post uri, data\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post\n Rentlinx.client.post(self)\n end", "def post; end", "def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def do_post(uri = \"\", body = \"\")\n @connection.post do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase do_post\", \"Error trying to send a POST to #{uri}\"\n $lxca_log.error \"XClarityClient::XclarityBase do_post\", \"Request sent: #{body}\"\n Faraday::Response.new\n end", "def post(path, **options)\n execute :post, path, options\n end", "def post(path, params={})\n RestClient.post request_base+path, params\n end", "def post method, params={}\n Request.new(self, :post, method, params)\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def post(action, params={}, options={})\n request(:post, action, params, options)\n end", "def http_post_request\n begin\n return http_client.post(http_path_query, compressed_request, http_headers)\n rescue APIKeyError\n log 'error - you must set your api_key.'\n rescue TimeoutError\n log 'fail - timeout while contacting the api server.'\n rescue Exception => e\n log \"fail - exception raised during http post. (#{e.class.name}: #{e.message})\"\n end\n nil\n end", "def post\r\n end", "def post(object, url, headers={})\n do_request(\"post\", url, object, headers)\n end", "def post_http(args)\n\t\t return(Net::HTTP.post_form @uri, args)\t\t\t\n \tend", "def post(path, data=nil)\n request(:post, path, data)\n end", "def post(url, options = {}, &block)\n request HttpPost, url, options, &block\n end", "def post(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end", "def POST(data=nil)\n\n if not data.nil? #if request data passed in, use it.\n @data = data\n end\n\n uri = URI(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n if @set_cert_file\n http = set_cert_file(http)\n end\n request = Net::HTTP::Post.new(uri.path)\n request.body = @data\n request.basic_auth(@user_name, @password)\n\n response = http.request(request)\n return response\n end", "def post\n request_object.post_query\n end", "def post(url, body, headers)\n conn = create_connection_object(url)\n\n http = conn.post(:body => body,\n :head => add_authorization_to_header(headers, @auth))\n\n action = proc do\n response = Response.new(http.response.parsed, http)#.response.raw)\n yield response if block_given?\n end\n\n http.callback &action\n http.errback &action \n end", "def post(url, params = {})\n client.post(url, params).body\n end", "def post(data = \"\")\n submit :Post, data\n end", "def post(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'post'}.merge(authentication))\n end", "def post(path, query_string, data)\n # ...and delegate to the Faraday connection we created on initilization\n @conn.post \"#{path}?#{query_string}\", data\n end", "def post(params)\n self.class.post(url, body: params)\n end", "def post(path, params = nil)\n response = @connection.post do |req|\n req.headers = generate_headers\n req.url path\n req.body = params.to_json\n end\n Arke::Log.fatal(build_error(response)) if response.env.status != 201\n response\n end", "def post(path, arguments = {})\n perform_request { connection.post(path, arguments).body }\n end", "def post(path, opts = {})\n request(:post, path, opts).body\n end", "def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end", "def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend", "def post(path, options={}, format=format)\n request(:post, path, options, format)\n end", "def post_request(uri, body, token = nil, manage_errors = true)\n request = Net::HTTP::Post.new(uri.request_uri, initheader = build_headers(token))\n request.body = body.to_json\n return do_request(uri, request, manage_errors) \n end", "def post(path, payload)\n req = Net::HTTP::Post.new(path)\n action(req, payload)\n end", "def send_post_request(url, payload, content_type = 'application/json')\n # set the uri\n url = URI(url)\n\n # set http settings\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # set request\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = content_type\n request[\"cache-control\"] = 'no-cache'\n\n # set the payload\n request.body = payload\n\n # send the request and get whatever is the response\n response = http.request(request)\n\n # return the response by reading the body\n return response.read_body\n end", "def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend", "def post(path, data = { }, query = { }, headers = { })\n clear_response\n path = process_path(path, query)\n @success_code = 201\n @response = http.post(path, data, headers)\n parse_response? ? parsed_response : response.body\n end" ]
[ "0.79024845", "0.7838824", "0.7816926", "0.77099574", "0.77091825", "0.7653466", "0.7597337", "0.7544226", "0.74662435", "0.74489796", "0.7427801", "0.74234486", "0.74013907", "0.7383522", "0.7363137", "0.73415595", "0.73223567", "0.7313033", "0.73035455", "0.7267529", "0.7263426", "0.72531545", "0.72531545", "0.72531545", "0.72083604", "0.7207918", "0.72000587", "0.7188021", "0.7186725", "0.7165166", "0.71634114", "0.7160558", "0.71601063", "0.71447533", "0.7143934", "0.71313924", "0.7130805", "0.71304256", "0.7124081", "0.7111498", "0.7110942", "0.7110942", "0.7110942", "0.7110942", "0.7110942", "0.7103515", "0.7102677", "0.7071654", "0.7067843", "0.7053066", "0.7044079", "0.70276684", "0.702539", "0.7023155", "0.7018971", "0.70118403", "0.700193", "0.70000887", "0.6983632", "0.6981588", "0.6981588", "0.6981588", "0.69795984", "0.69785815", "0.6973085", "0.69653726", "0.69653726", "0.69653726", "0.6949192", "0.694861", "0.6945002", "0.69403845", "0.6934657", "0.6929979", "0.6926715", "0.6921526", "0.6918056", "0.6913684", "0.6911986", "0.6911219", "0.6906505", "0.6899146", "0.68960303", "0.6892548", "0.68911874", "0.68852675", "0.6875735", "0.6874159", "0.68675715", "0.6863077", "0.6858127", "0.6847592", "0.6844472", "0.68441004", "0.6841665", "0.68394935", "0.68390775", "0.683041", "0.6827955", "0.6823461" ]
0.7108902
45
Perform a PUT request
def put(path, data={}) request(:put, path, data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(*args)\n request :put, *args\n end", "def put!\n request! :put\n end", "def put(*args)\n request(:put, *args)\n end", "def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def put(path, options={})\n request :put, path, options\n end", "def put url, object = nil\n request url, HTTP::Put, object\n end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def put(url, vars={})\n send_request url, vars, 'PUT'\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(url, body = {})\n call(url: url, action: :put, body: body)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def put(path, options={})\n send_request 'put', path, options\n end", "def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def put(object, url, headers={})\n do_request(\"put\", url, object, headers)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def do_put(uri = '', body = '')\n build_request(:put, uri, body)\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def put(request)\n request.method = :put\n request.call\n end", "def put(path, options = {}, raw = false)\n request(:put, path, options, raw)\n end", "def put options\n rest_request({ method: :put }.merge(options))\n end", "def put options\n rest_request({ method: :put }.merge(options))\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "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", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "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", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end", "def put(uri, params = {})\n send_request(uri, :put, params)\n end", "def put(path, options={}, raw=false)\n request(:put, path, options, raw)\n end", "def put(path, options={}, format=format)\n request(:put, path, options, format)\n end", "def put(path, params)\n request(:put, path, params)\n end", "def put(request)\n _request(request) { |client, options| client.put options }\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body)\n end", "def put(path, body = '', headers = {})\n with_auth { request(:put, path, body.to_s, build_request_headers(headers, :put, build_uri(path))) }\n end", "def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end", "def put(request)\n do_request(request) { |client| client.http_put request.body }\n end", "def put(path, options = {})\n request(:put, parse_query_and_convenience_headers(path, options))\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def raw_put(path, body, options = {})\n # Allow format override\n format = options.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Create PUT request\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", \n :verbose => DEBUG,\n :method => \"put\",\n :body => body,\n :headers => { :'Content-type' => options[:content_type] || content_type(format) }\n )\n # Send request\n do_request(put, format)\n end", "def put(path, body: {}, headers: nil)\n response = conn.put do |req|\n build_request(req, path: path, body: body, headers: headers)\n end\n puts response.body\n response.body unless response.blank?\n end", "def put(path, parameters = {})\n request(:put, path, parameters)\n end", "def put(resource, **params)\n\n execute(Net::HTTP::Put, 'PUT', resource, **params)\n\n end", "def do_put(uri = \"\", body = \"\")\n @connection.put do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase do_put\", \"Error trying to send a PUT to #{uri}\"\n $lxca_log.error \"XClarityClient::XclarityBase do_put\", \"Request sent: #{body}\"\n Faraday::Response.new\n end", "def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end", "def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put(path, params)\n parse_response @client[path].put(params)\n end", "def put(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Put.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end", "def put(path: nil, payload:, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :put,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\n end", "def put(path, headers = {})\n process :put, path, headers\n end", "def put(path, request_options = {}, resource_options = {})\n response(:put, resource(resource_options)[path], request_options)\n end", "def put method, params={}\n Request.new(self, :put, method, params)\n end", "def put(path, options={})\n response = request(path, :put, options)\n validate response\n responsed_response = parse response\n data = { headers: response.headers, body: parsed_response }\n end", "def make_put_request(url, data)\n headers = {\n \"Content-Type\" => \"application/json\",\n }\n\n response = HTTParty.put(url, body: data.to_json, headers: headers)\n\n if response.success?\n response\n else\n puts \"Request failed with response code: #{response.code}\"\n puts \"Response message: #{response.message}\"\n nil\n end\nend", "def put(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = self.no_response_wrapper, signed = sign_requests)\n request(:put, path, options, signature, raw, unformatted, no_response_wrapper, signed)\n end", "def put(url, options = {}, &block)\n run! Request.new(url, :put, options.slice(:headers, :params, :payload), &block)\n end", "def put(path, **options)\n execute :put, path, options\n end", "def put(url, payload, headers={})\n RestClient.put url, payload, headers\n end", "def put(path, params = {}, env = {}, &block)\n env[:request_method] = \"PUT\"\n mock_request(path, params, env, &block)\n end", "def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def put(url, options = {}, &block)\n request HttpPut, url, options, &block\n end", "def put(path, data = {})\n self.class.put path, :body => data.merge(:u => access_token)\n end", "def request_put(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"PUT\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def put(*args, &block)\n self.client.put *args\n end", "def put(url, payload = {}, headers = {})\n http :put, \"#{url}.json\", payload.to_json, headers\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def put(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :put, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end", "def do_PUT(req, res)\n perform_proxy_request(req, res) do |http, path, header|\n http.put(path, req.body || '', header)\n end\n end", "def put(path, payload)\n req = Net::HTTP::Put.new(path)\n action(req, payload)\n end", "def perform_put_with_object(path, options, klass)\n perform_request_with_object(:put, path, options, klass)\n end", "def put(*args)\n execute(:put, *args)\n end", "def put(action, params={}, options={})\n request(:put, action, params, options)\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def put(url, payload, headers: {}, options: {})\n request_with_payload(:put, url, payload, headers, options)\n end", "def put(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:put, url, payload, headers)\n end" ]
[ "0.82389766", "0.81615865", "0.8139411", "0.80490917", "0.8022917", "0.79202795", "0.78235656", "0.7817625", "0.779413", "0.77594733", "0.77217585", "0.7713028", "0.77125263", "0.76946163", "0.76946163", "0.76928", "0.76903844", "0.76903844", "0.76903844", "0.7686401", "0.7686401", "0.7686401", "0.7686401", "0.7686401", "0.7686401", "0.7686401", "0.7686401", "0.7684779", "0.7682536", "0.7680887", "0.7678755", "0.76740885", "0.7653248", "0.7648987", "0.7648987", "0.76334757", "0.76334757", "0.76288676", "0.7616578", "0.7614374", "0.76086533", "0.7606133", "0.7606133", "0.7604389", "0.7602717", "0.76025444", "0.76025087", "0.75952387", "0.75814337", "0.75811136", "0.75706214", "0.7561371", "0.75451976", "0.75414556", "0.75269854", "0.75269854", "0.75209177", "0.75163245", "0.74770766", "0.74726427", "0.7471056", "0.74415386", "0.74268234", "0.74001896", "0.7399607", "0.7371217", "0.7367338", "0.73535144", "0.73506415", "0.73506415", "0.7306642", "0.7293694", "0.72792596", "0.7277911", "0.72709507", "0.72575617", "0.7256071", "0.7211557", "0.7211368", "0.7186659", "0.7182299", "0.71681994", "0.7152834", "0.7146671", "0.7136787", "0.71354806", "0.713426", "0.7129521", "0.7128662", "0.7111379", "0.71084213", "0.71043396", "0.7103046", "0.7086025", "0.70748764", "0.70679677", "0.7066317", "0.70632863", "0.70530087", "0.7045735" ]
0.76078635
41
Perform a DELETE request
def delete(path, data={}) request(:delete, path, data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n request(:delete)\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def do_delete(uri = '')\n build_request(:delete, uri)\n end", "def delete(*args)\n request(:delete, *args)\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete!\n request! :delete\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete(path, params = {}, request_options = {})\n request(:delete, path, params)\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete\n request('delete').auth_required!\n end", "def delete(url)\n do_request(\"delete\", url)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def delete(*args)\n Request.delete(*args)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(url, vars={})\n send_request url, vars, 'DELETE'\n end", "def delete\n api(\"Delete\")\n end", "def delete(uri, params = {})\n send_request(uri, :delete, params)\n end", "def delete(uri)\r\n request(Net::HTTP::Delete.new(uri)) \r\n end", "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def delete(request)\n _request(request) { |client, options| client.delete options }\n end", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def delete(uri, request_headers)\n request('delete', uri, request_headers)\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def delete(request)\n request.method = :delete\n request.call\n end", "def deleteRequest\n\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def delete(url, headers = {})\n request(:delete, url, headers)\n end", "def delete(url, headers = {})\n request(:delete, url, headers)\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def delete(path)\n request(:delete, path)\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\n end", "def delete(uri, options = {})\n build_response(request.delete(uri, build_request_options({:input => options.to_params})))\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def delete(uri = nil)\n requestor(Net::HTTP::Delete.new(build_uri(uri)))\n end", "def delete options\n rest_request({ method: :delete }.merge(options))\n end", "def delete options\n rest_request({ method: :delete }.merge(options))\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 perform_delete(path, options = {})\n perform_request(:delete, path, options)\n end", "def delete(path, query={})\n request.delete(path, query_options(query))\n end", "def delete\n api_client.delete(url)\n end", "def delete(obj_or_request)\n Connection.new.delete get_request(obj_or_request)\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 delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end", "def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end", "def send_delete_request(path)\n response = self.class.delete(path)\n # need auth\n case (response.code)\n when 200\n # just continue\n when 401\n authenticate(response)\n response = self.class.delete(path)\n else\n end\n if response.code != 200 && response.code != 202\n throw \"Could not finish request, status #{response.code}\"\n end\n response\n end", "def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end", "def delete(path)\n request(:delete, path)\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 delete(uri, options = {})\n execute(uri, :delete, options)\n end", "def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end", "def delete(url, headers: {}, params: {}, options: {})\n url = encode_query(url, params)\n\n request = Net::HTTP::Delete.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options)\n end", "def delete(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpDeleteWithEntity, url, options, &block\n end", "def delete(path, options = {})\n request = Net::HTTP::Delete.new(request_uri(path))\n make_request(request, options.merge(no_callbacks: true))\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete(resource, **params)\n\n execute(Net::HTTP::Delete, 'DELETE', resource, **params)\n\n end", "def delete(url)\n call(url: url, action: :delete)\n end", "def delete(path, options={})\n send_request 'delete', path, options\n end", "def delete(path, opts = {})\n request(:delete, path, opts).body\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def delete\n execute_request { faraday_connection.delete }\n end", "def delete(url, headers: {}, options: {})\n request_without_payload(:delete, url, headers, options)\n end", "def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end", "def delete(path, payload = nil)\n req = Net::HTTP::Delete.new(path)\n action(req, payload)\n end", "def delete(path, query = { }, headers = {})\n clear_response\n path = process_path(path, query)\n @success_code = 204\n @response = http.delete(path, headers)\n parse_response? ? parsed_response : response.body\n end" ]
[ "0.8536471", "0.8378405", "0.83550817", "0.83550817", "0.8323079", "0.82867426", "0.82867426", "0.82253987", "0.81852996", "0.8145603", "0.8133176", "0.81054914", "0.81054914", "0.81054914", "0.81054914", "0.8067572", "0.7978741", "0.790326", "0.7859588", "0.7848933", "0.7820752", "0.78125507", "0.7808112", "0.7806505", "0.77755266", "0.77755266", "0.77755266", "0.77755266", "0.77755266", "0.77755266", "0.77755266", "0.7771241", "0.7767018", "0.7755909", "0.7743135", "0.7743135", "0.7737196", "0.7735432", "0.7735432", "0.7735432", "0.7730646", "0.7700959", "0.7700511", "0.76926225", "0.7688697", "0.76781213", "0.76704633", "0.7655258", "0.7653685", "0.76532054", "0.76436794", "0.76002926", "0.7599317", "0.7595053", "0.75801814", "0.7579905", "0.7570216", "0.7570094", "0.7558376", "0.7558376", "0.7542426", "0.75351995", "0.7534616", "0.7515525", "0.75121325", "0.7511428", "0.7502032", "0.7494248", "0.74886954", "0.7482391", "0.7478517", "0.7478517", "0.7476322", "0.7476206", "0.74579304", "0.74563086", "0.7451709", "0.74405336", "0.7437538", "0.74375004", "0.7415724", "0.7413878", "0.74112374", "0.7396375", "0.73960346", "0.7382246", "0.7381897", "0.7370826", "0.73677075", "0.7353765", "0.7351833", "0.734793", "0.7339778", "0.7338482", "0.7330376", "0.7308296", "0.7292441", "0.7289394", "0.72830564", "0.72816426" ]
0.75565785
60
Perform a HEAD request
def head(path, data={}) request(:head, path, data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head(path)\n request 'HEAD', path\n end", "def http_head(uri)\n http(uri, :http_method => 'head')\n end", "def http_head\n return @head if defined?(@head)\n begin\n @head = conn.request(http_request(:head, resource[:source]))\n fail \"#{resource[:http_verb].to_s.upcase} #{resource[:source]} \" +\n \"returned #{@head.code}\" unless @head.code == '200'\n rescue Exception => e\n fail \"Failed to fetch file: #{resource[:source]} - #{e.message}\"\n end\n @head\n end", "def head(path,headers={})\n request(:head,path,headers)\n end", "def head(url, headers = {})\n request(:head, url, headers)\n end", "def head(url, headers = {})\n request(:head, url, headers)\n end", "def head\n options, subprocess_options = self.options\n options.unshift(\"-I\")\n options << @source\n\n @logger.info(\"HEAD: #{@source}\")\n result = execute_curl(options, subprocess_options)\n result.stdout\n end", "def head(query_url,\r\n headers: {})\r\n HttpRequest.new(HttpMethodEnum::HEAD,\r\n query_url,\r\n headers: headers)\r\n end", "def head(path, headers = {})\n request(:head, path, build_request_headers(headers, :head))\n end", "def head!\n request! :head\n end", "def http_head(url, options={}, &block)\n return FeedTools::RetrievalHelper.http_request(\n :head, url, options, &block)\n end", "def test_head_collection\n request = Http::Request.new('HEAD', '/dir')\n response = self.request(request)\n\n assert_equal(200, response.status)\n end", "def head(request)\n do_request(request) { |client| client.http_head }\n end", "def head(path, headers = {})\n with_auth { request(:head, path, nil, build_request_headers(headers, :head, build_uri(path))) }\n end", "def head(path, options = {})\n options = options.merge(:head => true) # No parsing!\n execute('HEAD', path, options)\n end", "def head(url, headers: {}, params: {}, options: {})\n url = encode_query(url, params)\n\n request = Net::HTTP::Head.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options)\n end", "def http_head_with_tingyun(*args, &blk)\n self._ty_http_verb = :HEAD\n http_head_without_tingyun(*args, &blk)\n end", "def head(url, options = {}, &block)\n run! Request.new(url, :head, options.slice(:headers, :params, :payload), &block)\n end", "def head(request)\n _request(request) { |client, options| client.head options }\n end", "def head(request, response)\n OK\n end", "def head(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpHead, url, options, &block\n end", "def head(url, headers: {}, options: {})\n request_without_payload(:head, url, headers, options)\n end", "def head(path, options={})\n url = build_url path, options\n headers = options[:headers] || {}\n Response.new(@client[url].head headers)\n rescue RestClient::Exception => e\n Response.new e.response\n end", "def head(url, params={}, headers={}, http_options=@options)\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n # add URL parameters\n uri.query = URI.encode_www_form(params)\n\n @logger.debug(\"HEAD #{uri} #{headers.inspect}\")\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Head.new(uri.request_uri, headers)\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n if redirect_limit == -1\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n head(response['location'], params, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n KineticHttpResponse.new(response)\n elsif gateway_retries == 0\n @logger.info(\"HTTP response: #{response.code} #{response.message}\") unless @logger.debug?\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n @logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n head(url, params, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n @logger.info(\"HTTP response code: 0\") unless @logger.debug?\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n KineticHttpResponse.new(e)\n else\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n @logger.info(\"HTTP bad response: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n rescue StandardError => e\n @logger.info(\"HTTP error: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n end\n end", "def head query = nil\n\t\tif (query = make_query query)\n\t\t\[email protected] = @uri.query ? @uri.query+\"&\"+query : query\n\t\tend\n\t\tfull_path = @uri.path + (@uri.query ? \"?#{@uri.query}\" : \"\")\n\t\t\t\n\t\treq = Net::HTTP::Head.new(full_path)\n\t\t# puts Net::HTTP::Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pwd).get(@uri)\n\t\tdo_http req\n\tend", "def HEAD()\n self.class.open @dir, \"HEAD\"\n end", "def head(path = \"\", &handler)\n route(\"HEAD\", path, handler)\n end", "def head\n \"HEAD\"\n end", "def head(path, headers = {})\n process :head, path, headers\n end", "def head\n self.class.head(url)\n end", "def http_head(request, response)\n # This is implemented by changing the HEAD request to a GET request,\n # and dropping the response body.\n sub_request = request.clone\n sub_request.method = 'GET'\n\n begin\n @server.invoke_method(sub_request, response, false)\n response.body = ''\n rescue Exception::NotImplemented => e\n # Some clients may do HEAD requests on collections, however, GET\n # requests and HEAD requests _may_ not be defined on a collection,\n # which would trigger a 501.\n # This breaks some clients though, so we're transforming these\n # 501s into 200s.\n response.status = 200\n response.body = ''\n response.update_header('Content-Type', 'text/plain')\n response.update_header('X-Sabre-Real-Status', e.http_code)\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def head\n \"HEAD\"\n end", "def head\n if(resource.exist?)\n response['Etag'] = resource.etag\n response['Content-Type'] = resource.content_type\n response['Last-Modified'] = resource.last_modified.httpdate\n OK\n else\n NotFound\n end\n end", "def head(url, params={}, headers={}, http_options={})\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n # add URL parameters\n uri.query = URI.encode_www_form(params)\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Head.new(uri.request_uri, headers)\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n # handle 302\n when Net::HTTPRedirection then\n if redirect_limit == -1\n HttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n head(response['location'], params, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n HttpResponse.new(response)\n elsif gateway_retries == 0\n Kinetic::Platform.logger.info(\"HTTP response: #{response.code} #{response.message}\")\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n Kinetic::Platform.logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n head(url, params, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n Kinetic::Platform.logger.info(\"HTTP response code: 0\")\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n HttpResponse.new(e)\n else\n Kinetic::Platform.logger.info(\"HTTP response code: #{response.code}\")\n HttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n Kinetic::Platform.logger.info(\"HTTP bad response: #{e.inspect}\")\n HttpResponse.new(e)\n rescue StandardError => e\n Kinetic::Platform.logger.info(\"HTTP error: #{e.inspect}\")\n HttpResponse.new(e)\n end\n end", "def get_head(project)\n get(\"/projects/#{project}/HEAD\")\n end", "def head(uri, options = T.unsafe(nil)); end", "def head_and_get(path, codes = [200], params = {})\n url_to_get = url(path)\n head_params = (params[:head] || {}).merge(head_or_get_params)\n\n head_res = NS::Browser.forge_request(url_to_get, head_params).run\n\n codes.include?(head_res.code) ? NS::Browser.get(url_to_get, params[:get] || {}) : head_res\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def handle_head(env)\n status, headers, body = *yield\n headers['Content-Length'] = body.sum(&:bytesize).to_s\n [status, headers, env['REQUEST_METHOD'].casecmp('head').zero? ? [] : body]\n end", "def getHTTPHdrs(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n request = Net::HTTP::Head.new(uri.request_uri)\n http.request(request)\nend", "def head?\r\nHTTP_METHOD_LOOKUP[request_method] == :head\r\nend", "def head_request(request_data = {}, errback = DEFAULT_ERROR, &blk)\n req = create_test_request(request_data).head(request_data)\n hookup_request_callbacks(req, errback, &blk)\n end", "def write_head(method, output, options={})\n headers = {\n \"User-Agent\" =>\n \"retrieve/#{Retrieve::VERSION::STRING} (#{RUBY_PLATFORM})\",\n \"Accept\" => \"*/*\"\n }.merge(options[:headers] || {})\n\n # We always need these headers.\n headers[\"Host\"] = @normalized_uri.authority\n if options[:body]\n headers[\"Content-Length\"] = options[:body].bytesize\n end\n\n if options[:connections] && !headers[\"Connection\"]\n # We've been passed a connections hash, so keep the connections\n # alive.\n headers[\"Connection\"] = \"Keep-Alive\"\n end\n\n if options[:range]\n if !options[:range].kind_of?(Range)\n raise TypeError, \"Expected Range, got #{options[:range].class}.\"\n end\n if options[:range].last < -1 ||\n (options[:range].exclude_end? && options[:range].last <= -1)\n raise ArgumentError, \"Invalid Range: #{options[:range].inspect}\"\n end\n first = options[:range].first\n last = options[:range].last\n last -= 1 if options[:range].exclude_end?\n headers[\"Range\"] = \"#{first}-#{last == -1 ? \"\" : last}\"\n end\n\n # Merge cookies with headers.\n if headers[\"Cookie\"].kind_of?(String)\n headers[\"Cookie\"] = [headers[\"Cookie\"]]\n else\n headers[\"Cookie\"] ||= []\n end\n for key, value in (options[:cookies] || {})\n next if value == nil\n if value.kind_of?(Array)\n value.each do |subvalue|\n headers[\"Cookie\"] << \"#{escape(key)}=#{escape(subvalue)}\"\n end\n else\n headers[\"Cookie\"] << \"#{escape(key)}=#{escape(value)}\"\n end\n end\n\n # Write to the socket.\n output.write(\"%s %s HTTP/1.1\\r\\n\" % [\n method.to_s.upcase, @normalized_uri.omit(\n :scheme, :authority, :fragment\n )\n ])\n output.write(encode_headers(headers))\n output.write(CRLF)\n nil\n end", "def head(request, adapter = nil)\n request = Request.new :url => request if request.kind_of? String\n\n with_adapter :head, request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.head request\n end\n end", "def head(status, options = {})\n super status, options.merge(content_type: 'application/json')\n end", "def exists?\n request :head\n true\n rescue Stretcher::RequestError::NotFound\n false\n end", "def head(status, headers, env)\n [status, update_headers(headers), []]\n end", "def head(options = nil)\n options ||= {}\n options[:method] = :head\n call options\n end", "def preflight\n head 200\n end", "def head(*args, &block)\n args = web_dav_args args\n map_method :head, args, &block\n end", "def head(request, adapter = nil)\n request = Request.new :url => request if request.kind_of? String\n \n with request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.head request\n end\n end", "def local_content_head\n response.headers['Content-Length'] = local_file_size.to_s\n head :ok, content_type: local_file_mime_type\n end", "def head(path, options={}, &b)\n event(:head, path, options, &b)\n end", "def check_http_status(href)\n url = href.split(\".com/\")\n response = nil\n Net::HTTP.start(url[0].split(\"https://\").last + \".com\", 80) {|http|\n response = http.head(\"/\" + url[1])\n }\n if(response.code != \"200\")\n fail(href + \" returned code: \" + response.code)\n end\nend", "def agencies_head_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_head ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_head\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:HEAD, 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: AgenciesApi#agencies_head\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getHeadTag\n head_commit_id = @gop.revparse(\"HEAD\")\n\n begin\n @gop.describe(head_commit_id, :contains => true)\n rescue Git::GitExecuteError => giterror\n # do nothing, continue\n end\n end", "def index\n head params[:response_status]\n end", "def head(status, additional_headers = {})\n @response_status = status\n response_headers.merge!(additional_headers)\n response_headers.merge!({\"Access-Control-Allow-Origin\": ENV[\"ACCESS_CONTROL_ALLOW_ORIGIN\"]})\n end", "def test_get_with_host_header\n uri = default_uri\n uri.host = '127.0.0.1'\n res = nil\n\n in_transaction do\n res = get_response(uri.to_s, 'Host' => 'test.local')\n end\n\n assert_match %r{<head>}i, body(res)\n assert_externals_recorded_for('test.local', 'GET')\n end", "def fetch_http(uri, last_modified = nil, head = false, depth = 0)\n fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get\n # beginning of change\n response = request uri, fetch_type, last_modified do |req|\n headers.each {|k, v| req.add_field(k, v) } if headers\n end\n # end of change\n\n case response\n when Net::HTTPOK, Net::HTTPNotModified then\n response.uri = uri if response.respond_to? :uri\n head ? response : response.body\n when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,\n Net::HTTPTemporaryRedirect then\n raise FetchError.new(\"too many redirects\", uri) if depth > 10\n\n location = URI.parse response[\"Location\"]\n\n if https?(uri) && !https?(location)\n raise FetchError.new(\"redirecting to non-https resource: #{location}\", uri)\n end\n\n fetch_http(location, last_modified, head, depth + 1)\n else\n raise FetchError.new(\"bad response #{response.message} #{response.code}\", uri)\n end\n end", "def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end\nend", "def exists?\n # Unless the exception is hit we know its a 2xx response\n request(:head)\n true\n rescue Stretcher::RequestError::NotFound\n false\n end", "def head(params)\n raise Couchdbtools::Error::DocumentRevisionRequired unless params['_rev']\n request.method = :put\n execute(params)\n end", "def status\n head :ok\n end", "def status\n head :ok\n end", "def head(path, **args); end", "def head_filebucket_file(path, environment:, bucket_path: nil)\n headers = add_puppet_headers('Accept' => 'application/octet-stream')\n\n response = @client.head(\n with_base_url(\"/file_bucket_file/#{path}\"),\n headers: headers,\n params: {\n environment: environment,\n bucket_path: bucket_path\n }\n )\n\n process_response(response)\n\n response\n end", "def head_filebucket_file(path, environment:, bucket_path: nil)\n headers = add_puppet_headers('Accept' => 'application/octet-stream')\n\n response = @client.head(\n with_base_url(\"/file_bucket_file/#{path}\"),\n headers: headers,\n params: {\n environment: environment,\n bucket_path: bucket_path\n }\n )\n\n process_response(response)\n\n response\n end", "def head\n {\n \"Host\" => HOST,\n \"Content-Type\" => CONTENT_TYPE,\n \"Accept-Encoding\" => ACCEPT_ENCODINGS.join(','),\n \"User-Agent\" => USER_AGENT,\n \"Authorization\" => \"#{ authorization }\",\n }\n end", "def headers_fetch(uri)\n # Fetch the result at that location\n if (loc = ensure_uri(uri)).relative?\n headers_fetch(relative_uri(uri))\n else\n response = Net::HTTP.start(loc.host, loc.port) do |http|\n headers = @cookie ? {'Cookie' => @cookie} : {}\n http.head(loc.path, headers)\n end\n end\n end", "def get_head\n raise \"Not implemented\"\n end", "def _fetch\n curl @url, '-o', @tarball_path\n end", "def request(method, path, **kwargs)\n verbs = %w(put get post delete options head move copy patch)\n method = method.to_s.downcase\n raise HTTPBadRequest(\"Unsupported HTTP method #{method}\") unless verbs.include?(method)\n resp = self.class.send(method.to_sym, path, **kwargs)\n if method == 'head'\n handle_response resp, head_instead: true\n else\n handle_response resp\n end\n end", "def size(path)\n response = with_remote do |http|\n http.head(path)\n end\n response['Content-Length'].to_i\n end", "def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end\n end", "def set_head(project, branch)\n url = \"/projects/#{project}/HEAD\"\n body = {\n ref: 'refs/heads/' + branch\n }\n put(url, body)\n end", "def head(pattern, &hndlr)\n @j_del.head(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end", "def link_is_existent?(url)\n \tbegin\n\t uri = URI.parse(url)\n \t http_conn = Net::HTTP.new(uri.host, uri.port)\n \t resp, data = http_conn.head(\"/\" , nil)\n \t puts \"=== RESPONSE CODE #{resp.code}\"\n \t resp.code != \"404\"\n \trescue URI::InvalidURIError, Errno::ECONNREFUSED, SocketError\n \t\tfalse\n \tend\n end", "def check_package (url)\n Net::HTTP.start('dl.iuscommunity.org') do |http|\n http.open_timeout = 2\n http.read_timeout = 2\n http.head(url).code == '200'\n end\nend", "def fresh(options)\n conditional_get = ConditionalGet.new(@_env, options)\n\n headers.merge!(conditional_get.headers)\n\n conditional_get.fresh? do\n halt 304\n end\n end", "def fetch()\n @result = open(@url,@headers)\n end", "def http_status(hs=nil)\n @_http_status = hs unless hs.nil?\n @_http_status\n end", "def http_get(_request, h_r, temp_location)\n return nil unless ::File.exist?(temp_location)\n\n h_r.update_header('Content-Type', 'application/octet-stream')\n h_r.update_header('Content-Length', ::File.size(temp_location))\n h_r.update_header('X-Sabre-Temp', 'true')\n h_r.status = 200\n h_r.body = ::File.open(temp_location, 'r')\n false\n end", "def http_request(url_s, method, body = nil, headers = {}, www_authenticate = nil, redirect_limit = 5)\n cachekey = url_s.to_s\n\n cached_value = @cache[cachekey]\n if cached_value\n sock = Net::BufferedIO.new(StringIO.new(cached_value))\n info = Net::HTTPResponse.read_new(sock)\n info.reading_body(sock, true) {}\n\n if method == Net::HTTP::Put and info.key? 'etag' and not headers['If-Match']\n headers['If-Match'] = info['etag']\n end\n end\n\n if cached_value and not [Net::HTTP::Get, Net::HTTP::Head].member? method\n @cache.delete(cachekey)\n elsif cached_value\n entry_disposition = _entry_disposition(info, headers)\n\n if entry_disposition == :FRESH\n info.extend Atom::HTTPResponse\n\n return info\n elsif entry_disposition == :STALE\n if info.key? 'etag' and not headers['If-None-Match']\n headers['If-None-Match'] = info['etag']\n end\n if info.key? 'last-modified' and not headers['Last-Modified']\n headers['If-Modified-Since'] = info['last-modified']\n end\n end\n end\n\n req, url = new_request(url_s, method, headers)\n\n # two reasons to authenticate;\n if @always_auth\n self.send(\"#{@always_auth}_authenticate\", req, url)\n elsif www_authenticate\n dispatch_authorization www_authenticate, req, url\n end\n\n http_obj = Net::HTTP.new(url.host, url.port)\n http_obj.use_ssl = true if url.scheme == \"https\"\n\n res = http_obj.start do |h|\n h.request(req, body)\n end\n\n # a bit of added convenience\n res.extend Atom::HTTPResponse\n\n case res\n when Net::HTTPUnauthorized\n if @always_auth or www_authenticate or not res[\"WWW-Authenticate\"] # XXX and not stale (Digest only)\n # we've tried the credentials you gave us once\n # and failed, or the server gave us no way to fix it\n raise Unauthorized, \"Your authorization was rejected\"\n else\n # once more, with authentication\n res = http_request(url_s, method, body, headers, res[\"WWW-Authenticate\"])\n\n if res.kind_of? Net::HTTPUnauthorized\n raise Unauthorized, \"Your authorization was rejected\"\n end\n end\n when Net::HTTPRedirection\n if res.code == \"304\" and method == Net::HTTP::Get\n res.end2end_headers.each { |k| info[k] = res[k] }\n\n res = info\n\n res[\"Content-Length\"] = res.body.length\n\n res.extend Atom::HTTPResponse\n\n _updateCache(headers, res, @cache, cachekey)\n elsif res[\"Location\"] and (allow_all_redirects or [Net::HTTP::Get, Net::HTTP::Head].member? method)\n raise HTTPException, \"Too many redirects\" if redirect_limit.zero?\n\n res = http_request res[\"Location\"], method, body, headers, nil, (redirect_limit - 1)\n end\n when Net::HTTPOK, Net::HTTPNonAuthoritativeInformation\n unless res.key? 'Content-Location'\n res['Content-Location'] = url_s\n end\n _updateCache(headers, res, @cache, cachekey)\n end\n\n res\n end", "def has_new?\n return true if @last_post_time.nil?\n \n Net::HTTP.start @thread_url.host, 80 do |http|\n response = http.head(@thread_url.path)\n raise Thread404dError if response.code.to_i == 404 # .to_i because net/http is retarded.\n Time.parse(response['Last-Modified']) > @last_post_time\n end\n end", "def image_http_status(uri)\r\n puts \"Requesting Image: #{uri}\"\r\n http = Net::HTTP.new(uri.host, uri.port)\r\n response = http.head(uri.path)\r\n return response.code\r\n rescue\r\n return \"500\"\r\n end", "def getStatus()\n params = Hash.new\n return doCurl(\"get\",\"/status\",params)\n end", "def valid_link?(url)\n # GET or HEAD? Head is more friendly to the server, but some pages\n # May behave differently depending on HEAD or GET.\n HTTParty.head(url,\n verify: false, # don't verify ssl certs\n ).code == 200\n end", "def ping\n response, body = send_request :get, '', :binary\n true\n end", "def file_exists?(key)\n result = http.head([200,404], luwak, escape(key))\n result[:code] == 200\n end", "def status(path)\n ret_status = UNKNOWN\n begin\n # Arguments: File, Revision, Recursive, Any files, Update\n new_client.status(path, \"HEAD\", true, true, false) do |path, status|\n ret_status = status.text_status if status.text_status > ret_status\n end\n rescue Svn::Error::WC_NOT_DIRECTORY\n rescue Svn::Error::WC_NOT_LOCKED\n end\n ret_status\n end", "def http_get(request, response)\n path = request.path\n node = @server.tree.node_for_path(path)\n\n return nil unless node.is_a?(IFile)\n\n body = node.get\n\n # Converting string into stream, if needed.\n if body.is_a?(String)\n stream = StringIO.new\n stream.write(body)\n stream.rewind\n body = stream\n end\n\n # TODO: getetag, getlastmodified, getsize should also be used using\n # this method\n http_headers = @server.http_headers(path)\n\n # ContentType needs to get a default, because many webservers will otherwise\n # default to text/html, and we don't want this for security reasons.\n unless http_headers.key?('Content-Type')\n http_headers['Content-Type'] = 'application/octet-stream'\n end\n\n if http_headers.key?('Content-Length')\n node_size = http_headers['Content-Length'].to_i\n\n # Need to unset Content-Length, because we'll handle that during figuring out the range\n http_headers.delete('Content-Length')\n else\n node_size = 0\n end\n\n response.add_headers(http_headers)\n\n range = @server.http_range\n if_range = request.header('If-Range')\n ignore_range_header = false\n\n # If ifRange is set, and range is specified, we first need to check\n # the precondition.\n if node_size > 0 && range && if_range\n # if IfRange is parsable as a date we'll treat it as a DateTime\n # otherwise, we must treat it as an etag.\n\n if_range_date = Chronic.parse(if_range)\n\n if if_range_date\n # It's a date. We must check if the entity is modified since\n # the specified date.\n if !http_headers.key?('Last-Modified')\n ignore_range_header = true\n else\n modified = Time.parse(http_headers['Last-Modified'])\n ignore_range_header = true if modified > if_range_date\n end\n else\n # It's an entity. We can do a simple comparison.\n if !http_headers.key?('ETag')\n ignore_range_header = true\n elsif http_headers['ETag'] != if_range\n ignore_range_header = true\n end\n end\n end\n\n # We're only going to support HTTP ranges if the backend provided a filesize\n if !ignore_range_header && node_size && range\n # Determining the exact byte offsets\n if range[0]\n start = range[0]\n ending = range[1] ? range[1] : node_size - 1\n if start >= node_size\n fail Exception::RequestedRangeNotSatisfiable, \"The start offset (#{range[0]}) exceeded the size of the entity (#{node_size})\"\n end\n\n if ending < start\n fail Exception::RequestedRangeNotSatisfiable, \"The end offset (#{range[1]}) is lower than the start offset (#{range[0]})\"\n end\n\n ending = node_size - 1 if ending >= node_size\n else\n start = node_size - range[1]\n ending = node_size - 1\n\n start = 0 if start < 0\n end\n\n # for a seekable body stream we simply set the pointer\n # for a non-seekable body stream we read and discard just the\n # right amount of data\n if body.respond_to?(:seek)\n body.seek(start)\n else\n consume_block = 8192\n consumed = 0\n loop do\n break unless start - consumed > 0\n\n if body.eof?\n fail Exception::RequestedRangeNotSatisfiable, \"The start offset (#{start}) exceeded the size of the entity (#{consumed})\"\n end\n\n consumed += body.read([start - consumed, consume_block].min)\n end\n end\n\n response.update_header('Content-Length', ending - start + 1)\n response.update_header('Content-Range', \"bytes #{start}-#{ending}/#{node_size}\")\n response.status = 206\n response.body = body\n else\n response.update_header('Content-Length', node_size) if node_size > 0\n response.status = 200\n response.body = body\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def _head?\n _execution_id == head_execution(reload: true).id\n end", "def last_modified\n url = make_uri\n http = Net::HTTP.new(url.host, url.port)\n request = Net::HTTP::Head.new(url)\n request['if-modified-since'] = ''\n response = http.request(request)\n response['last-modified']\n end", "def file_exists?(path)\n response = self.class.head(File.join('/', path), request_options)\n response.code >= 200 && response.code < 300\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 page_status url\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n if url.scheme.downcase == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true\n end\n http.start do\n http.request_get(url.path.empty? ? \"/\" : url.path) do |res|\n return {:name => res.class, :code => res.code}\n end\n end\n end", "def head\n git.get_head(branch)\n end", "def head\n git.get_head(branch)\n end" ]
[ "0.8272921", "0.8121206", "0.79404664", "0.78960806", "0.7895889", "0.7895889", "0.78953785", "0.7877307", "0.7673712", "0.7603142", "0.7537705", "0.7534993", "0.7470162", "0.7465292", "0.7444265", "0.740834", "0.7407242", "0.73743105", "0.7357283", "0.7354718", "0.73525304", "0.73211473", "0.72951543", "0.7284706", "0.71686846", "0.7153721", "0.7146015", "0.7141544", "0.71191937", "0.7038225", "0.702547", "0.690934", "0.6821354", "0.67459726", "0.6712201", "0.6607791", "0.65989035", "0.6523316", "0.6523316", "0.63255006", "0.6282649", "0.6275234", "0.626146", "0.6238545", "0.61515397", "0.613144", "0.6111108", "0.6081881", "0.60655075", "0.6060895", "0.6028378", "0.6023011", "0.5993185", "0.59690005", "0.5948652", "0.58825475", "0.58059317", "0.5749802", "0.57329917", "0.5703417", "0.56868696", "0.5668954", "0.5663275", "0.56131047", "0.5580738", "0.5580738", "0.5561699", "0.5531855", "0.5531855", "0.55227053", "0.55155593", "0.5507638", "0.54755616", "0.54750943", "0.5450799", "0.5426625", "0.54088837", "0.5381464", "0.5379015", "0.5344716", "0.53238165", "0.5323683", "0.53227705", "0.53191257", "0.53118783", "0.5307817", "0.52901167", "0.52586293", "0.5256539", "0.523944", "0.5236401", "0.5211034", "0.52006036", "0.5183583", "0.51809514", "0.5168698", "0.51659197", "0.5153108", "0.5144383", "0.5144383" ]
0.7465599
13
auto complete search for quest
def quest_autocomplete render json: Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findorsuggest()\n \n end", "def autocomplete; end", "def auto_complete\n @query = params[:auto_complete_query]\n @auto_complete = self.controller_name.classify.constantize.scoped(:limit => 10).search(@query)\n render :template => \"common/auto_complete\", :layout => nil\n end", "def auto_complete_for_ingredient_name\n value = params[:ingredient][:name]\n @ingredients = Ingredient.find(:all, \n :conditions => [ 'LOWER(name) LIKE ?',\n '%' + value.downcase + '%' ], \n :order => 'name ASC',\n :limit => 8)\n render :partial => 'ingredient_name_matches'\n end", "def auto_complete_for_recipeSearch_description\n criteria = '%' + params[:recipeSearch][:description] + '%'\n @recipes = Recipe.find(:all, \n :conditions=>[\"title like ? OR description like ?\",criteria, criteria],\n :order=>'title desc', :limit=>10)\n render :partial=> \"recipes\" \n end", "def all_autocomplete\n quests = Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n recs = Record.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n render json: Search.json(quests.results + recs.results)\n end", "def complete(search); Bond::DefaultMission.completions; end", "def autocomplete(q:)\n return unless String(q).length > 1\n\n result = Geocoder.search(q, autocomplete: true)\n result&.data\n end", "def auto_complete\n type = params[:type].to_s\n string = CGI.unescape(params[:id].to_s).strip_squeeze\n if string.blank?\n render(text: \"\\n\\n\")\n else\n auto = AutoComplete.subclass(type).new(string, params)\n results = auto.matching_strings.join(\"\\n\") + \"\\n\"\n render(text: results)\n end\n end", "def auto_complete\n @query = params[:term] || ''\n @auto_complete = hook(:auto_complete, self, query: @query, user: current_user)\n if @auto_complete.empty?\n exclude_ids = auto_complete_ids_to_exclude(params[:related])\n @auto_complete = klass.my(current_user).text_search(@query).ransack(id_not_in: exclude_ids).result.limit(10)\n else\n @auto_complete = @auto_complete.last\n end\n\n session[:auto_complete] = controller_name.to_sym\n respond_to do |format|\n format.any(:js, :html) { render partial: 'auto_complete' }\n format.json do\n results = @auto_complete.map do |a|\n {\n id: a.id,\n text: a.respond_to?(:full_name) ? a.full_name : a.name\n }\n end\n render json: {\n results: results\n }\n end\n end\n end", "def autocomplete(name)\n self.class.get(\"/cards/autocomplete?q=#{name}\")\n end", "def suggest\n end", "def autocomplete(term)\n get(\"/catalog/titles/autocomplete?term=#{term}\")\n end", "def ajax_auto_complete\n type = params[:type].to_s\n instr = params[:id].to_s\n letter = ' '\n scientific = false\n user = login_for_ajax\n if user\n scientific = (user.location_format == :scientific)\n end\n @items = []\n if instr.match(/^(\\w)/)\n letter = $1\n case type\n\n when 'location'\n @items = Observation.connection.select_values(%(\n SELECT DISTINCT `where` FROM observations\n WHERE `where` LIKE '#{letter}%' OR\n `where` LIKE '% #{letter}%'\n )) + Location.connection.select_values(%(\n SELECT DISTINCT `name` FROM locations\n WHERE `name` LIKE '#{letter}%' OR\n `name` LIKE '% #{letter}%'\n ))\n if scientific\n @items.map! {|i| Location.reverse_name(i)}\n end\n @items.sort!\n\n when 'name'\n @items = Name.connection.select_values %(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{letter}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )\n\n when 'name2'\n @items = Name.connection.select_values(%(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{instr}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )).sort_by {|x| (x.match(' ') ? 'b' : 'a') + x}\n # This sort puts genera and higher on top, everything else on bottom,\n # and sorts alphabetically within each group.\n letter = ''\n\n when 'project'\n @items = Project.connection.select_values %(\n SELECT title FROM projects\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'species_list'\n @items = SpeciesList.connection.select_values %(\n SELECT title FROM species_lists\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'user'\n @items = User.connection.select_values %(\n SELECT CONCAT(users.login, IF(users.name = \"\", \"\", CONCAT(\" <\", users.name, \">\")))\n FROM users\n WHERE login LIKE '#{letter}%'\n OR name LIKE '#{letter}%'\n OR name LIKE '% #{letter}%'\n ORDER BY login ASC\n )\n end\n end\n\n # Result is the letter requested followed by results, one per line. (It\n # truncates any results that have newlines in them -- that's an error.)\n render(:layout => false, :inline => letter +\n %(<%= @items.uniq.map {|n| h(n.gsub(/[\\r\\n].*/,'')) + \"\\n\"}.join('') %>))\n end", "def auto_complete_for_keyword_list\n auto_complete_responder_for_keyword params[:keyword][:list]\n end", "def fast_suggestions query\n return []\n end", "def auto_complete_result(entries, field, phrase = nil)\n return unless entries\n render :partial => '/admin/orders/autocomplete', :locals => { :entries => entries, :field => field, :phrase => phrase }\n end", "def searchSuggestions(query,extras)\n method = 'searchSuggestions'\n type = TODO\n args = {:query=>query}\n args[:extras] = extras if extras\n return_object type,method,args\n end", "def autocomplete\n @leader = Leaders.find(:all, :conditions => [\"name like ?\",\"%\" + params[:term].upcase + \"%\"])\n render json: @leader \n end", "def search; end", "def search_account\n data=params\n search_result =[]\n unless data[:q].blank?\n search_result = @company.accounts.search data[:q], :star => true, :limit => 10000\n else\n search_result = @company.accounts.all(:order => 'name ASC')\n end\n render :partial=> 'account_auto_complete', :locals => {:search_result => search_result}\n end", "def autocomplete_sn\n render :partial => 'autocomplete', :object => Scientificname.find(:all, :conditions => ['name ILIKE ?', params[:sn] + '%' ])\n end", "def suggestions\n suggest(search_suggestions)\n end", "def getAutocomplete(query, type)\n request('getAutocomplete', {'query' => query, 'type' => type})\nend", "def search\n\n end", "def bu_autocomplete\n search_term = params[:term]\n\n species_id = Specie.find_by_scientificname(params[:species])\n\n cultivars = Cultivar.where(\"specie_id = ?\", species_id)\n\n logger.debug(\"cultivars for autocompletion: #{cultivars.inspect}\")\n\n filtered_cultivars = cultivars.where(\"LOWER(name) LIKE LOWER(?)\", '%' + search_term + '%')\n\n if filtered_cultivars.size > 0 || search_term.size > 1\n cultivars = filtered_cultivars\n # else if there are no matches and the user has only typed one letter, just return every cultivar associated with the chosen species\n end\n\n cultivars = cultivars.to_a.map do |item|\n item.name.squish\n end\n\n # don't show rows where name is null or empty\n # TO-DO: eliminate these from the database and prevent them with a constraint\n cultivars.delete_if { |item| item.nil? || item.empty? }\n\n if cultivars.empty?\n cultivars = [ { label: \"No matches\", value: \"\" }]\n end\n\n respond_to do |format|\n format.json { render :json => cultivars }\n end\n end", "def autocomplete\r\n# return '' unless session[:edit_mode] > 0 # \r\n return render text: t('drgcms.not_authorized') unless dc_user_can(DcPermission::CAN_VIEW)\r\n# TODO Double check if previous line works as it should.\r\n table = params['table'].classify.constantize\r\n id = [params['id']] || '_id'\r\n# call method in class if search parameter has . This is for user defined searches\r\n# result must be returned as array of [id, search_field_value]\r\n a = if params['search'].match(/\\./)\r\n name, method = params['search'].split('.')\r\n table.send(method, params['input']).inject([]) do |r,v|\r\n r << { label: v[0], value: v[0], id: v[1].to_s }\r\n end\r\n# simply search which will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{params['input']}/i).limit(20).inject([]) do |r,v|\r\n r << { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render inline: a.to_json, formats: 'js'\r\nend", "def search\n end", "def search\r\n\t\t\t$browser.text_field(:id => 'sb_form_q')\r\n\t\tend", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search \n\n end", "def auto_complete_for_journal_title\n # Don't search on blank query.\n query = params['rft.jtitle']\n search_type = params[\"umlaut.title_search_type\"] || \"contains\"\n unless ( query.blank? )\n (context_objects, total_count) = find_by_title\n @titles = context_objects.collect do |co|\n metadata = co.referent.metadata\n {:object_id => metadata[\"object_id\"], :title => (metadata[\"jtitle\"] || metadata[\"btitle\"] || metadata[\"title\"])}\n end\n end\n render :text => @titles.to_json, :content_type => \"application/json\"\n end", "def auto_complete_for_ces\r\n value = params[:term]\r\n field = %w(collectors locality mthd verbatim_method macro_habitat micro_habitat).include?(params[:field]) && params[:field]\r\n\r\n if field && value\r\n @ids = Ce.select(field.downcase).where([ \"ces.proj_id = ? AND LOWER(ces.#{field.downcase}) LIKE (?)\", params[:proj_id], '%' + value.downcase + '%' ])\r\n .group(field.downcase).order(\"#{field.downcase} ASC\").limit(100).map {|v| v.send(field.downcase.to_sym)}\r\n\r\n render :json => Json::simple_autocomplete(@ids)\r\n elsif value\r\n @ces = Ce.find_for_auto_complete(value)\r\n render :json => Json::format_for_autocomplete_with_display_name(:entries => @ces, :method => params[:method])\r\n else\r\n head(:bad_request)\r\n end\r\n end", "def search(word)\n \n end", "def get_autocomplete_items(parameters)\n HsCode.where(\"hs_codes.code like :search or hs_codes.description like :search\", :search => \"%#{params[:term]}%\").select('description, code').limit(100)\n end", "def causeautocomplete\n searchtext = params['searchText']\n\n if session[:roleid] == ADMIN_ROLE\n # this will do a like search ignoring case\n @searchcauseresults = Charity.where(\"charityname ILIKE ?\", \"%\" + searchtext + \"%\")\n \n else\n \n # this will do a like search ignoring case\n @searchcauseresults = Charity.where(\"charityname ILIKE ?\", \"%\" + searchtext + \"%\")\n .where(isapproved: true)\n \n end\n\n \n\n #if @searchcauseresults.count == 0\n # @searchcauseresults = Charity.new\n #end\n \n render :json => @searchcauseresults\n\n end", "def contact_autocomplete(type, options)\n set_search_path\n Contact.where(\"type = :type AND matchcode ILIKE :term\", :type => type, :term => \"%#{options[:term]}%\").limit(20).map {|c| {:id => c.id, :label => c.to_s}}\n end", "def autocomplete\n render :json => end_of_association_chain.ordered.search(params[:term]).limit(params[:limit] || 10).to_autocomplete\n end", "def search\n\n end", "def suggest_results\n repository.auto_suggest(suggest_handler_path, request_params)\n end", "def do_search\n @search_text = params[:q]\n\n # Doctoring for the view to find matches:\n @q = @search_text\n @q.chop! if params[:q] =~ /\\*$/\n @q = @q[1..-1] if params[:q] =~ /^\\*/\n\n # TODO: we'll want some whitelist filtering here later:\n # params[:q] = \"#{@q}*\" unless params[:q] =~ /\\*$/ or params[:q] =~ /^[-+]/ or params[:q] =~ /\\s/\n params[:q] = I18n.transliterate(params[:q]).downcase\n\n # TODO: This search suggestions block is large; extract.\n\n # First step (and, yes, this will be slow—we will optimize later), look for\n # search suggestions that match the query:\n words = params[:q].split # TODO: we might want to remove words with ^-\n # TODO: we might also want to remove stopwords e.g.: https://github.com/brenes/stopwords-filter\n suggestions = []\n # YUCK! This is the best way to do this in Searchkick at the moment, though.\n # :S\n words.each do |word|\n word_search = SearchSuggestion.search(word, fields: [{ match: :exact }])\n suggestions += word_search.results if word_search.respond_to?(:results)\n end\n\n # If we only found one thing and they only asked for one thing:\n if suggestions.size == 1 && params[:q] !~ /\\s/\n Rails.logger.warn(\"One suggestion.\")\n # TODO: move this to a helper? It can't go on the model...\n suggestion = suggestions.first\n suggestion = suggestion.synonym_of if suggestion.synonym_of\n where = case suggestion.type\n when :page\n suggestion.page\n when :object_term\n term_records_path(uri: suggestion.object_term, object: true)\n when :path\n suggestion.path\n when :wkt_string\n flash[:notice] = \"Unimplemented, sorry.\"\n \"/\"\n end\n return redirect_to(where)\n elsif suggestions.size >= 2 && params[:q] =~ /\\s/\n Rails.logger.warn(\"Multiple suggestions.\")\n groups = suggestions.group_by(&:type)\n # Easier to handle:\n groups[:page] ||= []\n groups[:object_term] ||= []\n groups[:path] ||= []\n groups[:wkt_string] ||= []\n if groups[:page].size > 1\n Rails.logger.warn(\"Multiple PAGE suggestions.\")\n # We can't use suggestions if there's more than one species. Sorry.\n flash[:notice] = t(\"search.flash.more_than_one_species\",\n species: groups[:page].map(&:match).to_sentence)\n else\n Rails.logger.warn(\"0 or 1 Page suggestions.\")\n clade = groups[:page].try(:first).try(:page_id)\n Rails.logger.warn(\"Page suggestion: #{clade}\") if clade\n if groups[:object_term].size > 2\n Rails.logger.warn(\"Over two TERM suggestions.\")\n flash[:notice] = t(\"search.flash.more_than_two_terms\",\n terms: groups[:object_term].map(&:match).to_sentence)\n elsif groups[:path].size > 0\n Rails.logger.warn(\"...had PATH suggestions.\")\n flash[:notice] = t(\"search.flash.cannot_combine_paths\",\n path: groups[:path].map(&:match).to_sentence)\n else # NOTE: this assumes we only have OBJECT term suggestions, not predicates.\n Rails.logger.warn(\"Usable suggestions...\")\n (first, second) = groups[:object_term] # Arbitrary which is first...\n Rails.logger.warn(\"First term: #{first.object_term}\")\n Rails.logger.warn(\"Second term: #{second.object_term}\") if second\n return redirect_to(term_records_path(uri: first.object_term, object: true,\n and_object: second.try(:object_term), clade: clade))\n end\n end\n end\n\n @clade = if params[:clade]\n puts \"*\" * 100\n puts \"** Filtering by clade #{params[:clade]}\"\n # It doesn't make sense to filter some things by clade:\n params[:only] = if params[:only]\n Array(params[:only]) - [:collections, :users, :predicates, :object_terms]\n else\n [:pages, :media]\n end\n puts \"Only param should now be: #{params[:only]}\"\n Page.find(params[:clade])\n else\n nil\n end\n\n default = params.has_key?(:only)? false : true\n @types = {}\n [ :pages, :collections, :articles, :images, :videos, :videos, :sounds, :links, :users, :predicates, :object_terms ].\n each do |sym|\n @types[sym] = default\n end\n\n @types[params[:only].to_sym] = true if params.has_key?(:only)\n\n # if params.has_key?(:only)\n # Array(params[:only]).each { |type| @types[type.to_sym] = true }\n # elsif params.has_key?(:except)\n # Array(params[:except]).each { |type| @types[type.to_sym] = false }\n # end\n\n # NOTE: no search is performed unless the @types hash indicates a search for\n # that class is required:\n\n @pages = if @types[:pages]\n fields = %w[preferred_vernacular_strings^20 vernacular_strings^20 preferred_scientific_names^10 scientific_name^10 synonyms^10 providers resource_pks]\n match = words.size == 1 ? :text_start : :phrase\n basic_search(Page, boost_by: [:page_richness, :specificity, :depth], match: match, fields: fields,\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n includes: [:preferred_vernaculars, :medium, { native_node: { node_ancestors: :ancestor } }])\n else\n nil\n end\n\n\n @collections = if @types[:collections]\n basic_search(Collection, fields: [\"name^5\", \"description\"])\n else\n nil\n end\n\n @articles = if @types[:articles]\n basic_search(Searchkick,\n fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n index_name: [Article])\n else\n nil\n end\n\n @images = if @types[:images]\n media_search(\"image\")\n else\n nil\n end\n\n @videos = if @types[:videos]\n media_search(\"video\")\n else\n nil\n end\n\n @sounds = if @types[:sounds]\n media_search(\"sound\")\n else\n nil\n end\n\n # @links = if @types[:links]\n # basic_search(Searchkick,\n # fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n # where: @clade ? { ancestry_ids: @clade.id } : nil,\n # index_name: [Link])\n # else\n # nil\n # end\n\n @users = if @types[:users]\n basic_search(User, fields: [\"username^6\", \"name^4\", \"tag_line\", \"bio^2\"])\n else\n nil\n end\n\n Searchkick.multi_search([@pages, @articles, @images, @videos, @sounds, @collections, @users].compact)\n\n @pages = PageSearchDecorator.decorate_collection(@pages) if @pages\n @articles = ArticleSearchDecorator.decorate_collection(@articles) if @articles\n @images = ImageSearchDecorator.decorate_collection(@images) if @images\n @videos = VideoSearchDecorator.decorate_collection(@videos) if @videos\n @sounds = SoundSearchDecorator.decorate_collection(@sounds) if @sounds\n @collections = CollectionSearchDecorator.decorate_collection(@collections) if @collections\n @users = UserSearchDecorator.decorate_collection(@users) if @users\n\n # if @types[:predicates]\n # @predicates_count = TraitBank.count_predicate_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @predicates = Kaminari.paginate_array(\n # TraitBank.search_predicate_terms(@q, params[:page], params[:per_page]),\n # total_count: @predicates_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n #\n # if @types[:object_terms]\n # @object_terms_count = TraitBank.count_object_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @object_terms = Kaminari.paginate_array(\n # TraitBank.search_object_terms(@q, params[:page], params[:per_page]),\n # total_count: @object_terms_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n\n respond_to do |fmt|\n fmt.html do\n @page_title = t(:page_title_search, query: @q)\n end\n\n fmt.js { }\n\n # TODO: JSON results for other types! TODO: move; this is view logic...\n fmt.json do\n render json: JSON.pretty_generate(@pages.results.as_json(\n except: :native_node_id,\n methods: :scientific_name,\n include: {\n preferred_vernaculars: { only: [:string],\n include: { language: { only: :code } } },\n # NOTE I'm excluding a lot more for search than you would want for\n # the basic page json:\n top_media: { only: [ :id, :guid, :owner, :name ],\n methods: [:small_icon_url, :medium_icon_url],\n include: { provider: { only: [:id, :name] },\n license: { only: [:id, :name, :icon_url] } } }\n }\n ))\n end\n end\n end", "def auto_complete_model_for_person_fullname\n @result = Person.non_student.find_all{|p| p.fullname.downcase.include?(params[:person][:fullname].downcase)}[0..10]\n render :partial => \"auto_complete\", :object => @result, :locals => { :highlight_phrase => params[:person][:fullname] }\n end", "def handle_search(query)\n @results = search query unless query.empty?\n\n prompt_for_selection(query)\nend", "def auto_complete_for_person_name\n \tname = params[:person][:name].downcase\n \tnames = name.strip.split(' ')\n \t\n find_options = {\n :order => \"last_name, first_name ASC\",\n\t :limit => 10 }\n\n\t\tif names.size > 1\n\t\t\t# there are two names provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' AND LOWER(last_name) LIKE '%#{names[1]}%' OR LOWER(first_name) LIKE '%#{names[1]}%' AND LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\telse\n\t\t\t# only the first name or last name has been provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' OR LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\tend\n\t\n\t\t@items = Person.find(:all, find_options)\n\t\n\t\tRails.logger.info(\"@items.size = #{@items.size}\")\n\n render :inline => \"<%= auto_complete_result @items, 'name' %>\"\n end", "def search_matter\n cid = @company.id\n @search_result =[]\n @search_result = matter_search # Common search\n respond_to do |format|\n format.js { render :partial=> 'matter_auto_complete', :object => @search_result }\n format.html { render :partial=> 'matter_auto_complete', :object => @search_result }\n end \n end", "def restaurant_suggestions\n match_key = Riddle.escape(params[:key]).split(' ').join('* ') + '*'\n begin\n suggestions = Restaurant.search(match_key,{:limit=>20,:match_mode => :extended,\n :ignore_errors=>true,:populate=>true,:retry_stale=>true})\n rescue Exception\n suggestions = []\n end\n response = []\n suggestions.each{|d| response << {:value=>d.id,:label=>d.name}}\n render :json=>response.to_json\n end", "def scaffold_auto_complete_find(phrase, options = {})\n find_options = { :limit => scaffold_auto_complete_results_limit,\n :conditions => scaffold_auto_complete_conditions(phrase), \n :order => scaffold_select_order,\n :include => scaffold_include}.merge(options)\n find(:all, find_options)\n end", "def autocomplete\n\t\tquery_params = QueryFormat.autocomplete_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tquery['field'] = \"content_auto\" if query['field'].blank?\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\tmax = query['max'].to_i\n\t\t\tquery.delete('max')\n\t\t\twords = solr.auto_complete(query)\n\t\t\twords.sort! { |a,b| b[:count] <=> a[:count] }\n\t\t\twords = words[0..(max-1)]\n\t\t\t@results = words.map { |word|\n\t\t\t\t{ :item => word[:name], :occurrences => word[:count] }\n\t\t\t}\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results } }\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n\tend", "def autocomplete\n render json: Post.search(params[:query],operator: \"or\", autocomplete: true,limit: 10,boost_by_distance: {field: :location, origin: [current_user.lat, current_user.lon]}).map {|post| {title: post.title, value: post.id}}\n end", "def auto_complete\n @users = if params[:term] =~ /(@[^\\s]+)\\s.*/\n elsif user_name = params[:term].match(/(@[^\\s]+)/)\n users = User.select('name').where('name LIKE ?', \"%#{user_name[1].to_s[1..-1]}%\")\n\n users.map {|user| {name: \"#@{user.name}\"} }\n end\n render json: @users.to_json\n end", "def parse_search(q)\n # TODO continue\n end", "def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end", "def search(word)\r\n \r\n end", "def autocomplete_game_search \t\t\t\t \n #@games = Game.name_like(params[\"q\"])[0..10]\n #platform_result = Game.platform_like(params[\"q\"])[0..10] \n @games = Game.search({\"name_cont\" => params[\"q\"]}).result[0..10]\n platform_games = Game.search({\"platform_cont\" => params[\"q\"]}).result[0..10]\n @games = @games | platform_games\n render :json => @games.collect {|game| [game[\"name\"] + \" [\"+game[\"platform\"]+\"]\", game[\"platform\"]]}\n end", "def search\r\nend", "def suggestions\n response.try(:[], \"suggest\").try(:[], @suggest_key).try(:[], request_params[:q]).try(:[], \"suggestions\") || []\n end", "def autocomplete\n key = params[:key]\n feeds = Feed.select('title').where('title LIKE ?', \"%#{key}%\").limit(5).map { |f| f.title }\n upcomings = Upcoming.select('title').where('title LIKE ?',\"%#{key}%\").limit(5).map { |u| u.title }\n artists = Artist.select('name').where('name LIKE ?',\"%#{key}%\").limit(5).map { |u| u.name }\n result = feeds + upcomings + artists\n\n respond_to do |format|\n format.json { render json: result.shuffle }\n end\n end", "def suggest(name, text, completion={})\n request(:post, \"_suggest\", nil, {name => {:text => text, :completion => completion}})\n end", "def suggest(name, text, completion = {})\n request(:post, \"_suggest\", nil, { name => { text: text, completion: completion } })\n end", "def fill_auto_complete(field, filter = nil, full_text)\n fill_in field, with: filter unless filter\n\n page.execute_script %Q{ $('##{field}').trigger('focus') }\n page.execute_script %Q{ $('##{field}').trigger('keydown') }\n\n selector = %Q{ul.ui-autocomplete li.ui-menu-item a:contains(\"#{full_text}\")}\n\n sleep 5\n page.execute_script %Q{ $('#{selector}').trigger('mouseenter').click() }\n sleep 5\n end", "def textField(textField, completions:somecompletions, forPartialWordRange:partialWordRange, indexOfSelectedItem:theIndexOfSelectedItem)\n matches = Entry.where(:title).contains(textField.stringValue,NSCaseInsensitivePredicateOption).map(&:title).uniq\n matches\n end", "def auto_complete_for_club_member_login\n\n # split by spaces, downcase and create query for each.\n # Remember to Sanitize the SQL\n conditions = params[:club_member][:login].downcase.split.map {\n\t\t # Sanitize ***********************************\n\t\t |w| \"LOWER(login) LIKE '%\" + (w.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")) +\"%'\" } # AND the queries.\n\n # AND the queries.\n find_options = {\n :conditions => conditions.join(\" AND \"),\n :order => \"login ASC\",\n :limit => AC_CLUB_MEMBER_NAME_LIMIT }\n\n @items = ClubMember.find(:all, find_options)\n\n render :inline => \"<%= auto_complete_result_2 @items %>\"\n end", "def auto_complete_for_message_to\n query = params[:message][:to]\n @people = Person.all(:order => \"last_name ASC\", :conditions => ['first_name LIKE ? or last_name LIKE ?', \"#{query}%\", \"#{query}%\"])\n render :partial=>\"auto_complete_for_message_to\"\n end", "def search(query); end", "def autocomplete_on\n\t\tconditions = if params[:name]\n [\"name LIKE :name\", { :name => \"%#{params['name']}%\"} ]\n else\n {}\n end\n\t\t @objects = params[:model_name].classify.constantize.find(:all, :conditions => conditions)\n\t\t render :text => '<ul>'+ @objects.map{ |e| '<li>' + e.name + '</li>' }.join(' ')+'</ul>'\n\tend", "def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end", "def suggest\n if !params.has_key? :q then\n head :ok\n return\n end\n\n search_stmt = params[:q].upcase\n current_user_id = current_user.id\n\n results = UrContact.where.has{\n (user_id == current_user_id) &\n (upper(name).like \"%#{search_stmt}%\") |\n (upper(email).like \"%#{search_stmt}%\") |\n (upper(telephone).like \"%#{search_stmt}%\")\n }\n\n if params[:format] == \"search\" then\n formattedResults = results\n else\n formattedResults = {query:params[:q], suggestions:results.map{|x| {value:x.name, data:x}} }\n end\n\n #render json: {query:params[:q], suggestions:results}\n render json: formattedResults\n end", "def autocomplete_name\n @tags = Tag.where([\"name ILIKE ?\", \"*#{params[:term]}*\".to_escaped_for_sql_like]).order('LENGTH(name)', :name).limit(20).pluck(:name)\n respond_to do |format|\n format.json { render :json => @tags }\n end\n end", "def suggest\n @suggestions = suggestions_service.suggestions\n render 'suggest', layout: false\n end", "def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end", "def auto_complete_for_technician_enquiry_from\n re = Regexp.new(\"^#{params[:technician][:name]}\", \"i\")\n find_options = { :order => \"name ASC\" }\n @technicians = Technician.find(:all, find_options).collect(&:name).select { |org| org.match re }\n render :template => 'sales/auto_complete_for_technician_name',:layout=>false\n end", "def autocomplete_agente_apellido\n agente_activo = 1\n respond_to do |format|\n @agentes = Agente.where(\"agentes.estado_agente_id = ? AND agentes.apellido ILIKE ?\", agente_activo, \"%#{params[:term]}%\")\n render :json => @agentes.map { |agente| {:id => agente.id, :value => agente.apellido + \" \"+ agente.nombre } } \n format.js { } \n end\n end", "def search\nend", "def autocomplete_venue_name\n term = params[:term]\n if term && !term.empty?\n items = Venue.verified.select(\"name\").\n where(\"name like ?\", '%' + term.downcase + '%').\n limit(10).order(:name)\n else\n items = {}\n end\n render :json => json_for_autocomplete(items, :name)\n end", "def autosuggest(object, name, options={})\n options[:display] ||= name\n options[:limit] ||= 10\n options[:name] = name\n options[:search_in] ||= [name]\n options[:order] ||= \"#{options[:search_in].first} ASC\"\n\n define_method \"autosuggest_#{object}_#{name}\" do\n options.merge!(:query => params[:query], :object => object.to_s.camelize.constantize)\n query = ''\n values = []\n\n for column in options[:search_in]\n query += \"#{column} ILIKE ? OR \"\n values.push(\"#{options[:query]}%\")\n end\n results = options[:object].where(query[0..-4], *values).order(options[:order]).limit(options[:limit])\n render :json => Yajl::Encoder.encode(results.map{|r| {:name => r.send(options[:display]), :value => r.id.to_s}})\n end\n end", "def searching\n prepare_phrases.each do |phrase|\n searching_single(phrase)\n end\n end", "def auto_complete_for_user_name\n @users = session[:user].get_available_users(params[:user][:name])\n render inline: \"<%= auto_complete_result @users, 'name' %>\", layout: false\n end", "def index\n\n #this for auto-complete search for places\n @places = (params[:q].blank?)? Place.all : Place.where(\"name ilike ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n #format.html #index.html.erb\n format.json { render json: @places }\n format.xml { render :xml => @places }\n end\n end", "def test_autocomplete_searches\n do_find_all\n do_autocomplete_query\n end", "def searchdescription\n end", "def recipe_name_search\n key_word = User.prompt.ask(\"Please piece of recipe name\")\n key_word == nil ? (key_word = 'bdncjkascndxasklxnasmndxb') : (key_word)\n recipe_query = Recipe.all.filter{|recipe| recipe.name.include?(key_word.capitalize())}\n\n if recipe_query != []\n recipe_viewer(recipe_query)\n else\n puts 'Invalid Search!'.colorize(:red);\n end\n end", "def searchauthor\n end", "def handle_autocomplete\n if (query = request.params['q'].to_s).empty?\n ''\n else\n model.autocomplete(:type=>@subtype, :request=>request, :association=>params_association, :query=>query, :exclude=>request.params['exclude']).join(\"\\n\")\n end\n end", "def srch(opts={})\n\t\t\t\tsrch_client.search(opts)\n\t\t\tend", "def auto_complete(word)\n completion_list.grep(/^#{ Regexp.escape(word) }/)\n end", "def search_ingredient\n puts ''\n instruction = \"Please enter ingredient name to search recipes: \".colorize(:color => :blue)\n search_term = @prompt.ask(instruction)\n while search_term == nil\n puts ''\n puts \"*** Please enter a valid search term. ***\".colorize(:color => :red)\n puts ''\n search_term = @prompt.ask(instruction)\n end\n @ing = search_term.downcase\n end", "def autocomplete\n keyword = params[:keyword]\n gs = Api::Google.new\n results = gs.autocomplete(keyword)\n render json: results # Return to frontend (-> results injected by spot_autocomplete_dropdown.js)\n end", "def full_text_search(integer)\n select_size integer\n hit_enter\n end", "def full_text_search(integer)\n select_size integer\n hit_enter\n end", "def search(text)\n find_css(\"#mapsApp_actionBar_searchEntry_searchInput\").click\n fill_in \"mapsApp_actionBar_searchEntry_searchInput_input\", :with => \"#{text}\\n\"\n wait_until { image_visible('poi_active') }\nend", "def keyword_autocomplete\n search_keyword = params[\"search\"]\n similar_keywords =\n Keyword.get_similar_keywords(search_keyword, [])\n similar_keywords.map! { |keyword| keyword.name }\n render json: similar_keywords\n end" ]
[ "0.75734234", "0.71830136", "0.6902254", "0.67994446", "0.6773764", "0.67401993", "0.6713767", "0.6676064", "0.662794", "0.66222584", "0.654764", "0.65425867", "0.65410644", "0.65326715", "0.6524823", "0.6483522", "0.6437802", "0.64359456", "0.6431746", "0.64205676", "0.64148194", "0.6407676", "0.6394051", "0.6371537", "0.6357553", "0.6347604", "0.6347434", "0.6342594", "0.6330806", "0.6328594", "0.6328594", "0.6328594", "0.6328594", "0.6328594", "0.6328594", "0.6328594", "0.6328594", "0.6328594", "0.6328594", "0.63260245", "0.63235044", "0.6319904", "0.62955046", "0.62873393", "0.62817174", "0.62644166", "0.6256958", "0.62492245", "0.6246121", "0.62412083", "0.6224413", "0.6207479", "0.62024677", "0.61970866", "0.61937493", "0.61894166", "0.6183374", "0.61808103", "0.6170625", "0.6154441", "0.615357", "0.615138", "0.61446416", "0.61318946", "0.61259294", "0.6125299", "0.61178", "0.6115656", "0.61141676", "0.61048454", "0.6104832", "0.6097487", "0.6083524", "0.60792255", "0.60784554", "0.6072282", "0.60701925", "0.60572934", "0.60561925", "0.60540485", "0.6042295", "0.6026209", "0.6021903", "0.5996782", "0.5991451", "0.5987656", "0.5983937", "0.5958387", "0.595587", "0.59539574", "0.59479105", "0.5945641", "0.594218", "0.59270537", "0.59232837", "0.5917162", "0.59128124", "0.59128124", "0.5911914", "0.59077924" ]
0.71819603
2
auto complete search for record, quest and campaign
def all_autocomplete quests = Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id}) recs = Record.search(params[:query], where: { :group_id => @user.wrapper_group.id}) render json: Search.json(quests.results + recs.results) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_complete\n @query = params[:auto_complete_query]\n @auto_complete = self.controller_name.classify.constantize.scoped(:limit => 10).search(@query)\n render :template => \"common/auto_complete\", :layout => nil\n end", "def autocomplete\r\n# return '' unless session[:edit_mode] > 0 # \r\n return render text: t('drgcms.not_authorized') unless dc_user_can(DcPermission::CAN_VIEW)\r\n# TODO Double check if previous line works as it should.\r\n table = params['table'].classify.constantize\r\n id = [params['id']] || '_id'\r\n# call method in class if search parameter has . This is for user defined searches\r\n# result must be returned as array of [id, search_field_value]\r\n a = if params['search'].match(/\\./)\r\n name, method = params['search'].split('.')\r\n table.send(method, params['input']).inject([]) do |r,v|\r\n r << { label: v[0], value: v[0], id: v[1].to_s }\r\n end\r\n# simply search which will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{params['input']}/i).limit(20).inject([]) do |r,v|\r\n r << { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render inline: a.to_json, formats: 'js'\r\nend", "def autocomplete; end", "def auto_complete_belongs_to_for_record_client_id\n auto_param = params[:record][:client][:text]\n @results = Client.find(:all,\n :conditions => [\"LOWER(name) LIKE ?\", \"%#{auto_param.downcase}%\"],\n :limit => 10\n )\n render :inline => '<%= model_auto_completer_result(@results, :name) %>'\n end", "def auto_complete_for_keyword_list\n auto_complete_responder_for_keyword params[:keyword][:list]\n end", "def contact_autocomplete(type, options)\n set_search_path\n Contact.where(\"type = :type AND matchcode ILIKE :term\", :type => type, :term => \"%#{options[:term]}%\").limit(20).map {|c| {:id => c.id, :label => c.to_s}}\n end", "def findorsuggest()\n \n end", "def auto_complete\n @query = params[:term] || ''\n @auto_complete = hook(:auto_complete, self, query: @query, user: current_user)\n if @auto_complete.empty?\n exclude_ids = auto_complete_ids_to_exclude(params[:related])\n @auto_complete = klass.my(current_user).text_search(@query).ransack(id_not_in: exclude_ids).result.limit(10)\n else\n @auto_complete = @auto_complete.last\n end\n\n session[:auto_complete] = controller_name.to_sym\n respond_to do |format|\n format.any(:js, :html) { render partial: 'auto_complete' }\n format.json do\n results = @auto_complete.map do |a|\n {\n id: a.id,\n text: a.respond_to?(:full_name) ? a.full_name : a.name\n }\n end\n render json: {\n results: results\n }\n end\n end\n end", "def auto_complete\n type = params[:type].to_s\n string = CGI.unescape(params[:id].to_s).strip_squeeze\n if string.blank?\n render(text: \"\\n\\n\")\n else\n auto = AutoComplete.subclass(type).new(string, params)\n results = auto.matching_strings.join(\"\\n\") + \"\\n\"\n render(text: results)\n end\n end", "def search_account\n data=params\n search_result =[]\n unless data[:q].blank?\n search_result = @company.accounts.search data[:q], :star => true, :limit => 10000\n else\n search_result = @company.accounts.all(:order => 'name ASC')\n end\n render :partial=> 'account_auto_complete', :locals => {:search_result => search_result}\n end", "def auto_complete_for_recipeSearch_description\n criteria = '%' + params[:recipeSearch][:description] + '%'\n @recipes = Recipe.find(:all, \n :conditions=>[\"title like ? OR description like ?\",criteria, criteria],\n :order=>'title desc', :limit=>10)\n render :partial=> \"recipes\" \n end", "def auto_complete_model_for_person_fullname\n @result = Person.non_student.find_all{|p| p.fullname.downcase.include?(params[:person][:fullname].downcase)}[0..10]\n render :partial => \"auto_complete\", :object => @result, :locals => { :highlight_phrase => params[:person][:fullname] }\n end", "def quest_autocomplete\n render json: Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n end", "def auto_complete_result(entries, field, phrase = nil)\n return unless entries\n render :partial => '/admin/orders/autocomplete', :locals => { :entries => entries, :field => field, :phrase => phrase }\n end", "def auto_complete_for_ces\r\n value = params[:term]\r\n field = %w(collectors locality mthd verbatim_method macro_habitat micro_habitat).include?(params[:field]) && params[:field]\r\n\r\n if field && value\r\n @ids = Ce.select(field.downcase).where([ \"ces.proj_id = ? AND LOWER(ces.#{field.downcase}) LIKE (?)\", params[:proj_id], '%' + value.downcase + '%' ])\r\n .group(field.downcase).order(\"#{field.downcase} ASC\").limit(100).map {|v| v.send(field.downcase.to_sym)}\r\n\r\n render :json => Json::simple_autocomplete(@ids)\r\n elsif value\r\n @ces = Ce.find_for_auto_complete(value)\r\n render :json => Json::format_for_autocomplete_with_display_name(:entries => @ces, :method => params[:method])\r\n else\r\n head(:bad_request)\r\n end\r\n end", "def ajax_auto_complete\n type = params[:type].to_s\n instr = params[:id].to_s\n letter = ' '\n scientific = false\n user = login_for_ajax\n if user\n scientific = (user.location_format == :scientific)\n end\n @items = []\n if instr.match(/^(\\w)/)\n letter = $1\n case type\n\n when 'location'\n @items = Observation.connection.select_values(%(\n SELECT DISTINCT `where` FROM observations\n WHERE `where` LIKE '#{letter}%' OR\n `where` LIKE '% #{letter}%'\n )) + Location.connection.select_values(%(\n SELECT DISTINCT `name` FROM locations\n WHERE `name` LIKE '#{letter}%' OR\n `name` LIKE '% #{letter}%'\n ))\n if scientific\n @items.map! {|i| Location.reverse_name(i)}\n end\n @items.sort!\n\n when 'name'\n @items = Name.connection.select_values %(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{letter}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )\n\n when 'name2'\n @items = Name.connection.select_values(%(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{instr}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )).sort_by {|x| (x.match(' ') ? 'b' : 'a') + x}\n # This sort puts genera and higher on top, everything else on bottom,\n # and sorts alphabetically within each group.\n letter = ''\n\n when 'project'\n @items = Project.connection.select_values %(\n SELECT title FROM projects\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'species_list'\n @items = SpeciesList.connection.select_values %(\n SELECT title FROM species_lists\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'user'\n @items = User.connection.select_values %(\n SELECT CONCAT(users.login, IF(users.name = \"\", \"\", CONCAT(\" <\", users.name, \">\")))\n FROM users\n WHERE login LIKE '#{letter}%'\n OR name LIKE '#{letter}%'\n OR name LIKE '% #{letter}%'\n ORDER BY login ASC\n )\n end\n end\n\n # Result is the letter requested followed by results, one per line. (It\n # truncates any results that have newlines in them -- that's an error.)\n render(:layout => false, :inline => letter +\n %(<%= @items.uniq.map {|n| h(n.gsub(/[\\r\\n].*/,'')) + \"\\n\"}.join('') %>))\n end", "def auto_complete_for_club_member_login\n\n # split by spaces, downcase and create query for each.\n # Remember to Sanitize the SQL\n conditions = params[:club_member][:login].downcase.split.map {\n\t\t # Sanitize ***********************************\n\t\t |w| \"LOWER(login) LIKE '%\" + (w.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")) +\"%'\" } # AND the queries.\n\n # AND the queries.\n find_options = {\n :conditions => conditions.join(\" AND \"),\n :order => \"login ASC\",\n :limit => AC_CLUB_MEMBER_NAME_LIMIT }\n\n @items = ClubMember.find(:all, find_options)\n\n render :inline => \"<%= auto_complete_result_2 @items %>\"\n end", "def autocomplete\r\n # table parameter must be defined. If not, get it from search parameter\r\n if params['table'].nil? && params['search'].match(/\\./)\r\n name = params['search'].split('.').first\r\n params['table'] = name.underscore\r\n end\r\n if params['table'].match('_control')\r\n # it must be at least logged on\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW, 'dc_memory')\r\n else\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW)\r\n end\r\n\r\n table = params['table'].classify.constantize\r\n input = params['input'].gsub(/\\(|\\)|\\[|\\]|\\{|\\|\\.|\\,}/, '')\r\n # call method in class if search parameter contains . This is for user defined searches\r\n a = if params['search'].match(/\\./)\r\n #method, additional_params = params['search'].split('.')\r\n #data = additional_params ? table.send(method, input, additional_params, self) : table.send(method, input)\r\n name, method = params['search'].split('.')\r\n data = table.send(method, input)\r\n data.map do |v|\r\n { label: v[0], value: v[0], id: (v[1] || v[0]).to_s }\r\n end\r\n # will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{input}/i).limit(20).map do |v|\r\n { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render json: a\r\nend", "def complete(search); Bond::DefaultMission.completions; end", "def scaffold_auto_complete_find(phrase, options = {})\n find_options = { :limit => scaffold_auto_complete_results_limit,\n :conditions => scaffold_auto_complete_conditions(phrase), \n :order => scaffold_select_order,\n :include => scaffold_include}.merge(options)\n find(:all, find_options)\n end", "def live_search\n # @campaigns = Campaign.find_latest params[:textfield]\n @campaigns = Campaign.contains(params[:textfield])\n render :layout => false\n end", "def auto_complete_for_person_name\n \tname = params[:person][:name].downcase\n \tnames = name.strip.split(' ')\n \t\n find_options = {\n :order => \"last_name, first_name ASC\",\n\t :limit => 10 }\n\n\t\tif names.size > 1\n\t\t\t# there are two names provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' AND LOWER(last_name) LIKE '%#{names[1]}%' OR LOWER(first_name) LIKE '%#{names[1]}%' AND LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\telse\n\t\t\t# only the first name or last name has been provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' OR LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\tend\n\t\n\t\t@items = Person.find(:all, find_options)\n\t\n\t\tRails.logger.info(\"@items.size = #{@items.size}\")\n\n render :inline => \"<%= auto_complete_result @items, 'name' %>\"\n end", "def auto_complete_for_journal_title\n # Don't search on blank query.\n query = params['rft.jtitle']\n search_type = params[\"umlaut.title_search_type\"] || \"contains\"\n unless ( query.blank? )\n (context_objects, total_count) = find_by_title\n @titles = context_objects.collect do |co|\n metadata = co.referent.metadata\n {:object_id => metadata[\"object_id\"], :title => (metadata[\"jtitle\"] || metadata[\"btitle\"] || metadata[\"title\"])}\n end\n end\n render :text => @titles.to_json, :content_type => \"application/json\"\n end", "def autocomplete(opts={})\n type, request, assoc, query, exclude = opts.values_at(:type, :request, :association, :query, :exclude)\n if assoc\n if exclude && association_type(assoc) == :edit\n ref = model.association_reflection(assoc)\n block = lambda do |ds|\n ds.exclude(S.qualify(ref.associated_class.table_name, ref.right_primary_key)=>model.db.from(ref[:join_table]).where(ref[:left_key]=>exclude).select(ref[:right_key]))\n end\n end\n return associated_model_class(assoc).autocomplete(opts.merge(:type=>:association, :association=>nil), &block)\n end\n opts = autocomplete_options_for(type, request)\n callback_opts = {:type=>type, :request=>request, :query=>query}\n ds = all_dataset_for(type, request)\n ds = opts[:callback].call(ds, callback_opts) if opts[:callback]\n display = opts[:display] || S.qualify(model.table_name, :name)\n display = display.call(callback_opts) if display.respond_to?(:call)\n limit = opts[:limit] || 10\n limit = limit.call(callback_opts) if limit.respond_to?(:call)\n opts[:filter] ||= lambda{|ds1, _| ds1.where(S.ilike(display, \"%#{ds.escape_like(query)}%\"))}\n ds = opts[:filter].call(ds, callback_opts)\n ds = ds.select(S.join([S.qualify(model.table_name, model.primary_key), display], ' - ').as(:v)).\n limit(limit)\n ds = yield ds if block_given?\n ds.map(:v)\n end", "def search_matter\n cid = @company.id\n @search_result =[]\n @search_result = matter_search # Common search\n respond_to do |format|\n format.js { render :partial=> 'matter_auto_complete', :object => @search_result }\n format.html { render :partial=> 'matter_auto_complete', :object => @search_result }\n end \n end", "def autocomplete_on\n\t\tconditions = if params[:name]\n [\"name LIKE :name\", { :name => \"%#{params['name']}%\"} ]\n else\n {}\n end\n\t\t @objects = params[:model_name].classify.constantize.find(:all, :conditions => conditions)\n\t\t render :text => '<ul>'+ @objects.map{ |e| '<li>' + e.name + '</li>' }.join(' ')+'</ul>'\n\tend", "def autocomplete\n\t\tcond = get_search_conditions(params[:term], {\n\t\t\t'vacancies.exec_approval_no' => :like,\n\t\t\t'vacancies.org_no' => :like,\n\t\t\t'vacancies.cost_center' => :like,\n\t\t\t'vacancies.position_no' => :like,\n\t\t\t'vacancies.position' => :like,\n\t\t\t'vacancies.last_incumbent' => :like\n\t\t})\n\t\tcond << 'vacancies.exec_decision = \"Approved\"'\n\t\tuser_limited = @current_user.agency_level? && !@current_user.allow_vacancy_omb && !@current_user.allow_vacancy_admin\n\t\tagency_id = user_limited && @current_user.agency_id || params[:agency_id]\n\t\tdepartment_id = user_limited && @current_user.department_id || params[:department_id]\n\t\tdivision_id = user_limited && @current_user.division_id || params[:division_id]\n\t\tcond << 'vacancies.agency_id = %d' % agency_id.to_i if !agency_id.blank?\n\t\tcond << 'vacancies.department_id = %d' % department_id.to_i if !department_id.blank?\n\t\tcond << 'vacancies.division_id = %d' % division_id.to_i if !division_id.blank?\n\t\tobjs = @model.find(:all, :include => :vacancy_data, :conditions => get_where(cond), :limit => 10, :order => 'vacancies.id desc').map { |o|\n\t\t\to.autocomplete_json_data\n\t\t}\n\t\trender :json => objs.to_json\n\tend", "def auto_complete_for_customer\n render :json => {} and return if (terms_string = params[:term].to_s).length < 2\n terms = terms_string.split( /\\s+/ )\n max_matches = 60\n exact_name_matches = Customer.exact_name_matches(terms).limit(max_matches/3)\n partial_name_matches = Customer.partial_name_matches(terms).limit(max_matches/3) - exact_name_matches\n other_term_matches = Customer.other_term_matches(terms).limit(max_matches/3) - exact_name_matches - partial_name_matches\n\n if (exact_name_matches.size + partial_name_matches.size + other_term_matches.size) == 0\n render :json => [{'label' => '(no matches)', 'value' => nil}] and return\n end\n show_all_matches = [{\n 'label' => \"List all matching '#{terms_string}'\",\n 'value' => customers_path(:customers_filter => terms_string)}]\n result =\n exact_name_matches.map { |c| {'label' => c.full_name, 'value' => customer_path(c)} } +\n partial_name_matches.map { |c| {'label' => c.full_name, 'value' => customer_path(c)} } +\n other_term_matches.map { |c| {'label' => \"#{c.full_name} (#{c.field_matching_terms(terms)})\", 'value' => customer_path(c)} } +\n show_all_matches\n render :json => result.uniq\n end", "def autocomplete\n render :json => end_of_association_chain.ordered.search(params[:term]).limit(params[:limit] || 10).to_autocomplete\n end", "def auto_complete_for_ingredient_name\n value = params[:ingredient][:name]\n @ingredients = Ingredient.find(:all, \n :conditions => [ 'LOWER(name) LIKE ?',\n '%' + value.downcase + '%' ], \n :order => 'name ASC',\n :limit => 8)\n render :partial => 'ingredient_name_matches'\n end", "def causeautocomplete\n searchtext = params['searchText']\n\n if session[:roleid] == ADMIN_ROLE\n # this will do a like search ignoring case\n @searchcauseresults = Charity.where(\"charityname ILIKE ?\", \"%\" + searchtext + \"%\")\n \n else\n \n # this will do a like search ignoring case\n @searchcauseresults = Charity.where(\"charityname ILIKE ?\", \"%\" + searchtext + \"%\")\n .where(isapproved: true)\n \n end\n\n \n\n #if @searchcauseresults.count == 0\n # @searchcauseresults = Charity.new\n #end\n \n render :json => @searchcauseresults\n\n end", "def search\n\n end", "def autocomplete\n @response, = search_service.search_results do |builder|\n builder.with(builder.blacklight_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field, public: true, rows: 100))\n end\n\n respond_to do |format|\n format.json do\n render json: { docs: autocomplete_json_response(@response.documents) }\n end\n end\n end", "def autocomplete_game_search \t\t\t\t \n #@games = Game.name_like(params[\"q\"])[0..10]\n #platform_result = Game.platform_like(params[\"q\"])[0..10] \n @games = Game.search({\"name_cont\" => params[\"q\"]}).result[0..10]\n platform_games = Game.search({\"platform_cont\" => params[\"q\"]}).result[0..10]\n @games = @games | platform_games\n render :json => @games.collect {|game| [game[\"name\"] + \" [\"+game[\"platform\"]+\"]\", game[\"platform\"]]}\n end", "def search; end", "def search \n\n end", "def auto_complete_for_message_to\n query = params[:message][:to]\n @people = Person.all(:order => \"last_name ASC\", :conditions => ['first_name LIKE ? or last_name LIKE ?', \"#{query}%\", \"#{query}%\"])\n render :partial=>\"auto_complete_for_message_to\"\n end", "def autocomplete\n search_params = params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)\n (_, @document_list) = search_results(search_params.merge(public: true), search_params_logic)\n\n respond_to do |format|\n format.json do\n render json: { docs: autocomplete_json_response(@document_list) }\n end\n end\n end", "def suggest\n if !params.has_key? :q then\n head :ok\n return\n end\n\n search_stmt = params[:q].upcase\n current_user_id = current_user.id\n\n results = UrContact.where.has{\n (user_id == current_user_id) &\n (upper(name).like \"%#{search_stmt}%\") |\n (upper(email).like \"%#{search_stmt}%\") |\n (upper(telephone).like \"%#{search_stmt}%\")\n }\n\n if params[:format] == \"search\" then\n formattedResults = results\n else\n formattedResults = {query:params[:q], suggestions:results.map{|x| {value:x.name, data:x}} }\n end\n\n #render json: {query:params[:q], suggestions:results}\n render json: formattedResults\n end", "def auto_complete_for(object, association, method, options={}) #:nodoc:\n conditions = \"\"\n conditions = \" AND \"+options[:and_conditions].to_s unless options[:and_conditions].nil?\n options.delete(:and_conditions)\n if object.to_s.camelize.constantize.reflections[association].class_name.constantize.columns_hash[\"company_id\"].nil?\n define_method(\"auto_complete_belongs_to_for_#{object}_#{association}_#{method}\") do\n find_options = {\n :conditions => [\"LOWER(#{method}) LIKE ? #{conditions}\", '%' + params[association][method].downcase + '%'],\n :order => \"#{method} ASC\",\n :limit => 10\n }.merge!(options)\n klass = object.to_s.camelize.constantize.reflect_on_association(association).options[:class_name].constantize\n @items = klass.find(:all, find_options)\n render :inline => \"<%= model_auto_complete_result @items, '#{method}' %>\"\n end\n else\n define_method(\"auto_complete_belongs_to_for_#{object}_#{association}_#{method}\") do\n find_options = {\n :conditions => [\"LOWER(#{method}) LIKE ? AND company_id=? #{conditions}\", '%' + params[association][method].downcase + '%', @current_company_id],\n :order => \"#{method} ASC\",\n :limit => 10\n }.merge!(options)\n klass = object.to_s.camelize.constantize.reflect_on_association(association).options[:class_name].constantize\n @items = klass.find(:all, find_options)\n render :inline => \"<%= model_auto_complete_result @items, '#{method}' %>\"\n end\n end\n end", "def autocomplete\n\t\tquery_params = QueryFormat.autocomplete_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tquery['field'] = \"content_auto\" if query['field'].blank?\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\tmax = query['max'].to_i\n\t\t\tquery.delete('max')\n\t\t\twords = solr.auto_complete(query)\n\t\t\twords.sort! { |a,b| b[:count] <=> a[:count] }\n\t\t\twords = words[0..(max-1)]\n\t\t\t@results = words.map { |word|\n\t\t\t\t{ :item => word[:name], :occurrences => word[:count] }\n\t\t\t}\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results } }\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n\tend", "def autocomplete\n @drain_results = Drain.ransack(address_cont: params[:q]).result(distinct: true).limit(5)\n @street_results = Street.ransack(street_name_cont: params[:q]).result(distinct: true).limit(5)\n @need_help_category_results = NeedHelpCategory.ransack(category_name_cont: params[:q]).result(distinct: true).limit(5)\n render json: {streets: ActiveModel::ArraySerializer.new(\n @street_results,\n each_serializer: Api::V1::StreetSerializer\n ), drains: ActiveModel::ArraySerializer.new(\n @drain_results,\n each_serializer: Api::V1::DrainSerializer\n ), categories: ActiveModel::ArraySerializer.new(\n @need_help_category_results,\n each_serializer: Api::V1::NeedHelpCategorySerializer\n )}\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def autocomplete\n @leader = Leaders.find(:all, :conditions => [\"name like ?\",\"%\" + params[:term].upcase + \"%\"])\n render json: @leader \n end", "def autocomplete\n \n @credits = Credit.select([:id, :department, :credit]).where(\"credit ILIKE ? \", \"%#{params[:filter]}%\" ).limit(params[:limit])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @credits }\n format.js\n format.json { render :json => @credits }\n end\n\n\n end", "def search\n end", "def handle_autocomplete\n if (query = request.params['q'].to_s).empty?\n ''\n else\n model.autocomplete(:type=>@subtype, :request=>request, :association=>params_association, :query=>query, :exclude=>request.params['exclude']).join(\"\\n\")\n end\n end", "def search\n\n end", "def fast_suggestions query\n return []\n end", "def fill_auto_complete(field, filter = nil, full_text)\n fill_in field, with: filter unless filter\n\n page.execute_script %Q{ $('##{field}').trigger('focus') }\n page.execute_script %Q{ $('##{field}').trigger('keydown') }\n\n selector = %Q{ul.ui-autocomplete li.ui-menu-item a:contains(\"#{full_text}\")}\n\n sleep 5\n page.execute_script %Q{ $('#{selector}').trigger('mouseenter').click() }\n sleep 5\n end", "def suggestions\n suggest(search_suggestions)\n end", "def get_autocomplete_items(parameters)\n HsCode.where(\"hs_codes.code like :search or hs_codes.description like :search\", :search => \"%#{params[:term]}%\").select('description, code').limit(100)\n end", "def autocomplete_sn\n render :partial => 'autocomplete', :object => Scientificname.find(:all, :conditions => ['name ILIKE ?', params[:sn] + '%' ])\n end", "def auto_complete_for_technician_enquiry_from\n re = Regexp.new(\"^#{params[:technician][:name]}\", \"i\")\n find_options = { :order => \"name ASC\" }\n @technicians = Technician.find(:all, find_options).collect(&:name).select { |org| org.match re }\n render :template => 'sales/auto_complete_for_technician_name',:layout=>false\n end", "def bu_autocomplete\n search_term = params[:term]\n\n species_id = Specie.find_by_scientificname(params[:species])\n\n cultivars = Cultivar.where(\"specie_id = ?\", species_id)\n\n logger.debug(\"cultivars for autocompletion: #{cultivars.inspect}\")\n\n filtered_cultivars = cultivars.where(\"LOWER(name) LIKE LOWER(?)\", '%' + search_term + '%')\n\n if filtered_cultivars.size > 0 || search_term.size > 1\n cultivars = filtered_cultivars\n # else if there are no matches and the user has only typed one letter, just return every cultivar associated with the chosen species\n end\n\n cultivars = cultivars.to_a.map do |item|\n item.name.squish\n end\n\n # don't show rows where name is null or empty\n # TO-DO: eliminate these from the database and prevent them with a constraint\n cultivars.delete_if { |item| item.nil? || item.empty? }\n\n if cultivars.empty?\n cultivars = [ { label: \"No matches\", value: \"\" }]\n end\n\n respond_to do |format|\n format.json { render :json => cultivars }\n end\n end", "def do_search\n @search_text = params[:q]\n\n # Doctoring for the view to find matches:\n @q = @search_text\n @q.chop! if params[:q] =~ /\\*$/\n @q = @q[1..-1] if params[:q] =~ /^\\*/\n\n # TODO: we'll want some whitelist filtering here later:\n # params[:q] = \"#{@q}*\" unless params[:q] =~ /\\*$/ or params[:q] =~ /^[-+]/ or params[:q] =~ /\\s/\n params[:q] = I18n.transliterate(params[:q]).downcase\n\n # TODO: This search suggestions block is large; extract.\n\n # First step (and, yes, this will be slow—we will optimize later), look for\n # search suggestions that match the query:\n words = params[:q].split # TODO: we might want to remove words with ^-\n # TODO: we might also want to remove stopwords e.g.: https://github.com/brenes/stopwords-filter\n suggestions = []\n # YUCK! This is the best way to do this in Searchkick at the moment, though.\n # :S\n words.each do |word|\n word_search = SearchSuggestion.search(word, fields: [{ match: :exact }])\n suggestions += word_search.results if word_search.respond_to?(:results)\n end\n\n # If we only found one thing and they only asked for one thing:\n if suggestions.size == 1 && params[:q] !~ /\\s/\n Rails.logger.warn(\"One suggestion.\")\n # TODO: move this to a helper? It can't go on the model...\n suggestion = suggestions.first\n suggestion = suggestion.synonym_of if suggestion.synonym_of\n where = case suggestion.type\n when :page\n suggestion.page\n when :object_term\n term_records_path(uri: suggestion.object_term, object: true)\n when :path\n suggestion.path\n when :wkt_string\n flash[:notice] = \"Unimplemented, sorry.\"\n \"/\"\n end\n return redirect_to(where)\n elsif suggestions.size >= 2 && params[:q] =~ /\\s/\n Rails.logger.warn(\"Multiple suggestions.\")\n groups = suggestions.group_by(&:type)\n # Easier to handle:\n groups[:page] ||= []\n groups[:object_term] ||= []\n groups[:path] ||= []\n groups[:wkt_string] ||= []\n if groups[:page].size > 1\n Rails.logger.warn(\"Multiple PAGE suggestions.\")\n # We can't use suggestions if there's more than one species. Sorry.\n flash[:notice] = t(\"search.flash.more_than_one_species\",\n species: groups[:page].map(&:match).to_sentence)\n else\n Rails.logger.warn(\"0 or 1 Page suggestions.\")\n clade = groups[:page].try(:first).try(:page_id)\n Rails.logger.warn(\"Page suggestion: #{clade}\") if clade\n if groups[:object_term].size > 2\n Rails.logger.warn(\"Over two TERM suggestions.\")\n flash[:notice] = t(\"search.flash.more_than_two_terms\",\n terms: groups[:object_term].map(&:match).to_sentence)\n elsif groups[:path].size > 0\n Rails.logger.warn(\"...had PATH suggestions.\")\n flash[:notice] = t(\"search.flash.cannot_combine_paths\",\n path: groups[:path].map(&:match).to_sentence)\n else # NOTE: this assumes we only have OBJECT term suggestions, not predicates.\n Rails.logger.warn(\"Usable suggestions...\")\n (first, second) = groups[:object_term] # Arbitrary which is first...\n Rails.logger.warn(\"First term: #{first.object_term}\")\n Rails.logger.warn(\"Second term: #{second.object_term}\") if second\n return redirect_to(term_records_path(uri: first.object_term, object: true,\n and_object: second.try(:object_term), clade: clade))\n end\n end\n end\n\n @clade = if params[:clade]\n puts \"*\" * 100\n puts \"** Filtering by clade #{params[:clade]}\"\n # It doesn't make sense to filter some things by clade:\n params[:only] = if params[:only]\n Array(params[:only]) - [:collections, :users, :predicates, :object_terms]\n else\n [:pages, :media]\n end\n puts \"Only param should now be: #{params[:only]}\"\n Page.find(params[:clade])\n else\n nil\n end\n\n default = params.has_key?(:only)? false : true\n @types = {}\n [ :pages, :collections, :articles, :images, :videos, :videos, :sounds, :links, :users, :predicates, :object_terms ].\n each do |sym|\n @types[sym] = default\n end\n\n @types[params[:only].to_sym] = true if params.has_key?(:only)\n\n # if params.has_key?(:only)\n # Array(params[:only]).each { |type| @types[type.to_sym] = true }\n # elsif params.has_key?(:except)\n # Array(params[:except]).each { |type| @types[type.to_sym] = false }\n # end\n\n # NOTE: no search is performed unless the @types hash indicates a search for\n # that class is required:\n\n @pages = if @types[:pages]\n fields = %w[preferred_vernacular_strings^20 vernacular_strings^20 preferred_scientific_names^10 scientific_name^10 synonyms^10 providers resource_pks]\n match = words.size == 1 ? :text_start : :phrase\n basic_search(Page, boost_by: [:page_richness, :specificity, :depth], match: match, fields: fields,\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n includes: [:preferred_vernaculars, :medium, { native_node: { node_ancestors: :ancestor } }])\n else\n nil\n end\n\n\n @collections = if @types[:collections]\n basic_search(Collection, fields: [\"name^5\", \"description\"])\n else\n nil\n end\n\n @articles = if @types[:articles]\n basic_search(Searchkick,\n fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n index_name: [Article])\n else\n nil\n end\n\n @images = if @types[:images]\n media_search(\"image\")\n else\n nil\n end\n\n @videos = if @types[:videos]\n media_search(\"video\")\n else\n nil\n end\n\n @sounds = if @types[:sounds]\n media_search(\"sound\")\n else\n nil\n end\n\n # @links = if @types[:links]\n # basic_search(Searchkick,\n # fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n # where: @clade ? { ancestry_ids: @clade.id } : nil,\n # index_name: [Link])\n # else\n # nil\n # end\n\n @users = if @types[:users]\n basic_search(User, fields: [\"username^6\", \"name^4\", \"tag_line\", \"bio^2\"])\n else\n nil\n end\n\n Searchkick.multi_search([@pages, @articles, @images, @videos, @sounds, @collections, @users].compact)\n\n @pages = PageSearchDecorator.decorate_collection(@pages) if @pages\n @articles = ArticleSearchDecorator.decorate_collection(@articles) if @articles\n @images = ImageSearchDecorator.decorate_collection(@images) if @images\n @videos = VideoSearchDecorator.decorate_collection(@videos) if @videos\n @sounds = SoundSearchDecorator.decorate_collection(@sounds) if @sounds\n @collections = CollectionSearchDecorator.decorate_collection(@collections) if @collections\n @users = UserSearchDecorator.decorate_collection(@users) if @users\n\n # if @types[:predicates]\n # @predicates_count = TraitBank.count_predicate_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @predicates = Kaminari.paginate_array(\n # TraitBank.search_predicate_terms(@q, params[:page], params[:per_page]),\n # total_count: @predicates_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n #\n # if @types[:object_terms]\n # @object_terms_count = TraitBank.count_object_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @object_terms = Kaminari.paginate_array(\n # TraitBank.search_object_terms(@q, params[:page], params[:per_page]),\n # total_count: @object_terms_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n\n respond_to do |fmt|\n fmt.html do\n @page_title = t(:page_title_search, query: @q)\n end\n\n fmt.js { }\n\n # TODO: JSON results for other types! TODO: move; this is view logic...\n fmt.json do\n render json: JSON.pretty_generate(@pages.results.as_json(\n except: :native_node_id,\n methods: :scientific_name,\n include: {\n preferred_vernaculars: { only: [:string],\n include: { language: { only: :code } } },\n # NOTE I'm excluding a lot more for search than you would want for\n # the basic page json:\n top_media: { only: [ :id, :guid, :owner, :name ],\n methods: [:small_icon_url, :medium_icon_url],\n include: { provider: { only: [:id, :name] },\n license: { only: [:id, :name, :icon_url] } } }\n }\n ))\n end\n end\n end", "def set_search\n @search_adie = Adie.search(params[:q])\n @search_company = Company.search(params[:q])\n @search_employee = Employee.search(params[:q])\n end", "def restaurant_suggestions\n match_key = Riddle.escape(params[:key]).split(' ').join('* ') + '*'\n begin\n suggestions = Restaurant.search(match_key,{:limit=>20,:match_mode => :extended,\n :ignore_errors=>true,:populate=>true,:retry_stale=>true})\n rescue Exception\n suggestions = []\n end\n response = []\n suggestions.each{|d| response << {:value=>d.id,:label=>d.name}}\n render :json=>response.to_json\n end", "def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end", "def perform_search\n terms = { vehicle_year: 2006,\n vehicle_brand: \"Yamaha\",\n vehicle_model: \"Yz250\",\n vehicle_submodel: \"-- Base\",\n category_name: \"Complete Wheel Assembly\" }\n perform_search(terms)\n end", "def search\r\nend", "def autocomplete\n key = params[:key]\n feeds = Feed.select('title').where('title LIKE ?', \"%#{key}%\").limit(5).map { |f| f.title }\n upcomings = Upcoming.select('title').where('title LIKE ?',\"%#{key}%\").limit(5).map { |u| u.title }\n artists = Artist.select('name').where('name LIKE ?',\"%#{key}%\").limit(5).map { |u| u.name }\n result = feeds + upcomings + artists\n\n respond_to do |format|\n format.json { render json: result.shuffle }\n end\n end", "def autocomplete(q:)\n return unless String(q).length > 1\n\n result = Geocoder.search(q, autocomplete: true)\n result&.data\n end", "def suggest_results\n repository.auto_suggest(suggest_handler_path, request_params)\n end", "def auto_complete(controller, context = {})\n query, tags = parse_query_and_tags(context[:query])\n klass = controller.controller_name.classify.constantize\n if tags.empty?\n klass.my(:user => context[:user], :limit => 10).search(query)\n else\n klass.my(:user => context[:user], :limit => 10).search(query).tagged_with(tags, :on => :tags)\n end\n end", "def test_autocomplete_searches\n do_find_all\n do_autocomplete_query\n end", "def autocomplete(term)\n get(\"/catalog/titles/autocomplete?term=#{term}\")\n end", "def getAutocomplete(query, type)\n request('getAutocomplete', {'query' => query, 'type' => type})\nend", "def autocomplete(name)\n self.class.get(\"/cards/autocomplete?q=#{name}\")\n end", "def auto_search\n\t\t@city=ActiveRecord::Base.connection.execute(\"select c.id, c.name,co.name from City c, Country co where c.name like '%\"+params[:search]+\"%' and c.countrycode=co.code\")\n\t\trender :json =>@city\n\t\treturn\n\t\tend", "def scaffold_auto_complete_find(phrase, options = {})\n session = options.delete(:session)\n if association = options.delete(:association)\n if meth = scaffold_method_override(:auto_complete_find, association, phrase, options)\n meth.call\n else\n scaffold_associated_class(association).scaffold_auto_complete_find(phrase, :session=>session)\n end\n else\n find_options = { :limit => scaffold_auto_complete_results_limit,\n :conditions => [scaffold_auto_complete_conditions(phrase), scaffold_session_conditions(session)],\n :order => scaffold_select_order(:auto_complete),\n :include => scaffold_include(:auto_complete)}.merge(options)\n scaffold_get_objects(find_options)\n end\n end", "def suggest\n end", "def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end", "def searchSuggestions(query,extras)\n method = 'searchSuggestions'\n type = TODO\n args = {:query=>query}\n args[:extras] = extras if extras\n return_object type,method,args\n end", "def record_default_search\n Umbra::Record.search {\n fulltext params[:q]\n any_of do\n current_user_admin_collections.each { |collection|\n with(:collection, collection)\n }\n end\n order_by(sort_column.to_sym, sort_direction.to_sym)\n paginate :page => params[:page] || 1, :per_page => 30\n }\n end", "def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end", "def search\nend", "def search\n @query = params[:q]\n @ads = Ad.within(@city, 30)\n @ads = @ads.fulltext_search(@query).group_by { |x| x.created_at.to_date }\n end", "def search\n if params[:search].present?\n @commercial_leads = CommercialLead.search(params[:search])\n else\n @commercial_leads = CommercialLead.all.order('initial_contact DESC')\n end\n end", "def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end", "def macro_search\n @cities_search = City.ransack(name_cont: params[:q]).result(distinct: true).limit(5)\n @users_search = User.ransack(name_cont: params[:q]).result(distinct: true).limit(6)\n respond_to do |format|\n format.json # Renders json for the macro_search.json.jbuilder file in views/searches folder\n format.html {\n flash[:alert] = \"Please select a search result from the dropdown\"\n redirect_to request.referrer\n }\n end \n end", "def auto_complete\n @users = if params[:term] =~ /(@[^\\s]+)\\s.*/\n elsif user_name = params[:term].match(/(@[^\\s]+)/)\n users = User.select('name').where('name LIKE ?', \"%#{user_name[1].to_s[1..-1]}%\")\n\n users.map {|user| {name: \"#@{user.name}\"} }\n end\n render json: @users.to_json\n end", "def autocomplete\n render json: Post.search(params[:query],operator: \"or\", autocomplete: true,limit: 10,boost_by_distance: {field: :location, origin: [current_user.lat, current_user.lon]}).map {|post| {title: post.title, value: post.id}}\n end", "def generate_autocomplete\n # we'll martial brand into the autocomplete field since it's\n # natural to search by brand\n s = \"#{ brand } #{ name } #{ model_number }\".squish\n s = s.truncate(45, omission: \"\", separator: \" \") if s.length > 45\n self.autocomplete = self.class.normalize(s)\n end", "def search\n Settings.record_activity \n if @params['show_results'] == 'true' && (@last_search = SearchContacts.last_search)\n @contacts_already_on_device = @last_search.find_contacts_on_device\n end\n render :action => :search, :back => 'callback:', :layout => 'layout_JQM_Lite'\n end", "def scaffold_auto_complete_conditions(phrase)\n [scaffold_auto_complete_conditions_phrase, (scaffold_auto_complete_search_format_string % phrase.send(scaffold_auto_complete_phrase_modifier))]\n end", "def autocomplete\n keyword = params[:keyword]\n gs = Api::Google.new\n results = gs.autocomplete(keyword)\n render json: results # Return to frontend (-> results injected by spot_autocomplete_dropdown.js)\n end", "def search(query); end", "def search_designer\n end", "def srch(opts={})\n\t\t\t\tsrch_client.search(opts)\n\t\t\tend", "def scaffold_auto_complete_conditions(phrase)\n [scaffold_auto_complete_conditions_phrase, (scaffold_auto_complete_search_format_string % phrase.send(scaffold_auto_complete_phrase_modifier))]\n end" ]
[ "0.72117686", "0.6935926", "0.68776965", "0.68259245", "0.6804525", "0.67708963", "0.6766838", "0.67333305", "0.6709296", "0.6705312", "0.66823095", "0.6648196", "0.66409165", "0.6623571", "0.6620798", "0.6590435", "0.65527", "0.64900714", "0.64672875", "0.64652604", "0.64617246", "0.645568", "0.64386064", "0.6412318", "0.6404812", "0.64004576", "0.63960004", "0.63812697", "0.6378223", "0.63770354", "0.637356", "0.6314554", "0.62933487", "0.62834334", "0.6276992", "0.6267009", "0.62609273", "0.6253186", "0.6246613", "0.6243804", "0.6231632", "0.620361", "0.61981684", "0.61981684", "0.61981684", "0.61981684", "0.61981684", "0.61981684", "0.61981684", "0.61981684", "0.61981684", "0.61981684", "0.6189794", "0.61894596", "0.6188447", "0.6175207", "0.6174071", "0.6162635", "0.61544526", "0.6145486", "0.6138886", "0.612767", "0.61224216", "0.6117366", "0.61154675", "0.61117315", "0.61023444", "0.61013645", "0.6097531", "0.609172", "0.6090378", "0.6083269", "0.6078269", "0.60702574", "0.60650337", "0.60648215", "0.60645723", "0.60569113", "0.604417", "0.6040791", "0.60303056", "0.60293376", "0.6001476", "0.59775716", "0.5976546", "0.5972741", "0.59596646", "0.59525037", "0.5949816", "0.59266996", "0.59250796", "0.5924155", "0.591614", "0.59076273", "0.58987725", "0.58849776", "0.5872659", "0.5866325", "0.5859876", "0.58530164" ]
0.7028649
1
GET /commit_filepaths GET /commit_filepaths.json
def index @commit_filepaths = CommitFilepath.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_in_commit(commit)\n\tfiles = {}\n\tcommit.diffs.each do | diff |\n\t\tfiles[diff.a_path] = nil unless files.has_key? diff.a_path\n\t\tfiles[diff.b_path] = nil unless files.has_key? diff.b_path\n\t\t# what about diff.deleted_file and diff.new_file?\n\tend\n\treturn files.keys\nend", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n def lslr(tree, path = '')\n all_files = []\n for f in tree.map{|x| x}\n f[:path] = path + '/' + f[:name]\n if f[:type] == :tree\n begin\n all_files << lslr(repo.lookup(f[:oid]), f[:path])\n rescue Exception => e\n STDERR.puts e\n all_files\n end\n else\n all_files << f\n end\n end\n all_files.flatten\n end\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n begin\n files = lslr(repo.lookup(base_commit).tree)\n files.select{|x| filter.call(x)}\n rescue Exception => e\n STDERR.puts \"Cannot find commit #{base_commit} in base repo\"\n []\n end\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n files = repo.lstree(base_commit, :recursive => true)\n\n files.select{|x| filter.call(x)}\n end", "def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end", "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "def diff_files_from(commit)\n git_args = ['diff', '--stat', '--name-only', commit]\n result = default_repository.git_output(git_args).lines.map { |line| line.strip }.sort\n # not sure if git would ever mention directories in a diff, but ignore them.\n result.delete_if { |item| ::File.directory?(item) }\n return result\n end", "def getPullRequestFiles(id)\n getFilesFromDiff(getPullRequestDiff(id))\n end", "def commit_filepath_params\n params.fetch(:commit_filepath, {})\n end", "def diff_files(commit)\n cache_key = [\n GITALY_TIMEOUT_CACHE_KEY,\n commit.project.id,\n commit.cache_key\n ].join(':')\n\n return [] if Rails.cache.read(cache_key).present?\n\n begin\n commit.diffs.diff_files\n rescue GRPC::DeadlineExceeded => error\n # Gitaly fails to load diffs consistently for some commits. The other information\n # is still valuable for Jira. So we skip the loading and respond with a 200 excluding diffs\n # Remove this when https://gitlab.com/gitlab-org/gitaly/-/issues/3741 is fixed.\n Rails.cache.write(cache_key, 1, expires_in: GITALY_TIMEOUT_CACHE_EXPIRY)\n Gitlab::ErrorTracking.track_exception(error)\n []\n end\n end", "def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end", "def files_commits(num_commits)\n @repo = Grit::Repo.new(@directory)\n related_files = []\n commits_all(num_commits) do |commits|\n commits.each do |commit|\n paths = []\n begin\n commit.diffs.each do |diff|\n if diff.a_path != diff.b_path\n related_files += [[diff.a_path, diff.b_path]]\n end\n paths += [diff.a_path, diff.b_path]\n end\n rescue Grit::Git::GitTimeout\n puts \"Failed to diff for %s\" % commit.sha\n end\n paths.uniq!\n yield commit, paths, related_files\n end\n end\n end", "def get_committed_files\n # set the current branch name to be the current branch you're on --> need to check that this works as part of push\n curr_branch_name = `git rev-parse --abbrev-ref HEAD`\n\n # raw_sha_list lists all the local, unpushed commit SHAs from your current branch\n raw_sha_list = `git log --graph --pretty=format:'%H' #{curr_branch_name}`\n\n committed_files = []\n # loop through the raw_sha_list and push properly formatted SHAs into the all_shas arr\n raw_sha_list.each_line { |sha|\n # using the .tr method on the sha makes a copy of the sha and replaces instances that matches with the to_str (second arg),\n # unless the range starts with a ^ carrot, in which case, it replaces on matches outside the range\n curr_sha = sha.tr('^A-Za-z0-9', '')\n\n # this `git diff-tree --no-commit-id --name-only -r <SHA>` will list the files of an individual commit when you add the SHA\n # on each iteration, set the changed_files variable to be the list of files from a particular commit, based its SHA\n changed_files = `git diff-tree --no-commit-id --name-only -r #{curr_sha}`\n\n # loop over the changed_files and add in each file that's part of a commit and add into the committed_files arr\n changed_files.each_line { |file|\n # remove any trailing whitespace from the file name and add into our arr\n committed_files << file.rstrip()\n }\n }\n # return the final, no-repeat array of committed files in this push\n return committed_files.uniq\nend", "def find_by_commit_path(commits, args)\n raise \"Configuration Error: #{path.join('>')} specified 'find_by' 'commit_path' without any 'match' or 'omit' attributes\" unless args[\"match\"] || args[\"omit\"]\n match = eval(args[\"match\"]) rescue nil\n omit = eval(args[\"omit\"]) rescue nil\n commits.select {|commit| commit.paths.any?{|commit_path| (match.nil? || commit_path.path =~ match) && (omit.nil? || (commit_path.path =~ omit).nil?)}}\n end", "def commit_info(params)\n user, repo = params[\"user\"], params[\"repo\"]\n shas = get_last_30_days_commits(user, repo)\n commit_hash = {}\n file_arr = []\n hydra = Typhoeus::Hydra.new\n shas.each do |sha|\n request = Typhoeus::Request.new(\"#{GithubApiConstants::GITHUB_ROOT}/repos/#{user}/#{repo}/commits/#{sha}?access_token=#{GITHUB_ACCESS_TOKEN}\")\n request.on_complete do |response|\n if response.success?\n parsed_sha_info = JSON.parse(response.response_body)\n author = parsed_sha_info[\"commit\"][\"author\"][\"name\"]\n files = parsed_sha_info[\"files\"].collect { |f| f[\"filename\"] }\n commit_hash[files] = author\n file_arr << files\n else\n raise RepoExceptionHandler::GithubAPILimitReached.new(GithubApiConstants::GITHUB_API_LIMIT_REACHED_MESSAGE)\n end\n end\n hydra.queue(request)\n end\n hydra.run\n return commit_hash, file_arr\n end", "def set_commit_filepath\n @commit_filepath = CommitFilepath.find(params[:id])\n end", "def get_path(commit)\n repos_path = File.expand_path('repos')\n File.join(repos_path, commit)\n end", "def get_repo_paths\n\t\t\tpaths = {}\n\t\t\tpathspec = read_command_output( 'hg', 'paths' )\n\t\t\tpathspec.split.each_slice( 3 ) do |name, _, url|\n\t\t\t\tpaths[ name ] = url\n\t\t\tend\n\t\t\treturn paths\n\t\tend", "def list(options = {})\n get_path(\n path_to_list,\n options,\n get_parser(:collection, Tinybucket::Model::Commit)\n )\n end", "def files_at_commit(pr, filter = lambda { |x| true })\n sha = pr[:base_commit]\n begin\n files = lslr(git.lookup(sha).tree)\n rescue StandardError => e\n log pr[:id]\n log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n return nil # not to the default branch\n end\n\n # # find the eariler than and closest to the creation time of commit\n # sha = commit_closest_earlier_pr(pr)\n # begin\n # files = sha.nil? ? [] : lslr(git.lookup(sha).tree)\n # rescue StandardError => e\n # log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n # files = [] # no files found before the pr\n # end\n\n\n if files.size <= 0\n log \"No files for commit #{sha}\"\n end\n files.select { |x| filter.call(x) }\n\n end", "def list_files(env, res, tag, path)\n files = []\n git(\"ls-tree\", \"-z\", \"#{tag}:#{path}\") do |io|\n io.each_line(\"\\0\") do |line|\n line.chomp!(\"\\0\")\n #STDERR.puts line\n info, file = line.split(/\\t/, 2)\n mode, type, object = info.split(/ /)\n files << {\n :mode => mode,\n :type => type,\n :object => object,\n :file => file,\n }\n end\n end\n files = files.sort_by{|h| h[:file] }\n E_list_files.result(binding)\n end", "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "def load_ref_commits(ref)\n commits = []\n page = 1\n begin\n loop do\n commits += Octokit.commits(@path, ref, :page => page)\n page += 1\n end\n rescue Octokit::NotFound, Faraday::Error::ResourceNotFound\n end\n commits\n end", "def fetch_commit_hash_list()\n `git rev-list --all --reverse`.strip.split(/\\n/)\nend", "def repo_files\n @vault.sys.auths.select { |_,v| v.type == 'approle' }\n .keys\n .inject([]) { |acc, elem| acc + role_files(elem) }\n end", "def commit_path\n return ['data'] if to_build.to_s.empty?\n\n countries.flat_map(&:legislatures).map { |l| 'data/' + l.directory }\n end", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n\n result = Overcommit::Utils.execute(%W[git ls-tree --name-only #{ref}], args: paths)\n unless result.success?\n raise Overcommit::Exceptions::Error,\n \"Error listing files. EXIT STATUS(es): #{result.statuses}.\\n\" \\\n \"STDOUT(s): #{result.stdouts}.\\n\" \\\n \"STDERR(s): #{result.stderrs}.\"\n end\n\n result.stdout.split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def create_commit_filepath(filepaths, commit_hash)\n filepaths.each do |str_path, churn|\n @con.exec_prepared('fileInsert', [commit_hash,str_path, churn])\n end\n end", "def files_in branch:\n array_output_of(\"git ls-tree -r --name-only #{branch}\")\nend", "def commit_paths_NO_LOGGING\n queries = path_as_report_groups.collect {|group| group.find_by_hash[\"commit_path\"]}.compact\n return commits.inject([]) {|commit_paths, commit| commit_paths | commit.paths} if queries.empty?\n queries.inject(nil) do |common_commit_paths, query|\n match = eval(query[\"match\"]) rescue nil\n omit = eval(query[\"omit\"]) rescue nil\n all_matching_paths = commits.inject([]) do |commit_paths, commit|\n commit_paths | commit.paths.select {|commit_path| (match.nil? || commit_path.path =~ match) && (omit.nil? || (commit_path.path =~ omit).nil?)}\n end\n (common_commit_paths ? common_commit_paths & all_matching_paths : all_matching_paths).sort!\n end\n end", "def repo_commits(repos)\n repos_commits = []\n repos.each do |repo|\n repos_commits << HTTParty.get(repo[\"commits_url\"].gsub(\"{/sha}\", \"\"))[0]\n end\n repos_commits\nend", "def uncommitted_files\n files = nil\n p4 (['change','-o']).each do |line|\n files << line.strip if files\n files = [] if line.start_with?('Files:')\n end\n files ||= []\n end", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n commits = commit_entries(pr, at_open = true)\n\n commits_per_file = commits.flat_map { |c|\n unless c[:files].nil?\n JSON.parse(c[:files]).map { |f|\n [c[:sha], f[\"filename\"]]\n }\n else\n []\n end\n }.select{|x| x.size > 1}.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]} # get the shas of pr related commits\n\n walker = Rugged::Walker.new(git)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr[:base_commit])\n\n commit_list = walker.select do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid # (oid is the object id - c.oid gets the commit sha). this commit is not part of pr's commits\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n :cwd => node['delivery']['workspace']['repo']\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end", "def list(options = {})\n get_path(\n path_to_list,\n options,\n Tinybucket::Parser::CommitsParser\n )\n end", "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def commits(project, options={})\n get(\"/projects/#{project}/repository/commits\", :query => options)\n end", "def commits(project, options={})\n get(\"/projects/#{project}/repository/commits\", :query => options)\n end", "def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n cwd: repo_path(node)\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end", "def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n filter_modified_files(@modified_files)\n end\n end", "def modified_files\n diff = git.diff(local_branch, remote_branch(local_branch))\n diff.stats[:files].keys\n end", "def file_url(filename)\n raw_url = git_repository_url[0..-5]\n \"#{raw_url}/blob/#{git_commit_sha}/#{filename}\"\n end", "def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "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 project_commit(project, commit_id)\n get(\"/projects/#{project}/commits/#{commit_id}\")\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACM --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end", "def branches_containing_commit(commit_ref); end", "def branches_containing_commit(commit_ref); end", "def json_files\n file_list '**/*.json'\n end", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n pr_against = pull_req_entry(pr[:id])['base']['sha']\n commits = commit_entries(pr[:id])\n\n commits_per_file = commits.flat_map { |c|\n c['files'].map { |f|\n [c['sha'], f['filename']]\n }\n }.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]}\n\n walker = Rugged::Walker.new(repo)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr_against)\n\n commit_list = walker.take_while do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def create\n @commit_filepath = CommitFilepath.new(commit_filepath_params)\n\n respond_to do |format|\n if @commit_filepath.save\n format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully created.' }\n format.json { render :show, status: :created, location: @commit_filepath }\n else\n format.html { render :new }\n format.json { render json: @commit_filepath.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_file_commits_data(path)\n time = ` cd /tmp/#{@repo} && git log --format=%ct #{path} `.split(\"\\n\").map{|time| time.to_i}\n ins_del = ` cd /tmp/#{@repo} && git log --numstat --format=%h #{path} | grep #{path} `.split(\"\\n\").map{|line| line.split(\" \")[0..1]}.map{|insert| insert.map{|x| x.to_i}}\n time.zip(ins_del)\n end", "def files; changeset.all_files; end", "def commit_refs(commit, repo_param)\n commit.refs.map{ |r| commit_ref(r, repo_param) }.join(\"\\n\")\n end", "def update\n respond_to do |format|\n if @commit_filepath.update(commit_filepath_params)\n format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully updated.' }\n format.json { render :show, status: :ok, location: @commit_filepath }\n else\n format.html { render :edit }\n format.json { render json: @commit_filepath.errors, status: :unprocessable_entity }\n end\n end\n end", "def keys\n head.commit.tree.contents.map{|blob| deserialize(blob.name) }\n end", "def keys\n head.commit.tree.contents.map{|blob| deserialize(blob.name) }\n end", "def diff_committed(local_path, revision = nil)\n remote_files = {}\n if revision\n command = \"git diff --name-status #{revision} -- #{local_path}\"\n changed_files(command)\n else\n remote_files = {}\n `git ls-files`.split(\"\\n\").each {|file| remote_files[file] = 'M'}\n remote_files\n end\n end", "def commit_diff(project, sha)\n get(\"/projects/#{project}/repository/commits/#{sha}/diff\") \n end", "def fetch_svn_urls()\n urls = bot.config['svn_urls']\n commits = []\n urls.each do |url_str|\n begin\n @log.info \"checking #{url_str} for new commits...\"\n\n # https://username:[email protected]:8080/svn/path/in/repo/\n url = Addressable::URI.parse(url_str)\n\n xmldata = `svn log --username #{url.user} --password #{url.password} --xml -v --limit 15 #{url.omit(:user, :password)}`\n doc = REXML::Document.new(xmldata)\n \n doc.elements.inject('log/logentry', commits) do |commits, element|\n commits.push({:url => url}.merge(parse_entry_info(element)))\n end\n\n rescue Exception => e\n @log.error \"error connecting to svn: #{e.message}\"\n end\n end\n return commits\n end", "def revision_files(options={})\r\n @scm.revisions(Time.epoch, options.dup.merge({:to_identifier => Time.infinity, :relative_path => @relative_path})).collect do |revision|\r\n if revision.files.length != 1\r\n files_s = revision.files.collect{|f| f.to_s}.join(\"\\n\")\r\n raise \"The file-specific revision didn't have exactly one file, but #{revision.files.length}:\\n#{files_s}\"\r\n end\r\n if(!revision.files[0].path.eql?(@relative_path))\r\n raise \"The file-specific revision didn't have expected path '#{@relative_path}', but '#{revision.files[0].path}'\"\r\n end\r\n revision.files[0]\r\n end\r\n end", "def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end", "def list(path=nil, sha=nil)\n remote_path = list_path(path).sub(/^\\//, '').sub(/\\/$/, '')\n\n result = @client.tree(repo, sha || source_branch, recursive: true).tree\n result.sort! do |x, y|\n x.path.split('/').size <=> y.path.split('/').size\n end\n\n # Filters for folders containing the specified path\n result.reject! { |elem| !elem.path.match(remote_path + '($|\\/.+)') }\n raise Error, 'Invalid GitHub path specified' if result.empty?\n\n # Filters out lower levels\n result.reject! do |elem|\n filename = elem.path.split('/').last\n File.join(remote_path, filename).sub(/^\\//, '') != elem.path\n end\n\n result.map do |elem|\n {\n name: elem.path.split('/').last,\n path: elem.path,\n type: elem.type == 'tree' ? 'folder' : 'file',\n sha: elem.sha\n }\n end\n end", "def line_uri\n branch.commit_uri.chomp(\"commit/$commit\")\n end", "def get_commits(pull_req_id)\n do_request(\"https://api.github.com/repos/#{CONFIG[\"repo\"][\"org\"]}/#{CONFIG[\"repo\"][\"repo\"]}/pulls/#{pull_req_id}/commits\", true)\n end", "def committees(options = {})\n get('/committees', options)\n end", "def test_read_files_wrong_repo\n get \"/repos/#{GIT_REPO}.git/branches/master/files/myfile.txt\"\n assert_equal 404, last_response.status\n end", "def filePaths\n result = OpenStudio::PathVector.new\n if @workflow[:file_paths]\n @workflow[:file_paths].each do |file_path|\n result << OpenStudio.toPath(file_path)\n end\n else\n result << OpenStudio.toPath('./files')\n result << OpenStudio.toPath('./weather')\n result << OpenStudio.toPath('../../files')\n result << OpenStudio.toPath('../../weather')\n result << OpenStudio.toPath('./')\n end\n result\n end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def signature_request_files(opts)\n path = \"/signature_request/files/#{opts[:signature_request_id]}\"\n if opts[:file_type]\n path = path + \"?file_type=#{opts[:file_type]}\"\n end\n\n if opts[:get_url]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_url=#{opts[:get_url]}\"\n elsif opts[:get_data_uri]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_data_uri=#{opts[:get_data_uri]}\"\n end\n\n get(path)[:body]\n end", "def pull_requests_for_commit(token, repo, commit_hash)\n query = \"#{commit_hash}+type:pr+repo:#{repo}\"\n say \"Searching github pull requests for #{commit_hash}\"\n response = RestClient::Request.new(:url => \"https://api.github.com/search/issues?q=#{query}\", :method => \"GET\", :headers => {:accept => :json, :content_type => :json, 'Authorization' => \"token #{token}\"}).execute\n JSON.parse response.body\n rescue RestClient::Exception => e\n process_error e\n throw e\n end", "def commits!\n response = @client.get_json(\"#{path}/commits\")\n @commits = response.map do |commit| \n Commit.new(client: @client, user: @user, repo: self, sha: commit['sha']) \n end\n @commits\n end", "def get_changed_file_list\n command = \"git log -m -1 --name-only --pretty='format:' $(git rev-parse origin/master)\"\n file_paths = []\n features = {}\n features.compare_by_identity\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n files = stdout.read.gsub! \"\\n\", \",\"\n file_paths = files.split(\",\")\n puts \"Found files:\\n#{file_paths}\"\n end\n\n puts \"Count files in push: #{file_paths.count}\"\n\n file_paths.each do |file_path|\n if file_path.include?(\".feature\")\n puts \"Added: #{file_path}\"\n folder = get_name_folder_from_path file_path\n features.store(folder, file_path)\n end\n end\n\n puts \"\\n\"\n puts \"Count feature files: #{features.count}\"\n features.sort\nend", "def filepaths\n object.object_files.map(&:relative_path)\n end", "def test_get_tags\n post '/repos', {:name => GIT_REPO}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"[email protected]\", :message => \"My First Commit\"}\n sha = JSON.parse(last_response.body)[\"commit_sha\"]\n post \"/repos/#{GIT_REPO}.git/tags\", {:tag => \"version1\", :message => \"hello\", :sha => sha, :type => \"commit\", :user => \"Rune Madsen\", :email => \"[email protected]\"}\n get \"/repos/#{GIT_REPO}.git/tags\"\n end", "def file_paths\n @file_paths ||= BrowseEverythingFilePaths.new(selected_files)\n end", "def commit_entries(pr_id)\n q = <<-QUERY\n select c.sha as sha\n from pull_requests pr, pull_request_commits prc, commits c\n where pr.id = prc.pull_request_id\n and prc.commit_id = c.id\n and pr.id = ?\n QUERY\n commits = db.fetch(q, pr_id).all\n\n commits.reduce([]){ |acc, x|\n a = mongo.find(:commits, {:sha => x[:sha]})[0]\n acc << a unless a.nil?\n acc\n }.select{|c| c['parents'].size <= 1}\n end", "def get_checksums(commit)\n # Reset @currenthash\n @currenthash = Hash.new\n path = find_relative_git_cookbook_path\n #puts \"path is '#{path}' commit hash is #{commit}\"\n #puts \"commit.tree is #{commit.tree}\"\n unless path == '.'\n tree = commit.tree / path\n git_checksum_hash(tree)\n else\n git_checksum_hash(commit.tree)\n end\n end", "def applicable_owners_files\n CACHE.cache_block('arb_commit/' + self.sha1 + '/' + 'applicable_owners_files', 0) do\n raise \"not in review repository\" unless exists_in_review_repository?\n\n affected_dirs = changed_files.map { |f| File.dirname(f) }.uniq\n \n owners_files = affected_dirs.\n map { |d| find_owners_file(d) }.\n reject { |d| d.nil? }.\n uniq\n end\n end", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n `git ls-tree --name-only #{ref} #{paths.join(' ')}`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def download_list\n task = params[:task]\n files = []\n\n case task\n when DOWNLOAD_ACTION, OPEN_ACTION, COPY_ACTION, COPY_TO_PRIVATE_ACTION\n nodes = Node.accessible_by(@context).where(id: params[:ids])\n nodes.each { |node| files += node.is_a?(Folder) ? node.all_files : [node] }\n when PUBLISH_ACTION\n nodes = Node.editable_by(@context).\n where(id: params[:ids]).\n where.not(scope: UserFile::SCOPE_PUBLIC)\n nodes.each do |node|\n files += if node.is_a?(Folder)\n node.all_files(Node.where.not(scope: UserFile::SCOPE_PUBLIC))\n else\n [node]\n end\n end\n when DELETE_ACTION\n nodes = Node.editable_by(@context).where(id: params[:ids]).to_a\n files += nodes\n nodes.each { |node| files += node.all_children if node.is_a?(Folder) }\n files.filter! { |file| file.scope == params[:scope] }\n else\n raise ApiError, \"Parameter 'task' is not defined!\"\n end\n\n render json: files,\n each_serializer: FileActionsSerializer,\n scope_name: params[:scope] || SCOPE_PRIVATE,\n action_name: task\n end", "def update_commitlist(h)\n h.map do |entry|\n sha = entry[\"commit\"].to_s.strip\n n = entry[\"note\"]\n # First, try to look it up in our existing repo\n if commit_exists?(sha) || sha.empty?\n entry # do nothing, put it back in the hash\n else\n # Ok, we know it doesn't exist. Now look it up in gitlog.json\n if @gitlog_json.key? sha\n m = @gitlog_json[sha][\"message\"]\n svn_id = m.lines.select {|l| l.match? /git-svn-id/ }.join.strip\n grep_cmd = <<~EOS.strip\n git -C ./tmp/src rev-list --all --grep=\"#{svn_id}\" --\n EOS\n stdout, stderr, status = Open3.capture3(grep_cmd)\n if stderr.empty?\n {\n \"commit\" => stdout.strip,\n \"note\" => <<~EOS.strip\n #{entry[\"note\"].to_s.lines.join(\"\\n\")}\n\n Formerly #{sha} before HTTPD rewrote Git history.\n EOS\n }\n else\n warn \"ERROR getting commit #{sha}. #{stderr}\"\n entry\n end\n else\n warn \"ERROR commit #{sha} does not exist in gitlog.json\"\n entry\n end\n end\n end\nend", "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "def applicable_owners_files_hash\n return @applicable_owners_files_hash if !@applicable_owners_files_hash.nil?\n\n # Make hash of (directory => [files in that directory in this commit]) pairs\n\n puts \"changed files: #{changed_files.inspect}\"\n\n affected_dirs_hash = changed_files.collect_to_reverse_hash do |file|\n File.dirname(file)\n end\n\n puts \"affected_dirs_hash: #{affected_dirs_hash.inspect}\"\n\n affected_dirs = affected_dirs_hash.keys\n\n # Make hash of owners file => [file1, file2, file3]\n res = affected_dirs.inject(Hash.new) do |hash, dir|\n owner = find_owners_file(dir)\n\n # If there's no OWNERS file for this dir, just skip it\n if owner.nil?\n return hash\n end\n\n data = {\n :owner_data => owner,\n :files => affected_dirs_hash[dir]\n }\n\n key = owner[:path]\n\n if (hash.include?(key))\n combined_data = hash[key]\n combined_data[:files] = combined_data[:files] + data[:files]\n\n hash[key] = combined_data\n else\n hash[key] = data\n end\n hash\n end \n\n @applicable_owners_files_hash = res\n end", "def get(*args)\n arguments(args, required: [:user, :repo, :sha])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/commits/#{arguments.sha}\", arguments.params)\n end", "def files\n return get_result('files')\n end", "def path_to_file_on_github\n \"https://github.com/#{@repo.name}/blob/master/#{@file}#L#{@todo.line_number}\"\n end", "def compute_changed_and_risk_files(params)\n commit_hash, file_arr = commit_info(params)\n changed_file_freq = file_arr.flatten!.each_with_object(Hash.new(0)) {|file, freq_acc| freq_acc[file] += 1}\n changed_g2_files = []\n changed_file_freq.select {|file, freq| changed_g2_files << file if freq > 2}\n risk_files = changed_g2_files.dup\n rf = risk_files.each_with_object({}) do |file, acc|\n author_set = Set.new\n commit_hash.each do |file_arr, author|\n acc[file] = (author_set << author ) if file_arr.include? (file)\n end\n end\n rf.delete_if {|_file, author_arr| author_arr.length < 2}\n {\n \"changed_files\" => changed_g2_files,\n \"risk_files\" => rf\n }\n end", "def raw_data_in_committer(committer, dir, filename)\n data = nil\n\n [*dir.split(::File::SEPARATOR), filename].each do |key|\n data = data ? data[key] : committer.tree[key]\n break unless data\n end\n\n data\n end", "def paths\n paths = {}\n end", "def paths\n paths = {}\n end", "def tracked_files; end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def diffs_to_api\n return @diffs_to_api if @diffs_to_api\n @diffs_to_api = []\n\n diffs.each do |diff|\n path = diff.delta.new_file[:path]\n # Presumably only the first commit\n next if path.split('.').first.to_s.downcase == \"readme\"\n\n lines = []\n diff.each_hunk.each do |hunk|\n lines += hunk.lines\n end\n\n html = OutputRenderer.diff(lines)\n status = diff.delta.status\n\n @diffs_to_api << {\n status: status,\n path: path,\n html: html,\n content: @repo.lookup(diff.delta.new_file[:oid]).content\n }\n\n end\n\n @diffs_to_api\n end" ]
[ "0.6951814", "0.67700416", "0.6696471", "0.6359521", "0.6351097", "0.6117724", "0.6080518", "0.60698694", "0.6019396", "0.60059994", "0.5992208", "0.5892106", "0.58767265", "0.58048034", "0.5798398", "0.5767319", "0.5717499", "0.56756264", "0.5629655", "0.56192356", "0.56174886", "0.5583314", "0.5570799", "0.55656135", "0.55226725", "0.550642", "0.5484653", "0.5462572", "0.54379815", "0.54329723", "0.5428162", "0.54104275", "0.54058194", "0.54020166", "0.5398381", "0.5376806", "0.5376806", "0.5368046", "0.5366885", "0.53561455", "0.5349219", "0.5348043", "0.5345564", "0.5339436", "0.5335946", "0.53337824", "0.5328198", "0.53207433", "0.5320398", "0.53075516", "0.5302787", "0.530182", "0.52847034", "0.5284677", "0.52841157", "0.527812", "0.5277698", "0.5277698", "0.5275619", "0.5266645", "0.52658695", "0.52636933", "0.52615154", "0.5255883", "0.5253785", "0.5247794", "0.52476674", "0.5231538", "0.521741", "0.5206603", "0.5206603", "0.5206603", "0.5206603", "0.5206603", "0.5200767", "0.5198996", "0.5193881", "0.51904064", "0.5185643", "0.5183609", "0.5175775", "0.5171824", "0.5158144", "0.514915", "0.5146825", "0.5137393", "0.5136817", "0.51327133", "0.51327133", "0.5129179", "0.51281595", "0.5127105", "0.5125836", "0.51248324", "0.5123464", "0.5117264", "0.5117264", "0.51133025", "0.51125795", "0.51104164" ]
0.7456648
0
GET /commit_filepaths/1 GET /commit_filepaths/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @commit_filepaths = CommitFilepath.all\n end", "def get_files_in_commit(commit)\n\tfiles = {}\n\tcommit.diffs.each do | diff |\n\t\tfiles[diff.a_path] = nil unless files.has_key? diff.a_path\n\t\tfiles[diff.b_path] = nil unless files.has_key? diff.b_path\n\t\t# what about diff.deleted_file and diff.new_file?\n\tend\n\treturn files.keys\nend", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n def lslr(tree, path = '')\n all_files = []\n for f in tree.map{|x| x}\n f[:path] = path + '/' + f[:name]\n if f[:type] == :tree\n begin\n all_files << lslr(repo.lookup(f[:oid]), f[:path])\n rescue Exception => e\n STDERR.puts e\n all_files\n end\n else\n all_files << f\n end\n end\n all_files.flatten\n end\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n begin\n files = lslr(repo.lookup(base_commit).tree)\n files.select{|x| filter.call(x)}\n rescue Exception => e\n STDERR.puts \"Cannot find commit #{base_commit} in base repo\"\n []\n end\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n files = repo.lstree(base_commit, :recursive => true)\n\n files.select{|x| filter.call(x)}\n end", "def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end", "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "def getPullRequestFiles(id)\n getFilesFromDiff(getPullRequestDiff(id))\n end", "def files_commits(num_commits)\n @repo = Grit::Repo.new(@directory)\n related_files = []\n commits_all(num_commits) do |commits|\n commits.each do |commit|\n paths = []\n begin\n commit.diffs.each do |diff|\n if diff.a_path != diff.b_path\n related_files += [[diff.a_path, diff.b_path]]\n end\n paths += [diff.a_path, diff.b_path]\n end\n rescue Grit::Git::GitTimeout\n puts \"Failed to diff for %s\" % commit.sha\n end\n paths.uniq!\n yield commit, paths, related_files\n end\n end\n end", "def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end", "def diff_files_from(commit)\n git_args = ['diff', '--stat', '--name-only', commit]\n result = default_repository.git_output(git_args).lines.map { |line| line.strip }.sort\n # not sure if git would ever mention directories in a diff, but ignore them.\n result.delete_if { |item| ::File.directory?(item) }\n return result\n end", "def diff_files(commit)\n cache_key = [\n GITALY_TIMEOUT_CACHE_KEY,\n commit.project.id,\n commit.cache_key\n ].join(':')\n\n return [] if Rails.cache.read(cache_key).present?\n\n begin\n commit.diffs.diff_files\n rescue GRPC::DeadlineExceeded => error\n # Gitaly fails to load diffs consistently for some commits. The other information\n # is still valuable for Jira. So we skip the loading and respond with a 200 excluding diffs\n # Remove this when https://gitlab.com/gitlab-org/gitaly/-/issues/3741 is fixed.\n Rails.cache.write(cache_key, 1, expires_in: GITALY_TIMEOUT_CACHE_EXPIRY)\n Gitlab::ErrorTracking.track_exception(error)\n []\n end\n end", "def set_commit_filepath\n @commit_filepath = CommitFilepath.find(params[:id])\n end", "def commit_filepath_params\n params.fetch(:commit_filepath, {})\n end", "def get_committed_files\n # set the current branch name to be the current branch you're on --> need to check that this works as part of push\n curr_branch_name = `git rev-parse --abbrev-ref HEAD`\n\n # raw_sha_list lists all the local, unpushed commit SHAs from your current branch\n raw_sha_list = `git log --graph --pretty=format:'%H' #{curr_branch_name}`\n\n committed_files = []\n # loop through the raw_sha_list and push properly formatted SHAs into the all_shas arr\n raw_sha_list.each_line { |sha|\n # using the .tr method on the sha makes a copy of the sha and replaces instances that matches with the to_str (second arg),\n # unless the range starts with a ^ carrot, in which case, it replaces on matches outside the range\n curr_sha = sha.tr('^A-Za-z0-9', '')\n\n # this `git diff-tree --no-commit-id --name-only -r <SHA>` will list the files of an individual commit when you add the SHA\n # on each iteration, set the changed_files variable to be the list of files from a particular commit, based its SHA\n changed_files = `git diff-tree --no-commit-id --name-only -r #{curr_sha}`\n\n # loop over the changed_files and add in each file that's part of a commit and add into the committed_files arr\n changed_files.each_line { |file|\n # remove any trailing whitespace from the file name and add into our arr\n committed_files << file.rstrip()\n }\n }\n # return the final, no-repeat array of committed files in this push\n return committed_files.uniq\nend", "def commit_info(params)\n user, repo = params[\"user\"], params[\"repo\"]\n shas = get_last_30_days_commits(user, repo)\n commit_hash = {}\n file_arr = []\n hydra = Typhoeus::Hydra.new\n shas.each do |sha|\n request = Typhoeus::Request.new(\"#{GithubApiConstants::GITHUB_ROOT}/repos/#{user}/#{repo}/commits/#{sha}?access_token=#{GITHUB_ACCESS_TOKEN}\")\n request.on_complete do |response|\n if response.success?\n parsed_sha_info = JSON.parse(response.response_body)\n author = parsed_sha_info[\"commit\"][\"author\"][\"name\"]\n files = parsed_sha_info[\"files\"].collect { |f| f[\"filename\"] }\n commit_hash[files] = author\n file_arr << files\n else\n raise RepoExceptionHandler::GithubAPILimitReached.new(GithubApiConstants::GITHUB_API_LIMIT_REACHED_MESSAGE)\n end\n end\n hydra.queue(request)\n end\n hydra.run\n return commit_hash, file_arr\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def get_path(commit)\n repos_path = File.expand_path('repos')\n File.join(repos_path, commit)\n end", "def files_at_commit(pr, filter = lambda { |x| true })\n sha = pr[:base_commit]\n begin\n files = lslr(git.lookup(sha).tree)\n rescue StandardError => e\n log pr[:id]\n log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n return nil # not to the default branch\n end\n\n # # find the eariler than and closest to the creation time of commit\n # sha = commit_closest_earlier_pr(pr)\n # begin\n # files = sha.nil? ? [] : lslr(git.lookup(sha).tree)\n # rescue StandardError => e\n # log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n # files = [] # no files found before the pr\n # end\n\n\n if files.size <= 0\n log \"No files for commit #{sha}\"\n end\n files.select { |x| filter.call(x) }\n\n end", "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "def find_by_commit_path(commits, args)\n raise \"Configuration Error: #{path.join('>')} specified 'find_by' 'commit_path' without any 'match' or 'omit' attributes\" unless args[\"match\"] || args[\"omit\"]\n match = eval(args[\"match\"]) rescue nil\n omit = eval(args[\"omit\"]) rescue nil\n commits.select {|commit| commit.paths.any?{|commit_path| (match.nil? || commit_path.path =~ match) && (omit.nil? || (commit_path.path =~ omit).nil?)}}\n end", "def revision_files(options={})\r\n @scm.revisions(Time.epoch, options.dup.merge({:to_identifier => Time.infinity, :relative_path => @relative_path})).collect do |revision|\r\n if revision.files.length != 1\r\n files_s = revision.files.collect{|f| f.to_s}.join(\"\\n\")\r\n raise \"The file-specific revision didn't have exactly one file, but #{revision.files.length}:\\n#{files_s}\"\r\n end\r\n if(!revision.files[0].path.eql?(@relative_path))\r\n raise \"The file-specific revision didn't have expected path '#{@relative_path}', but '#{revision.files[0].path}'\"\r\n end\r\n revision.files[0]\r\n end\r\n end", "def create\n @commit_filepath = CommitFilepath.new(commit_filepath_params)\n\n respond_to do |format|\n if @commit_filepath.save\n format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully created.' }\n format.json { render :show, status: :created, location: @commit_filepath }\n else\n format.html { render :new }\n format.json { render json: @commit_filepath.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend", "def list_files(env, res, tag, path)\n files = []\n git(\"ls-tree\", \"-z\", \"#{tag}:#{path}\") do |io|\n io.each_line(\"\\0\") do |line|\n line.chomp!(\"\\0\")\n #STDERR.puts line\n info, file = line.split(/\\t/, 2)\n mode, type, object = info.split(/ /)\n files << {\n :mode => mode,\n :type => type,\n :object => object,\n :file => file,\n }\n end\n end\n files = files.sort_by{|h| h[:file] }\n E_list_files.result(binding)\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def get_file_status(file_path)\n response = HTTParty.get(\"https://#{accountName}.azuredatalakestore.net\" +\n \"/webhdfs/v1/#{file_path}?op=GETFILESTATUS\", {\n body: \"grant_type=client_credentials&client_id=#{clientId}\"+\n \"&client_secret=#{clientSecret}\"+\n \"&resource=https%3A%2F%2Fmanagement.azure.com%2F\",\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => \"*/*\",\n \"Cache-Control\" => 'no-cache',\n \"Host\" => \"#{accountName}.azuredatalakestore.net\",\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n verify: true,\n })\n\n return JSON.parse response.read_body\n end", "def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n :cwd => node['delivery']['workspace']['repo']\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end", "def update\n respond_to do |format|\n if @commit_filepath.update(commit_filepath_params)\n format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully updated.' }\n format.json { render :show, status: :ok, location: @commit_filepath }\n else\n format.html { render :edit }\n format.json { render json: @commit_filepath.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def file_url(filename)\n raw_url = git_repository_url[0..-5]\n \"#{raw_url}/blob/#{git_commit_sha}/#{filename}\"\n end", "def create_commit_filepath(filepaths, commit_hash)\n filepaths.each do |str_path, churn|\n @con.exec_prepared('fileInsert', [commit_hash,str_path, churn])\n end\n end", "def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n cwd: repo_path(node)\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end", "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def load_ref_commits(ref)\n commits = []\n page = 1\n begin\n loop do\n commits += Octokit.commits(@path, ref, :page => page)\n page += 1\n end\n rescue Octokit::NotFound, Faraday::Error::ResourceNotFound\n end\n commits\n end", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n\n result = Overcommit::Utils.execute(%W[git ls-tree --name-only #{ref}], args: paths)\n unless result.success?\n raise Overcommit::Exceptions::Error,\n \"Error listing files. EXIT STATUS(es): #{result.statuses}.\\n\" \\\n \"STDOUT(s): #{result.stdouts}.\\n\" \\\n \"STDERR(s): #{result.stderrs}.\"\n end\n\n result.stdout.split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def fetch_commit_hash_list()\n `git rev-list --all --reverse`.strip.split(/\\n/)\nend", "def line_uri\n branch.commit_uri.chomp(\"commit/$commit\")\n end", "def files_in branch:\n array_output_of(\"git ls-tree -r --name-only #{branch}\")\nend", "def project_commit(project, commit_id)\n get(\"/projects/#{project}/commits/#{commit_id}\")\n end", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n commits = commit_entries(pr, at_open = true)\n\n commits_per_file = commits.flat_map { |c|\n unless c[:files].nil?\n JSON.parse(c[:files]).map { |f|\n [c[:sha], f[\"filename\"]]\n }\n else\n []\n end\n }.select{|x| x.size > 1}.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]} # get the shas of pr related commits\n\n walker = Rugged::Walker.new(git)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr[:base_commit])\n\n commit_list = walker.select do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid # (oid is the object id - c.oid gets the commit sha). this commit is not part of pr's commits\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def list(options = {})\n get_path(\n path_to_list,\n options,\n get_parser(:collection, Tinybucket::Model::Commit)\n )\n end", "def commit_path\n return ['data'] if to_build.to_s.empty?\n\n countries.flat_map(&:legislatures).map { |l| 'data/' + l.directory }\n end", "def call(path, page: nil, per_page: nil, start_at: nil)\n retrieve(\"/api/rest/v1/history/files/#{ERB::Util.url_encode(path)}\", page, per_page, start_at)\n end", "def b2_list_file_names(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n bucket_id = ENV['bucket_id']\n prefix = file\n\n uri = URI(\"#{api_url}/b2api/v1/b2_list_file_names\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"bucketId\\\":\\\"#{bucket_id}\\\", \\\"prefix\\\":\\\"#{prefix}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend", "def get_repo_paths\n\t\t\tpaths = {}\n\t\t\tpathspec = read_command_output( 'hg', 'paths' )\n\t\t\tpathspec.split.each_slice( 3 ) do |name, _, url|\n\t\t\t\tpaths[ name ] = url\n\t\t\tend\n\t\t\treturn paths\n\t\tend", "def index\n fs = FileStore.by_hash(params[:hash])\n\n file_stores = fs.map do |item|\n {\n sha1_hash: item.sha1_hash,\n file_name: File.basename(item.file.path),\n user: {\n id: item.user_id,\n uname: item.user_uname\n }\n }\n end\n render json: file_stores\n end", "def test_read_files_wrong_repo\n get \"/repos/#{GIT_REPO}.git/branches/master/files/myfile.txt\"\n assert_equal 404, last_response.status\n end", "def repo_commits(repos)\n repos_commits = []\n repos.each do |repo|\n repos_commits << HTTParty.get(repo[\"commits_url\"].gsub(\"{/sha}\", \"\"))[0]\n end\n repos_commits\nend", "def path_to_file_on_github\n \"https://github.com/#{@repo.name}/blob/master/#{@file}#L#{@todo.line_number}\"\n end", "def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACM --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end", "def files; changeset.all_files; end", "def commit_diff(project, sha)\n get(\"/projects/#{project}/repository/commits/#{sha}/diff\") \n end", "def all_file_commits_data(path)\n time = ` cd /tmp/#{@repo} && git log --format=%ct #{path} `.split(\"\\n\").map{|time| time.to_i}\n ins_del = ` cd /tmp/#{@repo} && git log --numstat --format=%h #{path} | grep #{path} `.split(\"\\n\").map{|line| line.split(\" \")[0..1]}.map{|insert| insert.map{|x| x.to_i}}\n time.zip(ins_del)\n end", "def uncommitted_files\n files = nil\n p4 (['change','-o']).each do |line|\n files << line.strip if files\n files = [] if line.start_with?('Files:')\n end\n files ||= []\n end", "def get_changed_file_list\n command = \"git log -m -1 --name-only --pretty='format:' $(git rev-parse origin/master)\"\n file_paths = []\n features = {}\n features.compare_by_identity\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n files = stdout.read.gsub! \"\\n\", \",\"\n file_paths = files.split(\",\")\n puts \"Found files:\\n#{file_paths}\"\n end\n\n puts \"Count files in push: #{file_paths.count}\"\n\n file_paths.each do |file_path|\n if file_path.include?(\".feature\")\n puts \"Added: #{file_path}\"\n folder = get_name_folder_from_path file_path\n features.store(folder, file_path)\n end\n end\n\n puts \"\\n\"\n puts \"Count feature files: #{features.count}\"\n features.sort\nend", "def diff_committed(local_path, revision = nil)\n remote_files = {}\n if revision\n command = \"git diff --name-status #{revision} -- #{local_path}\"\n changed_files(command)\n else\n remote_files = {}\n `git ls-files`.split(\"\\n\").each {|file| remote_files[file] = 'M'}\n remote_files\n end\n end", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n pr_against = pull_req_entry(pr[:id])['base']['sha']\n commits = commit_entries(pr[:id])\n\n commits_per_file = commits.flat_map { |c|\n c['files'].map { |f|\n [c['sha'], f['filename']]\n }\n }.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]}\n\n walker = Rugged::Walker.new(repo)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr_against)\n\n commit_list = walker.take_while do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def getFile(tree, name, path = '')\n blob = nil\n\n tree.each_blob do |file|\n blob = file if file[:name] == name[/[^\\/]*/]\n blob[:name] = path + blob[:name]\n end\n\n if blob.nil?\n tree.each_tree do |subtree|\n if subtree[:name] == name[/[^\\/]*/]\n path += name.slice! name[/[^\\/]*/]\n name[0] = ''\n return getFile($repo.lookup(subtree[:oid]), name, path + '/')\n end\n end\n end\n\n return blob\nend", "def modified_files\n diff = git.diff(local_branch, remote_branch(local_branch))\n diff.stats[:files].keys\n end", "def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end", "def show\n puts params[:id]\n @file_versions = FileVersion.where(versioned_file_id: params[:id]) \n #@file_versions = FileVersion.find(:versioned_file_id => params[:versioned_file_id])\n render json: @file_versions\n end", "def list(path=nil, sha=nil)\n remote_path = list_path(path).sub(/^\\//, '').sub(/\\/$/, '')\n\n result = @client.tree(repo, sha || source_branch, recursive: true).tree\n result.sort! do |x, y|\n x.path.split('/').size <=> y.path.split('/').size\n end\n\n # Filters for folders containing the specified path\n result.reject! { |elem| !elem.path.match(remote_path + '($|\\/.+)') }\n raise Error, 'Invalid GitHub path specified' if result.empty?\n\n # Filters out lower levels\n result.reject! do |elem|\n filename = elem.path.split('/').last\n File.join(remote_path, filename).sub(/^\\//, '') != elem.path\n end\n\n result.map do |elem|\n {\n name: elem.path.split('/').last,\n path: elem.path,\n type: elem.type == 'tree' ? 'folder' : 'file',\n sha: elem.sha\n }\n end\n end", "def iterate_over_file_paths\n parsed_file.each do |hit|\n file_path_array << hit[0]\n end\n file_path_array\n end", "def commit_paths_NO_LOGGING\n queries = path_as_report_groups.collect {|group| group.find_by_hash[\"commit_path\"]}.compact\n return commits.inject([]) {|commit_paths, commit| commit_paths | commit.paths} if queries.empty?\n queries.inject(nil) do |common_commit_paths, query|\n match = eval(query[\"match\"]) rescue nil\n omit = eval(query[\"omit\"]) rescue nil\n all_matching_paths = commits.inject([]) do |commit_paths, commit|\n commit_paths | commit.paths.select {|commit_path| (match.nil? || commit_path.path =~ match) && (omit.nil? || (commit_path.path =~ omit).nil?)}\n end\n (common_commit_paths ? common_commit_paths & all_matching_paths : all_matching_paths).sort!\n end\n end", "def parseFileslist(doc, params, path)\n prev_commit_hash = (doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash') ? doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash').content : nil) \n commit_hash = (doc.find_first('//xmpp2rest/user/device/files/commit_hash')) ? doc.find_first('//xmpp2rest/user/device/files/commit_hash').content : nil\n \n if not commit_hash\n raise Exception.new(\"Missing element: commit_hash\")\n end\n \n puts \"Prev_commit_hash: \" + prev_commit_hash.to_s\n puts \"Commit_hash: \" + commit_hash.to_s\n \n location = {}\n location['latitude'] = (doc.find_first('//xmpp2rest/user/device/files/location/latitude')) ? doc.find_first('//xmpp2rest/user/device/files/location/latitude').content : \"NULL\"\n location['longitude'] = (doc.find_first('//xmpp2rest/user/device/files/location/longitude')) ? doc.find_first('//xmpp2rest/user/device/files/location/longitude').content : \"NULL\"\n \n filelist = Hash.new\n doc.find('//user/device/files/file').each do |file|\n fullpath = (file.attributes.get_attribute(\"fullpath\")) ? file.attributes.get_attribute(\"fullpath\").value : nil \n filepath = (file.find_first('path')) ? file.find_first('path').content : nil\n filename = (file.find_first('filename')) ? file.find_first('filename').content : nil \n filedate = (file.find_first('filedate')) ? file.find_first('filedate').content : nil\n filetype = (file.find_first('filetype')) ? file.find_first('filetype').content : nil\n filesize = (file.find_first('filesize')) ? file.find_first('filesize').content : nil\n version_hash = (file.find_first('version_hash')) ? file.find_first('version_hash').content : nil\n\n if not filepath or not filename or not filetype or not filesize or not filedate or not version_hash\n raise Exception.new(\"Not all the needed metadata given: filename, filetype, filesize, filedate and version_hash are compulsory!\")\n elsif fullpath.to_s != filepath.to_s + filename.to_s\n raise Exception.new(\"fullpath: #{fullpath.to_s} doesn't match to path + name: #{filepath.to_s + filename.to_s}\")\n elsif fullpath[0,1] != '/' or filepath[0,1] != '/'\n raise Exception.new(\"path must begin with /\")\n end\nputs \"filepath: #{filepath}\"\n filelist.merge!({fullpath => {\"status\" => \"created\", \"blob_hash\" => version_hash, \"name\" => filename, \"path\" => filepath, \"size\" => filesize, \"filetype\" => filetype, \"filedate\" => filedate.to_s}}) \n end\n contains = YAML.dump_stream(filelist)\nputs \"contains: #{contains.to_s}\"\n if prev_commit_hash\n puts \"prev hash added!\"\n params['prev_commit_hash'] = prev_commit_hash\n end\n \n path += \"/files\"\n params.merge!({ 'contains' => contains, 'commit_hash' => commit_hash, 'commit_location' => location})\n return params, path\n end", "def tracked_files; end", "def tree\n read_repo\n if @branches.count < 1\n render :template => 'repositories/newrepo'\n return\n end\n\n @files = @repository.files(@branch, @path)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end", "def json_files\n file_list '**/*.json'\n end", "def list(options = {})\n get_path(\n path_to_list,\n options,\n Tinybucket::Parser::CommitsParser\n )\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 pull_requests_for_commit(token, repo, commit_hash)\n query = \"#{commit_hash}+type:pr+repo:#{repo}\"\n say \"Searching github pull requests for #{commit_hash}\"\n response = RestClient::Request.new(:url => \"https://api.github.com/search/issues?q=#{query}\", :method => \"GET\", :headers => {:accept => :json, :content_type => :json, 'Authorization' => \"token #{token}\"}).execute\n JSON.parse response.body\n rescue RestClient::Exception => e\n process_error e\n throw e\n end", "def blob\n read_repo\n if @branches.count < 1\n render :template => 'repositories/newrepo'\n return\n end\n\n params[:action] = \"blob\"\n\n @blob = @repository.get_blob(@branch, @path)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end", "def destroy\n @commit_filepath.destroy\n respond_to do |format|\n format.html { redirect_to commit_filepaths_url, notice: 'Commit filepath was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def repo_files\n @vault.sys.auths.select { |_,v| v.type == 'approle' }\n .keys\n .inject([]) { |acc, elem| acc + role_files(elem) }\n end", "def get(path = '/files/', params = {})\n request :get, path, params\n end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def server_get_file(server, path)\n request(\n :path => \"containers/#{server.id}/files\",\n :params => {\n :path => path\n },\n :disable_body_extraction => true\n ).get(:body)\n end", "def get_file(login, token)\n begin\n uri = URI('https://api.github.com/repos/'+ login + '/evil1.github.io/contents/powr/index.html')\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = 'token ' + token\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n responseObject = ActiveSupport::JSON.decode res.body\n fileContent = Base64.decode64(responseObject['content'])\n\n response = { 'success' => true, 'content' => fileContent, 'sha' => responseObject['sha'] }\n\n else\n response = { 'success' => false, 'message' => 'Error receiving file: ' + res.value }\n end\n rescue Exception => ex\n response = { 'success' => false, 'message' => 'Error receiving file: ' + ex.message }\n end\n\n return response\n end", "def pull_request_files(repo, number, options = {})\n paginate \"#{Repository.path repo}/pulls/#{number}/files\", options\n end", "def commits(project, options={})\n get(\"/projects/#{project}/repository/commits\", :query => options)\n end", "def commits(project, options={})\n get(\"/projects/#{project}/repository/commits\", :query => options)\n end", "def file_paths\n @file_paths ||= BrowseEverythingFilePaths.new(selected_files)\n end", "def get_checksums(commit)\n # Reset @currenthash\n @currenthash = Hash.new\n path = find_relative_git_cookbook_path\n #puts \"path is '#{path}' commit hash is #{commit}\"\n #puts \"commit.tree is #{commit.tree}\"\n unless path == '.'\n tree = commit.tree / path\n git_checksum_hash(tree)\n else\n git_checksum_hash(commit.tree)\n end\n end", "def commit_entries(pr_id)\n q = <<-QUERY\n select c.sha as sha\n from pull_requests pr, pull_request_commits prc, commits c\n where pr.id = prc.pull_request_id\n and prc.commit_id = c.id\n and pr.id = ?\n QUERY\n commits = db.fetch(q, pr_id).all\n\n commits.reduce([]){ |acc, x|\n a = mongo.find(:commits, {:sha => x[:sha]})[0]\n acc << a unless a.nil?\n acc\n }.select{|c| c['parents'].size <= 1}\n end", "def files_hash\n @files_hash\n end", "def files\n return get_result('files')\n end", "def files\n entries.map(&:filepath)\n end", "def related_files\n []\n end", "def show\n respond_to do |format|\n format.json { render json: @commit, status: 200 }\n end\n end", "def line_to_github_url(file_path, line_str)\n return nil unless file_url = url_for(file_path)\n project_url = file_url.sub(%r{/blob/.*/#{File.basename(file_path)}$}, '')\n commit = git.find_commit_with_line(line_str)\n return nil unless commit\n file_index = commit.file_paths.index(git.relative_file(file_path))\n \"#{project_url}/commit/#{commit.to_s}#diff-#{file_index}\"\n end", "def diffs_to_api\n return @diffs_to_api if @diffs_to_api\n @diffs_to_api = []\n\n diffs.each do |diff|\n path = diff.delta.new_file[:path]\n # Presumably only the first commit\n next if path.split('.').first.to_s.downcase == \"readme\"\n\n lines = []\n diff.each_hunk.each do |hunk|\n lines += hunk.lines\n end\n\n html = OutputRenderer.diff(lines)\n status = diff.delta.status\n\n @diffs_to_api << {\n status: status,\n path: path,\n html: html,\n content: @repo.lookup(diff.delta.new_file[:oid]).content\n }\n\n end\n\n @diffs_to_api\n end", "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "def signature_request_files(opts)\n path = \"/signature_request/files/#{opts[:signature_request_id]}\"\n if opts[:file_type]\n path = path + \"?file_type=#{opts[:file_type]}\"\n end\n\n if opts[:get_url]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_url=#{opts[:get_url]}\"\n elsif opts[:get_data_uri]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_data_uri=#{opts[:get_data_uri]}\"\n end\n\n get(path)[:body]\n end", "def getFiles(tree, name)\n files = []\n\n tree.each_tree do |subtree|\n path = name + subtree[:name] + '/'\n subfiles = getFiles($repo.lookup(subtree[:oid]), path)\n files.push(*subfiles)\n end\n\n tree.each_blob do |file|\n file[:name] = name + file[:name]\n files.push(file)\n end\n\n return files\nend", "def commit_refs(commit, repo_param)\n commit.refs.map{ |r| commit_ref(r, repo_param) }.join(\"\\n\")\n end", "def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n filter_modified_files(@modified_files)\n end\n end" ]
[ "0.73885286", "0.6709463", "0.6677118", "0.6676969", "0.6498145", "0.63304156", "0.61476487", "0.61163414", "0.6060172", "0.60272276", "0.5995217", "0.58763325", "0.58488333", "0.58412236", "0.5705098", "0.56625724", "0.5635051", "0.5591503", "0.5586235", "0.5580552", "0.55266213", "0.5512693", "0.55005795", "0.54898655", "0.5483187", "0.5469162", "0.5454869", "0.5448128", "0.5447244", "0.5430905", "0.54213667", "0.54156226", "0.539311", "0.5391904", "0.53890574", "0.53791344", "0.53788537", "0.53705466", "0.5365828", "0.53542596", "0.5343793", "0.5340107", "0.53362286", "0.53312033", "0.530954", "0.5308276", "0.53069633", "0.5300952", "0.52932155", "0.52896565", "0.52777535", "0.52560586", "0.5252903", "0.5252371", "0.5248503", "0.5245461", "0.5235615", "0.5231361", "0.5225253", "0.5225034", "0.52228117", "0.5222781", "0.5213185", "0.5209537", "0.52095306", "0.5202932", "0.52014935", "0.51940894", "0.518379", "0.51747465", "0.51656103", "0.5161328", "0.5152418", "0.51491904", "0.5148849", "0.5140968", "0.5140968", "0.5140968", "0.5140968", "0.5140968", "0.5140819", "0.5120444", "0.5120217", "0.51201344", "0.51201344", "0.5114623", "0.51136947", "0.51076066", "0.5106837", "0.51028174", "0.5102504", "0.509703", "0.50953627", "0.50938684", "0.5083195", "0.5081228", "0.5081228", "0.5079713", "0.50794667", "0.50788265", "0.5078414" ]
0.0
-1
POST /commit_filepaths POST /commit_filepaths.json
def create @commit_filepath = CommitFilepath.new(commit_filepath_params) respond_to do |format| if @commit_filepath.save format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully created.' } format.json { render :show, status: :created, location: @commit_filepath } else format.html { render :new } format.json { render json: @commit_filepath.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_commit_filepath(filepaths, commit_hash)\n filepaths.each do |str_path, churn|\n @con.exec_prepared('fileInsert', [commit_hash,str_path, churn])\n end\n end", "def commit_filepath_params\n params.fetch(:commit_filepath, {})\n end", "def index\n @commit_filepaths = CommitFilepath.all\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n files = repo.lstree(base_commit, :recursive => true)\n\n files.select{|x| filter.call(x)}\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n def lslr(tree, path = '')\n all_files = []\n for f in tree.map{|x| x}\n f[:path] = path + '/' + f[:name]\n if f[:type] == :tree\n begin\n all_files << lslr(repo.lookup(f[:oid]), f[:path])\n rescue Exception => e\n STDERR.puts e\n all_files\n end\n else\n all_files << f\n end\n end\n all_files.flatten\n end\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n begin\n files = lslr(repo.lookup(base_commit).tree)\n files.select{|x| filter.call(x)}\n rescue Exception => e\n STDERR.puts \"Cannot find commit #{base_commit} in base repo\"\n []\n end\n end", "def get_files_in_commit(commit)\n\tfiles = {}\n\tcommit.diffs.each do | diff |\n\t\tfiles[diff.a_path] = nil unless files.has_key? diff.a_path\n\t\tfiles[diff.b_path] = nil unless files.has_key? diff.b_path\n\t\t# what about diff.deleted_file and diff.new_file?\n\tend\n\treturn files.keys\nend", "def set_commit_filepath\n @commit_filepath = CommitFilepath.find(params[:id])\n end", "def post_file(filename,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\",{\"operation\"=> \"create\"}).body_str\n end", "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "def stage_and_commit_file(repo_base_path, relpath_to_file, commit_message = nil)\n commit_message = \"Updated #{relpath_to_file} via website\" unless !commit_message.blank?\n gitRepo = Repo.new(repo_base_path)\n olddir = Dir.pwd\n Dir.chdir(repo_base_path)\n gitRepo.add(relpath_to_file)\n gitRepo.commit_index(commit_message)\n Dir.chdir(olddir)\n end", "def db_add_pull_request_files(db, client, issues, org, repo)\n issues.each do |item|\n if(item.pull_request)\n begin\n files=client.pull_request_files(\"#{org}/#{repo}\", item.number.to_i)\n files.each do |file|\n if(db_pull_request_file_stored?(db, item.id, file.filename))\n db[\"DELETE FROM pull_request_files WHERE pull_request_id=? AND filename=?\", item.id.to_s, file.filename].delete\n end\n db[\n \"INSERT INTO pull_request_files (pull_request_id, filename, additions, deletions, changes, status)\n VALUES (?, ?, ?, ?, ?, ?)\",\n item.id, file.filename, file.additions, file.deletions, file.changes, file.status].insert\n end\n rescue Octokit::InternalServerError\n # 500 - Server Error: Sorry, there was a problem generating this diff. The repository may be missing relevant data. (Octokit::InternalServerError)\n # Skipping\n end\n end\n end\n end", "def save_file \n Grit.debug = true\n contents = params[:contents]\n message = params[:commit_message]\n @node = Node.new(:name => params[:name], :git_repo_id => params[:git_repo_id], :git_repo_path => params[:git_repo_path])\n save_file_to_disk(contents, @node.abspath)\n stage_and_commit_file(@node.repo_base_path, @node.git_repo_path, message)\n flash[:notice] = \"Created New Version\"\n render :action => :file\n end", "def push_files(files, commit_msg, prefix)\n ui.info(\"Applying your repository changes\")\n commit_prefix = \"#{prefix}:\"\n first_add = true\n files.each do |file|\n file_path = File.expand_path(file)\n if prefix == \"db\"\n file_name = file_path.split('/').last(3).join('/')\n else\n file_name = file_path.split('/').last(2).join('/')\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n if(!first_add)\n commit_prefix += \",\"\n end\n first_add = false\n commit_prefix += file_name.split('/').last\n ui.info(\"- #{file_name}\")\n git.add(\"#{file_name}\")\n end\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n push(commit_prefix, commit_msg)\n end\n end", "def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end", "def post_revert(filename,commit_id,repo)\n curl_put(\"#{self.host}/api2/repos/#{repo}/file/revert\",{\"commit_id\" => commit_id,\"p\" => filename }).body_str\n end", "def get_committed_files\n # set the current branch name to be the current branch you're on --> need to check that this works as part of push\n curr_branch_name = `git rev-parse --abbrev-ref HEAD`\n\n # raw_sha_list lists all the local, unpushed commit SHAs from your current branch\n raw_sha_list = `git log --graph --pretty=format:'%H' #{curr_branch_name}`\n\n committed_files = []\n # loop through the raw_sha_list and push properly formatted SHAs into the all_shas arr\n raw_sha_list.each_line { |sha|\n # using the .tr method on the sha makes a copy of the sha and replaces instances that matches with the to_str (second arg),\n # unless the range starts with a ^ carrot, in which case, it replaces on matches outside the range\n curr_sha = sha.tr('^A-Za-z0-9', '')\n\n # this `git diff-tree --no-commit-id --name-only -r <SHA>` will list the files of an individual commit when you add the SHA\n # on each iteration, set the changed_files variable to be the list of files from a particular commit, based its SHA\n changed_files = `git diff-tree --no-commit-id --name-only -r #{curr_sha}`\n\n # loop over the changed_files and add in each file that's part of a commit and add into the committed_files arr\n changed_files.each_line { |file|\n # remove any trailing whitespace from the file name and add into our arr\n committed_files << file.rstrip()\n }\n }\n # return the final, no-repeat array of committed files in this push\n return committed_files.uniq\nend", "def post_commit(commit_obj)\n return if commit_obj.empty?\n uri = URI.parse(\"http://gitsvn.bioconductor.org/git-push-hook\")\n json = commit_obj.to_json\n response = Net::HTTP.post_form(uri, {\"payload\" => json})\nend", "def update\n respond_to do |format|\n if @commit_filepath.update(commit_filepath_params)\n format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully updated.' }\n format.json { render :show, status: :ok, location: @commit_filepath }\n else\n format.html { render :edit }\n format.json { render json: @commit_filepath.errors, status: :unprocessable_entity }\n end\n end\n end", "def normalize_expected_commit_data commit_data\n # Convert file string list into real array\n commit_data[:file_name] = Kappamaki.from_sentence commit_data[:file_name]\n\n # Create individual expected commits for each location provided\n Kappamaki.from_sentence(commit_data.delete(:location)).map do |location|\n branch = branch_name_for_location location, commit_data[:branch]\n commit_data.clone.merge branch: branch\n end\nend", "def create\n data =params[:data]\n\n resource = ActiveSupport::JSON.decode(data)\n @repo = Repository.find(resource[\"repo_id\"])\n dir_path = resource[\"dirPath\"];\n post = DataFile.save(params['file'], @repo.path+dir_path)\n\n\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\tGitHelper.commitAll(@git, resource[\"comment\"])\n\n\t\trender json: {success: \"file uploaded\"}\n end", "def test_get_tags\n post '/repos', {:name => GIT_REPO}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"[email protected]\", :message => \"My First Commit\"}\n sha = JSON.parse(last_response.body)[\"commit_sha\"]\n post \"/repos/#{GIT_REPO}.git/tags\", {:tag => \"version1\", :message => \"hello\", :sha => sha, :type => \"commit\", :user => \"Rune Madsen\", :email => \"[email protected]\"}\n get \"/repos/#{GIT_REPO}.git/tags\"\n end", "def sync_code_dir\n fs_commands = { 'commit': '{\"commit-all\": true}', 'force-sync': \"\" }\n fs_commands.each do |fs_cmd, data|\n curl = %W[\n curl\n -X POST\n --cert $(puppet config print hostcert)\n --key $(puppet config print hostprivkey)\n --cacert $(puppet config print localcacert)\n -H \"Content-type: application/json\"\n https://#{master}:8140/file-sync/v1/#{fs_cmd}\n -d '#{data}'\n ].join(\" \")\n\n on(master, curl)\n end\n end", "def commit_path\n return ['data'] if to_build.to_s.empty?\n\n countries.flat_map(&:legislatures).map { |l| 'data/' + l.directory }\n end", "def commit\n File.open(file_path, \"w\") do |f|\n f.write(to_json)\n end\n end", "def commit_files(author: nil, message: nil, parent: nil, files: {})\n # check parameters\n raise \"no author given\" if author.nil?\n raise \"no message given\" if message.nil?\n\n # get parent commit\n if not parent.nil?\n parent = @wiki.commit_for(parent)\n elsif parent.nil? and not @wiki.repo.head.commit.nil?\n parent = @wiki.commit_for(@wiki.repo.head.commit.id)\n end\n\n unless parent.nil?\n log_debug \" checkpoint (parent #{parent})\"\n if parent.id != @wiki.repo.head.commit.id\n log_debug \" (parent #{parent} is not head)\"\n\n # now check version of each file individually, if it has been\n # changed in one of the changes since parent.\n #\n # if so, raise error, else proceed\n\n files.each do |path,contents|\n next if @wiki.repo.log(nil, path, {:since => parent.authored_date}).empty?\n log_debug \" file has changed\"\n raise \"repo has changed\"\n end\n end\n end\n\n options = {\n :message => message,\n :author => author,\n }\n unless parent.nil?\n options[:parent] = parent\n end\n\n committer = Gollum::Committer.new(@wiki, options)\n\n files.each do |path,contents|\n path = path.dup.gsub(/^\\.\\//, '')\n if contents.nil?\n committer.index.delete(path)\n else\n committer.index.add(path, normalize(contents))\n end\n # if wikifile_exists? path, parent\n # log_debug \" U path: #{path}, contents: #{normalize(contents)}\"\n # committer.index.add(path.dup, normalize(contents))\n # else\n # log_debug \" A path: #{path}, contents: #{normalize(contents)}\"\n # dir, name, format = split_path path\n # committer.add_to_index(dir, name, format, contents)\n # end\n end\n\n committer.after_commit do |index, sha|\n log_debug \" after_commit: #{index}, #{sha}\"\n @wiki.clear_cache\n\n files.each do |path,contents|\n path = path.gsub(/^\\.\\//, '')\n #dir, name, format = split_path path\n unless @wiki.repo.bare\n Dir.chdir(::File.join(@wiki.repo.path, \"..\")) do\n if contents.nil?\n @wiki.repo.git.rm(path, :force => true)\n else\n @wiki.repo.git.checkout(path, 'HEAD')\n end\n end\n end\n end\n\n @wiki_manager.add_to_index(@wiki, index, sha, files)\n end\n\n sha = committer.commit\n log_debug \"sha #{sha}\"\n end", "def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc:\n# sql = \"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\"\n# devfiles_of_prev_commit = ActiveRecord::Base.connection.execute(sql)\n#\n devfiles_of_prev_commit = Devfile.find_by_sql(\"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\")\n if devfiles_of_prev_commit.size > 0\n ActiveRecord::Base.connection.execute(\"begin\")\n now = DateTime.now\n devfiles_of_prev_commit.each do |df|\n if not changed_files.has_key?(df.path + df.name)\n begin\n sql = \"insert into blobs_in_commits(blob_id, commit_id, created_at, updated_at) values('#{df['blob_id']}', '#{commit.id}', '#{now}', '#{now}');\"\n ActiveRecord::Base.connection.execute(sql)\n rescue\n # do nothing\n end\n end\n end\n ActiveRecord::Base.connection.execute(\"commit\")\n end\n end", "def files_commits(num_commits)\n @repo = Grit::Repo.new(@directory)\n related_files = []\n commits_all(num_commits) do |commits|\n commits.each do |commit|\n paths = []\n begin\n commit.diffs.each do |diff|\n if diff.a_path != diff.b_path\n related_files += [[diff.a_path, diff.b_path]]\n end\n paths += [diff.a_path, diff.b_path]\n end\n rescue Grit::Git::GitTimeout\n puts \"Failed to diff for %s\" % commit.sha\n end\n paths.uniq!\n yield commit, paths, related_files\n end\n end\n end", "def create\n @repo = GitRepository.create(path: '/a/path')\n @commit = GitCommit.create(object_hash: params[:hash], git_repository: @repo)\n respond_to do |format|\n format.html { render html: @commit.object_hash }\n format.json { render json: @commit }\n end\n end", "def commit_params\n params.require(:commit).permit(:project_id, :branch, :commit)\n end", "def create_repository_file(project_id, options = {})\n post \"/projects/#{project_id}/repository/files\", options\n end", "def submit_form(formdata: {})\n formdata[SUBMITTED_AT] = Time.now.iso8601\n rc = 999 # Ensure it's a bogus value\n Dir.mktmpdir do |tmpdir|\n tmpdir.untaint\n credentials = ['--username', $USER, '--password', $PASSWORD]\n _.system ['svn', 'checkout', MAPPING_DIR, tmpdir, ['--depth', 'files', '--no-auth-cache', '--non-interactive'], credentials]\n \n filename = File.join(tmpdir, MAPPING_FILE).untaint\n idmaps = JSON.parse(File.read(filename))\n # Add user data (may overwrite existing entry)\n idmaps[formdata[COMMITTERID]] = formdata\n # Sort file (to keep diff clean) and write it back\n idmaps = Hash[idmaps.keys.sort.map {|k| [k, idmaps[k]]}]\n File.write(filename, JSON.pretty_generate(idmaps))\n \n Dir.chdir tmpdir do\n rc = _.system ['svn', 'commit', filename, '--message', \"#{formdata[COMMITTERID]} JIRA=#{formdata[JIRA]} Confluence=#{formdata[CONFLUENCE]}\",\n ['--no-auth-cache', '--non-interactive'], credentials]\n end\n end\n\n if rc == 0\n _div.alert.alert_success role: 'alert' do\n _p do\n _span.strong 'ID Mapping successfully submitted'\n _ 'Thanks for helping out the Infra team with the future SSO consolidation!'\n end\n end\n else\n _div.alert.alert_danger role: 'alert' do\n _p do\n _span.strong 'Checking in your ID Mapping failed, see above for errors.'\n end\n end\n end\nend", "def publish_report(files, path, pubpass=get_pub_pass(), overwrite=true, mkdirs=false)\n\n # files used to be a list of only local filepaths. files is now a hash from remotename => binarydata\n # What used to be params (a hash of MultiPart components) is now files\n\n # Moved to just outside the publish function\n # params = {}\n # files should be a list of file names\n #files.each do |f|\n # puts \"Filename: #{CGI::escape(f)}\"\n\n #openfile = File.new f, 'rb'\n #params[URI.encode(f)] = openfile#.read #.encode(Encoding::UTF_8)\n #v = URI.escape(params[URI.encode(f)], Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n #openfile.close\n #end\n path = CGI::escape(path)\n action_url = \"/RepositoryFilePublisher?publishPath=#{path}&publishKey=#{get_passkey(pubpass)}&overwrite=#{overwrite}&mkdirs=#{mkdirs}\"\n\n puts \"Action url:\", action_url\n return post action_url, files\n end", "def post(path = '/files/', params = {})\n request :post, path, params\n end", "def create\n @commit = Commit.new\n\n #walker = Rugged::Walker.new(@repo)\n #\n #walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE) # optional\n #\n #walker.push('HEAD')\n #walker.each { |c| \n # @commit = Commit.new(sha: c.oid, description:c.message,\n # author: c.author[:name], commit_date: c.author[:time])\n # @commit.save\n #}\n #walker.reset\n\n respond_to do |format|\n format.html { redirect_to @commit, notice: 'Commit was successfully created.' }\n format.json { render :show, status: :created, location: @commit }\n end\n end", "def build_repo repo_path, file_structure\n file_structure.each do |entry|\n add_file entry\n end\n end", "def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end", "def destroy\n @commit_filepath.destroy\n respond_to do |format|\n format.html { redirect_to commit_filepaths_url, notice: 'Commit filepath was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_pull_a_new_file_into_a_modified_tree\n b.add(\"dir/three\" => \"three content\").commit(\"b added three\")\n a.add(\"dir/two\" => \"two content\").commit(\"a added two\")\n \n assert_equal \"two content\", a['dir/two']\n assert_equal nil, b['dir/two']\n assert_equal \"three content\", b['dir/three']\n \n b.pull\n \n assert_equal \"two content\", a['dir/two']\n assert_equal \"two content\", b['dir/two']\n assert_equal \"three content\", b['dir/three']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\",\n \"b added three\", \n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n commits = commit_entries(pr, at_open = true)\n\n commits_per_file = commits.flat_map { |c|\n unless c[:files].nil?\n JSON.parse(c[:files]).map { |f|\n [c[:sha], f[\"filename\"]]\n }\n else\n []\n end\n }.select{|x| x.size > 1}.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]} # get the shas of pr related commits\n\n walker = Rugged::Walker.new(git)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr[:base_commit])\n\n commit_list = walker.select do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid # (oid is the object id - c.oid gets the commit sha). this commit is not part of pr's commits\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def update\n @resource = params[:content]\n\n\t\tif params[:dir_path] == \"/\"\n\t\t\tparams[:dir_path]=\"\"\n\t\tend\n\n\t\tfile_path = \"#{params[:dir_path]}/#{params[:filename]}\"\n\n if File.open(file_path, 'w') {|f| f.write(params[:content]) }\n\t\t\tDir.chdir(params[:dir_path])\n\t\t\t@git = Git.init()\n\t\t\tGitHelper.commitAll(@git, params[\"comment\"])\n\n\t\t\trender json: {success: \"file successfully uploaded\"}\n else\n render json: { error: \"SOMETHING WENT WRONG SAVING RESOURCE\" }\n end\n end", "def stage_files(*files)\n command = \"git add --all #{files.join(' ')}\"\n command_success?(command)\n end", "def getPullRequestFiles(id)\n getFilesFromDiff(getPullRequestDiff(id))\n end", "def post_paths\n %(/site/home\n /content/999/BOXID/TYPENAME\n /file/999/BOXID\n /shard/0000000000000000000000000000000000000000\n /schema/delete\n )\n end", "def add_files(file_path__content_array, opts = {})\n if any_changes = RepoManager.add_files(@repo_manger_context, file_path__content_array, no_commit: opts[:no_commit], commit_msg: opts[:commit_msg])\n RepoManager.push_changes(@repo_manger_context) unless opts[:donot_push_changes]\n end\n any_changes\n end", "def submission_files=(files)\n ensure_file_open!\n remove_folder_files(SUBMISSION_PATH)\n\n files.each do |path, file|\n path = Pathname.new(path) unless path.is_a?(Pathname)\n raise ArgumentError, 'Paths must be relative' unless path.relative?\n\n @file.get_output_stream(SUBMISSION_PATH.join(path)) do |stream|\n stream.write(file)\n end\n end\n end", "def add_files(context, file_path__content_array, opts = {})\n get_adapter_repo(context).add_files(file_path__content_array, no_commit: opts[:no_commit], commit_msg: opts[:commit_msg])\n end", "def commit( *files, **options )\n\t\tself.server.run( :commit, *files, **options )\n\t\treturn true\n\tend", "def make_files(targets)\n file_pairs = targets.map { |t| \n filename = sanitize_filename(t[:data][:name] + '.json')\n [filename, t]\n }\n unique_pairs = uniqufy(file_pairs)\n unique_pairs.each do |name, content| \n puts \"Write #{File.absolute_path(name)}\"\n File.open(name, 'w') { |file| file.write(JSON.pretty_generate(content)) }\n end\nend", "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "def commit_refs(commit, repo_param)\n commit.refs.map{ |r| commit_ref(r, repo_param) }.join(\"\\n\")\n end", "def commit_modified_files_task\n really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split(\"\\n\")\n if really_modified.any?\n really_modified.each { |file| sh git, 'add', file }\n sh git, 'commit', '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end\n end", "def add_commit_to_db(hash)\n #insert hash values into proper attribute in commits table\n @con.exec_prepared('commitInsert', hash.values_at(*@@GIT_LOG_PROPERTIES))\n \n create_commit_filepath(hash[\"filepaths\"], hash[:commit_hash])\n create_commit_bug(hash[:bug], hash[:commit_hash]) if hash[:bug]!=nil\n end", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n pr_against = pull_req_entry(pr[:id])['base']['sha']\n commits = commit_entries(pr[:id])\n\n commits_per_file = commits.flat_map { |c|\n c['files'].map { |f|\n [c['sha'], f['filename']]\n }\n }.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]}\n\n walker = Rugged::Walker.new(repo)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr_against)\n\n commit_list = walker.take_while do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def add_fileset\n\n # grab the parameters\n work_id = params[:work]\n file_id = params[:file]\n label = params[:label]\n\n # validate them\n if work_id.blank? == false && file_id.blank? == false && label.blank? == false\n work = get_the_work( work_id )\n if work.nil? == false\n filename = APIV1FilesetsController.cache_contents( file_id )\n if filename.blank? == false\n fileset = ::FileSet.new\n fileset.title << label\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.create_metadata( work )\n file_actor.create_content( File.open( filename ) )\n fileset.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n fileset.save!\n\n # audit the information\n #audit_log( \"File #{label} for work id #{work_id} (#{work.identifier}) added by #{User.cid_from_email( @api_user.email)}\" )\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{File.basename( filename )}/#{label} added\" )\n\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'File not found' )\n end\n else\n render_standard_response( :not_found, 'Work not found' )\n end\n else\n render_standard_response( :unauthorized, 'Missing work identifier or file identifier or file label' )\n end\n\n end", "def create\n path = save_file \n if path \n if update_versioned_files?\n\n @file_version = FileVersion.new(:path =>path, :versioned_file_id => params[:versioned_file_id], :isActive => true )\n if @file_version.save\n render json: @file_version, status: :created, location: @file_version\n else\n render json: @file_version.errors, status: :unprocessable_entity\n end\n else\n render json: @file_versions.errors, status: :unprocessable_entity\n end\n else \n render json: { :message => \"The file is not valid\" }, :status => :precondition_failed\n end\n \n end", "def branches_containing_commit(commit_ref); end", "def branches_containing_commit(commit_ref); end", "def paths_to_json\n JSON.unparse(paths_to_array) \n end", "def get_changed_file_list\n command = \"git log -m -1 --name-only --pretty='format:' $(git rev-parse origin/master)\"\n file_paths = []\n features = {}\n features.compare_by_identity\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n files = stdout.read.gsub! \"\\n\", \",\"\n file_paths = files.split(\",\")\n puts \"Found files:\\n#{file_paths}\"\n end\n\n puts \"Count files in push: #{file_paths.count}\"\n\n file_paths.each do |file_path|\n if file_path.include?(\".feature\")\n puts \"Added: #{file_path}\"\n folder = get_name_folder_from_path file_path\n features.store(folder, file_path)\n end\n end\n\n puts \"\\n\"\n puts \"Count feature files: #{features.count}\"\n features.sort\nend", "def project_files_add(project_id, files)\n put(\"/projects/#{project_id}/listfiles\", nil, files)\n end", "def add_hook_for_server_check target, project_name, branch = 'master', log: '/tmp/log', host: 'http://localhost'\n File.open \"#{target}/hooks/post-receive\", 'w' do |file|\n file.write <<-HOOK\n#!/bin/bash\n\nwhile read oldrev newrev refname\ndo\n branch=$(git rev-parse --symbolic --abbrev-ref $refname)\n if [ \"$branch\" == \"#{branch}\" ]; then\n echo \"curl -X PATCH '#{host}/api/projects/#{project_name}/#{branch}'\" >>\"#{log}\"\n curl -X PATCH \"#{host}/api/projects/#{project_name}/#{branch}\" >>\"#{log}\" 2>&1 &\n fi\ndone\n HOOK\n file.chmod 0755\n end\n true\n end", "def find_by_commit_path(commits, args)\n raise \"Configuration Error: #{path.join('>')} specified 'find_by' 'commit_path' without any 'match' or 'omit' attributes\" unless args[\"match\"] || args[\"omit\"]\n match = eval(args[\"match\"]) rescue nil\n omit = eval(args[\"omit\"]) rescue nil\n commits.select {|commit| commit.paths.any?{|commit_path| (match.nil? || commit_path.path =~ match) && (omit.nil? || (commit_path.path =~ omit).nil?)}}\n end", "def commit_params\n params.require(:commit).permit(:sha, :description, :author, :commit_date)\n end", "def post_receive_payloads(refs, project=nil)\n\t\tproject ||= @project\n\t\tpayloads = []\n\t\trefs.each do |ref|\n\t\t\toldhead, newhead, refname = ref.split(',')\n\n\t\t\t# Only pay attention to branch updates\n\t\t\tnext if not refname.match(/refs\\/heads\\//)\n\t\t\tbranch = refname.gsub('refs/heads/', '')\n\n\t\t\tif newhead.match(/^0{40}$/)\n\t\t\t\t# Deleting a branch\n\t\t\t\tGitHosting.logger.debug \"Deleting branch \\\"#{branch}\\\"\"\n\t\t\t\tnext\n\t\t\telsif oldhead.match(/^0{40}$/)\n\t\t\t\t# Creating a branch\n\t\t\t\tGitHosting.logger.debug \"Creating branch \\\"#{branch}\\\"\"\n\t\t\t\trange = newhead\n\t\t\telse\n\t\t\t\trange = \"#{oldhead}..#{newhead}\"\n\t\t\tend\n\n\t\t\trevisions_in_range = %x[#{GitHosting.git_exec} --git-dir='#{GitHosting.repository_path(project)}' rev-list --reverse #{range}]\n\t\t\t#GitHosting.logger.debug \"Revisions in Range: #{revisions.split().join(' ')}\"\n\n\t\t\tcommits = []\n\t\t\trevisions_in_range.split().each do |rev|\n\t\t\t\trevision = project.repository.find_changeset_by_name(rev.strip)\n\t\t\t\tcommit = {\n\t\t\t\t\t:id => revision.revision,\n\t\t\t\t\t:url => url_for(:controller => \"repositories\", :action => \"revision\", \n\t\t\t\t\t\t:id => project, :rev => rev, :only_path => false, \n\t\t\t\t\t\t:host => Setting['host_name'], :protocol => Setting['protocol']\n\t\t\t\t\t),\n\t\t\t\t\t:author => {\n\t\t\t\t\t\t:name => revision.committer.gsub(/^([^<]+)\\s+.*$/, '\\1'),\n\t\t\t\t\t\t:email => revision.committer.gsub(/^.*<([^>]+)>.*$/, '\\1')\n\t\t\t\t\t},\n\t\t\t\t\t:message => revision.comments,\n\t\t\t\t\t:timestamp => revision.committed_on,\n\t\t\t\t\t:added => [],\n\t\t\t\t\t:modified => [],\n\t\t\t\t\t:removed => []\n\t\t\t\t}\n\t\t\t\trevision.changes.each do |change|\n\t\t\t\t\tif change.action == \"M\"\n\t\t\t\t\t\tcommit[:modified] << change.path\n\t\t\t\t\telsif change.action == \"A\"\n\t\t\t\t\t\tcommit[:added] << change.path\n\t\t\t\t\telsif change.action == \"D\"\n\t\t\t\t\t\tcommit[:removed] << change.path\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tcommits << commit\n\t\t\tend\n\n\t\t\tpayloads << {\n\t\t\t\t:before => oldhead,\n\t\t\t\t:after => newhead,\n\t\t\t\t:ref => refname,\n\t\t\t\t:commits => commits,\n\t\t\t\t:repository => {\n\t\t\t\t\t:description => project.description,\n\t\t\t\t\t:fork => false,\n\t\t\t\t\t:forks => 0,\n\t\t\t\t\t:homepage => project.homepage,\n\t\t\t\t\t:name => project.identifier,\n\t\t\t\t\t:open_issues => project.issues.open.length,\n\t\t\t\t\t:owner => {\n\t\t\t\t\t\t:name => Setting[\"app_title\"],\n\t\t\t\t\t\t:email => Setting[\"mail_from\"]\n\t\t\t\t\t},\n\t\t\t\t\t:private => !project.is_public,\n\t\t\t\t\t:url => url_for(:controller => \"repositories\", :action => \"show\", \n\t\t\t\t\t\t:id => project, :only_path => false, \n\t\t\t\t\t\t:host => Setting[\"host_name\"], :protocol => Setting[\"protocol\"]\n\t\t\t\t\t),\n\t\t\t\t\t:watchers => 0\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\t\tpayloads\n\tend", "def create\n @project = Project.find params[:project_id]\n @file = @project.source_files.create :name=>params[:name], :code=>params[:code]\n\n respond_to do |format|\n if @file.save \n format.html {redirect_to @project}\n format.json {render json: @file}\n end\n end\n end", "def commit()\n\[email protected]!\n\t@awaitingCommitString += \"]\"\n\tputs \"debug: buffer awaiting commit:\\n\";\n\tputs @awaitingCommitString\n\t\n\tbegin\n\t\tresponse = @cs.upload_documents(documents: @awaitingCommitString, content_type: 'application/json')\n\trescue Aws::CloudSearchDomain::Errors::DocumentServiceException=>e\n\t\tbegin\n\t\t\tstructuredExceptionData = JSON.parse(e.message)\n\t\t\tputs \"A DocumentServiceException occurred:\"\n\t\t\tap structuredExceptionData\n\t\t\tputs e.backtrace\n\t\t\texit(1)\n\t\trescue JSON::JSONError\n\t\t\tputs \"A DocumentServiceException occurred which was not parseable:\"\n\t\t\tputs e.message\n\t\t\tputs e.backtrace\n\t\t\texit(2)\n\t\tend\n\tend\n\t\n\t@awaitingCommitString = \"[\"\n\t\n\tputs \"INFO: upload_document request:\"\n\tputs \"\\tStatus: #{response.status}\"\n\tputs \"\\tAdded documents: #{response.adds}, deleted documents: #{response.deletes}\";\n\tif(response.warnings and response.warnings.length>0)\n\t\tputs \"\\tWARNINGS:\"\n\t\tresponse.warnings.each do |w|\n\t\t\tputs \"\\t\\t#{w.message}\"\n\t\tend #response.warnings.each\n\tend #if\nend", "def git_add_commit_push(host, branch, message, git_repo_path)\n git_add_everything(host, git_repo_path)\n git_commit_push(host, branch, message, git_repo_path)\nend", "def parseFileslist(doc, params, path)\n prev_commit_hash = (doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash') ? doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash').content : nil) \n commit_hash = (doc.find_first('//xmpp2rest/user/device/files/commit_hash')) ? doc.find_first('//xmpp2rest/user/device/files/commit_hash').content : nil\n \n if not commit_hash\n raise Exception.new(\"Missing element: commit_hash\")\n end\n \n puts \"Prev_commit_hash: \" + prev_commit_hash.to_s\n puts \"Commit_hash: \" + commit_hash.to_s\n \n location = {}\n location['latitude'] = (doc.find_first('//xmpp2rest/user/device/files/location/latitude')) ? doc.find_first('//xmpp2rest/user/device/files/location/latitude').content : \"NULL\"\n location['longitude'] = (doc.find_first('//xmpp2rest/user/device/files/location/longitude')) ? doc.find_first('//xmpp2rest/user/device/files/location/longitude').content : \"NULL\"\n \n filelist = Hash.new\n doc.find('//user/device/files/file').each do |file|\n fullpath = (file.attributes.get_attribute(\"fullpath\")) ? file.attributes.get_attribute(\"fullpath\").value : nil \n filepath = (file.find_first('path')) ? file.find_first('path').content : nil\n filename = (file.find_first('filename')) ? file.find_first('filename').content : nil \n filedate = (file.find_first('filedate')) ? file.find_first('filedate').content : nil\n filetype = (file.find_first('filetype')) ? file.find_first('filetype').content : nil\n filesize = (file.find_first('filesize')) ? file.find_first('filesize').content : nil\n version_hash = (file.find_first('version_hash')) ? file.find_first('version_hash').content : nil\n\n if not filepath or not filename or not filetype or not filesize or not filedate or not version_hash\n raise Exception.new(\"Not all the needed metadata given: filename, filetype, filesize, filedate and version_hash are compulsory!\")\n elsif fullpath.to_s != filepath.to_s + filename.to_s\n raise Exception.new(\"fullpath: #{fullpath.to_s} doesn't match to path + name: #{filepath.to_s + filename.to_s}\")\n elsif fullpath[0,1] != '/' or filepath[0,1] != '/'\n raise Exception.new(\"path must begin with /\")\n end\nputs \"filepath: #{filepath}\"\n filelist.merge!({fullpath => {\"status\" => \"created\", \"blob_hash\" => version_hash, \"name\" => filename, \"path\" => filepath, \"size\" => filesize, \"filetype\" => filetype, \"filedate\" => filedate.to_s}}) \n end\n contains = YAML.dump_stream(filelist)\nputs \"contains: #{contains.to_s}\"\n if prev_commit_hash\n puts \"prev hash added!\"\n params['prev_commit_hash'] = prev_commit_hash\n end\n \n path += \"/files\"\n params.merge!({ 'contains' => contains, 'commit_hash' => commit_hash, 'commit_location' => location})\n return params, path\n end", "def create\n @stage_commit = StageCommit.new(stage_commit_params)\n\n respond_to do |format|\n if @stage_commit.save\n GitHubber.promote_to_prod(@stage_commit.sha)\n old_commits=GitHubber.all_before_hash(@stage_commit.sha)\n logged_commits = StageCommit.where(\"sha in (?)\", old_commits).map{ |reviews| reviews.sha }\n skipped_commits = old_commits - logged_commits\n\n skipped_commits.each do |skipped_sha|\n StageCommit.create(:sha => skipped_sha, :approver => @stage_commit.approver, :comment => \"Auto Approved in Commit #{@stage_commit.sha} and Message #{@stage_commit.comment}\")\n end\n\n format.html { redirect_to @stage_commit, notice: 'Stage commit was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stage_commit }\n else\n format.html { render action: 'new' }\n format.json { render json: @stage_commit.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_pull_a_new_file\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n \n assert_equal \"two content\", a['two']\n assert_equal nil, b['two']\n \n b.pull\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\"\n ], b\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end", "def files_at_commit(pr, filter = lambda { |x| true })\n sha = pr[:base_commit]\n begin\n files = lslr(git.lookup(sha).tree)\n rescue StandardError => e\n log pr[:id]\n log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n return nil # not to the default branch\n end\n\n # # find the eariler than and closest to the creation time of commit\n # sha = commit_closest_earlier_pr(pr)\n # begin\n # files = sha.nil? ? [] : lslr(git.lookup(sha).tree)\n # rescue StandardError => e\n # log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n # files = [] # no files found before the pr\n # end\n\n\n if files.size <= 0\n log \"No files for commit #{sha}\"\n end\n files.select { |x| filter.call(x) }\n\n end", "def commit_info(params)\n user, repo = params[\"user\"], params[\"repo\"]\n shas = get_last_30_days_commits(user, repo)\n commit_hash = {}\n file_arr = []\n hydra = Typhoeus::Hydra.new\n shas.each do |sha|\n request = Typhoeus::Request.new(\"#{GithubApiConstants::GITHUB_ROOT}/repos/#{user}/#{repo}/commits/#{sha}?access_token=#{GITHUB_ACCESS_TOKEN}\")\n request.on_complete do |response|\n if response.success?\n parsed_sha_info = JSON.parse(response.response_body)\n author = parsed_sha_info[\"commit\"][\"author\"][\"name\"]\n files = parsed_sha_info[\"files\"].collect { |f| f[\"filename\"] }\n commit_hash[files] = author\n file_arr << files\n else\n raise RepoExceptionHandler::GithubAPILimitReached.new(GithubApiConstants::GITHUB_API_LIMIT_REACHED_MESSAGE)\n end\n end\n hydra.queue(request)\n end\n hydra.run\n return commit_hash, file_arr\n end", "def create_commits commits_array\n commits_array = [commits_array] if commits_array.is_a? Hash\n normalize_commit_data commits_array\n commits_array.each do |commit_data|\n create_commit add_default_commit_data(commit_data)\n end\nend", "def ezii_delta_git_params\n params.require(:ezii_delta_git).permit(:git_commit_created_at, :github_commit_link, :git)\n end", "def commit_data local_branch_name:, branch_name:, message:, sha:, author:\n result = {\n 'BRANCH' => local_branch_name,\n 'LOCATION' => [branch_location(branch_name)],\n 'MESSAGE' => message\n }\n if attribute? 'FILE NAME'\n filenames = committed_files sha\n result['FILE NAME'] = filenames[0] || ''\n end\n if attribute? 'FILE CONTENT'\n if filenames.size == 1\n result['FILE CONTENT'] = content_of file: filenames[0], for_sha: sha\n else\n fail 'Cannot verify file content for multiple files'\n end\n end\n result['AUTHOR'] = author if attribute? 'AUTHOR'\n result\n end", "def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end", "def populate_with_submission_files(revision, path = '/')\n # Remember that assignments have folders within repositories - these\n # will be \"spoofed\" as root...\n if path == '/'\n path = assignment.repository_folder\n end\n\n files_added = false\n # First, go through directories...\n directories = revision.directories_at_path(path)\n directories.each do |_directory_name, directory|\n files_added = populate_with_submission_files(revision, File.join(path, directory.name))\n end\n files = revision.files_at_path(path)\n files.each do |filename, file|\n next if Repository.get_class.internal_file_names.include? filename\n\n files_added = true\n new_file = SubmissionFile.new\n new_file.submission = self\n new_file.filename = file.name\n new_file.path = file.path\n new_file.save\n end\n files_added\n end", "def createDevfile(f, commit) #:doc:\n \n dev_file = nil\n blob = nil\n b_in_c = nil\n \n # If file already exists, raises an error but nothing needs to be deleted (except the commit is cancelled)\n begin \n dev_file = Devfile.find_by_name_and_path_and_device_id(f['name'], f['path'], @device.id)\n if dev_file != nil\n puts \"Devfile: #{f['path'] + f['name']} already exits, cannot create, use update instead\"\n raise ArgumentError.new(\"Devfile already exits for this device, cannot use CREATE -method, use UPDATE instead to add new version\")\n end\n rescue Exception => e\n puts e.to_s\n puts e.backtrace[0].to_s\n raise e\n end\nputs \"name: #{f['name']}\"\nputs \"path: #{f['path']}\"\n \n # If something goes wrong, raises an error, and deletes the data created\n begin\n \n puts \"Creating new dev_file, blob etc..\"\n \n \n f_filedate = DateTime.strptime(f['filedate'], \"%T %F\")\n f_filedate = f_filedate.strftime('%F %T').to_s\n \n now = DateTime.now\n \n # get or create devfile\n dev_file = Devfile.find_or_create_by_name_and_path_and_device_id(f['name'], f['path'], @device.id)\n if dev_file.created_at >= now\n sql = \"update devfiles set filetype='#{f['filetype']}', path='#{f['path']}', privatefile=0 where id=#{dev_file.id}\" \n ActiveRecord::Base.connection.execute(sql)\n end\n \n # get or create blob\n blob = Blob.find_or_create_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id)\n if blob.created_at >= now # if just created\n # Version number\n version = 0\n predecessor_blob_id = \"NULL\"\n follower_blob_id = \"NULL\"\n if dev_file.blob_id != nil\n predecessor_blob_id = dev_file.blobs.find_by_id(dev_file.blob_id) ? dev_file.blobs.find_by_follower_id(dev_file.blob_id).id.to_s : \"NULL\"\n follower_blob_id = dev_file.blobs.find_by_predecessor_id(blob.id) ? dev_file.blobs.find_by_predecessor_id(blob.id).id.to_s : \"NULL\"\n version = dev_file.blobs.find_by_id(dev_file.blob_id).version + 1 \n end\n \nputs \"predecessor_id=#{predecessor_blob_id.to_s},\"\nputs \"follower_id=#{follower_blob_id.to_s},\"\nputs \"size=#{f['size'].to_s},\" \nputs \"filedate='#{f_filedate.to_s}',\" \nputs \"version=#{version.to_s},\" \nputs \"uploaded='0',\" \nputs \"latitude=#{@commit_location['latitude'].to_s}, \" \nputs \"longitude=#{@commit_location['longitude'].to_s} \" \n \n sql = \"update blobs set predecessor_id=#{predecessor_blob_id.to_s}, follower_id=#{follower_blob_id.to_s}, size=#{f['size'].to_s}, filedate='#{f_filedate.to_s}', version=#{version.to_s}, uploaded='0', latitude=#{@commit_location['latitude'].to_s}, longitude=#{@commit_location['longitude'].to_s} where id=#{blob.id};\"\nputs \"sql: \" + sql\n \n ActiveRecord::Base.connection.execute(sql)\n end\n \n # Creates association between blob and commit\n b_in_c = BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id)\n \n # update blob_id to devfile\n if dev_file.blob_id != blob.id\n sql = \"update devfiles set blob_id=#{blob.id} where id=#{dev_file.id};\"\n ActiveRecord::Base.connection.execute(sql)\n end\n \n \n #checkForObservers(dev_file)\n \n # If parent_blob_hash is given, tries to find the parent, and creates new branch form the parent\n if f['file_origin'] \n createBranch(f['file_origin'], blob)\n end\n\n rescue Exception => e\n puts \" -- Error in createDevfile: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n \n puts \"Deleting created data..\"\n \n # If dev_file was created now, deletes it\n dev_file.delete if dev_file\n puts \"Deleted created dev_file!\" if dev_file\n \n if blob \n if b_in_c\n BlobsInCommit.delete_all([\"commit_id = ? AND blob_id = ?\", b_in_c.commit_id.to_s, blob.blob_id.to_s])\n puts \"Deleted created blobs_in_commits!\" if b_in_c\n end\n blob.delete \n puts \"Deleted created blob!\"\n end\n \n # Throws forward the exception..\n raise e\n end\n puts \"File created\"\n return dev_file\n end", "def export_files(vivo_path, vitro_path, tag, branch, export_dir)\n\tDir.chdir(vivo_path) do |path|\n\t\tcmds = [\"git checkout #{branch}\", \n\t\t\t\t\"git pull\",\n\t\t\t\t]\n\t\tcmds.delete_at(1) unless remote_branch_exists?(path, branch)\n\t\tapprove_and_execute(cmds, \"in #{path}\")\n\tend\n\t\n\tDir.chdir(vitro_path) do |path|\n\t\tcmds = [\"git checkout #{branch}\", \n\t\t\t\t\"git pull\",\n\t\t\t\t]\n\t\tcmds.delete_at(1) unless remote_branch_exists?(path, branch)\n\t\tapprove_and_execute(cmds, \"in #{path}\")\n\tend\n\t\n\tapprove_and_execute([\n\t\t\t\"rm -Rf #{File.expand_path(\"..\", export_dir)}\",\n\t\t\t\"mkdir -pv #{export_dir}\",\n\t\t\t\"cp -R #{vivo_path}/* #{export_dir}\",\n\t\t\t\"mkdir -pv #{export_dir}/vitro-core\",\n\t\t\t\"cp -R #{vitro_path}/* #{export_dir}/vitro-core\",\n\t\t\t])\nend", "def run_on_change(paths)\n paths = normalize(paths)\n paths.each do |path|\n upload(path)\n end\n end", "def get_path(commit)\n repos_path = File.expand_path('repos')\n File.join(repos_path, commit)\n end", "def test_add_the_same_file_in_both_repos\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n b.add(\"two\" => \"two content\").commit(\"b added two\")\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n b.pull\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\", \n \"b added two\",\n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end", "def all_file_commits_data(path)\n time = ` cd /tmp/#{@repo} && git log --format=%ct #{path} `.split(\"\\n\").map{|time| time.to_i}\n ins_del = ` cd /tmp/#{@repo} && git log --numstat --format=%h #{path} | grep #{path} `.split(\"\\n\").map{|line| line.split(\" \")[0..1]}.map{|insert| insert.map{|x| x.to_i}}\n time.zip(ins_del)\n end", "def commit(*to_commit)\n checkout unless ::File.exist?(@wc_path)\n to_commit = @revisions if to_commit.empty?\n to_commit = [to_commit] if (!to_commit.respond_to?(:each) || to_commit.kind_of?(String))\n \n to_commit.each do | rev |\n rev = @revisions.find{ |r| r.name == rev } unless rev.kind_of?(Revision)\n rev.commit(self)\n end\n end", "def save_changes!(files_to_commit: [], custom_message: nil)\n not_implemented(__method__)\n end", "def create_local_commit author: nil, branch:, file_name:, file_content:, message:, push: false\n on_branch(branch) do\n if (folder_name = File.dirname file_name) != '.'\n Dir.mkdir folder_name\n end\n File.write file_name, file_content\n run \"git add '#{file_name}'\"\n run \"git commit -m '#{message}' #{\"--author='#{author}'\" if author}\"\n run 'git push' if push\n end\nend", "def commit\n read_repo\n if @branches.count < 1\n render :template => 'repositories/commit'\n return\n end\n\n params[:action] = \"commit\"\n\n blank_hash = \"4b825dc642cb6eb9a060e54bf8d69288fbee4904\"\n @commit = @repository.get_commit(@branch)\n @parent = @commit.parent\n @parent = @repository.get_commit(blank_hash) if @parent == nil\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end", "def test_repo_valid\n post '/repos', {:name => GIT_REPO}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"[email protected]\", :message => \"My First Commit\"}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There Again\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"[email protected]\", :message => \"My First Commit\"}\n `git clone #{path} /tmp/test`\n status = $?.to_i\n assert_equal(0, status)\n FileUtils.rm_rf \"/tmp/test\"\n end", "def submitted_files(path = self.path)\n files = []\n files = files(path) if directory_num\n files\n end", "def create_file(file_name, asset_path, update_source)\n response_name = \"#{response_name}\"\n # * 1) BASE URL\n base_url = 'https://dev-cascade.chapman.edu/api/v1/'.to_s\n\n # * 2) REST API ACTION\n # https://wimops.chapman.edu/wiki/WWW#Key_Links\n # https://www.hannonhill.com/cascadecms/latest/developing-in-cascade/rest-api/index.html\n rest_action = 'create/'.to_s # ! KEEP TRAILING SLASH\n\n # * 3) ASSET TYPE\n # this is easy to find in cascade's edit/preview url.\n # ie https://dev-cascade.chapman.edu/entity/open.act?id=7f74b81ec04d744c7345a74906ded22a&type=page\n asset_type = 'file/' # ! KEEP TRAILING SLASH\n\n # * 4) ASSET PATH OR ID\n # you can also use its path (ie \"Chapman.edu/_cascade/formats/modular/widgets/1-column\")... but.. whitespace.\n asset_path = \"#{asset_path}\" # ! NO TRAILING SLASH\n\n # * 5) SECRETS\n # set these in environment_variables.yml\n cascade_username = '?u=' + ENV['CASCADE_USERNAME']\n cascade_password = '&p=' + ENV['CASCADE_PASSWORD']\n cascade_api_key = '?apiKey=' + ENV['CASCADE_API_KEY']\n\n update_source = \"#{update_source}\"\n\n data = File.read(update_source)\n p data\n\n response_body = data\n\n url_post =\n base_url + rest_action + asset_type + asset_path + cascade_api_key\n\n # 👹Editing assets unfortunately requires PATH, SITENAME, ID. This can be obtained by reading the asset's response.body 👆\n # HTTParty.post(url_post, body: { asset: { xmlBlock: { xml: data, path: \"_cascade/blocks/html/0-write-test\", parentFolderId: parent_folder_id, siteName: \"Chapman.edu\", id: \"365ae5dec0a81e8a20b1d746fd3e0778\" } } }.to_json)\n\n p HTTParty.post(\n url_post,\n body: {\n \"asset\": {\n \"file\": {\n \"text\": data,\n \"rewriteLinks\": false,\n \"maintainAbsoluteLinks\": false,\n \"shouldBePublished\": true,\n \"shouldBeIndexed\": true,\n # \"lastPublishedDate\": \"Jul 15, 2020, 12:56:28 AM\",\n \"lastPublishedBy\": \"cbryant\",\n \"expirationFolderRecycled\": false,\n \"metadataSetId\": \"6fef14a3c04d744c610b81da9d165a27\",\n \"metadataSetPath\": \"Default\",\n \"metadata\": {},\n \"reviewOnSchedule\": false,\n \"reviewEvery\": 180,\n # \"parentFolderId\": \"fd5121b0c04d744c42ab23aa0aba0ba8\",\n \"parentFolderPath\": \"_assets\",\n # \"lastModifiedDate\": \"Feb 26, 2019, 1:05:39 PM\",\n # \"lastModifiedBy\": \"mthomas\",\n # \"createdDate\": \"Feb 26, 2019, 1:05:39 PM\",\n # \"createdBy\": \"mthomas\",\n # \"path\": \"#{asset_path}#{file_name}\",\n # \"siteId\": \"6fef14a3c04d744c610b81dac0a8d082\",\n \"siteName\": \"Chapman.edu\",\n \"tags\": [],\n \"name\": file_name,\n # \"id\": \"2ba09c01c0a81e4b0015d01bfd25ea78\"\n }\n },\n \"success\": true\n }.to_json\n )\n # p \"🎉 View changes at https://dev-cascade.chapman.edu/entity/open.act?id=#{\n # asset_id\n # }&type=#{asset_type}\".chomp('/')\nend", "def push_to_git\n response = @request.push_to_git\n redirect_to requests_path, response\n end", "def code_file_params\n params.require(:code_file).permit(:name, :path, :project_id)\n end", "def commit_and_push_to_repo(oauth_token, commit_message, \n tree_sha, head_sha, ref_name)\n client = Octokit::Client.new(access_token: oauth_token)\n sha_new_commit = client.create_commit(full_repo_name, commit_message, tree_sha, head_sha)[:sha]\n client.update_ref(full_repo_name, ref_name, sha_new_commit)\n end", "def upload_test(path)\n puts \"curl -F 'file=@#{path}' -F 'uKey=fc462b86df69a3373a1c657c68fa78ca' -F '_api_key=3a9cf2ef36199832fc96d03c4d870c42' https://www.pgyer.com/apiv1/app/upload\"\n puts \"uploading #{path}........\"\n puts `curl -F \"file=@#{path}\" -F \"uKey=fc462b86df69a3373a1c657c68fa78ca\" -F \"_api_key=3a9cf2ef36199832fc96d03c4d870c42\" https://www.pgyer.com/apiv1/app/upload`\n puts \"finish uploading #{path}........\"\nend", "def flatfile_params\n params.require(:flatfile).permit(:package_names, :function_names)\n end", "def diff_files_from(commit)\n git_args = ['diff', '--stat', '--name-only', commit]\n result = default_repository.git_output(git_args).lines.map { |line| line.strip }.sort\n # not sure if git would ever mention directories in a diff, but ignore them.\n result.delete_if { |item| ::File.directory?(item) }\n return result\n end", "def stage_commit_params\n params.require(:stage_commit).permit(:sha,:email, :commit_stamp, :approved, :approver, :comment, :developer)\n end", "def commit_file\n if @upload.public? && @upload.file_type.public? && @upload.address.blank? && (@upload.creating? || @upload.failed?)\n BlockchainCommitJob.perform_later(@upload.id)\n end\n end" ]
[ "0.6715083", "0.6302119", "0.61116266", "0.5731861", "0.57165325", "0.5666504", "0.56485254", "0.5558725", "0.55565107", "0.54922825", "0.5467764", "0.5414808", "0.54037255", "0.53529286", "0.53513163", "0.5346149", "0.53448796", "0.53245085", "0.5288588", "0.5283454", "0.52690214", "0.5257739", "0.5234994", "0.518274", "0.5182319", "0.5176843", "0.5167702", "0.51576525", "0.5134109", "0.5102238", "0.5070197", "0.5060916", "0.5051751", "0.5042561", "0.50419295", "0.50408334", "0.5030654", "0.4992058", "0.4984276", "0.49703813", "0.49568278", "0.49559635", "0.49519566", "0.49505588", "0.4943535", "0.4917481", "0.49174798", "0.4904821", "0.49042308", "0.49033993", "0.48952717", "0.48930296", "0.48796842", "0.48651412", "0.48554152", "0.48186263", "0.4817335", "0.48097128", "0.4807137", "0.4802619", "0.48024443", "0.48012626", "0.47990662", "0.47962198", "0.47867194", "0.47856236", "0.47766882", "0.47761887", "0.47679046", "0.4766235", "0.47652775", "0.4763954", "0.47582164", "0.47574523", "0.4749964", "0.47448733", "0.4737792", "0.47332078", "0.47321725", "0.47284433", "0.47172287", "0.47152346", "0.4711697", "0.4705086", "0.4705051", "0.4690746", "0.46902055", "0.468702", "0.46801153", "0.46766788", "0.46748465", "0.4674296", "0.4671627", "0.46687207", "0.46672824", "0.4661477", "0.46600735", "0.46488917", "0.46435478", "0.46421692" ]
0.6221837
2
PATCH/PUT /commit_filepaths/1 PATCH/PUT /commit_filepaths/1.json
def update respond_to do |format| if @commit_filepath.update(commit_filepath_params) format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully updated.' } format.json { render :show, status: :ok, location: @commit_filepath } else format.html { render :edit } format.json { render json: @commit_filepath.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch(path, **args); end", "def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @commit_metadata = args[:commit_metadata] if args.key?(:commit_metadata)\n @file_operations = args[:file_operations] if args.key?(:file_operations)\n @required_head_commit_sha = args[:required_head_commit_sha] if args.key?(:required_head_commit_sha)\n end", "def patch(diffs)\n @hash = nil # invalidate any cached image\n\n Dir.chdir(root) do\n diffs.each do |diff|\n flag, key, v1, _ = diff\n # if key =~ /\\[/\n # keyname = key.match(/^(.*)\\[\\]$/).captures\n # elsif key =~ /\\./\n # keyname, subkey = key.match(/^(.*)\\.(.*)$/).captures\n # else\n # keyname = key\n # end\n\n dirname, filename, fieldname = Treet::Repo.filefor(key)\n filepath = \"#{dirname}/#{filename}\"\n\n case flag\n when '~'\n # change a value in place\n # load the current data & overwrite with the new value\n # idempotent: this will overwrite the file with the same contents\n if fieldname\n # hash entry\n data = File.exists?(filepath) ? JSON.load(File.open(filepath)) : {}\n data[fieldname] = v1\n File.open(filepath, \"w\") {|f| f << JSON.pretty_generate(data)}\n else\n # string entry\n File.open(filepath, \"w\") {|f| f << v1}\n end\n\n when '+'\n # add something\n if fieldname\n # writing a value into a hash\n # idempotent: this will overwrite the file with the same contents\n data = File.exists?(filepath) ? JSON.load(File.open(filepath)) : {}\n data[fieldname] = v1\n Dir.mkdir(dirname) unless Dir.exists?(dirname)\n File.open(filepath, \"w\") {|f| f << JSON.pretty_generate(data)}\n else\n # writing an entire hash into an array entry\n # idempotent: this will overwrite the file with the same contents\n subfile = \"#{dirname}/#{Treet::Hash.digestify(v1)}\"\n Dir.mkdir(dirname) unless Dir.exists?(dirname)\n case v1\n when Hash\n # hash entry\n File.open(subfile, \"w\") {|f| f << JSON.pretty_generate(v1)}\n else\n # string entry - create empty file with this name\n FileUtils.touch(subfile)\n end\n end\n\n when '-'\n # remove something\n if fieldname\n # this is a key in a subhash\n if File.exists?(filepath)\n # if the subhash is missing, there's nothing to remove, so do nothing (for idempotence)\n data = JSON.load(File.open(filepath))\n data.delete(fieldname)\n if data.empty?\n # all keys have been removed, clean up the file\n File.delete(filename)\n else\n File.open(filepath, \"w\") {|f| f << JSON.pretty_generate(data)}\n end\n end\n elsif dirname == \".\"\n # this is a top-level string\n File.delete(filename) if File.exists?(filename) # need the existence check for idempotence\n else\n # this is an array, we look for a match on the entire contents via digest\n subfile = \"#{dirname}/#{Treet::Hash.digestify(v1)}\"\n File.delete(subfile) if File.exists?(subfile) # need the existence check for idempotence\n # TODO: if dirname is now empty, should it be removed? is that worthwhile?\n end\n end\n end\n end\n\n to_hash # ?? return the patched data? or no return value? true/false for success?\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end", "def update!(**args)\n @uncommitted_file_changes = args[:uncommitted_file_changes] if args.key?(:uncommitted_file_changes)\n end", "def post_revert(filename,commit_id,repo)\n curl_put(\"#{self.host}/api2/repos/#{repo}/file/revert\",{\"commit_id\" => commit_id,\"p\" => filename }).body_str\n end", "def update\n @resource = params[:content]\n\n\t\tif params[:dir_path] == \"/\"\n\t\t\tparams[:dir_path]=\"\"\n\t\tend\n\n\t\tfile_path = \"#{params[:dir_path]}/#{params[:filename]}\"\n\n if File.open(file_path, 'w') {|f| f.write(params[:content]) }\n\t\t\tDir.chdir(params[:dir_path])\n\t\t\t@git = Git.init()\n\t\t\tGitHelper.commitAll(@git, params[\"comment\"])\n\n\t\t\trender json: {success: \"file successfully uploaded\"}\n else\n render json: { error: \"SOMETHING WENT WRONG SAVING RESOURCE\" }\n end\n end", "def update\n parse_path\n validate_path!\n\n if params.include?(:dir)\n @path.mkdir\n elsif params.include?(:file)\n @path.mv_from(params[:file].tempfile)\n elsif params.include?(:touch)\n @path.touch\n else\n content = request.body.read\n\n # forcing utf-8 because File.write seems to require it. request bodies are\n # in ASCII-8BIT and need to be re encoded otherwise errors are thrown.\n # see test cases for plain text, utf-8 text, images and binary files\n content.force_encoding('UTF-8')\n\n @path.write(content)\n end\n\n render json: {}\n rescue => e\n render json: { error_message: e.message }\n end", "def multi_update\n errors = false\n return_value = []\n file_infos_params = params.permit(file_infos: [:id, :review_done, :component_id]).require(:file_infos)\n file_infos_params.each do |key, file_info_entry|\n (return_value << nil) and (errors = true) and next unless file_info_entry[:id]\n file_info = FileInfo.find(file_info_entry[:id])\n (return_value << nil) and (errors = true) and next unless file_info\n if file_info.update(file_info_entry)\n return_value << file_info_entry\n else\n return_value << file_info.errors\n errors = true\n end\n end\n respond_to do |format|\n format.json { render json: return_value }\n if errors\n format.html { redirect_to :back, notice: 'Some entries have errors'}\n else\n format.html { redirect_to :back }\n end\n end\n end", "def update_filepath(_package_id:, _filepath:, _sha1:, _size:); end", "def update\n @file_version = FileVersion.find(params[:id])\n params[:versioned_file_id] = @file_version.versioned_file_id\n if update_versioned_files? \n if @file_version.update(:isActive => true)\n head :no_content\n else\n render json: @file_version.errors, status: :unprocessable_entity\n end \n else \n render json: @file_version.errors, status: :unprocessable_entity\n end\n end", "def set_commit_filepath\n @commit_filepath = CommitFilepath.find(params[:id])\n end", "def update_repository_file(project_id, options = {})\n put \"/projects/#{project_id}/repository/files\", options\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n error_msg(ErrorCodes::OBJECT_ERROR, \"#{I18n.t \"endnote_files.errors.not_found\"}: #{params[:id]}\")\n render_json\n end", "def commit_filepath_params\n params.fetch(:commit_filepath, {})\n end", "def update\n @hdfs_path = HdfsPath.find(params[:id])\n\n respond_to do |format|\n if @hdfs_path.update_attributes(params[:hdfs_path])\n format.html { redirect_to @hdfs_path, notice: 'Hdfs path was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hdfs_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @new_path = args[:new_path] if args.key?(:new_path)\n @path = args[:path] if args.key?(:path)\n end", "def update!(**args)\n @new_path = args[:new_path] if args.key?(:new_path)\n @path = args[:path] if args.key?(:path)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update(path)\n output { patch(path, params) }\n end", "def update!(**args)\n @resource_paths_gcs_uri = args[:resource_paths_gcs_uri] if args.key?(:resource_paths_gcs_uri)\n end", "def update!(**args)\n @avro_file_format = args[:avro_file_format] if args.key?(:avro_file_format)\n @file_rotation_interval = args[:file_rotation_interval] if args.key?(:file_rotation_interval)\n @file_rotation_mb = args[:file_rotation_mb] if args.key?(:file_rotation_mb)\n @json_file_format = args[:json_file_format] if args.key?(:json_file_format)\n @path = args[:path] if args.key?(:path)\n end", "def updateDevfile(f, commit) #:doc:\n \n dev_file = nil\n \n begin\n # Checks if there is any changes in files.\n f_filedate = DateTime.strptime(f['filedate'], \"%T %F\")\n f_filedate = f_filedate.strftime('%F %T').to_s \n \n now = DateTime.now.strftime('%F %T')\nputs \"name: #{f['name']}\"\nputs \"path: #{f['path']}\"\n puts \"Finding devfile..\"\n dev_file = @device.devfiles.find(:first, :conditions => [\"name = ? and path = ?\", f['name'], f['path']])\n if dev_file != nil\n puts \"devfile found: \" + dev_file.id.to_s\n else\n puts \"Devfile not found\"\n raise Exception.new(\"Devfile not found. Can not update it!\")\n end\n \n \n blob = dev_file.blobs.find_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id)\n if blob != nil\n puts \"Blob already exists!\"\n puts \"Blob: \" + blob.id.to_s\n return\n else\n puts \"Blob was not found!\"\n end\n \n # Finds the blob that is newest one\n previous_blob_id = nil\n current_blob = dev_file.blobs.find_by_id(dev_file.blob_id)\n if current_blob != nil\n previous_blob_id = current_blob.id.to_s\n puts \"Current blob: \" + current_blob.id.to_s\n \n end\n \n # If the blob, didn't exist yet, creates it. Ensures that blob will have version number.\n if blob == nil #or current_blob == nil\n version = 0\n if current_blob != nil\n version = current_blob.version + 1\n end\n \n puts \"Creates new blob, verion num: \" + version.to_s\n sql = \"insert into blobs(blob_hash, created_at, updated_at, size, filedate, uploaded, version, devfile_id, predecessor_id, latitude, longitude) values('#{f['blob_hash']}', '#{now}', '#{now}', '#{f['size']}', '#{f_filedate}', '0', '#{version}', '#{dev_file.id}', '#{previous_blob_id}', '#{@commit_location['latitude']}', '#{@commit_location['longitude']}');\"\n ActiveRecord::Base.connection.execute(sql)\n end\n \n puts \"Finding the newly created blob..\"\n blob = dev_file.blobs.find_by_blob_hash(f['blob_hash'])\n puts \" found blob: \" + blob.id.to_s\n \n current_blob.update_attribute(:follower_id, blob.id)\n \n puts \"Updating devfile\"\n # Updates changes in devfile (current blob)\n sql = \"update devfiles set filetype = '#{f['filetype']}', latitude = '#{f['latitude']}', longitude = '#{f['longitude']}', blob_id = '#{blob.id.to_s}', updated_at = '#{now}' where name = '#{f['name']}' and path = '#{f['path']}' and device_id = #{@device.id};\"\n puts \" SQL: \" + sql.background(:red)\n ActiveRecord::Base.connection.execute(sql)\n \n BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id)\n \n \n #checkForObservers(dev_file)\n \n rescue => e\n puts \"Errors in updating file\" + e\n raise e\n end\n \n puts \"devfile updated!\"\n return dev_file\n end", "def update_file(login, token, fileContent, sha)\n begin\n uri = URI('https://api.github.com/repos/'+ login + '/evil1.github.io/contents/powr/index.html')\n putParams = { \"message\" => \"Inserted script into head and body sections\",\n \"committer\" => {\n \"name\" => \"Dmitriy Gritsenko\",\n \"email\" => \"[email protected]\"\n },\n \"content\" => Base64.encode64(fileContent),\n \"sha\" => sha\n }\n\n req = Net::HTTP::Put.new(uri)\n req['Authorization'] = 'token ' + token\n req['Accept'] = 'application/json'\n req.body = ActiveSupport::JSON.encode putParams\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n response = { 'success' => true, 'message' => res.body }\n else\n response = { 'success' => false, 'message' => 'Error updating file: ' + res.value }\n end\n\n rescue Exception => ex\n response = { 'success' => false, 'message' => 'Error updating file: ' + ex.message }\n end\n\n return response\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @author = args[:author] if args.key?(:author)\n @commit_message = args[:commit_message] if args.key?(:commit_message)\n @paths = args[:paths] if args.key?(:paths)\n end", "def put_path(base_path, payload)\n url = \"#{endpoint}/paths#{base_path}\"\n put_json(url, payload)\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n @bug = Bug.find(params[:id])\n Bug.save_file(params,@bug) if params[:keepold].nil? or params[:keepold].empty?\n updateparams = params\n updateparams[:bug][:fileuploadpath] = @bug.fileuploadpath\n respond_to do |format|\n if @bug.update_attributes(updateparams[:bug])\n format.html { redirect_to bugs_path, notice: 'Bug was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_ref_paths(data, paths = {})\n paths.each do |path, replace_path|\n replace_path = replace_path.sub(/\\/?$/, \"/\")\n data = data.gsub(/(\"\\$ref\"\\s*:\\s*\")#{Regexp.escape(path)}\\/?/, \"\\\\1#{replace_path}\")\n end\n data\n end", "def update\n respond_to do |format|\n if @commit.update(commit_params)\n format.html { redirect_to @commit, notice: 'Commit was successfully updated.' }\n format.json { render :show, status: :ok, location: @commit }\n else\n format.html { render :edit }\n format.json { render json: @commit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @events = args[:events] if args.key?(:events)\n @file_path = args[:file_path] if args.key?(:file_path)\n @status = args[:status] if args.key?(:status)\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @path = args[:path] if args.key?(:path)\n end", "def update\n authorize @task\n @task.updated_by = current_user\n\n files = @task.files\n files += task_params[:files] if task_params[:files]\n @task.assign_attributes(task_params)\n @task.files = files\n\n if params[:files_remove]\n\n remain_files = @task.files\n\n params[:files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n\n @task.remove_files! if remain_files.empty?\n end\n respond_to do |format|\n if @task.save\n format.html { redirect_back_or_default tasks_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @path = Path.find(params[:id])\n\n respond_to do |format|\n if @path.update_attributes(params[:path])\n format.html { redirect_to([@layer, @path], :notice => 'Path was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @path.errors, :status => :unprocessable_entity }\n end\n end\n end", "def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end", "def update!(**args)\n @blob_ref = args[:blob_ref] if args.key?(:blob_ref)\n @blobstore2_info = args[:blobstore2_info] if args.key?(:blobstore2_info)\n @cosmo_binary_reference = args[:cosmo_binary_reference] if args.key?(:cosmo_binary_reference)\n @crc32c_hash = args[:crc32c_hash] if args.key?(:crc32c_hash)\n @inline = args[:inline] if args.key?(:inline)\n @length = args[:length] if args.key?(:length)\n @md5_hash = args[:md5_hash] if args.key?(:md5_hash)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @path = args[:path] if args.key?(:path)\n @reference_type = args[:reference_type] if args.key?(:reference_type)\n @sha1_hash = args[:sha1_hash] if args.key?(:sha1_hash)\n end", "def update!(**args)\n @action = args[:action] if args.key?(:action)\n @paths = args[:paths] if args.key?(:paths)\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update_file_paths \n if self.url_part_was && self.url_part && self.short_name_changed?\n old_url_part = self.url_part\n old_ref_path = self.assignment_reference_repository.git_path\n set_url_part\n \n if old_url_part == self.url_part\n # Nothing changes\n return\n end\n \n self.save\n \n # Move reference repository folder if necessary\n if File.directory?(old_ref_path) \n new_ref_path = String.new(old_ref_path)\n new_ref_path[new_ref_path.index(File.basename(new_ref_path))..-1] = self.url_part\n \n FileUtils.mv old_ref_path, new_ref_path\n end\n \n # Move assignment repositories if necessary\n self.assignment_offerings.each do |assignment_offering|\n old_assignment_repo_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n old_url_part)\n \n if File.directory?(old_assignment_repo_path)\n new_assignment_repo_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n self.url_part) \n \n FileUtils.mv old_assignment_repo_path, new_assignment_repo_path\n end \n \n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def update\n respond_to do |format|\n if @grid_fs_file.update(grid_fs_file_params)\n format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully updated.' }\n format.json { render :show, status: :ok, location: @grid_fs_file }\n else\n format.html { render :edit }\n format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end", "def update\n upload = params.require(:file)\n handler = setup_handler(upload)\n\n if handler.valid?\n handler.call\n render json: {}, status: 202\n else\n render json: { errors: handler.errors }, status: 422\n end\n end", "def update\n respond_to do |format|\n if @ticket_file.update(ticket_file_params)\n format.html { redirect_to @ticket_file, notice: 'Ticket file was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_file }\n else\n format.html { render :edit }\n format.json { render json: @ticket_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @complaintfile.update(complaintfile_params)\n render json: @complaintfile, status: :ok\n else\n render json: @complaintfile.errors, status: :unprocessable_entity\n end\n\n #respond_to do |format|\n # if @complaintfile.update(complaintfile_params)\n # format.html { redirect_to @complaintfile, notice: 'Complaintfile was successfully updated.' }\n # format.json { render :show, status: :ok, location: @complaintfile }\n # else\n # format.html { render :edit }\n # format.json { render json: @complaintfile.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def update\n respond_to do |format|\n if @other_file.update(other_file_params)\n format.html { redirect_to @other_file, notice: 'Other file was successfully updated.' }\n format.json { render :show, status: :ok, location: @other_file }\n else\n format.html { render :edit }\n format.json { render json: @other_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def resync_input_files #:nodoc:\n params = self.params || {}\n file_args = params[:file_args] || {}\n\n cb_error(\"This CIVET task use the old multi-CIVET structure and cannot be restarted.\") if file_args.size != 1\n\n collection_id = params[:collection_id]\n if collection_id.present? # MODE A: collection\n addlog(\"Resyncing input FileCollection ##{collection_id}.\")\n collection = FileCollection.find(collection_id)\n collection.sync_to_cache\n else # MODE B: individual files\n file0 = file_args[\"0\"].presence || cb_error(\"Params structure error!\")\n t1_id = file0[:t1_id] # cannot be nil\n t2_id = file0[:t2_id] # can be nil\n pd_id = file0[:pd_id] # can be nil\n mk_id = file0[:mk_id] # can be nil\n\n addlog(\"Resyncing input T1 ##{t1_id}.\")\n SingleFile.find(t1_id).sync_to_cache\n\n if t2_id.present?\n addlog(\"Resyncing input T2 ##{t2_id}.\")\n SingleFile.find(t2_id).sync_to_cache\n end\n\n if pd_id.present?\n addlog(\"Resyncing input PD ##{pd_id}.\")\n SingleFile.find(pd_id).sync_to_cache\n end\n\n if mk_id.present?\n addlog(\"Resyncing input MASK ##{mk_id}.\")\n SingleFile.find(mk_id).sync_to_cache\n end\n end\n\n rescue ActiveRecord::RecordNotFound\n cberror \"Cannot find input file. Recovery impossible.\"\n end", "def update!(**args)\n @drive_file_id = args[:drive_file_id] if args.key?(:drive_file_id)\n end", "def update!(**args)\n @drive_file_id = args[:drive_file_id] if args.key?(:drive_file_id)\n end", "def update!(**args)\n @file_path = args[:file_path] if args.key?(:file_path)\n @gcs_timestamps = args[:gcs_timestamps] if args.key?(:gcs_timestamps)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "def update!(**args)\n @file_path = args[:file_path] if args.key?(:file_path)\n @gcs_timestamps = args[:gcs_timestamps] if args.key?(:gcs_timestamps)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @script_id = args[:script_id] if args.key?(:script_id)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def updated_cookbook_file(cookbook_name, path)\n end", "def test_pull_a_new_file_into_a_modified_tree\n b.add(\"dir/three\" => \"three content\").commit(\"b added three\")\n a.add(\"dir/two\" => \"two content\").commit(\"a added two\")\n \n assert_equal \"two content\", a['dir/two']\n assert_equal nil, b['dir/two']\n assert_equal \"three content\", b['dir/three']\n \n b.pull\n \n assert_equal \"two content\", a['dir/two']\n assert_equal \"two content\", b['dir/two']\n assert_equal \"three content\", b['dir/three']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\",\n \"b added three\", \n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end", "def _PATCHESDIR; Config._PATCHES; end", "def patch(uri, options = T.unsafe(nil)); end", "def index\n @commit_filepaths = CommitFilepath.all\n end", "def update_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/update_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n update_response = JSON.parse(response.read_body)['data']\n puts \"Feature '#{update_response['attributes']['name']}' with '#{update_response['attributes']['scenarios-count']} scenario(s)' updated.\"\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n $updated_count = $updated_count + 1\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend", "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n cf = CoreFile.find(params[:id])\n cf.update(core_file_params)\n\n redirect_to cf\n end", "def files_remote_update(options = {})\n post('files.remote.update', options)\n end", "def update\n respond_to do |format|\n if @batch_file.update(batch_file_params)\n format.html { redirect_to @batch_file, notice: \"Batch file was successfully updated.\" }\n format.json { render :show, status: :ok, location: @batch_file }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @batch_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n path = save_file \n if path \n if update_versioned_files?\n\n @file_version = FileVersion.new(:path =>path, :versioned_file_id => params[:versioned_file_id], :isActive => true )\n if @file_version.save\n render json: @file_version, status: :created, location: @file_version\n else\n render json: @file_version.errors, status: :unprocessable_entity\n end\n else\n render json: @file_versions.errors, status: :unprocessable_entity\n end\n else \n render json: { :message => \"The file is not valid\" }, :status => :precondition_failed\n end\n \n end", "def update\n @file.project_id = session[:project_id]\n respond_to do |format|\n if @file.update(file_params)\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n else\n params[:id] = @file.directory_id\n format.html { render action: 'edit', layout: false }\n format.json { render json: @file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end", "def update\n @capa = Capa.find(params[:id])\n\n respond_to do |format|\n if @capa.update_attributes(params[:capa])\n unless params[:capa_files].blank?\n params[:capa_files]['file'].each do |a|\n @capa_file = @capa.capa_files.create!(:file => a, :capa_id => @capa.id)\n end\n end\n format.html { redirect_to @capa, notice: 'Capa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capa.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_gist(id, files={}, options={:public => true})\n options.merge!(files)\n patch \"/gists/#{id}\", :body => options\n end", "def update\n @super_file = SuperFile.find(params[:id])\n\n respond_to do |format|\n if @super_file.update_attributes(params[:super_file])\n format.html { redirect_to @super_file, notice: 'Super file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end", "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @file = args[:file] if args.key?(:file)\n @path = args[:path] if args.key?(:path)\n @permissions = args[:permissions] if args.key?(:permissions)\n @state = args[:state] if args.key?(:state)\n end", "def patch\n end", "def commit_files(author: nil, message: nil, parent: nil, files: {})\n # check parameters\n raise \"no author given\" if author.nil?\n raise \"no message given\" if message.nil?\n\n # get parent commit\n if not parent.nil?\n parent = @wiki.commit_for(parent)\n elsif parent.nil? and not @wiki.repo.head.commit.nil?\n parent = @wiki.commit_for(@wiki.repo.head.commit.id)\n end\n\n unless parent.nil?\n log_debug \" checkpoint (parent #{parent})\"\n if parent.id != @wiki.repo.head.commit.id\n log_debug \" (parent #{parent} is not head)\"\n\n # now check version of each file individually, if it has been\n # changed in one of the changes since parent.\n #\n # if so, raise error, else proceed\n\n files.each do |path,contents|\n next if @wiki.repo.log(nil, path, {:since => parent.authored_date}).empty?\n log_debug \" file has changed\"\n raise \"repo has changed\"\n end\n end\n end\n\n options = {\n :message => message,\n :author => author,\n }\n unless parent.nil?\n options[:parent] = parent\n end\n\n committer = Gollum::Committer.new(@wiki, options)\n\n files.each do |path,contents|\n path = path.dup.gsub(/^\\.\\//, '')\n if contents.nil?\n committer.index.delete(path)\n else\n committer.index.add(path, normalize(contents))\n end\n # if wikifile_exists? path, parent\n # log_debug \" U path: #{path}, contents: #{normalize(contents)}\"\n # committer.index.add(path.dup, normalize(contents))\n # else\n # log_debug \" A path: #{path}, contents: #{normalize(contents)}\"\n # dir, name, format = split_path path\n # committer.add_to_index(dir, name, format, contents)\n # end\n end\n\n committer.after_commit do |index, sha|\n log_debug \" after_commit: #{index}, #{sha}\"\n @wiki.clear_cache\n\n files.each do |path,contents|\n path = path.gsub(/^\\.\\//, '')\n #dir, name, format = split_path path\n unless @wiki.repo.bare\n Dir.chdir(::File.join(@wiki.repo.path, \"..\")) do\n if contents.nil?\n @wiki.repo.git.rm(path, :force => true)\n else\n @wiki.repo.git.checkout(path, 'HEAD')\n end\n end\n end\n end\n\n @wiki_manager.add_to_index(@wiki, index, sha, files)\n end\n\n sha = committer.commit\n log_debug \"sha #{sha}\"\n end", "def update!(**args)\n @request_file_scope = args[:request_file_scope] if args.key?(:request_file_scope)\n end", "def update\n # exception if not HTTP POST\n raise \"Only POST to this route!\" unless env[\"REQUEST_METHOD\"] == \"POST\"\n body = env[\"rack.input\"].read\n astr = body.split(\"&\")\n params = {}\n astr.each do |a|\n name, val = a.split \"=\"\n params[name] = val\n end\n quote = FileModel.find(params[\"id\"].to_i)\n quote[\"submitter\"] = params[\"submitter\"]\n quote.save\n\n render :quote, :obj => quote\n end", "def update(path, content)\n file = pathname(path)\n\n # fail if path is a dir or similar\n fail FileNotFound unless file.file?\n\n # get rid of CRLFs\n content.gsub!(/\\r\\n?/, \"\\n\")\n\n # don't do anything if the contents are identical\n return if file.read == content\n\n # write, add, commit\n file.write(content)\n git :add, path.shellescape\n git :commit, \"-m 'update #{path}' -- #{path.shellescape}\"\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def create\n @commit_filepath = CommitFilepath.new(commit_filepath_params)\n\n respond_to do |format|\n if @commit_filepath.save\n format.html { redirect_to @commit_filepath, notice: 'Commit filepath was successfully created.' }\n format.json { render :show, status: :created, location: @commit_filepath }\n else\n format.html { render :new }\n format.json { render json: @commit_filepath.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(*filenames)\n puts send_cmd(\"update \"+filenames.map{|f| OptArg.quote(f)}.join(\" \"))\n end", "def update!(**args)\n @subpath = args[:subpath] if args.key?(:subpath)\n end", "def update!(**args)\n @file_contents = args[:file_contents] if args.key?(:file_contents)\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc:\n# sql = \"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\"\n# devfiles_of_prev_commit = ActiveRecord::Base.connection.execute(sql)\n#\n devfiles_of_prev_commit = Devfile.find_by_sql(\"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\")\n if devfiles_of_prev_commit.size > 0\n ActiveRecord::Base.connection.execute(\"begin\")\n now = DateTime.now\n devfiles_of_prev_commit.each do |df|\n if not changed_files.has_key?(df.path + df.name)\n begin\n sql = \"insert into blobs_in_commits(blob_id, commit_id, created_at, updated_at) values('#{df['blob_id']}', '#{commit.id}', '#{now}', '#{now}');\"\n ActiveRecord::Base.connection.execute(sql)\n rescue\n # do nothing\n end\n end\n end\n ActiveRecord::Base.connection.execute(\"commit\")\n end\n end" ]
[ "0.6103378", "0.5856162", "0.58377904", "0.5801592", "0.5675454", "0.56435007", "0.56307733", "0.56124526", "0.5610535", "0.5572411", "0.55660915", "0.5548735", "0.5491657", "0.5464166", "0.5457339", "0.54044825", "0.54044825", "0.54044825", "0.54044825", "0.54018867", "0.54007286", "0.5376571", "0.53145194", "0.52974415", "0.52974415", "0.5295567", "0.52843976", "0.5280882", "0.52724826", "0.52576315", "0.5257455", "0.52559155", "0.5247076", "0.52467364", "0.5240855", "0.5211732", "0.5200555", "0.51940644", "0.51922244", "0.5186783", "0.5183514", "0.516494", "0.5156449", "0.51443565", "0.5140824", "0.51269174", "0.512194", "0.51206684", "0.5114772", "0.5104505", "0.51023644", "0.51019627", "0.5095499", "0.50947714", "0.5091867", "0.5089249", "0.50833154", "0.5076062", "0.5070958", "0.507015", "0.5062822", "0.506216", "0.506216", "0.5060706", "0.5059869", "0.5051574", "0.5051574", "0.50496614", "0.50467044", "0.5045488", "0.50445986", "0.5038655", "0.5037982", "0.5036256", "0.5035804", "0.5034731", "0.50326186", "0.5029527", "0.50252306", "0.5021811", "0.5019951", "0.5015699", "0.5011429", "0.5003837", "0.49996483", "0.49979997", "0.49942243", "0.49919248", "0.49911186", "0.4990093", "0.4988163", "0.49847773", "0.49836594", "0.49829385", "0.4977487", "0.49774638", "0.49704406", "0.49654576", "0.49652043", "0.49651983" ]
0.66460806
0
DELETE /commit_filepaths/1 DELETE /commit_filepaths/1.json
def destroy @commit_filepath.destroy respond_to do |format| format.html { redirect_to commit_filepaths_url, notice: 'Commit filepath was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def delete_file(path, commit)\n fullpath = ::File.join([page_file_dir, path].compact)\n multi_commit = !!commit[:committer]\n committer = multi_commit ? commit[:committer] : Committer.new(self, commit)\n\n committer.delete(fullpath)\n\n committer.after_commit do |index, _sha|\n dir = '' if dir == '.'\n @access.refresh\n index.update_working_dir(fullpath)\n end\n\n multi_commit ? committer : committer.commit\n end", "def file_delete(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/delete\", params)\n parse_response(response)\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def test_remove_a_file\n a.rm(\"one\").commit(\"a removed one\")\n \n assert_equal nil, a['one']\n assert_equal \"one content\", b['one']\n \n b.pull\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n assert_log_equal [\n \"a added one\",\n \"a removed one\"\n ], b\n end", "def delete(bucket, file); end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete(path = '/files/', params = {})\n request :delete, path, params\n end", "def destroy(paths)\n\t\tlogin_filter\n\t\tpaths = [paths].flatten\n\t\tpaths = paths.collect { |path| namespace_path(path) }\n\t\[email protected](\"/cmd/delete\", {\"files\"=> paths, \"t\" => @token }).code == \"200\"\n\tend", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def b2_delete_file_version(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n\n file_hash = parse_files_json(file)\n file_name = file\n file_id = file_hash[file]\n\n uri = URI(\"#{api_url}/b2api/v1/b2_delete_file_version\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"fileName\\\":\\\"#{file_name}\\\", \\\"fileId\\\":\\\"#{file_id}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def run_on_deletion(paths)\n end", "def run_on_deletion(paths)\n end", "def delete_draft(filename)\n sh \"git rm #{filename}\" if `git ls-files #{filename}` != ''\n File.delete(filename) if File.exist?(filename)\n\n nil\nend", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def delete_repository_file(project_id, options = {})\n delete \"/projects/#{project_id}/repository/files\", options\n end", "def delete_file(file_name)\n fail 'No Structure ID defined for structure. Can\\'t delete file' if @structure.id.nil?\n\n data = Hashie::Mash.new\n data.structure_id = @structure.id\n data.file_name = file_name\n\n push_file('api/remove_file', MultiJson.dump(data))\n end", "def deleteFile(bucket, file, client)\n\tfilename = File.basename(file)\n\tbegin\n\t \tresp = client.client.delete_objects({\n\t \t\tbucket: bucket,\n\t\t\tdelete: { objects: [\n\t\t\t\t{ key: filename }\n\t\t\t],\n\t\t\tquiet: false }\n\t\t})\n\trescue Exception => e\n\t\tputs \"Wrong file name\"\n\t\tputs e\n\t\texit\n\tend\n\treturn resp\nend", "def delete_post_commit\n file_path = @path + '/.git/hooks/post-commit'\n if File.exists? file_path\n File.delete file_path\n end\n end", "def delete_github_repo_file\n # commit\n commit_to_github(@repo, post_params)\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def del_file( file_path )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_rm_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} rm #{file_path}\"\n log.info(x) { \"[git] file remove command => #{git_rm_cmd}\" }\n %x[#{git_rm_cmd}];\n log.info(x) { \"[git] has removed #{file_path} from repo and working copy.\" }\n\n end", "def destroy\n @history_file_delete.destroy\n respond_to do |format|\n format.html { redirect_to history_file_deletes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @commit.destroy\n respond_to do |format|\n format.html { redirect_to commits_url, notice: 'Commit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n date = gmtdate\n headers = {\n 'Host' => @aliyun_upload_host,\n 'Date' => date,\n 'Authorization' => sign('DELETE', bucket_path, '', '', date)\n }\n url = path_to_url(path)\n response = RestClient.delete(url, headers)\n response.code == 204 ? url : nil\n end", "def delete(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.delete\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def delete(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/delete?file_ids=%s' % [id]).status == \"OK\"\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(*args)\n commit(\"delete\", *args)\n end", "def delete(filename); end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete(path, opts = {})\n input_json = {\n path: path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/delete\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "def delete(args)\n args = {:path => args} unless args.is_a?(Hash)\n assert_supported_keys(args, [:path, :version, :callback, :context])\n assert_required_keys(args, [:path])\n args[:version] ||= -1\n\n if args[:callback] ## asynchronous\n raise KeeperException::BadArguments unless args[:callback].kind_of?(VoidCallback)\n return zoo_adelete(@zk_handle, args[:path], args[:version], args[:callback].proc, YAML.dump(args[:context]))\n end\n\n ## synchronous\n rc = zoo_delete(@zk_handle, args[:path], args[:version])\n raise KeeperException.by_code(rc), ZooKeeperFFI::zerror(rc) unless rc == ZOK\n return rc\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete(path_info)\n @file_store.delete path_info\n\n @bucket.objects[gem_object_name(path_info)].delete\n end", "def delete(*args)\n commit(\"delete\", *args)\n end", "def delete(cloud_file)\n\n payload = {\n root: \"auto\",\n path: cloud_file.path\n }\n\n connexion = Dropbox.start(:delete, access_token)\n response = connexion.post do |req|\n req.url \"fileops/delete\"\n req.body = payload\n end\n response = format_response(response)\n Filetree.new('dropbox').update([response[:path], nil])\n\n end", "def delete_files(uuids)\n Uploadcare::FileList.batch_delete(uuids)\n end", "def delete\n response = client[\"/vaults/#{vault_id}/blobs/#{blob_id}\"].delete\n response.code == 200\n end", "def delete_file(hash=nil)\n if @@hash.length < 1 && hash === nil \n raise \"Delete File: Hash not found.\"\n end\n return api_call('queue-manager',{\"apiKey\"=>@@_api_key,\"hash\"=>(hash!=nil)?hash:@@hash, \"method\"=>\"deleteFile\" });\n end", "def delete_file_from_database(file_id)\n $db.execute(\"DELETE FROM files WHERE id = ?\", file_id)\n $db.execute(\"DELETE FROM file_share_table WHERE file_id = ?\", file_id)\nend", "def delete(path, **options)\n execute :delete, path, options\n end", "def delete_file_from_db(file_id)\n $db.execute(\"DELETE FROM files WHERE file_id = ?\", file_id)\nend", "def test_remove_the_same_file_in_both_repos\n a.rm(\"one\").commit(\"a removed one\")\n b.rm(\"one\").commit(\"b removed one\")\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n b.pull\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n assert_log_equal [\n \"a added one\",\n \"a removed one\",\n \"b removed one\",\n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end", "def rm path\n end", "def delete_files(*files)\n files = files.flatten\n unless files.empty?\n @perforce.run(\"delete\", \"-c\", @number, *files)\n end\n end", "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(path)\n bucket.objects.delete(path)\n end", "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "def delete_one(file)\n files_collection.find(:_id => file.id).delete_one\n chunks_collection.find(:files_id => file.id).delete_many\n end", "def destroy\n @indexed_file = IndexedFile.find(params[:id])\n @indexed_file.destroy\n\n respond_to do |format|\n format.html { redirect_to indexed_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ezii_delta_git.destroy\n respond_to do |format|\n format.html { redirect_to ezii_delta_gits_url, notice: 'Ezii delta git was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete *paths\n branch = _find_delegate_hash *paths\n if branch.has_key? paths.last\n branch[paths.last].remove\n end\n end", "def delete(context, name)\n res = context.transport.delete_request(context, \"blobstores/#{name}\")\n\n context.err(res.body) unless res.success?\n end", "def destroy\n @client = Client.find(params[:id])\n Client.transaction do\n FileUtils.rm Dir[\"#{Rails.root}/public/files/logo_files/\"[email protected]_s]\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully deleted.' }\n format.json { head :no_content }\n end\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "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 @fileversion = Fileversion.find(params[:id])\n @fileversion.destroy\n\n respond_to do |format|\n format.html { redirect_to fileversions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n head :no_content\n end", "def test_delete_preconditions_failed\n request = Http::Request.new(\n 'DELETE',\n '/file1',\n 'If-Match' => \"\\\"#{Digest::MD5.hexdigest('bar')}\\\"\"\n )\n\n response = self.request(request)\n\n assert_equal(\n 412,\n response.status,\n \"Incorrect status code. Response body: #{response.body_as_string}\"\n )\n end", "def delete(path)\n self.stage { |idx| idx.delete(path) }\n end", "def test_delete_file()\n\n path = 'folder/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n request = DeleteFileRequest.new(path, versionId, storage)\n\n result = @storage_api.delete_file(request)\n assert result.code == 200,'Error while deleting document'\n\n end", "def destroy\n @file_version.destroy\n head :no_content\n end", "def rm(*path)\n super; on_success{ nil }\n end", "def delete_contents(repo, path, message, sha, options = {})\n options[:message] = message\n options[:sha] = sha\n url = \"#{Repository.path repo}/contents/#{path}\"\n delete url, options\n end", "def destroy\n @action_file = ActionFile.find(params[:id])\n @action_file.destroy\n\n respond_to do |format|\n format.html { redirect_to action_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incidentfile.destroy\n respond_to do |format|\n format.html { redirect_to incidentfiles_url, notice: 'Incidentfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to config_files_url }\n format.json { head :no_content }\n end\n end", "def delete(*filenames); end", "def delete(*uris); end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @q_resource = QResource.find(params[:id])\n @q_resource.bfile.remove!\n @q_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to q_resources_url }\n format.json { head :ok }\n end\n end", "def destroy\n @file_version = FileVersion.find(params[:id])\n @file_version.destroy\n\n respond_to do |format|\n format.html { redirect_to file_versions_url }\n format.json { head :no_content }\n end\n end", "def google_delete_file(client)\n files = []\n [@fields[:files],@fields[:folders]].each do |array|\n if array.is_a?(Array)\n files += array\n elsif !array.nil?\n files.push(array)\n end\n end\n targets = files.collect {|p| CGI::unescape(p)}\n client.delete_files_by_path(targets)\n end", "def delete(path)\n request(:delete, path)\n end", "def delete_fileset( user, fileset )\n\n print \"deleting file set #{fileset.id} (#{fileset.label})... \"\n\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, user )\n file_actor.destroy\n\n puts \"done\"\n\n end", "def destroy\n @cfile.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def delete_page(page, commit)\n index = nil\n sha1 = commit_index(commit) do |idx|\n index = idx\n index.delete(page.path)\n end\n\n dir = ::File.dirname(page.path)\n dir = '' if dir == '.'\n\n @access.refresh\n update_working_dir(index, dir, page.name, page.format)\n\n sha1\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end", "def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end", "def remove_file(id)\n\n # Get file name\n file_name = \"#{Repository.data_dir}#{id}.json\"\n\n\t\t# Check if file exists\n\t\tif File.exists?(file_name)\n\t\t\t# if so delete\n\t\t\tFile.delete(file_name)\n\t\telse\n\t\t\tDebug.add(\"[WARNING] #{id}.json not found\")\n\t\tend\n end", "def destroy\n @batch_file.destroy\n respond_to do |format|\n format.html { redirect_to batch_files_url, notice: \"Batch file was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def post_revert(filename,commit_id,repo)\n curl_put(\"#{self.host}/api2/repos/#{repo}/file/revert\",{\"commit_id\" => commit_id,\"p\" => filename }).body_str\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete(path)\n exec { index.delete(path) }\n end", "def destroy\n @purchase_file = PurchaseFile.find(params[:id])\n @purchase_file.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expenses_file.destroy\n respond_to do |format|\n format.html { redirect_to expenses_files_url, notice: 'Expenses file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def batch_delete(uuids)\n body = uuids.to_json\n request_delete(uri: '/files/storage/', content: body)\n end" ]
[ "0.6758197", "0.66282016", "0.66155815", "0.6552906", "0.64551204", "0.63730943", "0.6341973", "0.6308579", "0.62984496", "0.62692857", "0.6255808", "0.6246104", "0.6217623", "0.6192738", "0.618808", "0.6129804", "0.6125374", "0.6125374", "0.61101764", "0.6100545", "0.6093411", "0.60780495", "0.60649323", "0.60533684", "0.6045778", "0.6042967", "0.60418504", "0.6032793", "0.60295403", "0.6024223", "0.6020935", "0.601704", "0.60008657", "0.59927887", "0.59927887", "0.5991335", "0.5976733", "0.59755147", "0.59685796", "0.596711", "0.5959914", "0.5951508", "0.59383935", "0.5933687", "0.59020936", "0.5897264", "0.5891748", "0.5890562", "0.58876973", "0.58863133", "0.58691037", "0.58626574", "0.585968", "0.58514833", "0.58470565", "0.5846383", "0.5843765", "0.5833782", "0.58322126", "0.5829283", "0.5817998", "0.5811692", "0.5809484", "0.58024174", "0.58002996", "0.5799863", "0.5799779", "0.57978916", "0.57775486", "0.57737416", "0.57710665", "0.57709396", "0.57706916", "0.5757951", "0.5754492", "0.57543284", "0.5753565", "0.57460904", "0.57420933", "0.57390106", "0.57299477", "0.5729702", "0.57238007", "0.57180583", "0.57089627", "0.5707915", "0.57013047", "0.5698196", "0.56966966", "0.56944805", "0.5679169", "0.56764376", "0.56754243", "0.5667774", "0.5666666", "0.5665727", "0.56653196", "0.5664212", "0.5664113", "0.5663748" ]
0.7451704
0
Use callbacks to share common setup or constraints between actions.
def set_commit_filepath @commit_filepath = CommitFilepath.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def commit_filepath_params params.fetch(:commit_filepath, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def active_code_params\n params[:active_code].permit\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def url_whitelist; end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.6293856", "0.6290323", "0.62816143", "0.6241851", "0.6241208", "0.622036", "0.62128764", "0.62110275", "0.61966056", "0.61776453", "0.617547", "0.6174961", "0.61654735", "0.6153256", "0.61516005", "0.6149498", "0.6123234", "0.6118653", "0.61077267", "0.61061186", "0.6093616", "0.608318", "0.6074428", "0.60650206", "0.60244286", "0.6020295", "0.60155797", "0.6012826", "0.6010141", "0.6010141", "0.60037106", "0.600298", "0.59979576", "0.5994806", "0.5994283", "0.5993927", "0.5980616", "0.59667075", "0.59614897", "0.59610957", "0.596071", "0.5959614", "0.59554", "0.59542966", "0.5946781", "0.5940262", "0.5940262", "0.59401053", "0.5937168", "0.5932135", "0.59293395", "0.592659", "0.59202623", "0.59112674", "0.59088206", "0.590716", "0.59056735", "0.589997", "0.5899655", "0.5898926", "0.5896042", "0.589589", "0.5895867", "0.58894163", "0.5884936", "0.5879227", "0.58740723", "0.5871364", "0.5870148", "0.5869228", "0.5868196", "0.5867967", "0.5865532", "0.58653617", "0.58644646", "0.58631665", "0.5862611", "0.5857609", "0.58558804", "0.5853729", "0.5853025" ]
0.0
-1
Public methods for ac_as_api
def followers_count self.followers.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api; end", "def api; end", "def apis; end", "def api_only; end", "def api_only; end", "def api_only; end", "def api\n @api\n end", "def api_mode; end", "def set_api(*args); end", "def set_api(*args); end", "def parent_api; end", "def parent_api; end", "def api_only=(_arg0); end", "def api_only=(_); end", "def from_api?; false end", "def api_auth\n\t\tauth ::UApi\n\tend", "def apis=(_arg0); end", "def initialize(api)\n @api = api\n end", "def api_error; end", "def api_keys; rest_query(:api_key); end", "def api_keys; rest_query(:api_key); end", "def acts_as_api\n\n class_eval do\n include ActsAsApi::Base::InstanceMethods\n extend ActsAsApi::Base::ClassMethods\n end\n\n if block_given?\n yield ActsAsApi::Config\n end\n\n end", "def api_call(payload); end", "def api\n self.well_info.api\n end", "def api\n return @api\n end", "def api\n # Should return an instance of the API instantiated \n # with the credentials passed into the initialized.\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new \n end", "def hidden_apis=(_arg0); end", "def apply_ammendments(api_schema)\n api_schema.fetch(:apis).each do |endpoint|\n endpoint.fetch(:operations).each do |method|\n method[:nickname] = method[:nickname].sub('Api::V1::', '') unless method[:nickname].nil?\n method[:consumes] = ['application/x-www-form-urlencoded'] if ['post', 'patch', 'put', 'delete'].include? method[:method].downcase\n\n method[:parameters].each do |p|\n p[:required] = true if p[:required] == 'required'\n\n case p[:type]\n when 'date'\n p[:type] = 'string'\n p[:format] = 'date'\n when 'datetime'\n p[:type] = 'string'\n p[:format] = 'date-time'\n end\n\n p[:name] = :payload if p[:paramType] == 'body' && p[:name] == ''\n p[:'allowMultiple'] = true if p[:name] == 'state' # actually API allows multiple states in query\n end\n\n method[:responseMessages].each do |response_message|\n next unless response_message[:message].match?(/pdf/i)\n\n response_message[:responseModel] ||= 'File'\n method[:produces] ||= ['application/pdf', 'application/json']\n end\n end\n end\n\n\n api_schema.fetch(:models).values.each do |model|\n if model.fetch(:id) == 'Order'\n model.fetch(:properties)['updated_at'] ||= {:type=>\"date-time\", :description=>nil}\n end\n\n model.fetch(:properties).each do |name, property|\n case property[:type]\n when 'complex'\n property[:type] = [:items, :purchase_items].include?(name) ? 'array' : property[:items][:'$ref']\n when 'date'\n property[:type] = 'date-time'\n end\n end\n end\nend", "def call_api\n @client.build_url\n @client.get\n assign_data\n end", "def hidden_apis; end", "def api\n @config = ZipMoney::Configuration\n configure_api if @_api.nil?\n \t @_api\n end", "def api_object\n unless $api\n $api = FyberAPI.new(\n 'b07a12df7d52e6c118e5d47d3f9e60135b109a1f',\n {\n appid: 157,\n format: 'json',\n device_id: '2b6f0cc904d137be2e1730235f5664094b83',\n locale: 'de',\n ip: '109.235.143.113'\n }\n )\n end\n $api\n end", "def to_api\n\n results = {\n 'nation_name' => nation_name,\n 'client_app_id' => client_app_id,\n 'client_secret' => client_secret,\n 'redirect_uri' => redirect_uri\n }\n \n end", "def api\n @api ||= Battlenet.new(:eu)\n end", "def direct_request_to_saas_api\n\n token_has_ost_managed_owner = @token_details[:properties].include?(GlobalConstant::ClientToken.has_ost_managed_owner)\n\n params_for_saas_api = {\n token_id: @token_id,\n client_id: @client_id,\n bt_to_mint: @bt_to_mint_in_wei,\n fetch_request_stake_tx_params: !token_has_ost_managed_owner\n }\n\n saas_response = SaasApi::Token::PreMintDetails.new.perform(params_for_saas_api)\n return saas_response unless saas_response.success?\n\n saas_response_data = saas_response.data\n\n unless token_has_ost_managed_owner\n @api_response_data[:contract_details] = {\n gateway_composer: {\n abi: GlobalConstant::ContractDetails::GatewayComposer.abi,\n address: saas_response_data['request_stake_tx_params']['gateway_composer_contract_address'],\n gas: GlobalConstant::ContractDetails::GatewayComposer.gas\n }\n }\n @api_response_data[:gas_price] = saas_response_data['request_stake_tx_params']['origin_chain_gas_price']\n @api_response_data[:request_stake_tx_params] = {\n gateway_contract: saas_response_data['request_stake_tx_params']['gateway_contract_address'],\n gas_price: saas_response_data['request_stake_tx_params']['gas_price'],\n gas_limit: saas_response_data['request_stake_tx_params']['gas_limit'],\n staker_gateway_nonce: saas_response_data['request_stake_tx_params']['staker_gateway_nonce'],\n stake_and_mint_beneficiary: saas_response_data['request_stake_tx_params']['stake_and_mint_beneficiary']\n }\n end\n\n @api_response_data[:precise_amounts] = saas_response_data['precise_amounts']\n\n success\n end", "def to_api\n\n results = {\n 'page_id' => id,\n 'name' => name,\n 'description' => description,\n 'template_name' => template_name,\n 'url_fragment' => url_fragment,\n 'url_redirect' => url_redirect,\n 'url_redirect_property' => url_redirect_property\n }\n return results;\n\n end", "def api_method\n ''\n end", "def preflight; end", "def APICall params = {}\n \n path = params[:path]\n method = params[:method] || 'GET'\n payload = params[:payload] || nil\n \n params.delete(:method)\n params.delete(:path)\n params.delete(:payload)\n \n a = Time.now.to_f\n \n http = Net::HTTP.new(@infra[:domain]+'.zendesk.com',443)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true\n \n uri = %{#{@infra[:path]}#{path}}\n uri << '?'+params.map{ |key,val| \"#{key}=#{val}\" }.join('&') if params && params.count > 0\n uri = URI.escape uri\n \n reqs = {\n 'GET' => Net::HTTP::Get.new(uri),\n 'POST' => Net::HTTP::Post.new(uri),\n 'PUT' => Net::HTTP::Put.new(uri),\n 'DELETE' => Net::HTTP::Delete.new(uri)\n }\n req = reqs[method]\n \n content_type = 'application/json'\n content_type = 'application/binary' if path.include? 'uploads'\n req.content_type = content_type\n \n req.basic_auth @username,@infra[:authentication]\n \n req.body = payload if method == 'POST' || method == 'PUT'\n \n response = http.request req\n \n code = response.code.to_f.round\n body = response.body\n \n b = Time.now.to_f\n c = ((b-a)*100).round.to_f/100\n \n final = {code: code.to_i,body: nil}\n final = final.merge(body: JSON.parse(body)) if method != 'DELETE' && code != 500\n final = final.merge(time: c)\n \n @api += 1\n \n final\n \n end", "def fabricate_via_api!\n validate_reuse_preconditions\n\n resource_web_url(api_get)\n rescue Errors::ResourceNotFoundError\n super\n ensure\n self.class.resources[reuse_as] ||= {\n tests: Set.new,\n resource: self\n }\n\n self.class.resources[reuse_as][:attributes] ||= all_attributes.each_with_object({}) do |attribute_name, attributes|\n attributes[attribute_name] = instance_variable_get(\"@#{attribute_name}\")\n end\n self.class.resources[reuse_as][:tests] << Runtime::Example.location\n end", "def initialize(api_obj)\n @api_obj = api_obj\n end", "def create_api_instance\n facturama_user='prueba'\n facturama_password='pruebas2011'\n is_development = true # true = Modo de pruebas / sandbox, false = Modo de Producción (Timbrado real)\n\n\n #Creacion de una instancia de FacturamaApiMultiemisor\n Facturama::FacturamaApiMulti.new(facturama_user,facturama_password,is_development)\n end", "def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.underscore.downcase,\n :name => name,\n }\n end", "def create_api_instance\n facturama_user='prueba'\n facturama_password='pruebas2011'\n is_development = true # true = Modo de pruebas / sandbox, false = Modo de Producción (Timbrado real)\n\n\n #Creacion de una instancia de FacturamaApi\n Facturama::FacturamaApiWeb.new(facturama_user,facturama_password,is_development)\n end", "def render_api_with_ar_instance(ar_instance)\n if ar_instance.valid?\n render :json => OldApi.success(ar_instance.to_json)\n else\n render :json => OldApi.error(400, ar_instance.errors.full_messages.to_sentence.to_json), :status => 400\n end\n end", "def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.downcase,\n :name => name,\n :title => title,\n :about => about,\n :portrait => portrait,\n :sort => sort,\n }\n end", "def create_authorizations_api\n InfluxDB2::API::AuthorizationsApi.new(@api_client)\n end", "def api_key=(_arg0); end", "def api_key=(_arg0); end", "def api_key=(_arg0); end", "def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.underscore.downcase,\n :name => name,\n :sort => sort,\n }\n end", "def setup_api\n #\n @api = Api.new(current_user)\n\n #\n if white_listed?(path)\n return\n end\n\n #\n token = params[:token] || request.headers['X-Api-Token'] || request.headers['X-API-TOKEN']\n\n unless token.blank?\n user = nil\n token = Token.where(:kind => 'api', :uuid => token.to_s).first\n\n if token and token.context.is_a?(User)\n user = token.context\n end\n\n if user\n @api.user = user\n else\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n email, password = http_basic_auth_info\n\n if !email.blank? and !password.blank?\n user = User.where(:email => email).first\n\n if user and user.password == password\n @api.user = user\n else\n headers['WWW-Authenticate'] = ('Basic realm=\"\"' % realm)\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n if defined?(current_user) and current_user\n @api.user = current_user\n else\n @api.user = nil\n #headers['WWW-Authenticate'] = ('Basic realm=\"\"' % realm)\n #render(:nothing => true, :status => :unauthorized)\n #return\n end\n end\n end\n\n #\n unless @api.route?(@path) or @path == 'index'\n render :nothing => true, :status => 404\n end\n end", "def response_from_service\n\n end", "def fetch_api_console_data\n\n result = CacheManagement::ClientApiCredentials.new([@client_id]).fetch[@client_id]\n return validation_error(\n 'e_fss_2',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n ) if result.blank?\n\n # Create OST Sdk Obj\n ost_sdk = OSTSdk::Saas::Services.new(\n api_key: result[:api_key],\n api_secret: result[:api_secret],\n api_base_url: GlobalConstant::SaasApi.v1dot1_base_url,\n api_spec: true\n )\n @ost_spec_sdk_obj = ost_sdk.services.transactions\n\n api_spec_service_response = @ost_spec_sdk_obj.execute(api_spec_params)\n\n return api_spec_service_response unless api_spec_service_response.success?\n\n api_spec_service_response.data[:request_uri].gsub!(GlobalConstant::SaasApi.base_url, GlobalConstant::SaasApi.display_only_base_url)\n\n @api_response_data[:api_console_data] = {\n transaction: {\n execute: api_spec_service_response.data\n }\n }\n\n success\n\n end", "def typify(api_map); end", "def submission_api\n # noinspection RubyMismatchedReturnType\n api_service(SubmissionService)\n end", "def user_api\n $SDK_API\nend", "def get()\n \n end", "def api\n @api ||= PrismicService.init_api\n end", "def authenticate_api!\n Rails.logger.info(\"Enter Authenticate Api\")\n \n # just to test we are using HTTP_HOST in test mode as HTTP_ORIGIN cant be set\n Rails.env == \"test\" ? origin = request.env['HTTP_HOST'] : origin = request.env['HTTP_ORIGIN']\n\n if !params[\"token\"].blank? and origin.blank? # API Access\n\n account_id = AccountsCache.access_token(params[\"token\"])\n\n raise et(\"application.unauthorized\") if account_id.blank?\n \n # set account_id in params\n if params[:controller] == \"accounts\" and current_account\n params[:id] = current_account._id.to_s if params[:id].blank?\n else\n params[:account_id] = current_account._id.to_s if params[:account_id].blank?\n end\n\n # set the request type\n params[:request_type] = AppConstants.request_type_api\n\n # mark already authenticated\n set_authenticated\n\n # make api request synchronous as of now\n make_sync_request\n end\n rescue => e \n Rails.logger.error(\"**** ERROR **** #{er(e)}\")\n head :unauthorized\n end", "def http; end", "def set_api\r\n api = EVEAPI::API.new\r\n api.api_id = api_key.api_id\r\n api.v_code = api_key.v_code\r\n api.character_id = id\r\n api\r\n end", "def api_methods\n self.class.instance_methods(false)\n end", "def api_methods\n self.class.instance_methods(false)\n end", "def rest_endpoint; end", "def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.underscore.downcase,\n :name => name,\n :description => description,\n :partner => partner.present? ? partner.api_attributes : \"\",\n :day => day.present? ? day.api_attributes : \"\",\n :venue => venue.present? ? venue.api_attributes : \"\",\n :event_type => event_brand.present? ? event_brand.api_attributes : \"\",\n :banner => banner.url,\n :lab_host => lab_host.url,\n :start_time => start_time,\n :end_time => end_time,\n }\n end", "def api_params\n params[:api]\n end", "def inspect\n return 'Ballchasing API'\n end", "def api_key; end", "def api_key; end", "def call_authorization_issue_api(ticket, subject, authTime)\n return call_api(\"/api/auth/authorization/issue\", {\n \"ticket\" => ticket,\n \"subject\" => subject,\n \"authTime\" => authTime\n })\nend", "def to_jsonapi\n attributes = {\n \"symbol\" => symbol,\n \"salesforce_id\" => salesforce_id,\n \"consortium_salesforce_id\" => consortium_salesforce_id,\n \"parent_organization\" => consortium_id.present? ? consortium_id.upcase : nil,\n \"name\" => name,\n \"website\" => website,\n \"system_email\" => system_email,\n \"group_email\" => group_email,\n \"description\" => description,\n \"region\" => region,\n \"logo_url\" => logo_url,\n \"non_profit_status\" => non_profit_status,\n \"focus_area\" => focus_area,\n \"organization_type\" => organization_type,\n \"member_type\" => member_type_label,\n \"is_active\" => is_active == \"\\x01\",\n \"billing_street\" => billing_address,\n \"billing_organization\" => billing_organization,\n \"billing_department\" => billing_department,\n \"billing_postal_code\" => billing_post_code,\n \"billing_state_code\" => billing_state.present? ? billing_state.split(\"-\").last : nil,\n \"billing_country_code\" => billing_country,\n \"billing_country\" => billing_country_name,\n \"billing_city\" => billing_city,\n \"joined\" => joined&.iso8601,\n \"twitter_handle\" => twitter_handle,\n \"ror_id\" => ror_id,\n \"created\" => created.iso8601,\n \"updated\" => updated.iso8601,\n \"deleted_at\" => deleted_at ? deleted_at.iso8601 : nil,\n \"doi_estimate\" => doi_estimate,\n }\n\n {\n \"id\" => symbol.downcase, \"type\" => \"providers\", \"attributes\" => attributes\n }\n end", "def restful_api\n @restful_api ||= AlephApi::RestfulApiClient.new(url: @restful_api_url)\n end", "def api_config()\n AdwordsApi::ApiConfig\n end", "def api\n methods - Object.public_methods\n end", "def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.downcase,\n :name => name,\n :description => description,\n :sponsorship_level => sponsorship_level.api_attributes,\n :logo => logo,\n }\n end", "def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.downcase,\n :name => name,\n :description => description,\n :sponsorship_level => sponsorship_level.api_attributes,\n :logo => logo,\n }\n end", "def info\n standardize\n # Alphebatize the API hash\n @api_sort = @api_hash.sort\n # Convert to array because SQLite\n @api_arr = @api_sort.flat_map do |_, v|\n v.is_a?(Hash) ? v.map { |_, w| escape(w) } : escape(v)\n end\n end", "def api\n TaskMapper::Provider::Fogbugz.api\n end", "def api\n TaskMapper::Provider::Fogbugz.api\n end", "def set_api\n @api = Api.find(params[:id])\n end", "def get\n Ata.get self\n end", "def operations\n send(params[:ac])\n end", "def raw_api(method,params=nil)\n debug(6,:var=>method,:msg=>\"method\")\n debug(6,:var=>params,:msg=>\"Parameters\")\n\n checkauth\n checkversion(1,1)\n params={} if params==nil\n obj=do_request(json_obj(method,params))\n return obj['result']\n end", "def api_response\n @response\n end", "def api_params\n params[:api]\n end", "def get; end", "def api_keys\n rest_query(:api_key)\n end", "def run\n super\n\n # start with negative\n api_endpoint = nil\n api_reason = nil\n\n require_enrichment\n\n # get our url\n url = _get_entity_name\n\n ###\n # First just check our fingerprint, lots of stuff will already have been\n # fingerprinted during our ident run\n ###\n (_get_entity_detail(\"fingerprint\") || []).each do |fp|\n api_endpoint = true if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n api_reason = \"fingerprint\"\n end\n\n # first get a standard response\n standard_response = http_request :get, url\n return unless standard_response\n\n ####\n # next just check keywords in the url, but of course, sanity check this.\n ###\n if ( url.match(/api\\./) ||\n url.match(/apis\\./) ||\n url.match(/\\/api/) ||\n url.match(/\\/json/) ||\n url.match(/\\.json/) ||\n url.match(/\\.xml/) ||\n url.match(/skiptoken/) ||\n url.match(/\\/restapis/) )\n\n unless (\n url.match(/googleapis/) ||\n url.match(/\\.amazonaws\\.com/) ||\n standard_response.body_utf8.match(/^<HTML>/i) ||\n standard_response.body_utf8.match(/HTTP Status 404/i) ||\n standard_response.body_utf8.match(/NoSuchBucket/i) ) \n api_endpoint = true\n api_reason = \"url\"\n end\n\n end\n\n ###\n ### If we made it this far, and our base url matches, just return that\n if api_endpoint\n _create_api_endpoint(url, url, api_reason)\n return # return if our base URL was an endpoint\n end\n\n ####\n # otherwise check patterns in / around the original\n ####\n\n # always start empty\n api_endpoint = nil\n\n [\n \"#{url}\",\n \"#{url}/api\",\n \"#{url}/api/v1\",\n \"#{url}/api/v2\",\n \"#{url}/api/v3\",\n \"#{url}/docs\",\n \"#{url}/graphql\",\n \"#{url}/api-docs\",\n \"#{url}/api-docs/swagger.json\",\n \"#{url}/api/swagger\",\n \"#{url}/api/swagger-ui.html\",\n \"#{url}/api/swagger.yml\",\n \"#{url}/api/v2/swagger.json\",\n \"#{url}/apidocs\",\n \"#{url}/apidocs/swagger.json\",\n \"#{url}/rest\",\n \"#{url}/swagger\",\n \"#{url}/swagger/\",\n \"#{url}/swagger-resources\",\n \"#{url}/swagger-ui\",\n \"#{url}/swagger-ui.html\",\n \"#{url}/swagger.json\",\n \"#{url}/swagger/index.html\",\n \"#{url}/swagger/swagger-ui.html\",\n \"#{url}/swagger/ui/index\",\n \"#{url}/swagger/v1/swagger.json\",\n \"#{url}/v1/swagger.json\"\n ].each do |u|\n\n _log \"Checking... #{u}\"\n\n # Go ahead and get the response for this paritcular endpoint\n\n response = http_request :get, u\n\n next unless response\n # skip if we're not the original url, but we're getting the same response\n\n next if u != url && response.body_utf8 == standard_response.body_utf8\n\n ###\n ### Check for known strings\n ###\n if (response.body_utf8.match(/swagger-section/) ||\n response.body_utf8.match(/swaggerhub.com/) ||\n response.body_utf8.match(/soapenv:Envelope/) )\n # break and create it\n api_reason = \"response_body\"\n api_endpoint = u\n break\n end\n\n # check for content type of application.. note that this will flag\n # application/javascript, which is probably not wanted\n headers = standard_response.headers\n if headers\n ct = headers.find{|x, y| x if x =~ /^content-type/i }\n if ct\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/xml/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/ld+json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/x-protobuf/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/octet-stream/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^text\\/csv/i)\n\n # break and create it\n if api_endpoint\n api_reason = \"content_type\"\n break\n end\n\n end\n end\n\n ###\n # try to parse it (JSON)\n ###\n begin\n # get request body\n body = standard_response.body_utf8\n if body\n json = JSON.parse(body)\n\n if json\n # now check for common error scenarios, and proceed if we pass\n break if json.kind_of?(Hash) && \n ((standard_response.code == \"404\" && json[\"error\"] == \"Not Found\") ||\n (standard_response.code == \"404\" && json[\"response\"] == \"Content was not found.\"))\n \n # create it as an api endpoint\n api_endpoint = u\n api_reason = \"json_body\"\n break\n end\n\n end\n rescue JSON::ParserError\n _log \"No body!\"\n end\n\n # check known fingeprints\n _log \"Attempting to fingerprint (without the browser)!\"\n ident_matches = generate_http_requests_and_check(u,{:enable_browser => false, :'only-check-base-url' => true}) || {}\n ident_fingerprints = ident_matches[\"fingerprint\"] || []\n ident_fingerprints.each do |fp|\n api_endpoint = u if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n # break if it's been set so we dont genereate a bunch of FP's\n if api_endpoint\n api_reason = \"fingerprint\"\n break\n end\n end\n end\n\n ###\n ### Okay now that we're at the end, do we have an endpoint?!?\n ###\n\n # set the details and create a new entity if we made it this far!\n if api_endpoint\n _create_api_endpoint(url, api_endpoint, api_reason)\n else\n _set_entity_detail \"api_endpoint\", false\n end\n\n end", "def api_calls\n @dotcoms = Dotcom.active\n @apis = @dotcom&.apis || [] # ActiveRecord::Associations::CollectionProxy of Apis\n if not @api.nil? and @api.mode == 'demo_api'\n api = Api.find_by dotcom: @dotcom, mode: 'public_api'\n @calls = api.calls.active.rest_get\n else\n @calls = @api&.calls || [] # ActiveRecord::Associations::CollectionProxy of ApiMethods\n end\n\n unless @call.nil?\n if (@call.rest_get?)\n @request = GetRequest.new(dotcom: @dotcom, api: @api, call: @call, extension: demo_extension, options: demo_options)\n @response = @request.send\n else\n @request = PostRequest.new(dotcom: @dotcom, api: @api, call: @call, extension: demo_extension, options: demo_options)\n @body = demo_body\n @response = @request.send(body: @body)\n end\n @error_msg = request_error_check @response\n end\n end", "def api_table\n controller_name\n end", "def initialize\n @api_user = \"\"\n @api_key = \"\"\n end", "def set_api\n @api = Api.find(params[:id])\n end", "def set_api\n @api = Api.find(params[:id])\n end", "def call_authorization_api(params)\n return call_api(\"/api/auth/authorization\", {\n \"parameters\" => URI.encode_www_form(params)\n })\nend", "def api_rb(call)\n <<-EOS\n#{call[:id]} = http_#{call[:method]}(\n \"#{call[:endpoint]}\",\n #{field_param(call[:params])}\n)\nEOS\n end", "def api=(value)\n @api = value\n end", "def getinfo\n @api.request 'getinfo'\n end", "def api_args\n return @api_args unless @api_args.blank?\n \n @api_args = settings.select_keys(\"client_id\", \"client_secret\")\n\n @api_args[\"response_type\"] = \"code\"\n\n uri = URI(my_addr)\n uri.path = \"/#{app.name}/authCallback\" \n @api_args[\"redirect_uri\"] = uri.to_s\n\n \n @api_args[\"token\"] = access_token if signed_in?\n\n @api_args[\"id\"] = user_entity[\"id\"].to_s if signed_in?\n\n return @api_args\n end", "def define_endpoint\n endpoint_klass.instance_exec(\n opts.merge(this_resource: this_resource)\n ) do |opts|\n get '/:id', { authorize: opts[:authorize] }.compact do\n status 200\n return opts[:block].call if opts.key?(:block)\n\n data = \"Kagu::Models::#{opts[:this_resource].camelize}\"\n .constantize\n .accessible_by(current_ability)\n .find(declared_params[:id])\n\n present(\n data, with: \"API::Entities::#{opts[:this_resource]}\".constantize\n )\n end\n end\n end", "def authorization; end" ]
[ "0.7366039", "0.7366039", "0.7157097", "0.69463927", "0.69463927", "0.69463927", "0.6802661", "0.6786365", "0.6748311", "0.6748311", "0.6721838", "0.6721838", "0.66876954", "0.66224986", "0.65395206", "0.6448451", "0.6443889", "0.6384711", "0.6375172", "0.62735736", "0.62735736", "0.6264475", "0.61898786", "0.6163853", "0.61006314", "0.60981256", "0.6093002", "0.60510415", "0.6027552", "0.59748155", "0.5930317", "0.5909803", "0.58996147", "0.5824432", "0.5807585", "0.5797366", "0.57971334", "0.579128", "0.57835054", "0.57822704", "0.576587", "0.5761321", "0.5761068", "0.57562107", "0.5746144", "0.574341", "0.57156134", "0.5712448", "0.5712448", "0.5712448", "0.56943446", "0.5693215", "0.56895876", "0.5672349", "0.56628364", "0.56616074", "0.56482893", "0.56453913", "0.5643972", "0.5636063", "0.5633018", "0.56323993", "0.5628217", "0.5628217", "0.5622538", "0.5619245", "0.5603769", "0.55985695", "0.55951804", "0.55951804", "0.55844456", "0.5578203", "0.5568195", "0.55453146", "0.554359", "0.5542084", "0.5542084", "0.55412656", "0.55385834", "0.55385834", "0.5533093", "0.55329937", "0.5532991", "0.5530404", "0.5520883", "0.5518343", "0.5517339", "0.5504227", "0.5498293", "0.54904693", "0.5483898", "0.54796994", "0.5468491", "0.5468491", "0.54670984", "0.54610896", "0.5453129", "0.54498094", "0.5447932", "0.5446828", "0.54430306" ]
0.0
-1
Write a function that given an array, now CHANGES each of the numbers to be twice as big. This should mutate the original array!
def array_times_two!(arr) #note the ! to indicate what it does arr.each_with_index { |num, idx| arr[idx] = num*2 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_numbers(array)\n new_array = []\n\n array.each do |number|\n new_array << number *= 2\n end\n return new_array\nend", "def double_numbers(array)\n\tarray.map { |integer| integer * 2 }\t\nend", "def double_even_numbers(array)\n doubled_array = array.clone\n\n (array.length - 1).step(0, -2) do |i|\n doubled_array[i] += doubled_array[i]\n end\n\n doubled_array\n end", "def square_array(array)\n array.each_with_index do | num, index |\n array[index] = num * num\n end\nend", "def array_times_two!(arr)\n\n i = 0\n while i < arr.length\n arr[i] = arr[i] * 2\n i += 1\n end\n\n arr\n\nend", "def stretch(array)\n new_arr = []\n # can assign array to an variable and do only /2 once\n for i in 0...array.length\n # if element is a even number\n if array[i] % 2 == 0\n # add 1/2 value of the element for twice into the new array\n new_arr << array[i]/2\n # if element is an odd number\n else\n new_arr << array[i]/2 + 1\n end\n new_arr << array[i]/2\n end\n return new_arr\nend", "def array_times_two(array)\n new_array = array.map{ |el| el * 2}\n end", "def double_numbers!(numbers)\n counter = 0\n\n loop do\n break if counter == numbers.size\n\n current_number = numbers[counter]\n numbers[counter] = current_number * 2\n\n counter += 1\n end\n\n numbers\nend", "def doubler(arr)\n i = 0\n while i < arr.length\n arr[i] = arr[i] * 2\n i += 1\n end\n return arr\nend", "def double_numbers!(numbers)\n\n counter = 0\n loop do\n break if counter >= numbers.length\n numbers[counter] *= 2\n counter += 1\n end\n numbers # not really necessary, but good to have\n end", "def double_numbers(input_array)\n doubled_array =[]\n input_array.each {|num| doubled_array << num*2} \n doubled_array\nend", "def change_resistant_for_each_element(array)\n copy =Array.new(array)\n i=0\n while i<copy.length\n copy[i]=array[i]\n i +=1\n end\n copy\nend", "def doubler(array)\n array.map do |num|\n num *= 2\n end\n\nend", "def mutateTheArray(n, a)\n prv = 0\n (0...a.size).each do |i|\n nxt = i < (a.size - 1) ? a[i+1] : 0\n tmp = a[i]\n a[i] += nxt + prv\n prv = tmp\n end\n a\nend", "def square_array(array)\n array.map! { |ele| ele ** 2 }\nend", "def square_the_values(array_of_integers)\n # TODO\nend", "def multiply_2(array)\n # [1,2,3,4] -> [4,3,2,1] -> [4,6,2,2] -> [2,2,6,4]\n array.reverse.map.with_index { |n, i| i.even? ? n : n * 2 }.reverse\n end", "def double_numbers!(numbers)\n counter = 0\n\n loop do\n break if counter == numbers.size\n\n numbers[counter] *= 2\n\n counter += 1\n end\n numbers\nend", "def double_numbers(array)\n doubled_numbers = []\n array.each do |number|\n doubled_numbers << number * 2\n end\n return doubled_numbers\nend", "def modify_array(arr=[1, 2, 3, 2, 3, 2, 3, 1])\n range = (1...(arr.length - 1))\n arr.each_with_index do |el, i|\n if range.include?(i) && el.even?\n arr[i] += arr[0]\n end\n end\n print arr\nend", "def map_to_square(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array_value = source_array[i] ** 2\n new_array << new_array_value\n \n i += 1\n end\n \n new_array\nend", "def square_array(square_array)\ncounter = 0\nnew_numbers = [] \n while counter < square_array.count do\n new_numbers << (square_array[counter] ** 2)\n counter += 1\n end\n new_numbers\nend", "def calculate_doubles!(arr)\n arr.map! {|int| int * 2}\nend", "def array_times_two!(array)\n array.map!{ |el| el *2}\n end", "def doubler(numbers)\n\tfor i in 0..numbers.length-1\n numbers[i] = numbers[i] * 2\n end\n return numbers\nend", "def doubler(numbers)\n i = 0\n while i < numbers.length\n numbers[i] = numbers[i] * 2\n i += 1\n end\n return numbers\nend", "def double_array(input_array)\n \n double_array = []\n \n input_array.each do |number|\n double_array << number *= 2\n end\n return double_array\n\nend", "def even_num_array(numbers)\n puts \"The original array is #{numbers}\"\n\tnumbers = numbers.select {|n| n.even? } \n\tputs \"The modified array is #{numbers}\"\nend", "def calculate_doubles!(arr)\n arr.map!{|a|a=a*2}\nend", "def square_array(array)\n squared = []\n count = 0\n while count < array.size do\n squared << (array[count] ** 2)\n count = count + 1\n end\n squared\nend", "def square_array(array)\n squared = []\n count = 0\n while count < array.size do\n squared << (array[count] ** 2)\n count = count + 1\n end\n squared\nend", "def square_array(array)\n new_array = []\n array.each { |e| new_array << e ** 2 }\n new_array\nend", "def array_translate(array)\n new_arr = []\n \n array.each_with_index do |subArray, idx|\n if idx % 2 == 1\n subArray = ele\n else\n subArray = num\n \n #num.times { new_arr << ele }\n end\n end\n\n #return new_arr\nend", "def square_array(array)\n new_array = []\n array.each { |n| new_array << n*n }\n new_array\nend", "def square_array(array)\n new_numbers = []\n numbers = 0\n while array[numbers] do\n new_numbers << array[numbers] ** 2\n numbers += 1\n end\nreturn new_numbers\nend", "def map_to_square(array)\n new_array = array.map{|n| n**2}\n return new_array\nend", "def multiply_by_two(array)\n array.map { |n| n * 2 }\nend", "def rearrange_array(array)\n # size of an array\n n = array.size\n # iterate \n (0...n).each do |iter|\n array[iter] = array[iter]+(array[array[iter]]%n)*n\n end\n p array, n\n (0...n).each do |iter|\n p array[iter]\n array[iter] = (array[iter]/n)\n end\n array\nend", "def my_array_modification_method(array, number)\n\tarray = array.map! do |x|\n\t\tif x.is_a?(Integer)\n\t\t\tx + number\n\t\telse\n\t \tx\n\t end\nend\nend", "def calculate_doubles!(array)\n\t\n\tarray.map! { |num| num * 2}\nend", "def squared_primes(array)\n\n a=[]\n array.each do |x| \n for i in (2..x-1)\n a << x if x % i == 0 \n end\n end\n array -= a\n array.map{ |p| p*p } \n\nend", "def stretch(array)\n\n stretched_array = []\n\n for element in array\n if element % 2 == 0\n stretched_array << element/2\n stretched_array << element/2\n else\n stretched_array << element/2 + 1\n stretched_array << element/2\n end\n end\n\n return stretched_array\n\nend", "def double_array(array)\n array*2\nend", "def square_array(array)\n\tsquared_nums = []\n\n array.each do |number|\n squared_nums << (number * number)\n end\n squared_nums\nend", "def multiply_by_two(array)\n # double_numbers = []\n # array.each do |number|\n # double_numbers << number * 2\n # end\n # double_numbers\n array.map { |number| number * 2 }\nend", "def square_array(array)\nnew_array = []\ncounter = 0\nwhile counter < array.length do\n new_array << array[counter] ** 2 #**squaring incrments\ncounter += 1 #increments plus 1 after squaring elements\nend\nreturn new_array #can also just write new_array without the retun before it \nend", "def doubler(array)\r\n res = []\r\n array.each do |ele|\r\n res << ele * 2\r\n end\r\n res\r\nend", "def double_all array\n array.map { |i| i*2 }\nend", "def square_array(array)\n squared = []\n array.each { |element| squared << element ** 2 }\n squared\nend", "def double_num(array)\n array.map do |num|\n if num % 2 == 0 then num*2\n else\n num\n end\n end\nend", "def square_array(array)\nnew_array = []\n array.length.times do |squared|\n new_array.push(array[squared]**2)\nend\n new_array\nend", "def magic_array(array)\narray.flatten.reverse.map! {|i| i = i*2}.delete_if {|i| i.modulo(3) == 0}.uniq.sort\nend", "def square_array(array)\n numbers = []\n array.each do |number| numbers << number ** 2\n end\n numbers\nend", "def index_multiplier_method(reverse_integer_array)\n multiplied_integer_array = []\n reverse_integer_array.each_with_index do |value, index|\n if index.odd? == true\n value = value * 2\n multiplied_integer_array << value\n else\n value = value\n multiplied_integer_array << value\n end\n end\nreturn multiplied_integer_array\nend", "def double_array(array)\n\tn = [1, 2, 3]\n\tn * 2\nend", "def square_array(array)\r\n solution = []\r\n array.each do |number|\r\n solution << number**2\r\n end\r\n solution \r\nend", "def eveness(array)\n new_array = []\n index = 1\n while index < array.size\n new_array << array[index]\n index += 2\n end\n new_array\nend", "def square_array_2(array)\n array.collect { |i| i**2 }\n array\nend", "def array_times_two!(array)\nend", "def round_two(int_array)\n length = int_array.length\n product_place_holder = Array.new(length, 1)\n\n product = 1\n length.times do |i|\n product_place_holder[i] *= product\n product *= int_array[i]\n end\n\n product = 1\n length.times do |i|\n product_place_holder[-(i+1)] *= product\n product *= int_array[-(i+1)]\n end\n\n return product_place_holder\nend", "def stretch(arr)\n # new empty array\n new_arr = []\n # go through each element\n arr.each do |number|\n # if even, divide by two\n if number % 2 == 0\n new_arr << (number / 2)\n new_arr << (number / 2) # this isn't DRY, I think\n # if odd, subtract one, divide by two. Add one to the first half\n else\n new_arr << (((number - 1) / 2) + 1)\n new_arr << ((number - 1) / 2) # DRY-ness issue here, maybe\n # store both halves\n end\n end\n # return new array\n return new_arr\nend", "def square_array(array)\n squared_array = []\n \n array.each do |number| \n squared_array << number**2 \n end\n \n squared_array\nend", "def doubler(numbers)\n new_arr = []\n i = 0\n while i < numbers.length\n old_numbers = numbers[i]\n new_numbers = old_numbers * 2\n new_arr << new_numbers\n i += 1\n end\n return new_arr\nend", "def remove_evens!(arr)\n cloned_arr = arr.dup\n arr.each do |num|\n if num % 2 == 0\n cloned_arr.delete(num)\n end\n end\n cloned_arr\nend", "def square_every_digit(digits)\n array = digits.split\n array.map! do |digit| digit ** 2 \n end\n end", "def my_array_modification_method!(array, increase)\r\n array.map! do |x| \r\n if x.is_a? Integer\r\n x += increase\r\n else \r\n x\r\n end\r\n end\r\nend", "def increase_array_values(array, number)\n array.map {|num| num + number}\nend", "def map_to_double(array)\n new_array = array.map{|n| n*2}\n return new_array\nend", "def my_array_modification_method!(array, num)\n array.map! { |x| x.is_a?(Integer)? (x + num) : x } #attempted .each, but the values were not updating, seems to work with map.\nend", "def square_array(array)\n square = []\n \n array.each do |num|\n square << num * num\n end\n square\nend", "def my_array_modification_method!(array, number)\n array.map! {|x|\n x.is_a?(Integer) ? (x + number): x}\nend", "def remove_evens!(arr)\n cloned_arr = arr.dup\n cloned_arr.each do |num|\n if num % 2 == 0\n arr.delete(num)\n end\n end\n arr\nend", "def map_to_double(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array_value = source_array[i] * 2\n new_array << new_array_value\n \n i += 1\n end\n \n new_array\nend", "def productify(arr)\n\n up_product = 1\n up_array = []\n arr.length.times do |idx|\n up_product *= arr[idx]\n up_array << up_product\n end\n\n down_product = 1\n down_array = Array.new(arr.length)\n (arr.length - 1).downto(0) do |idx|\n down_product *= arr[idx]\n down_array[idx] = down_product\n end\n\n result = []\n arr.length.times do |idx|\n product = 1\n up_idx = idx - 1\n down_idx = idx + 1\n if up_idx >= 0\n product *= up_array[up_idx]\n end\n if down_idx < arr.length\n product *= down_array[down_idx]\n end\n result[idx] = product\n end\n\n result\n\nend", "def array_times_two(array)\nend", "def square_array(array)\n counter = 0\n new_array = []\n while counter < array.length do\n new_array << array[counter] ** 2\n counter += 1\n end\n p new_array\nend", "def square_array(array) #build square_array method\r\n\r\n new_array = [] #new array of squared numbers\r\n\r\n array.each do |integer|#implement own logic\r\n new_array << integer ** 2 #shovel /push logic into array \r\n end\r\n return new_array #returns array of these squared numbers\r\nend", "def doubler(array)\n array.map { |num| num * 2 }\nend", "def doubler(array)\n array.map { |num| num * 2 }\nend", "def double_eles(arr)\n arr.map do |ele|\n ele * 2\n end\nend", "def square_array(numbers)\n new_numbers = []\n numbers.each do |num|\n new_numbers << (num ** 2)\n end\n return new_numbers\nend", "def square_array(array)\n counter = 0\n \n while array[counter] do\n puts ((array[counter]) ** 2) => new_array \n counter += 1\n end\nend", "def square_array(array)\n squared = []\n array.each do |num|\n num**2\n squared << num**2\n end\n squared\nend", "def square_array(array)\n new_array =[]\n\n counter = 0\n\nend", "def element_times_index(numbers)\n i = 0\n count = 0\n while i < numbers.length\n numbers[i] = numbers[i] * count\n count += 1\n i += 1\n end\n return numbers\nend", "def dupe(array)\n n = array.length - 1\n sum = ((n * n) + n) / 2\n return array.reduce(&:+) - sum\n # array.each_with_object({}) { |i,o| o[i.to_s] ? o[i.to_s] += 1 : o[i.to_s] = 1 }.keep_if { |k,v| v > 1 }.to_a[0][0].to_i\nend", "def productify(array)\n prods = [1] * array.length\n current = array[0]\n (1...array.length).each do |i|\n prods[i] *= current\n current *= array[i]\n end\n current = array[-1]\n (array.length - 2).downto(0).each do |i|\n prods[i] *= current\n current *= array[i]\n end\n\n prods\nend", "def square_array(array)\n\n squared = []\n array.each do |num|\n squared.push(num * num)\n end\n\n squared\n \nend", "def oddities(array)\n new_array = []\n i = 0\n while i < array.size\n new_array << array[i]\n i += 2\n end\n new_array\nend", "def square_array2(array)\n return array.collect { |num| num ** 2 }\nend", "def calculate_doubles!(arr)\n\n arr.map! {|x| x + x}\n arr\n\nend", "def resize!\n @arr.size *=2\n end", "def my_array_modification_method(ary, number)\n\tif !number.is_a?(Fixnum)\n\t\traise ArgumentError.new('The Second Argument Should be a Fixnum')\t\t\n\tend\n\n\treturn ary.collect! {|element| element.is_a?(Fixnum) ? (element + number) : element}\n\nend", "def square_array(array)\n squared = []\n counter = 0\n while array[counter] do\n squared.push( array[counter] ** 2)\n counter +=1\n end\n squared\nend", "def find_square_of_number(array)\n\tarray.map{|x| x ** 2 }\nend", "def productify_easy(arr)\n product = arr.inject(:*)\n new_arr = []\n arr.each do |num|\n new_arr << product / num\n end\n new_arr\nend", "def calculate_doubles(array)\n\tmapped_array = array.map { |num| num * 2 }\nend", "def my_array_modification_method!(array, num)\n array[2] = array[2] + num\n array[-1] = array[-1] + num\n array\nend", "def square_array(array)\narray.map { |to_square| to_square**2}\nend", "def square_array_collect(array)\n array.collect{|num| num ** 2}\nend" ]
[ "0.7143005", "0.6805797", "0.6798778", "0.6788144", "0.6746983", "0.6699699", "0.6634698", "0.6632288", "0.6610793", "0.658726", "0.6578772", "0.6568035", "0.6559131", "0.6540778", "0.65353334", "0.6531856", "0.6516556", "0.65008646", "0.6496055", "0.6492201", "0.64829344", "0.6481932", "0.645251", "0.6450212", "0.6433064", "0.6424801", "0.64239395", "0.6421316", "0.64153606", "0.6407727", "0.6407727", "0.63994133", "0.6391155", "0.63902724", "0.6373581", "0.63546586", "0.6346408", "0.63450086", "0.63227016", "0.63067335", "0.6301388", "0.63006085", "0.6281116", "0.6279346", "0.6271937", "0.62707406", "0.6267585", "0.6262498", "0.6249017", "0.6246", "0.62391126", "0.62383896", "0.62360615", "0.62297803", "0.62223566", "0.6220786", "0.6214953", "0.62081546", "0.62063247", "0.6205206", "0.6200483", "0.6191259", "0.61732304", "0.61731684", "0.61724496", "0.61574394", "0.6153752", "0.61194927", "0.6114708", "0.6109926", "0.6108789", "0.6095056", "0.60937613", "0.60919666", "0.60636204", "0.60631585", "0.60607994", "0.6060486", "0.6060486", "0.605907", "0.6052921", "0.6044674", "0.6036693", "0.60323644", "0.6019405", "0.60160464", "0.60151595", "0.6008777", "0.6007713", "0.60044587", "0.59992355", "0.59967667", "0.5995561", "0.596069", "0.59499127", "0.5949185", "0.5944946", "0.59446955", "0.59308445", "0.5922618" ]
0.68613404
1
Write a function that given an array, returns another array of only the unique elements. I.e., return a version without duplicates.
def uniq(arr) new_array = [] arr = arr.sort arr.each_with_index do |num, idx| new_array << num if num != arr[idx + 1] end new_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_uniq(array)\n result = []\n array.each { |ele| result << ele unless result.include?(ele) }\n result\nend", "def using_uniq(array)\n array.uniq\n end", "def uniq(array)\n finalArray = []\n array.each do |element|\n if !finalArray.include?(element)\n finalArray.push(element)\n end\n end\n return finalArray\nend", "def using_uniq (array)\n return array.uniq!\nend", "def array_uniq!(a)\n a.uniq!\n end", "def uniq(array)\n unique_values = []\n array.each do |el|\n unless unique_values.include?(el)\n unique_values << el\n end\n end\n unique_values\n end", "def using_uniq(array)\n array.uniq()\nend", "def using_uniq(array)\n \n array.uniq\n \nend", "def ruby_unique(original_array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n\n \nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def custom_uniq(array)\n final = []\n array.each do |element|\n final << element if !final.include?(element)\n end \n final\nend", "def my_uniq(arr)\n uniques = []\n arr.each do |el|\n uniques << el unless uniques.include?(el)\n end\n uniques\nend", "def array_uniq!(a)\n a.uniq!\n end", "def remove_duplicates(array)\n uniq_array = []\n array.each {|value| uniq_array << value unless uniq_array.include?(value) }\n return uniq_array\nend", "def uniq(array)\nend", "def no_mutter(arr)\n arr.uniq\nend", "def my_unique(arr)\n res = []\n arr.each do |item|\n res << item unless res.include?(item)\n end\n \n res\nend", "def using_uniq(arr)\n arr.uniq\nend", "def using_uniq(arr)\n arr.uniq\nend", "def remove_dups(arr)\n\treturn arr.uniq()\nend", "def just_once(original_array)\n unique = []\n i = 0\n while i < original_array.length\n unique.push(original_array[i]) unless unique.include?(original_array[i])\n i += 1\n end\n return unique\n end", "def array_unique(array = [])\n raise 'incorrect array' unless array.is_a? Array\n\n uniq_values = []\n array.each do |el|\n unique_counter = 0\n array.each do |e|\n next if el != e\n\n unique_counter += 1\n end\n uniq_values << el if unique_counter == 1\n end\n uniq_values\nend", "def uniques(array)\n test_array=[]\n array.each do |i|\n if test_array.include?(i)==false\n test_array.push(i)\n else \n end\n end\n return test_array\nend", "def uniq(array)\n counts = Hash.new(0)\n result = []\n array.each do |element|\n counts[element] += 1\n result << element unless counts[element] > 1\n end\n result\nend", "def duplicate(array)\n array.uniq!\nend", "def no_mutate(arr)\n arr.uniq\nend", "def no_mutate(arr)\n arr.uniq\nend", "def no_mutate(arr)\n arr.uniq\nend", "def remove_duplicates(array)\nend", "def no_mutate(arr)\n arr.uniq!\nend", "def no_mutate(arr)\n arr.uniq!\nend", "def find_unique_elements(arr)\n arr.reject { |e| arr.count(e) > 1 }\nend", "def unique(array)\n unique_array = []\n\n array.each do |original_element|\n found = false\n\n unique_array.each do |unique_element|\n if original_element == unique_element\n found = true\n break\n end\n end\n\n if !found\n unique_array << original_element\n end\n end\n\n unique_array\nend", "def my_uniq(arr)\nend", "def my_method(arr)\n arr.uniq!\nend", "def unique(integers)\narray = []\nintegers.map {|item| array << item unless array.include?(item)}\narray\nend", "def some_method(array)\n array.uniq\nend", "def unique_items(ary)\r\n ary.select {|x| ary.count(x) == 1}\r\nend", "def unique(integers)\n integers.to_set.to_a\nend", "def my_method(arr)\n arr.uniq\nend", "def my_method(arr)\n arr.uniq\nend", "def uniqify(array)\n encountered = Hash.new { |hash, key| hash[key] = false }\n uniqified_array = []\n array.each do |element|\n uniqified_array.push(element) unless encountered[element]\n encountered[element] = true\n end\n uniqified_array\nend", "def my_uniq\n unique = []\n each_index { |i| unique << self[i] unless unique.include?(self[i]) }\n unique\n end", "def my_uniq(arr)\n unique_set = arr.reduce({}) do |acc, el|\n acc[el] = true\n acc\n end\n unique_set.keys\nend", "def remove_duplicates(array)\n array.uniq!.length\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend", "def find_unique_elements(arr)\n# Count how many times each element appears in the array, if an element appears\n# more than once, delete that element and any elements that are equal to it.\n \n arr.each do |i|\n\tif arr.count(i) > 1\n\t\tarr.delete(i)\n\tend\n end\n return arr\nend", "def set(arr)\n\treturn arr.uniq\nend", "def test_removes_duplicates\n stream = FromArray.new([2, 2, 3, 4, 1, 1, 2, 5, 4, 3, 6])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end", "def my_uniq(arr)\n \n output = []\n hash = Hash.new(false)\n \n arr.each do |x|\n output << x if !hash[x]\n hash[x] = true\n end\n output\n end", "def find_uniq(arr)\n\tarr.uniq\nend", "def mutate(arr)\n arr.uniq!\nend", "def find_unique_elements(arr)\n \nend", "def showuniquevalueswfunction(array)\n # result array \n result = Array.new \n # check if input array is empty\n if array.length > 0 then\n # make the result array iqual to the input array uniq function which returns a new array by removing duplicate values in self. \n result = array.uniq\n else\n print \"Input array is empty. It can not be empty\"\n end\n return result\nend", "def unique(arr)\n uniq = Hash.new(0)\n arr.each { |x| uniq[x] += 1 }\n uniq.select { |k, v| v == 1 }.keys\nend", "def compress(array)\n\tarray.uniq\nend", "def unique(integers)\n # set variable arr to empty array where we will push duplicates\n arr = []\n\n # iterate through integers array and push integer to arr if integer not already included in arr\n integers.each { |i| arr << i if !arr.include?(i) }\n # return arr with duplicates removed\n arr\nend", "def distinctValues(array)\n\nend", "def uniques(array)\n hash = Hash[array.map {|x| [x, nil]}]\n print hash.keys\nend", "def unique_elements(array)\n hash = Hash.new(0)\n array.each { |ele| hash[ele] += 1 }\n\n hash.keys\nend", "def unique(arr)\n var = \"\"\n output = [arr[0]]\n i = 1\n while i < arr.length\n j = 0\n var = \"\"\n while j < output.length\n if arr[i] != output[j]\n var = arr[i]\n j += 1\n else\n var = \"\"\n j += output.length\n end\n end\n if var != \"\"\n output << var\n end\n i += 1\n end\n return output\nend", "def test_distinct_no_duplicates\n stream = FromArray.new([1, 2, 3, 4, 5])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end", "def unique(integers)\n\n\t@arrayb4 = integers.to_a\n\t@arrayafter = []\n\n\[email protected] { |x|\n\t\tif @arrayafter.include?(x) == false\n\t\t\t@arrayafter << x\n\t\tend\n\t}\n\n\treturn @arrayafter\n\nend", "def remove_dups(arr)\n new_arr = []\n arr.each do |x|\n unless new_arr.include? x\n new_arr.push x\n end\n end\n new_arr\nend", "def only_unique_elements(arr)\n newHash = Hash.new(0)\n\n arr.each{|x|newHash[x]=1}\n \n newHash.to_a.flatten().select{|x|x.is_a?(String)==true}\nend", "def preserving_uniq(sorted)\n result = []\n elements = sorted.uniq\n sorted.each do |element|\n if elements.include?(element)\n result << element\n elements.delete(element)\n end\n end\n result\n end", "def my_uniq(arr)\n answer = Hash.new\n arr.each_with_index do |el, i|\n answer[el] = 1\n end\n answer.keys\nend", "def unique_elements(arr)\n hash = {}\n arr.each { |ele| hash[ele] = true }\n return hash.keys\nend", "def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend", "def unique_elements(arr)\n unique = {}\n\n arr.each { |ele| unique[ele] = true }\n\n return unique.keys\nend", "def uniq\n distinct\n end", "def unique(integers)\n filteredIntegers = []\n for i in 0..integers.length - 1\n if !filteredIntegers.include? integers[i]\n filteredIntegers.push(integers[i])\n end\n end\n return filteredIntegers\nend", "def find_unique_elements(arr)\n arr_fin=[]\n arr.each do |x|\n arr.count(x)\n if arr.count(x)==1\n arr_fin << x\n end\n end\n return arr_fin\nend", "def my_uniq(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] = 1} #value doesnt matter this case\n hash.keys\nend", "def my_uniq(arr)\n hash = {}\n arr.each {|elem| hash[elem] = true}\n hash.keys\nend", "def my_uniq\n unique = []\n self.each do |ele|\n unique << ele if !unique.include?(ele)\n end\n unique\n end", "def unique(integers)\n integers.reduce([]) do |collection,integer|\n !(collection.include? integer) ? collection.push(integer) : collection\n end\nend", "def unique_items(arr) #O(n)\n hash = Hash.new(0)\n results = []\n arr.each do |el|\n hash[el] += 1\n end\n hash.select { |k, v| k if v == 1 }.keys\nend", "def unique_elements(arr)\n\thash = {}\n arr.each { |ele| hash[ele] = true }\n return hash.keys \t\nend", "def unique_elements(arr)\n hash_elements = {}\n arr.each { |ele| hash_elements[ele] = true }\n return hash_elements.keys\nend", "def unique_in_order(sequence)\n\ta = 0\n\tfinal_arr = []\n\twhile a < sequence.length\n\t\tfinal_arr << sequence[a]\n\t\tduplicate = sequence[a]\n\t\twhile duplicate == sequence[a]\n\t\t\tif sequence[a] == duplicate\n\t\t\t\ta += 1\n\t\t\tend\n\t\tend\n\tend\n\treturn final_arr\nend", "def uniq\n dup.uniq! or dup\n end", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] += 1}\n return hash.keys\n\nend", "def unique(numbers)\r\n output = []\r\n \r\n numbers.each do |num|\r\n if output.include?(num)\r\n\r\n else\r\n output.push(num)\r\n end\r\n end\r\n\r\n return output\r\nend", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each { |ele| hash[ele] += 1}\n hash.keys\nend", "def find_duplicate(arr)\n\tarr.select{|e| arr.count(e) > 1}.uniq\nend", "def uniq(arr)\n result = []\n\n hash_of_uniqs = {}\n arr.each do |el|\n hash_of_uniqs[el] = el\n end\n\n hash_of_uniqs.each do |k, v|\n result << v\n end\n result\nend", "def duplicates(arr)\n values = Set.new\n copies = Set.new\n\n arr.each do |value|\n if values.include?(value)\n copies << value\n else\n values << value\n end\n end\n\n return copies\nend", "def dupitems(arr)\n puts arr.reject { |e| arr.rindex(e) == arr.index(e) }.uniq\nend" ]
[ "0.85015875", "0.8421703", "0.83882827", "0.8382231", "0.8357935", "0.83399683", "0.8296084", "0.8285239", "0.8283458", "0.8264928", "0.8264928", "0.8233076", "0.8223728", "0.8223728", "0.8223728", "0.8223728", "0.8223728", "0.8223728", "0.82081527", "0.8174246", "0.817381", "0.8134624", "0.81170845", "0.80843353", "0.804619", "0.79887575", "0.79887575", "0.7981784", "0.7981618", "0.7956165", "0.7890068", "0.7858487", "0.7852075", "0.7838806", "0.7838806", "0.7838806", "0.7809138", "0.7765784", "0.7765784", "0.77441317", "0.77423835", "0.77174026", "0.77009857", "0.7694141", "0.7607542", "0.75873697", "0.74966514", "0.74875647", "0.74875647", "0.7475574", "0.7469211", "0.74619544", "0.7434902", "0.7428471", "0.7428471", "0.7428471", "0.7408806", "0.73916036", "0.7375763", "0.73707485", "0.73666906", "0.7364985", "0.7354627", "0.7317705", "0.7315643", "0.7311241", "0.7299806", "0.7296386", "0.7269713", "0.72456694", "0.724194", "0.7235545", "0.722814", "0.71744585", "0.7154108", "0.7138608", "0.7137479", "0.71310085", "0.70958936", "0.7095837", "0.7075326", "0.7070237", "0.7068726", "0.7031188", "0.7024778", "0.7021782", "0.6967256", "0.6967145", "0.6961282", "0.6876796", "0.6865826", "0.68569595", "0.68404925", "0.68227553", "0.68097425", "0.6806622", "0.680321", "0.6801961", "0.6786559", "0.6779164" ]
0.76433396
44
A Slippery Number is a number is that has 3 as a factor or has 5 as a factor, but does not have both as factors. For example, 6 is a Slippery Number, but 30 is not. Write a function that given an N, returns an array of the first N Slippery numbers. You'll want to write a helper function that helps you determine which numbers are Slippery.
def slippery_numbers(n) num = 1 result = [] while result.length < n result << num if is_slippery?(num) num += 1 end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slippery_numbers(n)\n slippery_nums = []\n curr_num = 0\n while slippery_nums.length < n\n slippery_nums << curr_num if is_slippery?(curr_num)\n curr_num += 1\n end\n slippery_nums\n end", "def slippery_numbers(n)\n array = []\n counter = 0\n numbers = 0\n while (counter < n)\n if is_slippery?(numbers)\n array.push(numbers)\n counter += 1\n numbers += 1\n else\n numbers += 1\n end\n end\n return array\nend", "def slippery_numbers(n)\r\n array, num = [], 3\r\n while array.length < n\r\n array << num if is_slippery?(num)\r\n num += 1\r\n end\r\n array\r\nend", "def slippery_numbers(n)\r\n array, num = [], 3\r\n while array.length < n\r\n array << num if is_slippery?(num)\r\n num += 1\r\n end\r\n array\r\nend", "def slippery_numbers(n)\nend", "def is_slippery?(n)\r\n\r\n if n % 15 == 0\r\n false\r\n elsif n % 3 == 0 || n % 5 == 0\r\n true\r\n end\r\n\r\nend", "def first_square_numbers(number_of_squares)\n squares = []\n\n idx = 0\n while idx < number_of_squares\n squares.push(idx * idx)\n idx = idx + 1\n end\n\n return squares\nend", "def is_slippery?(n)\r\n\r\n if n % (3 * 5) == 0\r\n false\r\n elsif n % 3 == 0 || n % 5 == 0\r\n true\r\n end\r\n\r\nend", "def cats_in_hats(n = 100)\n # Ensure proper args\n raise ArgumentError, \"Argument provided must be a positive integer.\" unless n.is_a?(Integer) && n > 0\n # Create an empty array to store the results\n result = []\n\n #\n i = 1\n\n # Based on the rules, we know that if a cat is check an odd number of times,\n # it will have a hat on. Also, because of how the cats are checked, we know that\n # only cats that are n squared integers are ultimately checked an odd number of times.\n\n # Instead of checking every cat, we can just set a loop that will create squares\n # of i from i = 1 to i = square root of n.\n while i <= Math.sqrt(n)\n result << i ** 2\n i += 1\n end\n\n result\nend", "def remove_even array\n no_even_array = []\n array.each do |number|\n if number % 3 != 0\n no_even_array.push(number)\n end\n end\n no_even_array\nend", "def pretentious_primes(arr, n)\n pretentious_primes = []\n\n if n > 0\n arr.each do |x|\n primes = []\n i = (x + 1)\n while primes.length <= n\n primes << i if prime?(i)\n i +=1\n end\n pretentious_primes << primes[n-1]\n end\n elsif n < 0\n arr.each do |x|\n primes = []\n i = (x - 1)\n while primes.length <= -n\n if i <= 1\n primes << nil\n else\n primes << i if prime?(i)\n end\n i -=1\n end\n pretentious_primes << primes[(-n)-1]\n end\n else\n pretentious_primes = arr\n end\n pretentious_primes\nend", "def even_numbers(lottery_n)\n even_nums = []\n for num in lottery_n\n even_nums.push(num) if num%2 == 0\n end\n return even_nums\nend", "def first_n_primes(n)\n\n return \"n must be an integer.\" unless n.is_a? Integer\n return \"n must be greater than 0.\" if n <= 0\n \n prime_array ||= []\n \n prime = Prime.new\n n.times {\n prime_array << prime.next \n }\n prime_array\nend", "def pretentious_primes(nums, n)\n pretense = []\n if n > 0\n nums.each do |num|\n primes_after = []\n after_num = num + 1\n while primes_after.length < n\n primes_after << after_num if is_prime?(after_num)\n after_num += 1\n end\n pretense << primes_after.last\n end\n else\n nums.each do |num|\n primes_before = []\n before_num = num - 1\n while primes_before.length < n.abs\n if before_num < 2\n primes_before << nil\n end\n primes_before << before_num if is_prime?(before_num)\n before_num -= 1\n end\n pretense << primes_before.last\n end\n end\n return pretense\nend", "def first_n_primes(n)\n\n \"n must be an integer.\" unless n.is_a? Integer\n\n \"n must be greater than 0.\" if n <= 0\n \n prime_array ||= []\n \n prime = Prime.new\n n.times { prime_array << prime.next }\nend", "def thousand_lights(n)\n lights = Array.new(n, false)\n 1.upto(n) do |num|\n lights.map!.with_index do |value, index|\n if (index + 1) % num == 0\n !value\n else\n value\n end\n end\n end\n lights.map!.with_index { |value, index| value = (index + 1) if value }.compact\nend", "def select_odds(numbers)\n \n i = 0\n \n new_array = []\n \n while i < numbers.length\n \n if numbers[i] % 2 != 0\n \n \tnew_array << numbers[i]\n end\n \n i += 1\n end\n return new_array\n\nend", "def removNb(n)\n results = []\n (2..n).each do |a|\n b = (n*(n+1)/2.0-a)/(a + 1)\n results << [a, b.to_i] if b % 1 == 0 && b < n && b > 2\n end\n results\nend", "def select_odds(numbers)\n i = 0\n newArr = []\n while i < numbers.length\n if numbers[i] % 2 != 0\n newArr << numbers[i]\n end\n i += 1\n end\n return newArr\n end", "def isPP(n)\n\t (2..n).each do |i|\n\t \t(2..n).each do |j|\n\t \t\treturn [i,j] if i**j==n\n\t \t\tbreak if i**j > n\n\t \tend\n\t \treturn nil if i**2 > n\n\t end\nend", "def oddities(array)\n count = 0\n new_array = []\n loop do\n break if array.size == 0\n new_array << array[count]\n count += 2\n break if count >= array.size\n end\n new_array\nend", "def climb_stairs_dp(n)\n return 1 if n==1\n dp = []\n dp[1] = 1\n dp[2] = 2\n for i in (3..n) do\n dp[i] = dp[i-2] + dp[i-1]\n end\n dp[n]\nend", "def select_odds(numbers)\n new_arr = []\n\n i = 0\n while i < numbers.length\n if numbers[i] % 2 == 1\n new_arr << numbers[i]\n else \n end\n\n i += 1\n end\n\n return new_arr\n \nend", "def pretentious_primes(arr, n) \n arr.map { |ele| nth_prime(ele,n) }\nend", "def crazy_nums(max)\n nums = [] # store result\n i = 0\n count = 0\n \n while i < max\n if(i % 3 == 0) && (i % 5 == 0)\n \n elsif (i % 3 == 0) || (i % 5 == 0)\n nums[count] = i\n count = count + 1\n end\n i = i + 1\n end\n return nums \nend", "def ideal_numbers(num)\n count = 0\n arr = []\n i = 1\n while count < num\n if perfect_number?(i)\n arr << i \n count += 1\n end\n i += 1\n end\n arr\nend", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def remove_numbers(arr,n)\n arr.reject { |i| i % n == 0 }\nend", "def evil_even_numbers(array_of_numbers)\n result = []\n for number in array_of_numbers\n result.push(number) if(number % 2 == 0)\n end\n \n return result \nend", "def series_up(n) # Got help again. My first code couldn't adapt at all. This one has a reset limit, meaning it loops the amount of times it needs to for each interger. Still not perfect, but almost there. \n list = [1]\n i = 1\n length = n*(n+1)/2\n reset = 3\n list.push i\n i += 1\n if i == reset\n reset += 1\n end\n return list\nend", "def first_n_primes(n)\n\t return \"n must be an integer.\" unless n.is_a? Integer\n\t return \"n must be greater than 0.\" if (n<=0)\n\n prime_array||=[]\n\tprime = Prime.new\n\tn.times {prime_array << prime.next } \n\tprime_array\nend", "def select_every_n arr, n=1\n ans = []\n arr.each_with_index do |item, i|\n ans.push item if i%n == 0\n end\n ans\nend", "def pure_number(n)\n arr = []\n arr[0] = \"\"\n blocks = 0\n displacement = 0\n i = 1\n while(i <= n)\n blocks = blocks + 1 if(is_power_of_2?(i+1))\n if(is_4_series?(i, blocks))\n displacement = power_of_num(2, blocks-1)\n arr[i] = \"4\" + arr[i-displacement] + \"4\"\n else\n displacement = power_of_num(2, blocks) \n arr[i] = \"5\" + arr[i-displacement] + \"5\"\n end\n i+=1\n end\n arr\nend", "def toothpick n\n ways = [$tooths[n]] +\n # TODO: uncomment the following line for use of '-'\n # I do not know, if n = (x+i) - i for i \\in {1,2,...,n} is ok\n # (1..n).map{|i| $tooths[n+i] - $tooths[i]} +\n (1..(n/2)).map{|i| $tooths[n-i] + $tooths_add[i] } \n ways.min\nend", "def pretentious_primes(arr, num)\nend", "def prime_number(n)\n res = []\n prime = Array.new(n + 1, true)\n (2..n).each do |x|\n num = x * x\n break if num > n\n\n if prime[x]\n (num..n).step(x).each do |multiples|\n prime[multiples] = false\n end\n end\n end\n \n (2..n).each do |primes|\n res << primes if prime[primes]\n end\n res\nend", "def squares (x, n)\n starting_number = x\n repeate = n\n array = []\n\n\n if n == 0 || n == nil\n return array\n end\n\n array.push(starting_number)\n\n\n i = 1\n until i == repeate\n root_index = starting_number * starting_number\n starting_number = root_index\n array.push(starting_number)\n i += 1\n end\n\n\n return array\nend", "def climb_stairs(n)\n return 0 if n.zero?\n return 1 if n == 1\n\n dp = []\n dp[n] = 1\n dp[n - 1] = 1\n (n - 2).downto(0) do |idx|\n dp[idx] = dp[idx + 1] + dp[idx + 2]\n end\n dp.first\nend", "def prime_number(n)\n prime_array = []\n count = 1\n until prime_array.length == n\n if count == 1\n prime_array << 2\n count += 2\n elsif is_prime?(count) == true\n prime_array << count\n count += 2\n else\n count += 2\n end\n end\n prime_array.last\nend", "def thousand_lights(n)\n lights = Array.new(n, false)\n n.times do |num|\n lights.map!.with_index do |light, index|\n if (index + 1) % (num + 1) == 0\n !light\n else\n light\n end\n end\n end\n lights.map.with_index {|element, index| (index + 1) if element}.compact\nend", "def oddities(array)\n result = []\n count = 0\n array.each do |element|\n result << element if count.even?\n count += 1\n end\n result\nend", "def first_n_primes(n)\n\n #unless n.is_a? Integer\n # return \"n must be an integer.\"\n #end\n return \"n must be an integer.\" unless n.is_a? Integer\n\n #if n <= 0\n # return \"n must be greater than 0.\"\n #end\n return \"n must be greater than 0.\" if n <= 0\n \n #prime_array = [] if prime_array.nil?\n prime_array ||= []\n \n prime = Prime.new\n #for num in (1..n)\n # prime_array.push(prime.next)\n #end\n # n.times { prime_array.push(prime.next) }\n n.times { prime_array << prime.next }\n \n #return prime_array\n prime_array # implicit return!\n\nend", "def diamond_array_sequence(number)\n array = []\n 1.upto(number) do |n|\n if n.odd?\n array << n\n end\n end\n array\nend", "def oddities(array)\n new_array = []\n index_range = (1..array.size-1)\n for n in index_range do \n new_array << array[n] if n.odd?\n end\n new_array\nend", "def multiples(number)\n number_array = Array(1..number)\n multiples_array = []\n\n number_array.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples_array << num\n end\n end\n multiples_array.inject(:+)\nend", "def multiples_x(number, multiple)\n current_multiple = multiple\n multiples = []\n\n while current_multiple <= number\n multiples << current_multiple\n current_multiple += multiple\n end\n\n multiples\nend", "def count_to (n)\n array = []\n count = 0\n while count <= n\n count += 1\n array.push(count.round)\n end\nend", "def select_odds(numbers)\n index = 0 \n \n odds = [] \n \n while index < numbers.length \n if numbers[index] % 2 != 0\n odds << numbers[index]\n end \n \n index += 1 \n end \n \n return odds \n \nend", "def remove_factors(n)\n numbers_range = *(2..n)\n range_length = numbers_range.length\n numbers_to_check = numbers_range[(range_length/2), range_length]\n return numbers_to_check\nend", "def primes_to_n n\n non_primes = []\n non_primes[1] = 1\n (2..(n/2)).each do |factor|\n ((factor*2)..n).step(factor).each do |multiple_of_factor|\n non_primes[multiple_of_factor] = 1\n end\n end\n (1..n).reject {|i| non_primes[i]}\nend", "def first_even(array_of_numbers)\n even_number_array = []\n array_of_numbers.each do |num| \n if num % 2 == 0\n even_number_array << num\n end\n end\n even_number_array[0]\nend", "def odd_numbers(array)\n end", "def oddball(arr)\n evens = []\n odds = []\n arr.each do |int|\n if int.even?\n evens << int\n else\n odds << int\n end\n end\n evens.length > 1 ? odds[0] : evens[0]\nend", "def series_up(n)\n #nlist is the list that will be the output of the code\n nlist = []\n #i changed from an if statement to a loop.\n (n*(n+1)/2+1).times do |i|\n i.times do |x|\n nlist.push(x+1)\n end\n end\n #I use three dots to only get the information i need from the code\n return nlist[0...(n*(n+1)/2)].to_a\nend", "def climb_stairs(n)\n return 1 if n == 1\n dp = [0] * (n + 1)\n dp[1] = 1\n dp[2] = 2\n for i in 3..n do \n dp[i] = dp[i - 1] + dp[i - 2]\n end\n dp[n]\nend", "def magic_numbers(count)\n num = 1\n result = []\n while result.length < count\n result << num if is_magic_number?(num)\n num += 1\n end\n result\nend", "def isPP(n)\n i, j = 2, 2\n while i**j <= n do\n while i**j <= n do\n return [i, j] if i**j == n\n j+=1\n end\n i+=1\n j=2\n end\n nil\nend", "def drop_every_nth(n)\n self.inject([[]]) do |array, current|\n if array[-1].size == n\n array << [current]\n else\n array[-1] << current\n end\n array\n end.inject([]) do |array, list|\n list.pop if list.size == n\n array << list\n end.flatten\n end", "def get_squares(first_number, last_number)\n n = (first_number..last_number).to_a\n squares = []\n n.each do |i|\n if i % 2 == 0\n squares << i\n end\n end\n return squares\nend", "def select_odds(numbers)\n array = []\n i = 0\n while i < numbers.length\n \n if numbers[i] % 2 == 1\n array << numbers[i]\n end\n i += 1\n end\n return array\n end", "def select_odds(numbers)\n\tnums = []\n \n\ti = 0\n\twhile i < numbers.length\n\t\tif numbers[i] % 2 == 1\n\t\t\tnums << numbers[i]\n\t\tend\n\t\ti += 1\n end\n \n\treturn nums\nend", "def oddball(arr)\n odd = arr.select {|x| x.odd? }\n even = arr.select {|x| x.even? }\n if even.length > odd.length\n odd[0]\n else\n even[0]\n end\nend", "def oddball(arr)\n even_arr = arr.select { |n| n % 2 == 0 }\n odd_arr = arr.reject { |n| n % 2 == 0 }\n\n return even_arr[0] if even_arr.length == 1\n return odd_arr[0]\nend", "def select_odds(numbers)\n odd_numbers = []\n \n i = 0\n while i < numbers.length\n if numbers [i] % 2 == 1\n odd_numbers << numbers [i]\n end\n \n i += 1\n end\n \n return odd_numbers\nend", "def first_n_primes(n)\n\n unless n.is_a? Integer\n return \"n must be an integer.\"\n end\n\n if n <= 0\n return \"n must be greater than 0.\"\n end\n \n prime_array = [] if prime_array.nil?\n \n prime = Prime.new\n for num in (1..n)\n prime_array.push(prime.next)\n end\n return prime_array\nend", "def squared_primes(array)\n array.find_all{|x| (2..x-1).select(){|i| x % i == 0}.count == 0 && x > 1}.map{|p| p*p}\n\n\n # primes = []\n # array.each do |x|\n # 2.upto(x-1) do |i|\n # if x % i == 0 && x > 2\n # primes << x*x\n # end\n # end\n # end\n # primes\n\n # primes= []\n # array.find_all do |x|\n # if x == 2\n # primes << 2*2\n # end\n\n # if x > 2 && (x % 2 != 0)\n # #(2..x-1).select()\n # # if x % 2 != 0 && x > 1\n # #{|i| x % i == 0}\n # #x.count == 0 && x > 1\n # primes << x * x\n # #end\n # end\n # end\n # # new_array.map{|p| p*p}\n # primes\nend", "def get_even_numbers_from_array(numbers)\n even_numbers = []\n\n for number in numbers\n\n if number.even? == true\n even_numbers << number\n end\n \n end\n\n return even_numbers\nend", "def evenNumbers(n)\n arr = Array.new\n i = 1\n\n while arr.length < n\n i = i + 1\n if i % 2 == 0\n arr << i\n end\n end\n\n puts \"#{arr.length} and #{arr}\"\nend", "def slices(n)\n digits.each_cons(n).to_a\n end", "def oddities(arr)\n counter = 0\n return_array = []\n loop do\n return_array << arr[counter]\n counter += 2\n break if counter >= arr.size\n end\n return_array.compact\nend", "def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend", "def select_odds(numbers)\n\todds = []\n \tfor i in 0..numbers.length-1\n number = numbers[i]\n if number % 2 == 1\n odds << number\n end\n end\n return odds\nend", "def pretentious_primes(arr, num)\n new_arr = []\n if num > 0\n arr.each do |ele|\n i = ele + 1\n count = 0\n while true\n if is_prime?(i)\n count += 1\n end\n if count == num\n new_arr << i\n break\n end\n i += 1\n end\n end\n else\n num = -1 * num\n end\n new_arr\nend", "def even_nums(max)\n newArr = []\n i = 0\n while i <= max\n if i % 2 == 0\n newArr << i\n end\n i+=1\n end\n return newArr\n end", "def oddball(arr)\n odds = arr.select {|num| num.odd?}\n evens = arr.select {|num| num.even?}\n odds.size > evens.size ? evens[0] : odds[0]\nend", "def oddities(array)\n result = []\n index = 0\n\n loop do\n result << array[index]\n index += 2\n break if index >= array.size\n end\n\n result\nend", "def primes (n)\r\n primes = Array.new(n) { |index| index+=1 }\r\n return primes.select { |x| factors(x).length == 2 }\r\nend", "def select_odds(numbers)\n\tarry = []\n \ti = 0\n while i < numbers.length\n if numbers[i] % 2 == 1\n arry << numbers[i]\n end\n i += 1\n end\n return arry\nend", "def remove_odd array\n no_odds_array = []\n array.each do |number|\n if number % 2 == 0\n no_odds_array.push(number)\n end\n end\n no_odds_array\nend", "def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n array.push(index)\n found += 1\n end\n index += 1\n end\n return array\nend", "def list(nth)\n result = []\n if nth > 0\n (1..nth).each do |i|\n if i > 2 \n result << result[-1] + result[-2]\n else\n result << number(i) \n end\n end\n end\n result\n end", "def at_least_n_factors(numbers, n)\n\n arr = []\n numbers.each do |x|\n arr << x if num_factors(x) >= n\n end\n\n arr\nend", "def sieve(n) # quickly makes array of all primes from 2 to n\n s = 3.step(n, 2).to_a # make array of odd integers from 3 to n. Skip evens. \n s.each do |p|\n next if p.nil? # go to next element if p has been marked empty\n break if p * p > n # p only needs to go up to sqrt(n)\n\n k, pval = 0, 0\n\n while pval < n\n pval = p * (p + k) # jump forward 2p at a time: p*p, p*p + 2p, p*p + 4p, etc.\n\n # Set all those multiples to nil. i = (pval - 3)/2 translates pvals to index i\n\n s[(pval - 3) / 2] = nil \n k += 2 \n end\n\n end\n s.compact! # removes all nil elements from array\n s.unshift(2).sort # adds 2 as 1st element\nend", "def pretentious_primes(arr, n)\n arr.map { |num| replace_with_prime(num, n) }\nend", "def collect_multiples(number)\n \n numbers = Array.new(number - 1, 0)\n count = 0\n while count < numbers.length \n numbers[count] = count + 1\n count += 1\n end\n\n numbers.select do |element|\n element % 3 == 0 || element % 5 == 0\n end\n\nend", "def get_squares(array)\n numbers = []\n array.select do |n|\n if array.include? n*n\n numbers << n\n end\n end\n numbers.sort\nend", "def oddities(array)\n odd_element_array = []\n index = 0\n loop do\n break if index >= array.size\n odd_element_array << array[index] if index.even?\n index += 1\n end\n odd_element_array\nend", "def sptriplet(n)\n divisors_of_500 = []\n1.upto(500) {|n| divisors_of_500 << n if 500 % n == 0}\ndivisors_of_500.inspect\n\n solutions = []\n for x in divisors_of_500\n for z in divisors_of_500\n if (x < z && z < 2*x) && n%(x*z) == 0\n y = z - x\n k = ((n/2) / x) / z\n\n a = k*(x*x-y*y)\n b = 2*k*x*y\n c = k*(x*x+y*y)\n\n solutions << [a,b,c]\n end\n end\n end\n\n product = 1\n solutions.map! {|arr| arr.sort}\n solutions.uniq!\n solutions[0].each {|num|product *= num}\n product\n\nend", "def small_numbers(input_array)\nnew_array = [ ]\nnumber_of_loops = input_array.length\nindex = 0\n\nnumber_of_loops.times do\n if input_array[index] < 10\n new_array << input_array[index]\n end\n index = index + 1\nend\n\noutput = new_array\nreturn output\nend", "def even_nums(max) # max is some int\n new_arr = [] # initialize new array\n i = 0 # indice counter @ 0\n\n while i <= max # while i is less than or equal to the given int\n if i % 2 == 0 # if i is not divisible by 0\n new_arr << i # add the number into the new array\n end\n\n i += 1\n end\n return new_arr\nend", "def drop(list, n)\n result = []\n list.each_index do |i| \n if i % n != n - 1 \n result << list[i] \n end \n end\n result\nend", "def square_array(pancakes)\n elephant = []\n pancakes.each do |num|\n elephant << num**2\n end\n return elephant\nend", "def lights(n)\n arr = Array.new(n, false)\n n.times do |count|\n arr.each_with_index { |element, idx| arr[idx] = !element if (idx + 1) % (count + 1) == 0}\n end\n result =[]\n arr.each_with_index { |element, idx| result << idx+1 if element }\n result\nend", "def get_primes(n)\n primes = [2]\n pp = 0\n i = 3\n while pp < n do\n if i%2 != 0\n counter = 0\n prime = 1\n while counter < primes.length do\n if (i%primes[counter] == 0)\n prime = 0\n break;\n end\n counter += 1\n end\n if prime == 1\n primes.push(i)\n pp +=1\n end\n end\n i+=1\n end\n return primes[n-1]\nend", "def persistence(n)\n multiples = []\n until n.to_s.chars.count < 2 do\n n = n.to_s.chars.map(&:to_i).inject(:*)\n multiples << n\n end\n multiples.count\nend", "def divisors(n)\n divs = []\n # NOT INCLUDING ITSELF\n (1...n).each do |i|\n if n % i == 0\n divs << i\n end\n end\n divs\nend", "def pentagon_sequence(nth)\n sequence = []\n (1..nth).each do |n|\n sequence.push( n * (3 * n - 1) / 2 )\n end\n return sequence\nend", "def collect_multiples(limit)\n multiples = []\n numbers = (1..limit.to_i-1).to_a\n numbers.each do |i|\n if i % 3 == 0 || i % 5 == 0\n multiples.push(i)\n end\n end\n multiples \nend", "def smallest_multiple(num)\n x = 2\n arr = []\n while x <= 20\n arr.push(x)\n x += 1\n end\n arr\nend", "def oddities(array)\n new_array = []\n array.each_with_index do |num, index|\n new_array << num if index.odd?\n end\n new_array\nend" ]
[ "0.83439183", "0.82858", "0.81821746", "0.81821746", "0.7393893", "0.59299415", "0.5917558", "0.58745056", "0.5851067", "0.5777433", "0.5772545", "0.57675886", "0.5761323", "0.5750955", "0.5748554", "0.57400185", "0.57368875", "0.57148546", "0.57079905", "0.5698356", "0.56491584", "0.5636923", "0.5635629", "0.56335837", "0.5630231", "0.56204087", "0.56189436", "0.560252", "0.5598058", "0.5596539", "0.5589582", "0.5562036", "0.55562985", "0.55382085", "0.5530196", "0.55266106", "0.55251384", "0.5522091", "0.5519459", "0.55133146", "0.54987264", "0.5498324", "0.5497737", "0.5497736", "0.5486393", "0.5485998", "0.5480618", "0.5475731", "0.5471206", "0.54704595", "0.54698247", "0.54666376", "0.5457258", "0.5452565", "0.5449614", "0.5446537", "0.54434174", "0.54363644", "0.54339975", "0.5432117", "0.5431163", "0.5430015", "0.542949", "0.542257", "0.54163873", "0.5414599", "0.5405763", "0.540502", "0.5401395", "0.5400675", "0.5390352", "0.5389168", "0.5389022", "0.53884417", "0.5385471", "0.53853875", "0.53823483", "0.53751314", "0.53744256", "0.5371305", "0.5370535", "0.5369153", "0.5367306", "0.5366426", "0.5355086", "0.535232", "0.5349601", "0.53418547", "0.53412795", "0.53375524", "0.53369445", "0.53368515", "0.53353345", "0.53284615", "0.5326367", "0.5324012", "0.5322044", "0.5320375", "0.53179234", "0.53164095" ]
0.82373935
2
Write a function that finds whether any two elements in the array sum to 0. If it does, return true; else, return false.
def two_sum_to_zero?(arr) arr.each_with_index do |n1, idx1| arr.each_with_index do |n2, idx2| next if idx1 == idx2 return true if (n1 + n2).zero? end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_sum_to_zero?(array)\n array.each_with_index do |element, index|\n array.each_with_index do |element2, index2|\n if element + element2 == 0 and index != index2\n return true\n end\n end\n end\n return false\nend", "def zero_sum?(array)\n (0...array.length).each do |index1|\n (index1 + 1...array.length).each do |index2|\n return true if array[index1] + array[index2] == 0\n end\n end\n false\nend", "def two_sum_to_zero?(array)\nend", "def two_sum(arr)\n \n found = false\n arr.each do |e|\n found = true if arr.any?{|x| e+x == 0}\n end\n found\n \nend", "def two_sum_zero(array)\n \n i = 0\n while i < array.length - 1\n \n j = i + 1\n while j < array.length\n if array[i] + array[j] == 0\n return true\n end\n \n j += 1\n end\n \n i += 1\n end\n return false\nend", "def two_sum_to_zero?(arr)\r\n\r\n #\r\n arr.each_index {|index|\r\n index_out = arr.slice(0, index) +arr.slice(index +1, arr.length)\r\n\r\n return true if index_out.include?(-arr[index])\r\n }\r\n false\r\nend", "def zero_sum?(array)\nend", "def sum_to_zero(array)\n array_of_nums = array.map {|i| i.abs}\n duplicates = array_of_nums.select {|i| array_of_nums.count(i) > 1}\n return true if duplicates.uniq.length > 0\n false\nend", "def valid?(array)\n array.include?(0) || array.sum != 180\nend", "def only_one_non_zero?( array )\n found_non_zero = false\n array.each do |val|\n if val!=0\n return false if found_non_zero\n found_non_zero = true\n end\n end\n found_non_zero\n end", "def zeroes?(array)\n\t\n\tarray.include?(0)\n\t\n\tarray.each do |i|\n\t\tif i == 0\n\t\t\treturn (true)\n\t\tend\n\tend\n\tputs \"both return true\"\nend", "def sum_checker(array)\n# Check if the array contains at least 2 elements\n if array.length < 2\n false\n else\n# Iterate over the array to check if the array has a -num (num and -num add up to zero)\n array.each do |num|\n return true if array.include?(-num)\n end\n end\n false\nend", "def bad_two_sum?(arr, target)\n zero_sum = false\n arr.each_with_index do |el1, idx1|\n arr.drop(idx1).each do |el2|\n zero_sum = true if el1 + el2 == target\n end\n end\n zero_sum\nend", "def two_sum_to_zero?(array)\n # len = array.length - 1\n # len.times do |i|\n # (i + 1).upto(len) do |j|\n # return true if array[i] + array[j] == 0\n # end\n # end\n # false\n nums_hash = {}\n array.each do |el|\n return true if nums_hash[-(el)]\n nums_hash[el] = true\n end\n false\nend", "def bad_two_sum?(arr, target_sum)\n arr.size.times do |start|\n (start + 1...arr.size).each do |stop|\n return true if arr[start] + arr[stop] == target_sum\n end\n end\n false\nend", "def bad_two_sum?(arr, target_sum)\n (0...arr.length - 1).each do |i|\n (i + 1..arr.length - 1).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n false\nend", "def bad_two_sum?(arr, target)\n (0...arr.length).each do |idx1|\n return true if arr[idx1] == target\n (idx1+1...arr.length).each do |idx2|\n return true if (arr[idx1] + arr[idx2]) == target\n end\n end\n false\nend", "def all_zeros?(numbers = [])\n # numbers.none? { |number| !number.zero? }\n numbers.all?(&:zero?)\nend", "def bad_two_sum?(arr, target)\n (0...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target\n end\n end\n false\nend", "def bad_two_sum?(arr, target_sum)\n (0...arr.length - 1).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n return false\nend", "def bad_two_sum?(arr, target)\n (0...(arr.length - 1)).each do |idx1|\n ((idx1 + 1)...arr.length).each do |idx2|\n return true if arr[idx1] + arr[idx2] == target\n end\n end\n false\nend", "def bad_two_sum?(arr, target_sum)\r\n arr.each_with_index do |ele1, i1|\r\n arr.each_with_index do |ele2, i2|\r\n return true if i2 != i1 && (ele1 + ele2 == target_sum)\r\n end\r\n end\r\n\r\n false\r\nend", "def nonoverlaping_sums?\n @good_sums.each_with_index do |sum1, idx1|\n @good_sums[idx1+1..-1].each do |sum2|\n return true if sum1 & sum2 == 0\n end\n end\n false\n end", "def bad_two_sum?(arr, target_sum)\n arr.length.times do |i|\n (arr.length - i - 1).times do |j|\n return true if arr[i] + arr[j + i + 1] == target_sum\n end\n end\n false\nend", "def bad_sum?(arr, target)\n\n (0...arr.length).each do |idx|\n (idx + 1...arr.length).each do |jdx|\n return true if arr[idx] + arr[jdx] == target\n end\n end\n false\nend", "def bad_two_sum?(arr, target_sum) #O(n^2)\n (0...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n false\nend", "def two_sum(array, target)\n arr_a = array.pop()\n var = false \n array.each { |x| \n return true if arr_a + x == target\n }\n return false \nend", "def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |o_el, o_idx|\n arr.each_with_index do |i_el, i_idx|\n next if o_idx == i_idx\n return true if o_el + i_el == target_sum\n end\n end\n false\nend", "def okay_two_sum?(array, target)\n array.sort!\n (1...array.length).each do |idx|\n return true if array[idx-1] + array[idx] == target\n end\n false\nend", "def two_sum?(arr, target_sum)\n (0...arr.length).each do |i|\n (0...arr.length).each do |j|\n next if i == j\n return true if arr[i] + arr[j] == target_sum\n end\n end\n\n false\nend", "def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2,idx2|\n if idx2 > idx1 && arr[idx1] + arr[idx2] == target_sum\n return true\n end\n end\n end\n false\nend", "def bad_two_sum?(arr, target)\n arr.each_with_index do |num1,idx1|\n i = idx1 + 1\n while i < arr.length\n return true if num1 + arr[i] == target\n i+=1\n end\n end\n false\nend", "def can_sum(target_sum, numbers)\n return true if target_sum == 0 # 0 can be generated by taking no numbers from the array\n return false if target_sum < 0\n\n for num in numbers\n remainder = target_sum - num\n return true if can_sum(remainder, numbers) == true\n end\n\n return false\nend", "def all_negatives?(nums)\n nums.each { |element| return false if element >= 0 }\n true\nend", "def all_zeros?(numbers = [])\n all_zeros = true\n numbers.each do |number|\n return all_zeros = false if !number.zero?\n end\n\n all_zeros\nend", "def okay_two_sum?(arr, target)\n arr.each do |el|\n return true if arr.bsearch { |x| x == (target - el) && x != el }\n end\n false\nend", "def make_sum?(num, game_array) \n\tarray_of_sums = []\n\n\tgame_array.each do |i|\n\t\tarray_of_sums << i + num\n\tend\n\tif (array_of_sums & game_array).length > 0\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |num1, i|\n arr[i..-1].each do |num2|\n next if num1 == num2\n\n return true if (num1 + num2) == target_sum\n end\n end\n\n false\nend", "def a_sum?(num, game_array)\n\tarray_of_sums = []\n\tarray_of_sums << game_array[0]\n\n\tgame_array.each_index do |i|\n\t\tgame_array.each_index do |j|\n\t\t\tunless i == j\n\t\t\t\tarray_of_sums << game_array[i] + game_array[j]\n\t\t\tend\n\t\tend\n\tend\n\tif ([num] & array_of_sums).length > 0\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def bad_two_sum?(arr, target_sum) \n arr.each_with_index do |num, idx|\n arr.each_with_index do |num2, idx2|\n next if idx2 == idx\n return true if num2 + num == target_sum\n end\n end\n false\nend", "def two_sum?(arr, target)\n s1 = Set.new \n arr.each_with_index do |el, idx|\n return true if s1.include?(target-el)\n s1.add(el)\n end\n false\nend", "def two_sum(array, target)\n\n !!array.uniq.combination(2).detect { |a, b| a + b == target }\nend", "def okay_two_sum?(arr, target_sum)\n arr.sort!\n arr.each do |el|\n target = target_sum - el\n return true if !binary_search(arr, target).nil?\n end\n false\nend", "def seesaw2?(arr)\n left_sum = 0\n right_sum = arr.size > 1 ? arr[1..-1].reduce(:+) : 0\n\n arr.each_index do |i| #O(n)\n return true if left_sum == right_sum\n left_sum += arr[i]\n i < arr.size-1 ? right_sum -= arr[i+1] : right_sum = 0\n end\n return false\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort\n (0...arr.length).each do |idx|\n diff = target - arr[idx]\n return true if arr.include?(diff) && idx != arr.index(diff)\n end\n false\nend", "def okay_two_sum?(arr, sum)\n arr = arr.sort\n arr.each_with_index do |el, idx|\n arr_dup = arr.dup\n arr_dup.delete_at(idx)\n return true if arr_dup.bsearch { |x| x == sum - el }\n end\n false\nend", "def bad_two_sum?(arr, target)\n sums = []\n arr.each_index do |i|\n (i+1...arr.length).each do |j|\n sums << arr[i] + arr[j]\n end\n end\n sums.include?(target)\nend", "def all_else_equal(arr)\n sum_num = 0\n\n arr.each do |num|\n sum_num = num\n if sum_num == sum_elements_except_me(arr, num)\n return sum_num\n end\n end\n\n return false\n\nend", "def sum_to_n? arr, n\n\nreturn false if arr.empty? || arr.length==1\n\nfor i in 0...arr.length\n for j in 0...arr.length\n if i != j\n return true if arr[i] + arr[j] == n\n end\n end\nend\n\nreturn false\n\nend", "def okay_two_sum?(arr, target)\n \n\nend", "def okay_two_sum?(arr, target_sum)\n sorted_arr = quick_sort(arr)\n (0...sorted_arr.length - 1).each do |i|\n return true if sorted_arr[i] + sorted_arr[i + 1] == target_sum\n end\n false\nend", "def sum_to_n?( arr, n )\n return false if arr.nil? or arr.empty? or arr.length == 1\n arr.each do |first|\n arr.each do |second|\n return true if (first + second == n) and first != second\n end\n end\n false\nend", "def bad_two_sum?(array, target)\n array.each.with_index do |el1, idx1|\n array.each.with_index do |el2, idx2|\n if el1 + el2 == target && idx2 > idx1\n return true \n end\n end\n end\n false \nend", "def sum_to_n?(arr, n)\n for x in arr\n if arr.include?(n - x)\n return true\n end\n end\n return n==0 && arr.empty?\nend", "def okay_two_sum?(arr, target) # => [0,1,5,7] \n sorted = qs(arr)\n\n (0...sorted.length-1).each do |i|\n return true if sorted[i] + sorted[i + 1] == target\n end\n\n false\nend", "def okay_two_sum?(arr, target_sum)\n sorted_arr = arr.sort\n (0...sorted_arr.length).each do |i|\n next if i+1 == sorted_arr.length\n return true if sorted_arr[i] + sorted_arr[i+1] == target_sum\n end\n\n return false\nend", "def two_sums?(arr, target)\n # number_count = Hash.new(0)\n #\n # arr.each do |num|\n # number_count[num] += 1\n # end\n #\n # arr.each do |num|\n # other_num = target - num\n # number_count[num] -= 1\n # return true if number_count.include?(other_num) && number_count[other_num] > 0\n # end\n #\n # false\n set = Set.new(arr)\n arr.each do |num|\n set.delete(num)\n return true if set.include?(target - num)\n end\n false\nend", "def sum_to_n? arr, n\n if arr.nil? || arr.empty? || arr.size == 1\n return false\n else \n arr.each {|x| arr.each {|y| return true if x + y == n && x != y}}\n end\n return false\nend", "def bad_two_sum?(arr, target)\n arr.each_with_index do |num1, idx1| #O(n)\n arr.each_with_index do |num2, idx2| #O(n)\n return true if idx2 > idx1 && num1 + num2 == target #O(1)\n end\n end\n false\nend", "def two_sum?(arr, target_sum)\n hash = Hash.new(0)\n arr.each_with_index do |num, idx|\n hash[num] = idx\n end\n arr.each_with_index do |num, idx|\n return true if hash.has_key?(target_sum - num) && idx != hash[target_sum - num]\n end\n false\nend", "def okay_two_sum?(arr, target)\n sorted_arr = arr.sort\n sorted_arr.each do |el|\n search_val = target - el\n return true if sorted_arr.bsearch {|x| x == search_val && x!= el}\n end\n false\nend", "def two_sum?(arr, target)\n hash = Hash.new { |h, k| h[k] = 0}\n arr.each do |el|\n hash[el] += 1\n end\n\n arr.each do |el|\n hash2 = hash.dup\n hash2[el] -= 1\n return true if hash2[target - el] > 0\n end\n false\nend", "def okay_two_sum?(arr, target)\n arr.sort!\n\n arr.select! { |el| el < target }\n\n arr.each { |el| arr.include?(target - el) ? (return true) : next }\n false\nend", "def okay_two_sum?(arr, sum)\n sorted = arr.dup.sort\n arr.each do |el|\n return false if el > sum\n return true if arr.b_search(sum - el)\n end\n false\nend", "def okay_two_sum?(arr, target)\n small = arr.select {|el| el < target}\n small.each_with_index do |e, i|\n sub_el = target - e \n # arr.delete(sub_el)\n return true if small.include?(sub_el) && small[i] != sub_el\n \n end\n false \n \n \nend", "def sum_eq_n?(arr, n)\n if arr == [] && n == 0\n return true\n end\n for i in 0..arr.length-2\n for j in i+1..arr.length-1\n if arr[i] + arr[j] == n\n return true\n end\n end\n end\n return false\nend", "def okay_two_sum?(arr, target_sum)\n arr.sort!\n arr.each_with_index do |el, idx|\n diff = target_sum - el\n other_idx = bsearch(arr, diff)\n next if idx == other_idx\n return true unless other_idx.nil?\n end\n false\nend", "def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn false\nend", "def two_sum?(array, target_sum)\n array_hash = {}\n array.each do |el|\n array_hash[el] = true\n end\n\n array.each_with_index do |el|\n next if target_sum - el == el\n return true if array_hash[target_sum - el]\n end\n false\nend", "def okay_two_sum?(arr, target_sum)\n sorted = arr.sort\n\n arr.each_with_index do |el, i|\n complement = target_sum - el\n\n if bsearch(arr[(i + 1)..-1], complement)\n return true\n end\n end\n false\nend", "def hardcore_two_sum?(arr, target)\n nums = {}\n arr.each{ |n| nums[n] = n }\n\n nums.each do |n,_|\n needed = target - n\n return true if !nums[needed].nil? && nums[needed] != n\n end\n\n false\nend", "def sum_pair?(arr, sum)\n for i in (0...arr.size-1)\n for j in (i...arr.size)\n return true if arr[i] + arr[j] == sum\n end\n end\n false\nend", "def arr_sum(arr, target)\n 0.upto(arr.size - 2) do |idx1|\n 1.upto(arr.size - 1) do |idx2|\n return true if arr[idx1] + arr[idx2] == target && idx2 > idx1\n end\n end\n false\nend", "def two_sum?(arr, target_sum) \n hash = Hash.new(0)\n arr.each do |num|\n hash[num] = 1 \n end \n\n arr.each do |num|\n num2 = target_sum - num\n next if num2 == num\n next if hash[num2].nil?\n return true if hash[num2] == 1\n end\n false\nend", "def is_sum_of_any_two(target, numbers)\n for index1 in 0...numbers.length - 1\n for index2 in index1 + 1...numbers.length\n if (numbers[index1] + numbers[index2]) == target\n return true\n end\n end\n end\n false\nend", "def ok_two_sum(arr, target)\n sorted = quick_sort(arr)\n\n arr.each do |el|\n b_target = target - el\n return true if b_search(arr, b_target)\n end\n false\nend", "def ok_two_sum?(arr, target_sum)\n sorted_arr = ok_mergesort(arr)\n sorted_arr.each_with_index do |ele, idx|\n diff = target_sum - ele\n return true unless ok_bsearch(sorted_arr[idx+1..-1], diff).nil?\n end\n false\nend", "def checkArray(a)\n\tn = a.length-1\n\tcount = 0\n\tfor i in 0..n do\n\t\tfor j in (i+1)..n do\n\t\t\tfor k in (j+1)..n do\n\t\t\t\tif (a[i] + a[j] + a[k] == 0)\n\t\t\t\t\tcount += 1\n\t\t\t\t\treturn count;\n\t\t\t\telse\n\t\t\t\t\treturn count;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def okay_two_sum?(arr, target)\n arr.sort!\n pairs = arr.combination(2)\n pairs.any? { |pair| pair.sum == target }\nend", "def okay_two_sum?(arr, target)\n arr.each_with_index do |el,idx|\n if bi_search(arr[idx+1..-1], target, el)\n return true\n end\n end\n false\nend", "def sum_to_n?(array, n)\n return false if array.empty? || array.length == 1\n\n array.combination(2).any? { |x, y| x + y == n }\nend", "def sum_to_n? arr, n\n arr = arr.combination(2).to_a\n arr.any? {|a| a.sum == n} ? true : false\nend", "def sum_to_n?(int_array, n)\n return true if int_array.length == 0 && n == 0\n int_array.each_with_index{ |val, index| \n return true if int_array.find_index(n - val) && int_array.find_index(n - val ) != index\n }\n return false # default return false\nend", "def okay_two_sum_a?(arr, target_sum)\n arr = arr.sort\n i, j = 0, arr.length - 1\n\n while i < j\n case (arr[i] + arr[j]) <=> target_sum\n when 0\n return true\n when -1\n i += 1\n when 1\n j -= 1\n end\n end\n\n false\nend", "def sum_to_n? arr, n\n len = arr.length\n\n #Returns false when the length of the array is 0.\n if len == 0 then\n return false\n end\n #Iterates through the array to find the first index\n i = 0\n while i < len-1 do\n #Iterate through the rest of the elements of the array\n j = i+1\n while j <= len-1 do\n if arr[i]+arr[j] == n then\n return true\n end\n j+=1\n end\n i+=1\n end\n return false\nend", "def okay_two_sum?(arr, target_sum)\n\narr.sort!\n\nreturn false if arr[-1] < target_sum\n\ni = 0\ni += 1 until arr[i] > target_sum\n\nresult = []\nnew_arr = arr[0...i]\n(0...new_arr.length - 1).each do |i|\n (i+1...new_arr.length).each do |j|\n result << new_arr[i] + new_arr[j]\n end\n end\n result.include?(target_sum)\n\nend", "def two_sum1?(arr, target_sum)\n sorted_arr = arr.sort\n length = arr.length - 1\n\n mid = arr.length / 2\n\n if mid < target_sum\n (0...mid).any? { |i| arr[i] + arr[i+1] == target_sum }\n else\n (mid...length).any? { |i| arr[i] + arr[i+1] == target_sum }\n end\nend", "def is_magic_three(array)\n # Your code goes here\n if array == [0]\n true\n else\n sumas = array.combination(3).to_a.collect { |item| item.inject(0, :+) }\n\n puts sumas\n check = sumas.collect { |item| true if item == 0 }\n puts check\n check.include? true\n end\nend", "def okay_two_sum?(arr, target_sum)\n array = arr.sort #n log n\n i1 = 0\n i2 = array.length-1\n while i1 < i2\n case array[i1] + array[i2] <=> target_sum\n when 0\n return true\n when -1\n i1 += 1\n when 1\n i2 -= 1\n end\n end\n false\nend", "def sum_to_n?(array, n)\n return false if array.length < 2\n\n for i in 0..array.length - 2\n for j in i+1..array.length - 1\n return true if array[i] + array[j] == n\n end\n end\n\n return false\nend", "def two_sum?(arr, sum)\n hash = Hash.new { |h, k| h[k] = 0 }\n arr.each do |el|\n if hash.has_key?(sum - el)\n return true\n else\n hash[el] = sum - el\n end\n end\n false\nend", "def two_sum?(arr,target)\n hash = Hash.new(0)\n arr.each do |el|\n hash[el] += 1\n difference = target - el\n if el == difference\n return true if hash[difference] > 1\n else\n return true if hash[difference] > 0\n end\n end\n false\nend", "def sum_to_n?(array, n)\n\n array_size = array.size\n\n i = 0\n\n while i < array_size do\n argument = array.slice!(0)\n array.each{|x| return true if x + argument == n}\n i += 1\n end\n return false\nend", "def okay_two_sum?(arr, target)\n # arr.sort.bsearch(target)\n # arr.combination(2).any? { |el,el2| return true if el + el2 == target }\n\n sorted = arr.sort\n (0...sorted.lentgh-1).each do |i|\n if arr[i] + arr[i+1] == target \n return true \n end \n end \nend", "def okay_two_sum?(arr, target_sum)\n arr.sort!\n arr.each do |el|\n return true if arr.bsearch { |x| x >= (target_sum - el)}\n end\n false\nend", "def can_be_summed_by_two_abunds?(n, arr)\n i = 0\n while i < arr.length-1\n j = i+1\n while j < arr.length\n if arr[i] + arr[j] == n\n return true\n end\n j+=1\n end\n i+=1\n end\n return false\nend", "def okay_two_sum?(arr, target_sum)\n sorted = arr.sort\n (0...sorted.length).each do |i|\n (i + 1...sorted.length).each do |j|\n return true if sorted[i] + sorted[j] == target_sum\n break if sorted[i] + sorted[j] > target_sum\n end\n end\n false\nend", "def bad_two_sum?(arr, target)\n\n arr.each.with_index do |x, idx|\n arr.each.with_index do |y, idy|\n if idx == idy\n next\n else\n if (x + y) == target\n return true\n end\n end\n end\n end\n\n return false\n\nend", "def sum_to_n?(array,n)\n\n raise 'parameters include non integers' unless \n (array.empty? || array.length == 1 || n.integer? || array.all? { |x| x.integer?})\n\n array.length.times do \n y = array.shift\n if array.any? { |x| x + y == n } \n return true\n end\n end\n return false\nend", "def sum_to_n? arr, n\n result = false\n sum = 0\n if arr.size>1\n arr.each {|num| result = true if num == n}\n end\n \n return result\nend" ]
[ "0.8394237", "0.83940583", "0.830928", "0.827356", "0.81459486", "0.8121386", "0.81028754", "0.7764583", "0.77233285", "0.76961035", "0.7662283", "0.7648399", "0.7640471", "0.7600156", "0.7395936", "0.73931307", "0.7374467", "0.7362017", "0.73169756", "0.7314895", "0.7314512", "0.72898126", "0.728182", "0.725014", "0.72316724", "0.7223527", "0.7173397", "0.715928", "0.71572536", "0.7121282", "0.7117185", "0.708561", "0.70851976", "0.7064803", "0.7058028", "0.7032558", "0.70063186", "0.69973934", "0.6984369", "0.698411", "0.6974111", "0.69731534", "0.6953441", "0.69425094", "0.6937155", "0.6921636", "0.68992627", "0.6899216", "0.6885649", "0.68499684", "0.684739", "0.6842586", "0.68411857", "0.68258667", "0.68162143", "0.6815013", "0.6809677", "0.68052703", "0.68029064", "0.67881745", "0.6788105", "0.67827725", "0.677538", "0.6756826", "0.6738338", "0.6736725", "0.6729093", "0.6728344", "0.6727609", "0.6723588", "0.6719035", "0.6715951", "0.6714347", "0.67118776", "0.6699936", "0.66802794", "0.6679713", "0.6679502", "0.6678455", "0.6662685", "0.6659473", "0.6657415", "0.6646726", "0.6644952", "0.66433156", "0.66349", "0.66341543", "0.6632085", "0.66239506", "0.6621605", "0.6618605", "0.6617968", "0.6610904", "0.6610792", "0.6610399", "0.66085154", "0.66078085", "0.6601605", "0.65915185", "0.6586977" ]
0.82066303
4
A magic number is a number whose digits, when added together, sum to 7. For example, the number 34 would be a magic number, because 3 + 4 = 7. Write a function that finds the first N many magic numbers. You'll want to write a helper function that checks whether a given number is a magic number. Reminder: you can convert an integer to a string using to_s. You can convert a string back to an integer using to_i.
def magic_numbers(count) num = 1 result = [] while result.length < count result << num if is_magic_number?(num) num += 1 end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic_number?(n)\r\n \r\nend", "def magic_number?(n)\n n.to_s.split('').each.map {|ch| ch.to_i}.reduce(:+) == 7 \nend", "def find_primes_magic_value(magic_number)\n @primes = []\n number = 2\n while magic_number > 1\n if magic_number % number == 0\n magic_number /= number\n @primes << number\n end\n number += 1\n end\n\n end", "def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n array.push(index)\n found += 1\n end\n index += 1\n end\n return array\nend", "def magic_numbers(count)\nend", "def featured(num)\n return 'Error! No featured numbers exist over 10 digits!' if num >= 9876543210\n loop do\n num += 1\n break if num.odd? && (num % 7).zero? && num.digits.uniq! == nil\n end\n num\nend", "def featured(num)\n num += 1\n num += 1 until num.odd? && (num % 7).zero?\n loop do\n return num if num.to_s.chars.size == num.to_s.chars.uniq.size\n num += 14\n break if num > 9_876_543_210\n end\n 'There is no possible number that fulfills those requirements'\nend", "def featured(number)\n max = 9_876_543_210\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n loop do\n number_chars = number.to_s.chars\n if number_chars.size == number_chars.uniq.size\n return number\n end\n if number > max\n break\n end\n number += 14\n end\n \"ERROR! No next featured number!\"\nend", "def featured(integer)\n return \"There is no possible number that fulfills those requirements\" if \n integer >= 9_876_543_210\n integer += 1\n until integer % 7 == 0 && integer.odd? && integer.digits.uniq! == nil\n integer += 1\n end\n integer\nend", "def featured(int)\n next_num = 0\n loop do\n next_num = int.succ\n break if next_num.odd? && next_num % 7 == 0\n int = next_num\n end\n loop do\n break if next_num >= 9_876_543_210\n if next_num.to_s.chars.uniq == next_num.to_s.chars\n return next_num\n else next_num += 14\n end\n end\n \"There is no possible number that fulfills those requirements.\"\nend", "def featured(integer)\n return \"Error: There is no possible number that fulfills those requirements\" if integer >= 9_876_543_210\n counter = integer + 1\n counter += 1 until counter % 7 == 0 && counter.odd?\n \n loop do\n return counter if counter.digits.uniq.size == counter.digits.size\n counter += 14\n end\nend", "def featured(int)\n if int >= 9_876_543_210\n return 'There is no possible number that fulfills those requirements.'\n end\n \n featured_num = 0\n until featured_num > int\n loop do\n featured_num += 7\n next if featured_num.even?\n next if featured_num.digits != featured_num.digits.uniq\n break\n end\n end\n featured_num\nend", "def featured(int)\n loop do \n int += 1\n if int.odd? && int % 7 == 0\n return int if int.to_s.chars.uniq == int.to_s.chars\n end\n break if int == 9_999_999\n end\n \"There is no possible number that fulfils those requirements\"\nend", "def featured(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number > 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend", "def featured(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend", "def featured2(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend", "def featured(int)\n for num in (int + 1...9_999_999_999) \n return num if num.odd? && num % 7 == 0 && num.digits == num.digits.uniq\n end\n \"There is no possible number that fulfills those requirements\"\nend", "def featured(num)\n loop do\n num += num % 7 == 0 ? 7 : 1\n num_str = num.to_s.chars\n return num if num.odd? && num % 7 == 0 && num_str.uniq == num_str\n break if num >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend", "def featured(int)\n int += 1\n int += 1 until int % 7 == 0 && int.odd?\n \n loop do\n double_check = int.to_s.split(\"\")\n if double_check.uniq == double_check\n return int\n else\n int += 14\n end \n break if int >= 9_876_543_210 \n end\n \"There is no possible number that fulfills those requirements\"\nend", "def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend", "def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend", "def featured(number)\n number += 1\n\n until number % 7 == 0 && number.odd?\n number += 1\n end\n\n loop do\n if number.digits.uniq == number.digits\n return number\n else\n number += 14\n end\n break if number.digits.size > 10\n end\n\n \"Error\"\nend", "def find_number\n\ti = 0 \n\tnot_found = true\n\twhile not_found \n\t\ti+=1\n\t\t#puts i \n\t\t#puts is_int(f6(i))\n\t\tnot_found = ! is_int(f6(i.to_f))\n\tend\n\ti\nend", "def featured(number)\n featured = 0\n loop do \n number += 1\n if number % 7 == 0 &&\n number.odd? &&\n number.to_s.length == number.to_s.chars.uniq.length\n featured = number\n break\n end\n if number.to_s.length > 10\n puts \"Invalid\"\n featured = 0\n break\n end\n end\n featured\nend", "def featured(num)\n divisor = num / 7\n count = 1\n total = 0\n\n until (count > divisor) && (total.odd? && total > num) \n total = count * 7\n count += 1\n end\n\n loop do\n number_chars = total.to_s.split('')\n return total if number_chars.uniq == number_chars\n total += 7\n break if num >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements'\nend", "def magic_num(str)\t\n\tstr.bytes.reduce(0) {|sum, c_bytes| sum+=c_bytes-64}\nend", "def featured(number)\n loop do\n number +=1\n characters = number.to_s.split('')\n if (number.odd?) && (number % 7 == 0) && (characters.uniq == characters) \n p number\n break\n end \n end \nend", "def featured(num)\n num +=1 \n until num % 7 == 0 && num.odd?\n num += 1\n end\n\n loop do\n return num if num.to_s.chars.uniq == num.to_s.chars\n num += 14\n break if num >= 9_876_543_210\n end\n\n \"Your quest is doomed. There is no featured number beyond these walls.\"\nend", "def digit_match(n, m, sum = 0)\n return n.to_s.length if n == m\n return 1 if n == 0 && m == 0\n\n return digit_match_helper(n, m, sum)\nend", "def get_first_digit n \n n / 10**length(n) \nend", "def digit_match(n, m)\n return 0 if (n % 10 != m % 10)\n \n matches = 0\n\n return match_helper(n, m, matches)\nend", "def digit_match(n, m)\n\nend", "def contains_ten_integers?(fms_number)\n if fms_number.present?\n fms_number.match(/\\A[0-9Vv][0-9SsCc]\\d{8}\\z/)\n end\n end", "def boredFriends(n)\n n.to_i % 9\nend", "def featured(number)\n sum = 7\n loop do \n return \"There is no possible number that fulfills those requirements\" if number >= 9_876_543_210\n if sum <= number\n sum += 7\n elsif sum.even?\n sum += 7\n elsif sum.digits.uniq != sum.digits\n sum += 7\n else\n break\n end\n end\n sum\nend", "def digit_match(n, m)\n if n == 0 || m == 0\n return 0\n end\n if n%10 == m%10\n value = 1\n else\n value = 0\n end\n return value + digit_match(n/10, m/10)\nend", "def create_magic_number(opts = {})\n # defaults\n opts[:rundate] ||= Date.today\n opts[:divisor] ||= 4\n drinking_hash(opts[:rundate], opts[:divisor])\n end", "def featured(n)\n # The next 2 lines guarantees we start with odd multiples of 7 that is higher than n\n n += 1\n n += 1 until n.odd? && n % 7 == 0\n\n while n < 9_876_543_201\n return n if featured?(n)\n n += 14 # this hastens the loop - we only iterate odd multiples of 7\n end\n raise StandardError, \"No more featured number available\"\nend", "def pling_plang_plong(magic_number)\n magicResult = ''\n # If the number contains 3 as a factor, output 'Pling'.\n if magic_number % 3 == 0\n magicResult += 'Pling '\n puts magicResult\n end\n # If the number contains 5 as a factor, output 'Plang'.\n if magic_number % 5 == 0\n magicResult.to_s += 'Plang'\n puts magicResult\n end\n # If the number contains 7 as a factor, output 'Plong'.\n if magic_number % 7 == 0\n magicResult += 'Plong'\n end\n # If the number does not contain 3, 5, or 7 as a factor, output the number as a string.\n if magicResult == ''\n magicResult = number.to_s\n end\nend", "def digit_match(n, m, count = 0, first_run = true)\n raise ArgumentError if !n || !m\n\n return 1 if n == 0 && m == 0 && first_run\n return count if (n == 0) || (m == 0)\n\n count += 1 if (n % 10) == (m % 10)\n return digit_match(n/10, m/10, count, false)\nend", "def persistence(n)\n count = 0\n while n > 9 do\n n = n.digits.inject(:*)\n count += 1\n end\n count\nend", "def featured(integer)\n count = 0\n\n loop do \n break if count >= 9_999_999_999\n count += 7\n if count.odd? && count % 7 == 0 && count.digits.uniq == count.digits && count > integer\n return count\n end\n end\n \"There is no possible number that fulfills those requirements.\"\nend", "def featured_num?(num)\n num.odd? && num % 7 == 0 && num.digits.uniq == num.digits\nend", "def digit_match(n, m)\n if (n / 10 == 0) || (m / 10 == 0)\n return (n % 10 != m % 10) ? 0 : 1\n else\n if (n % 10 == m % 10)\n return 1 + digit_match(n / 10, m / 10)\n else\n return digit_match(n / 10, m / 10)\n end\n end\nend", "def digit_match(n, m)\n if n % 10 == m % 10\n matches = 1\n else\n matches = 0\n end\n \n if n / 10 == 0 || m / 10 == 0\n return matches\n else\n return matches + digit_match(n / 10, m / 10)\n end\nend", "def digit_match(n, m)\n # not enough time to get to this one, will attempt later on own time\n raise NotImplementedError, \"Method not implemented\"\nend", "def featured?(num)\n num.odd? && num % 7 == 0 && num.digits.uniq.size == num.digits.size\nend", "def digit_match(n, m, matches = 0)\n \n if n % 10 == m % 10\n matches += 1\n end\n\n return matches if n < 10 || m < 10 #base-case\n return digit_match(n/10, m/10, matches) \nend", "def featured(n)\n (n..9_999_999_999).each {|number| return number if number_valid?(n, number)}\n return \"There is no possible number that fulfills those requirements.\"\nend", "def featured_num?(num)\n return false unless num.odd?\n return false unless num % 7 == 0\n return false unless num.digits.size == num.digits.uniq.size\n true\nend", "def digit_match(n, m, count = 0)\n # base case\n return 1 if n == 0 && m == 0\n return count if n == 0 || m == 0\n # recursive case\n if n % 10 == m % 10\n return digit_match(n/10, m/10, count + 1)\n else\n return digit_match(n/10, m/10, count)\n end\nend", "def persistence(n)\n n < 10 ? 0 : 1 + persistence(n.digits.reduce(&:*))\nend", "def digit_match(n, m)\n # TODO: Complete this method, could not figure it out\n raise NotImplementedError, \"Method not implemented\"\nend", "def digit_match(n, m)\n return 0 if n == 0 || m == 0\n return 1 + digit_match(n / 10, m / 10) if n % 10 == m % 10\n return digit_match(n / 10, m / 10)\nend", "def digit_match(n, m)\n if (n / 10) < 1 || (m / 10) < 1\n if n % 10 != m % 10\n return 0\n else\n return 1\n end\n end\n \n if n % 10 == m % 10\n return 1 + digit_match((n / 10), (m / 10))\n else\n return digit_match((n / 10), (m / 10))\n end\nend", "def digit_match(n, m)\n result = 0\n return 1 if n == 0 && m == 0\n if n % 10 == m % 10\n result += 1\n end\n if n / 10 == 0 || m / 10 == 0\n return result\n end\n return result + digit_match(n / 10, m / 10);\nend", "def digit_match(n, m)\n digit_match_helper(n, m)\nend", "def digit_match(n, m, matches = 0)\n\n dig1 = n % 10\n dig2 = m % 10\n \n return matches if n == 0 || m == 0\n matches += 1 if dig1 == dig2 \n \n n = n / 10\n m = m / 10\n digit_match(n, m, matches)\n \nend", "def test_number_divisible_by_five\n\t\tassert_equal \"buzz\", FizzBuzz.identify(10)\n\tend", "def digit_match(n, m)\n return 1 if n == 0 && m == 0\n return 0 if n <= 1 || m <= 1 \n return n % 10 == m % 10 ? (1 + digit_match(n / 10, m / 10)) : digit_match(n / 10, m / 10)\nend", "def featured?(num)\n chars = num.to_s.split(//)\n num.odd? && (num % 7).zero? && chars.size == chars.uniq.size\nend", "def digit_fifth_powers\r\n fifth_power_nums = []\r\n#the highest we need to search, 9**5 * 6 = 354294\r\n (1..354294).each do |x|\r\n sum = 0\r\n x.to_s.split(\"\").each do |x|\r\n sum += x.to_i ** 5\r\n end \r\n fifth_power_nums << x if x == sum unless x == 1\r\n end \r\n return fifth_power_nums.reduce(:+)\r\nend", "def digit_match(n, m)\n return match(n, m, 0)\nend", "def digit_match(n, m)\n raise NotImplementedError, \"Method not implemented\"\nend", "def persistence(n, count = 0)\n return count if n < 10\n i = 0\n arr = n.to_s.split('')\n if arr.length > 1\n tot = arr.map(&:to_i).inject(:*)\n i += 1\n count += 1\n tot.to_i >= 10 ? persistence(tot.to_i, count) : count\n end\nend", "def digit_match(n, m)\n raise NotImplementedError, \"Method not implemented\"\nend", "def digit_match(n, m)\n raise NotImplementedError, \"Method not implemented\"\nend", "def digit_match(n, m)\n raise NotImplementedError, \"Method not implemented\"\nend", "def digit_match(n, m)\n # raise NotImplementedError, \"Method not implemented\"\n counter = 0\n if ((n < 10) || (m < 10)) && (n % 10 != m % 10)\n return 0\n end\n\n if ((n < 10) || (m < 10)) && (n % 10 != m % 10)\n return 1\n end\n if n % 10 == m % 10\n match = 1\n else\n match = 0\n end\n return match + digit_match(n / 10, m / 10)\nend", "def phone_number_mnemonics(phone_number)\n current_mnemonic = Array.new(phone_number.length, 0)\n mnemonics_found = []\n\n phone_number_mnemonics_helper(0, phone_number, current_mnemonic, mnemonics_found)\n\n mnemonics_found\nend", "def buzz(int)\n int % 5 == 0\nend", "def digit_match(n, m)\n\ti = 0\n\tcount = 0\n\treturn digit_helper(n.digits, m.digits, i, count)\nend", "def mod11(number); end", "def digit_match(n, m, c = 0)\n\n if n == 0 && m == 0\n return 1\n end \n\n if n == 0 || m == 0\n return c\n end \n\n if n%10 == m%10\n return digit_match(n/10, m/10, c+1)\n else \n return digit_match(n/10, m/10, c)\n end \nend", "def magic_index_binary(array)\n low = 0\n high = array.length #6\n mid = (low + high) / 2 #3\n loop do\n # if array[mid] == 0 && array[0] != 0\n # return \"no magic array\"\n if array[mid] > mid\n # value at array[mid] is 5. 5 is greater than 3. So nothing to the right can be a magic index. We could still have one to the left.\n high = mid #1\n mid = (low + high) / 2 #0\n elsif array[mid] < mid\n # Nothing to the left can be a magic index. We could still have one to the right.\n low = mid\n mid = (low + high) / 2\n elsif array[mid] == mid\n return mid\n else\n break\n end\n end\nend", "def digit_match(n, m, match = 0)\n return count_match if n == 0 || m == 0\n\n n_last = n % 10\n m_last = m % 10\n\n return digit_match(n / 10, m /10, match + 1) if n_last == m_last\n return digit_match(n / 10, m /10, match)\nend", "def luhn? (number)\n\n max_power = number.to_s.length - 1\n\n sum = 0\n\n # 1. Process from right to left: 3 9 8 4\n (0 .. max_power).each do |current_power|\n\n this_digit = extract_nth_digit_from(current_power, number)\n\n # 4. Sum digits\n\n if current_power % 2 != 0\n # 2. Double value of every 2nd digit, starting at offset 1: 3 18 8 8\n sum += value_of_summed_digits_of_this_less_than_100_number(this_digit *= 2)\n else\n sum += value_of_summed_digits_of_this_less_than_100_number(this_digit)\n end\n\n end\n\n\n # 5. Sum mods with 10 == 0 (pass)\n\n sum % 10 == 0\n \nend", "def featured(num)\n # next_num = 7 # assume input is only positive\n closer_num = num / 7 * 7 # to start closer to the next required number instead of starting from 7\n next_num = closer_num.odd? ? closer_num : closer_num + 7 # so that next_num is odd and we can increment by 14 in the while loop\n\n while next_num < 9_999_999_999\n if next_num % 7 == 0 \\\n && next_num.to_s.size == next_num.to_s.chars.uniq.size \\\n && next_num > num\n return next_num\n else\n next_num += 14\n end\n end\nend", "def digit_match(n, m)\n # 1232440340 0 # 1 match\n # 1232440341 0 # no match\n # 12324403 3 # 3 match\n # if n/10 or m/10 == 0\n # if n%10 == m%10 return 1\n # else return 0\n # compare values in ones place n%10 , m % 10\n # if they're the same, return digit_match(n/10, m/10) + 1\n # else return digit_match(n/10, m/10)\n\n if n / 10 == 0 || m / 10 == 0 # base case when n or m is only 1 digit\n if n % 10 == m % 10 # if last digit match\n return 1\n else # if last digit doesn't match\n return 0\n end\n else\n if n % 10 == m % 10\n return digit_match(n / 10, m / 10) + 1\n else\n return digit_match(n / 10, m / 10)\n end\n end\nend", "def fizzbuzz(number)\n return 'FizzBuzz' if number % 15 == 0\n return 'Fizz' if number % 3 == 0\n return 'Buzz' if number % 5 == 0\n return number\nend", "def fizz_buzz number \n#prints numbers from 1 to 200\n #Modulo\n if number % 3 == 0 && number % 5 == 0\n 'FizzBuzz'\n elsif number % 3 == 0\n 'Fizz'\n elsif number % 5 == 0\n 'Buzz'\n else\n return number\n end\n\nend", "def test_number_has_three_in_it\n\t\tassert_equal \"fizz\", FizzBuzz.identify(13)\n\tend", "def digit_match(n, m)\n \n if (n % 10) == (m % 10)\n if n == 0 && m == 0\n return 1\n elsif n == 0 || m == 0\n return 0\n end \n return 1 + digit_match(n/10, m/10)\n else\n if(n / 10 == 0) || (m / 10 == 0) # Used to determine if either number is a single digit\n return 0\n end\n return digit_match(n/10, m/10)\n end\n \n \nend", "def find_loop_size(public_key)\n value = 1\n (1..).find do |loop_size|\n value = value * 7 % 20_201_227\n value == public_key\n end\nend", "def bsfind_magic(arr)\n size = arr.size\n return false if size == 0\n mid_index = (size/2).floor\n # edge case\n # check if start or end of array is magic_index or not\n if size == 1\n if mid_index == arr[mid_index]\n return mid_index\n else\n return false\n end\n end\n # compare index and element of array\n if mid_index > arr[mid_index]\n right_arr = arr[mid_index+1..-1]\n bsfind_magic(right_arr)\n elsif mid_index < arr[mid_index]\n left_arr = arr[0..mid_index-1]\n bsfind_magic(left_arr)\n else\n return arr[mid_index]\n end\n return false\nend", "def digit_match(n, m, match = 0)\n if n.digits.count == 1 || m.digits.count == 1\n if n % 10 == m % 10\n return match +=1\n else\n return match\n end\n else\n if n % 10 == m % 10\n match += 1\n end\n n = n / 10\n m = m / 10\n return digit_match(n, m, match)\n end\nend", "def isFizzBuzz(n) \n\treturn $fizz + $buzz if n % 15 == 0\n\treturn $fizz if n % 3 == 0\n\treturn $buzz if n % 5 == 0\n\treturn n.to_s\nend", "def num_of_num(number)\n\tnumber_of_num=1\n\tnumber_size=number.to_s.size\n while number_size > 1 do\n number_of_num = number_of_num * \tnumber_size\n number_size = number_size - 1 \n end\n return number_of_num\nend", "def digit_match(n, m)\n if (n < 0 || m < 0)\n return 0\n end\n\n if (n == 0 && m == 0)\n return 1\n else\n result = 0\n if (n % 10 == m % 10)\n result+=1\n end\n end\n\n if (n / 10 == 0 || m / 10 == 0)\n return result\n end\n\n return result + digit_match(n / 10, m / 10)\nend", "def digit_match(n, m)\n count = 0\n return 1 if n == 0 && m == 0\n return count if n == 0 || m == 0\n\n if n % 10 == m % 10\n count += 1\n end\n return count if n < 10 || m < 10\n return count + digit_match(n/10, m/10)\nend", "def ifind_magic(arr)\n return false if arr.size == 0\n s = arr[0]\n e = arr[-1]\n magic_arr = []\n i = 0\n while s < e\n return magic_arr if arr[i] != i\n if arr[i] == i\n magic_arr[i] = i\n end\n i += 1\n end\nend", "def digit_match(n, m)\n return 1 if n == 0 && m == 0\n return 0 if n == 0 || m == 0\n return 1 if n.digits[0] == 0 && m.digits[0] == 0\n return 0 + digit_match(n / 10, m / 10) if n % 10 != m % 10\n return 1 + digit_match(n / 10, m / 10) if n % 10 == m % 10\nend", "def test_find_id_by_serial_num\n d = Dog.new({\"name\"=>\"Phoebe\", \"breed\"=>\"Heeler x\", \"age\"=>3, \"serial_num\"=>3, \n \"colour\"=>\"Black tri\", \"description\"=>\"Fearful of people.\", \"temperament_id\"=>13, \"owner_id\"=>1})\n x = Dog.find_id_by_serial_num({\"serial_num\"=>3})\n assert_kind_of(Integer, x)\n end", "def mult_five(number)\n if number%5 === 0\n puts \"#{number} is a multiple of 5.\"\n else\n puts \"#{number} is not a multiple of 5.\" # You need the hash stuff here because you can't add an integer to a string, you idiot.\n end\nend", "def find_the_digit number\n if number / 1000\n thousands = number / 1000\n number = number - thousands*1000\n puts \"thousands: #{thousands}\"\n end\n if number / 100\n hundreds = number / 100\n number = number - hundreds*100\n puts \"hundreds: #{hundreds}\"\n end\n if number / 10\n tens = number / 10\n number = number - tens*10\n puts \"tens: #{tens}\"\n end\n if number / 1\n ones = number / 1\n puts \"ones: #{ones}\"\n end\nend", "def checksum\n @number.to_s.reverse.split('').map.each_with_index do |digit, position|\n digit = digit.to_i\n if position.odd?\n digit = digit * 2\n digit -= 9 if (digit >= 10)\n end\n digit\n end.inject(:+s)\n end", "def generate_check_digit(odd_sum, even_sum)\n (10 - (odd_sum * 3 + even_sum) % 10) % 10\n end", "def fact num\n if num == 0\n 1\n elsif num == 1\n 1\n elsif num == 2\n 2\n elsif num == 10\n 3628800\n end\nend", "def set_magic\n @magic = Magic.friendly.find(params[:id])\n end", "def find_first_num_whose_cube_gr8ter_500(input)\n input.find do |i|\n i ** 3 > 500\n end\n end" ]
[ "0.72970706", "0.7033409", "0.64717877", "0.63664323", "0.630829", "0.621672", "0.61688673", "0.6160541", "0.61272424", "0.60939336", "0.6055924", "0.6055093", "0.60417634", "0.6034535", "0.60342854", "0.59959614", "0.59762275", "0.59742683", "0.59689856", "0.59504205", "0.5842501", "0.5815802", "0.5772568", "0.567764", "0.5674984", "0.56433517", "0.5625297", "0.5529363", "0.54987717", "0.5464622", "0.54622245", "0.5449456", "0.5424407", "0.5422367", "0.54147565", "0.5409434", "0.54066426", "0.5388479", "0.5360627", "0.53464216", "0.532939", "0.5294836", "0.5281155", "0.52799654", "0.52773106", "0.52748275", "0.5259271", "0.52592576", "0.52590775", "0.5244708", "0.524005", "0.5215203", "0.52145123", "0.5204054", "0.52031696", "0.51999635", "0.5185874", "0.5185371", "0.5160539", "0.51491994", "0.5147301", "0.5143318", "0.51399755", "0.513751", "0.5135386", "0.5132964", "0.5132964", "0.5132964", "0.51297545", "0.5119354", "0.51150316", "0.5106734", "0.51022387", "0.5095089", "0.5094329", "0.5094258", "0.50870764", "0.50849557", "0.5079452", "0.5077969", "0.50778556", "0.5077315", "0.50711006", "0.5059468", "0.5058884", "0.50582933", "0.5052588", "0.5044561", "0.5042646", "0.50223595", "0.5010559", "0.5009555", "0.5003537", "0.49990815", "0.49945092", "0.4983164", "0.4981852", "0.49815467", "0.4980683", "0.49740377" ]
0.6747305
2
describe "initial_round" do it "calls on deal_card twice and returns the sum" do expect(self).to receive(:deal_card).at_least(:twice).and_return(6) expect(initial_round).to eq(12) end it "calls on the 'display_card_total' to print sum of cards" do expect(self).to receive(:deal_card).at_least(:twice).and_return(6) expect($stdout).to receive(:puts).with(/Your cards add up to /) initial_round end end
def hit?(card_total) # code hit? here end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_round\n display_card_total(deal_card + deal_card)\n # binding.pry\nend", "def initial_round\n card_total = deal_card + deal_card\n display_card_total(card_total)\n card_total\nend", "def initial_round\n total = deal_card + deal_card\n display_card_total(total)\n return total\nend", "def initial_round\n total = deal_card + deal_card\n display_card_total(total)\n total\nend", "def test_cards_total()\n assert_equal(\"You have a total of 4\", @cardgame.cards_total([@card1, @card2]))\n end", "def runner\n welcome\n initial_total = initial_round # prints and returns sum of two cards\n curr_total = hit?(initial_total)\n display_card_total(curr_total)\n until curr_total > 21\n hit?(curr_total)\n curr_total = hit?(curr_total)\n display_card_total(curr_total)\n end\n end_game(curr_total)\nend", "def test_number_correct_still_equals_1\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess_1 = round.record_guess({value: \"3\", suit: \"Hearts\"})\n new_guess_2 = round.record_guess({value: \"Jack\", suit: \"Diamonds\"})\n assert_equal 50.0, round.percent_correct\nend", "def display_card_total(total)\n puts \"Your cards add up to #{total}\"\nend", "def runner\n welcome \n card_total = initial_round\n new_total = hit?(card_total)\n if new_total > 21\n end_game(new_total)\n # binding.pry\n else\n hit?(new_total)\n end\nend", "def xtest_can_play_one_round_and_receive_the_players_score\n flexmock(game).should_receive(:random_number).and_return(\"2\")\n assert_equal(3, 'x')\n end", "def display_card_total(card_total)\n puts \"Your cards add up to #{card_total}\"\n card_total\nend", "def test_add_goals_to_opposing_team\n game_team_win = GameTeam.new({\n :game_id => \"201203022015\",\n :team_id => \"3\",\n :result => \"WIN\",\n :goals => \"4\"\n })\n \n game_team_loss = GameTeam.new({\n :game_id => \"201203022015\",\n :team_id => \"3\",\n :result => \"LOSS\",\n :goals => \"4\"\n })\n \n GameTeam.stub(:all_game_teams, [game_team_win, game_team_loss]) do\n expected = IncrementalAverage.new\n expected.add_sample(4)\n expected.add_sample(4)\n \n assert_equal expected.average, Defense.add_goals_to_opposing_team[\"3\"].average\n end\n end", "def test_number_correct_still_equals_1\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess_1 = round.record_guess({value: \"3\", suit: \"Hearts\"})\n new_guess_2 = round.record_guess({value: \"Jack\", suit: \"Diamonds\"})\n assert_equal 1, round.number_correct\nend", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total > 21\ncard_total = hit?(card_total)\ndisplay_card_total(card_total)\nend \nend_game(card_total)\nend", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total > 21\ncard_total = hit?(card_total)\ndisplay_card_total(card_total)\nend_game(card_total)\nend\nend", "def runner\n # calls on the #welcome method\n welcome\n # then on the #initial_round method, \n running_total = initial_round\n # then calls #hit? and #display_card_total methods\n until running_total > 21\n running_total = hit?(running_total)\n display_card_total(running_total)\n end\n # -until- the card sum is greater than 21,\n # then calls on the #end_game method\n end_game(running_total)\nend", "def runner(current_card_total)\n welcome\n initial_round\n until current_card_total>21\n hit?(sum)\n display_card_total(card_total)\n end\n end_game\nend", "def test_number_correct_equals_1\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess = round.record_guess({value: \"3\", suit: \"Hearts\"})\n assert_equal 1, round.number_correct\nend", "def runner\n welcome\n card_sum = initial_round\nuntil card_sum > 21\n new_value = hit?(card_sum)\n card_sum = new_value\n display_card_total(card_sum)\nend\nend_game(card_sum)\nend", "def stub_cartage_run(*expected)\n expected = [expected].flatten(1)\n stub_instance_method Cartage, :run, ->(v) { assert_equal expected.shift, v } do\n yield\n end\n assert_empty expected\n end", "def runner\n welcome\n card_sum = initial_round\n card_sum\n card_sum = hit?(card_sum)\n display_card_total(card_sum)\n until card_sum > 21\n hit?(card_sum)\n display_card_total(card_sum)\n end\n end_game(card_sum)\nend", "def runner\n # code runner\n welcome #welcome method called \n card_total = initial_round # variable card_total store information from initial_round method\n until card_total > 21 #until loop used to continue loop until card_total > 21\n card_total = hit?(card_total)\n \n display_card_total(card_total)\n end\n\n end_game(card_total) #endgame when card total is more than 21\nend", "def runner\n welcome\n card = hit?(initial_round)# code runner here\n until card > 21\n display_card_total(card)\n card += hit?(deal_card)\n end\n display_card_total(card)\n end_game(card)\nend", "def runner\n welcome\n\n num = initial_round #sum of 2 first cards\n num\n\n until num > 21\n num = hit?(num) #type h or s, if s return initial_round, if h return new sum\n display_card_total(num) #total is num\n end\n\n end_game(num)\n\nend", "def runner\n welcome\n card_total = initial_round\nuntil card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend\nend_game(card_total)\nend", "def runner\n welcome\n hand = hit?(initial_round)\n until hand > 21\n display_card_total(hand)\n hand += hit?(deal_card)\n end\n display_card_total(hand)\n end_game(hand)\nend", "def runner\n # code runner here\ncard_total = 0\nwelcome\ncard_total = initial_round\nuntil card_total > 21\ncard_total = hit? (card_total)\ndisplay_card_total (card_total)\nend\nend_game (card_total)\nend", "def runner\n welcome\n # initial_round\n cardTotal = initial_round\n until cardTotal > 21\n cardTotal = hit? cardTotal\n display_card_total cardTotal\n end\n end_game cardTotal\nend", "def runner\n welcome\n cards_counter = initial_round\n\n until cards_counter > 21\n compare = hit?(cards_counter)\n compare == cards_counter ? display_card_total(cards_counter):display_card_total(compare)\n cards_counter = compare\n end\nend_game(cards_counter)\nend", "def runner\n welcome\n\ncard = hit?(initial_round)\nuntil card > 21\ndisplay_card_total(card)\ncard = hit?(card)\nend\ndisplay_card_total(card)\noutput = end_game(card)\noutput\nend", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total >21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend\n end_game(card_total)\nend", "def runner\n welcome\n card_total = initial_round\n until card_total > 21\n card_total =+ hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def runner\r\n welcome\r\n num = initial_round\r\n numAfter = hit?(num)\r\n display_card_total(numAfter)\r\n end_game(numAfter)\r\nend", "def runner\n welcome\n card_total = initial_round\n card_total = hit?(card_total)\n display_card_total(card_total)\n until card_total > 21\n end \n end_game(card_total)\nend", "def runner\n welcome #welcomes player \n cardtotal = initial_round #stores the two cards from the first dealing\n until cardtotal > 21 #until their card total is greater than 21\n cardtotal = hit?(cardtotal) #set the new card total equal to the player's decision\n display_card_total(cardtotal)\n if cardtotal == 21\n puts \"You cards add up to #{cardtotal}! Blackjack!\"\n return\n end\n end\n end_game(cardtotal) #ends the game and returns player's cardtotal\nend", "def test_calculate_total_price\n assert_equal(26.5776,Stub.new.calculate_total_price(23.52,3.0576))\n end", "def runner\n # code runner here\nwelcome\ncard_total = initial_round\nuntil card_total > 21\ncard_total = hit?(card_total)\ndisplay_card_total(card_total)\nend\nend_game(card_total) \nend", "def runner\n # code runner here\n welcome\n card_total=initial_round\n until card_total >21\n card_total=hit?(card_total)\n display_card_total(card_total)\nend\n end_game(card_total) \nend", "def runner\n welcome\ncard_total =0\nuntil card_total >= 21\ninitial_round\nhit?(card_total)\nend\nend_game\n\nend", "def runner\n welcome\n cardTotal= initial_round\n until cardTotal > 21\n cardTotal = hit?(cardTotal)\n display_card_total(cardTotal)\n end\n end_game(cardTotal)\nend", "def runner\n welcome\n total = initial_round\n hit?(total)\n display_card_total(total)\n until total >= 21\n hit?(total)\n display_card_total(total)\n end\nend_game\nend", "def runner\n welcome\n users_hand = initial_round\n card_total = users_hand\n \n until card_total >= 21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend \nend_game(card_total)\nend", "def runner\n welcome\n card_sum = initial_round\n until card_sum > 21\n card_sum = hit?(card_sum)\n display_card_total(card_sum)\n card_sum\n end\nend_game(card_sum)\nend", "def runner\n # code runner here\n welcome\n card = initial_round\n card = hit?(card)\n if card > 21\n end_game(card)\n end\n display_card_total(card)\n\n\nend", "def deal(draw_amount, round)\r\n\t@betting_round += 1\r\n\tputs \"Dealer is dealing the #{round}...\"\r\n\tdraw_amount.times {@table.board << @table.deck.draw}\r\n\tputs \"Cards on the board: #{@table.board.join(' ')}\"\r\nend", "def test_guess_response\n card = Card.new(\"10\", \"Hearts\")\n guess = Guess.new(\"10 of Hearts\", card)\n\n #assert_equal guess.response, \"#{@card.value} of #{@card.suit}\"\n end", "def runner\n welcome\n card_total = initial_round #score after 1st two cards\n until card_total > 21\n card_total = hit?(card_total) #prompt user for h or s until card totals more than 21\n display_card_total(card_total) #shows user their total\n end\nend_game(card_total) #considers card total and outputs game over message\nend", "def runner\n welcome\n begnum = initial_round\n final = hit?(begnum)\n display_card_total(final)\n until final >21\n res = hit?(final)\n display_card_total(res)\n end\n puts \"Sorry, you hit #{final}. Thanks for playing!\"\nend", "def runner\n total = initial_round\n welcome\n while total < 21\n hit?(total)\n total += deal_card\n display_card_total(total)\nend_game(total)\nend\nend", "def runner\n welcome\n card_total = initial_round\n\n until card_total > 21\n \n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n return end_game(card_total)\nend", "def runner\n welcome\n card_sum = 0\n card_sum += initial_round\n\n until card_sum > 21\n card_sum = hit?(card_sum)\n display_card_total(card_sum)\n end\n\n end_game(card_sum)\nend", "def test_number_of_guesses_equals_2\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess_1 = round.record_guess({value: \"3\", suit: \"Hearts\"})\n new_guess_2 = round.record_guess({value: \"Jack\", suit: \"Diamonds\"})\n assert_equal 2, round.guesses.count\nend", "def runner\n welcome\n card_sum = initial_round\n until card_sum > 21\n card_sum = hit?(card_sum)\n display_card_total(card_sum)\n end\nend_game(card_sum)\n\nend", "def test_it_evaluates_card_value_when_same\n card = Card.new(\"10\",\"Hearts\")\n response = \"10 of Clubs\"\n guess = Guess.new(response, card)\n assert_equal :same, Evaluation.evaluate_value(guess)\n end", "def test_all_planes_can_land_then_all_planes_in_airport_can_takeoff \n airport2 = Airport.new(6)\n airport2.stub :weather_conditions, \"sunny\" do\n 6.times do |i|\n plane = Plane.new(i)\n airport2.land(plane)\n end\n end\n \n assert airport2.full? \n\n airport2.planes.each do |plane|\n assert_equal 'landed', plane.status\n end \n\n airport2.stub :weather_conditions, \"sunny\" do\n airport2.planes.each do |plane|\n airport2.take_off(plane)\n assert_equal 'flying', plane.status\n end \n end\n\n puts airport2.planes.count\n end", "def runner\n welcome\n card_total=initial_round\n begin\n deal_card\n card_total=hit?(card_total)\n display_card_total(card_total)\nend until card_total>21 \nend_game(card_total)\nend", "def runner\n welcome\n cardTotal = initial_round\n until cardTotal > 21\n cardTotal = hit?(cardTotal)\n display_card_total(cardTotal)\n end\n end_game(cardTotal)\nend", "def runner\n welcome\n cardTotal = initial_round\n until cardTotal > 21\n cardTotal = hit?(cardTotal)\n display_card_total(cardTotal)\n end\n end_game(cardTotal)\nend", "def runner\n welcome\n card_total = initial_round\n while card_total < 21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend\nend_game(card_total)\nend", "def runner\n # code runner here\n welcome \n num = initial_round\n total = hit?(num)\n display_card_total(total)\n if total<=21\n num1 = hit?(num)\n total += num1\n else end_game(total)\n end\nend", "def runner\n welcome\n card_total = initial_round\n until card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\n\n\nend", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total > 21 \n card_total = hit?(card_total)\n display_card_total(card_total)\nend\nend_game(card_total)\nend", "def runner\n welcome\n sum = initial_round\nuntil sum > 21\n sum = hit?(sum)\n display_card_total(sum)\nend\n end_game(sum)\nend", "def runner\n # code runner here\n # total=0\n welcome\n input=initial_round\n until input > 21 \n input=hit?(input)\n display_card_total(input)\nend\nend_game(input)\nend", "def runner\n welcome\n sum = initial_round #this line accomplishes the same goal as the above line. It calls initial round while simultaneously assigning it a variable\nuntil sum > 21 do\n sum = hit?(sum)\n display_card_total(sum)\n end\n end_game(sum)\nend", "def runner\n welcome\n total = initial_round\n until total > 21\n total = hit?(total)\n display_card_total(total)\nend\nend_game(total)\n\nend", "def runner\r\n welcome \r\n total = initial_round #tricky too \r\n until total > 21\r\n total = hit?(total) #tricky part \r\n display_card_total(total)\r\n \r\n end\r\nend_game(total)\r\nend", "def runner\n welcome\n total = initial_round\n until total > 21\n total = hit?(total)\n display_card_total(total)\n end \nend_game(total)\nend", "def runner\n welcome\n card_total=initial_round\n until card_total>21\n card_total=hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def runner\n welcome\n card_sum = initial_round\n \n until card_sum > 21 do\n card_sum = hit?(card_sum)\n display_card_total(card_sum)\n end\n \n end_game(card_sum)\n \nend", "def runner\nwelcome\ncardtotal = initial_round\n until cardtotal > 21\n cardtotal = hit? (cardtotal)\n display_card_total(cardtotal)\n end\n end_game(cardtotal)\nend", "def runner\nwelcome\ncard_total = initial_round\nwhile card_total < 21\ncard_total = hit?(card_total)\ndisplay_card_total(card_total)\nend\nend_game(card_total)\nend", "def runner\n welcome\n sum = initial_round\n until sum > 21\n sum = hit?(sum)\n display_card_total(sum)\n end\nend_game(sum)\nend", "def runner\n welcome\n total = initial_round\n #binding.pry\n until total > 21 do\n total = hit?(total)\n display_card_total(total)\n #binding.pry\n end\n end_game(total)\nend", "def runner\n welcome \n subTotal = initial_round\n until subTotal > 21\n subTotal = hit?(subTotal)\n display_card_total(subTotal)\n end\nend_game(subTotal)\nend", "def runner\n welcome\n card_total = initial_round # first round delt cards\n\n until card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n\n end_game(card_total)\nend", "def runner\nwelcome\ncards=initial_round\ncards=hit?(cards)\ndisplay_card_total(cards)\nwhile cards<21\n cards=hit?(cards)\nend\nend_game(cards)\nend", "def runner\n # code runner here\n welcome\n card = initial_round\n sum = 0\n until sum > 21\n sum += hit?(card)\n display_card_total(sum)\n end\n return end_game(sum)\nend", "def runner\nwelcome\ncard_total = initial_round \n until card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end \n end_game(card_total)\nend", "def test_any_chance_of_working \n assert_equal(true, credit_cards(:cc_no_statuses_live).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_no_statuses_live).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_no_statuses_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_no_statuses_expired).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_expired).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_expired).any_chance_of_working?(true))\n\n assert_equal(true, credit_cards(:cc_one_status_gateway).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_gateway).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_addrnomatch).any_chance_of_working?)\n assert_equal(false, credit_cards(:cc_one_status_addrnomatch).any_chance_of_working?(true))\n \n end", "def runner\nwelcome\ncard_total = initial_round\nwhile card_total < 21\ncard_total=hit?(card_total)\ndisplay_card_total(card_total)\nend\nend_game(card_total)\nend", "def runner\n # code runner here\n welcome\n total = initial_round\n until total > 21\n total = hit?(total)\n display_card_total(total)\nend\nend_game(total)\nend", "def runner\n welcome\n card_total = initial_round\n until card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def runner\n welcome\n card_total = initial_round\n until card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def runner\n welcome\n card_total = initial_round\n until card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def test_it_can_average\n calc = Calculator.new\n numbers1 = [1, 2, 3, 4, 5]\n numbers2= [2, 3, 4]\n\n\n #can also call result actual\n result1 = calc.total (numbers)\n result2 = calc.total(numbers2)\n result3= calc.average([0,10])\n\n assert_equal 15, expected1\n assert_equal 9, expected2\n assert_equal 7, expected1\n assert_equal 3, expected2\n\nend", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend\nend_game(card_total)\n\n\n\n # code runner here\nend", "def runner\n welcome\n card_sum = initial_round\n \n while card_sum <= 21\n card_sum = hit?(card_sum)\n display_card_total(card_sum)\n end\n \nend_game(card_sum)\n \nend", "def runner\n welcome\n card_total = initial_round\n until card_total > 21 \n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def runner\n\n welcome\n card_total = initial_round\n until card_total > 21 do\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\n\nend", "def runner\n welcome\n cardtotal = initial_round\n until cardtotal > 21\n cardtotal = hit?(cardtotal)\n display_card_total(cardtotal)\nend\nend_game(cardtotal)\n # code runner here\nend", "def runner\n welcome\n total=initial_round\n until total>21\n total = hit?(total)\n display_card_total(total)\n end\nend_game(total)\nend", "def runner\n # code runner here\n welcome\n sum=initial_round\n until sum > 22\n sum=hit?(sum)\n display_card_total(sum)\n end\n end_game(sum)\nend", "def runner\n welcome\n card_total = initial_round\n until card_total >= 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def dealer_method\n\tdcard1 = deck.sample\n\tdcard2 = deck.sample\n\tputs \"The dealer's cards are #{dcard1} and #{dcard2}. His total is currently #{dealer_total}\"\n\t\tif dealer_total > 21\n\t\t\tputs \"Dealer Busts\"\n\t\telsif dealer_total < 17 \n\t\t\tputs \"Dealer needs to draw\"\n\t\t\tdealer_draw\n\t\telse dealer_total >= 17 && dealer_total <= 21 \n\t\t\tcompare_method \n\t\tend \nend", "def runner\n # code runner here\n \n theSum = 0 \n \n welcome\n theSum = initial_round\n until(theSum > 21)\n theSum = hit?(theSum)\n display_card_total(theSum)\n end\nend_game(theSum)\nend", "def runner\n # code runner here\n \n welcome\n card_total = initial_round\n until card_total > 21 \n card_total = hit?(card_total)\n display_card_total(card_total)\n end \n end_game(card_total)\nend", "def runner\n # code runner here\n running_total = 0\n welcome\n running_total += initial_round\n until running_total > 21 do\n running_total = hit?(running_total)\n display_card_total(running_total)\n end\nend_game(running_total)\nend", "def runner\n welcome()\n curr_sum = initial_round()\n until curr_sum > 21\n \n curr_sum = hit?(curr_sum)\n display_card_total(curr_sum)\n end\n end_game(curr_sum)\nend", "def runner\n welcome\n running_total = initial_round \n while running_total < 22 \n running_total = hit?(running_total) \n display_card_total(running_total)\n end\n end_game(running_total)\nend", "def runner\r\n welcome\r\n card_total = initial_round\r\n until card_total > 21\r\n card_total = hit?(card_total)\r\n display_card_total(card_total)\r\n end\r\n end_game(card_total)\r\nend" ]
[ "0.6851482", "0.6777375", "0.67634237", "0.6745637", "0.6612278", "0.63837755", "0.6380489", "0.63374615", "0.6334782", "0.6315005", "0.6227981", "0.62184477", "0.61767113", "0.61735654", "0.6167525", "0.6162733", "0.6161246", "0.61575246", "0.61502117", "0.6150105", "0.61466837", "0.6140985", "0.6136605", "0.6107012", "0.60976243", "0.6093727", "0.60929435", "0.60855806", "0.60732424", "0.6069894", "0.6067057", "0.6063007", "0.60543853", "0.60471714", "0.60405225", "0.60389507", "0.60383695", "0.6034737", "0.60288274", "0.60199624", "0.6017702", "0.60164666", "0.60143286", "0.60073256", "0.6005137", "0.60032815", "0.60027194", "0.59995985", "0.5997983", "0.5996959", "0.5988794", "0.5988018", "0.5985766", "0.5984336", "0.5979809", "0.59721243", "0.5971496", "0.5971496", "0.5971478", "0.59710777", "0.59696347", "0.5965779", "0.5965705", "0.5965378", "0.5961984", "0.5961637", "0.5958542", "0.595593", "0.59555006", "0.595498", "0.5954546", "0.59452844", "0.5942243", "0.59373933", "0.5934465", "0.5930198", "0.591077", "0.59076923", "0.5904358", "0.5904126", "0.5901166", "0.59007156", "0.5898333", "0.5898333", "0.5898333", "0.5891648", "0.58892787", "0.5888123", "0.58865243", "0.5881811", "0.5881473", "0.58756804", "0.5874726", "0.5868548", "0.58678675", "0.5866231", "0.5859925", "0.58587945", "0.5857251", "0.58472866", "0.58459306" ]
0.0
-1
Turn a large number into 3digit chunks
def chunkify(number) chunks = [] while number > 0 number, chunk = number.divmod(1000) chunks << chunk end chunks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_by_hundreds(num)\n str = num.to_i.to_s\n a = []\n str.split(//).reverse.each_slice(3) { |slice| a << slice }\n\n t = str.length % 3\n t = 3-t if t>0\n for i in 1..t\n a << 0\n end\n\n new_a = []\n a.each do |item|\n new_a << item\n end\n\n new_a.flatten.join\nend", "def split_in_three(number, length1, length2)\n [number.slice(0, length1), number.slice(length1, length2), number.slice(length1 + length2, 10)]\n end", "def convert_3_digits_number(value)\n word = ''\n division_result = value / 100\n mod_result = value % 100\n\n if division_result > 0\n word = \"#{LESS_THAN_20[division_result]} hundred\"\n word = \"#{word} \" if mod_result > 0\n end\n\n word = \"#{word}#{convert_2_digits_number(mod_result)}\" if mod_result > 0\n word\n end", "def split_into_parts\n number = integer.to_i\n\n @parts = [\n number / 10**8,\n (number / 10**4) % 10**4,\n number % 10**4\n ]\n end", "def triple_digit_breakdown(digits_hash)\n base_nums = {0=>'', 1=>'one', 2=>'two', 3=>'three', 4=>'four', 5=>'five', 6=>'six', 7=>'seven', 8=>'eight', 9=>'nine'}\n ten_to_nineteen = {10=>'ten', 11=>'eleven', 12=>'twelve', 13=>'thirteen', 14=>'fourteen', 15=>'fifteen', 16=>'sixteen', 17=>'seventeen', 18=>'eighteen', 19=>'nineteen'}\n multiples_of_ten = {0=>'', 2=>'twenty ', 3=>'thirty ', 4=>'forty ', 5=>'fifty ', 6=>'sixty ', 7=>'seventy ', 8=>'eighty ', 9=>'ninety '}\n\n ones = digits_hash[1]\n tens = digits_hash[2]\n hundreds = digits_hash[3]\n\n val_str = hundreds > 0 ? \"#{base_nums[hundreds]} hundred \" : \"\"\n val_str += tens == 1 ? ten_to_nineteen[(tens*10)+ones] : multiples_of_ten[tens] + base_nums[ones]\n end", "def separate_comma(integer)\n if integer >= 1000\n number_array = integer.to_s.split(\"\").reverse\n counter = 0\n array_for_reverse = []\n number_array.each do |digit|\n if counter % 3 == 0 && counter != 0\n array_for_reverse << \",\"\n end\n array_for_reverse << digit\n counter += 1\n end\n final = \"\"\n array_for_reverse.reverse.each do |digit|\n final << digit\n end\n else\n final = integer.to_s\n end\n return final\nend", "def break_number(num,short_scale)\n first_slice = (num.to_s.size - short_scale.to_s.size ) if num == short_scale\n first_slice = (num.to_s.size - (short_scale.to_s.size - 3) ) if num < short_scale\n first = num.to_s.slice(0..first_slice)\n second = num.to_s.slice(first.size..num.to_s.size)[0]\n return first,second\n end", "def dynamic_chunk(base_ten_num) #=>inncludes first 1 in output\n base_two_num = binarify(base_ten_num)\n base_two_num.slice(static_chunk(base_ten_num).length..(base_two_num.length - 1))\nend", "def split_number(start)\r\r\n number = []\r\r\n number[0] = start / 1000 / 1000\r\r\n number[1] = start / 1000 % 1000\r\r\n number[2] = start % 1000\r\r\n return number\r\r\n end", "def expanded_form(num)\n size = num.to_s.size\n result = []\n i = 1\n while i < size\n rest = num % 10**i\n num -= rest\n result.unshift(rest)\n i += 1\n end\n result.unshift(num).delete(0)\n result.join(\" + \")\nend", "def separate_comma(integer)\n comma_array = []\n array_of_strings = integer.to_s.reverse.split(//)\n array_of_strings.each_slice(3){|triple_digits| comma_array << triple_digits}\n comma_array = comma_array.map{|numbers| numbers.join}\n comma_array.join(\",\").reverse\nend", "def to_digits(n = 3)\n str = self.to_s\n return str if str.size >= n\n ret = \"\"\n (n - str.size).times { ret += \"0\" }\n return ret + str\n end", "def commify(number)\n\t\t\tc = { :value => \"\", :length => 0 }\n\t\t\tr = number.to_s.reverse.split(\"\").inject(c) do |t, e| \n\t\t\tiv, il = t[:value], t[:length]\n\t\t\tiv += ',' if il % 3 == 0 && il != 0 \n\t\t\t{ :value => iv + e, :length => il + 1 }\n\t\tend\n\t\tr[:value].reverse!\n\tend", "def split_number(start)\n number = []\n number[0] = start / 1000 / 1000\n number[1] = start / 1000 % 1000\n number[2] = start % 1000\n return number\n end", "def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n end\nend", "def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n p number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n p a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n n -= 4\n end\n p a.join(\"\")\n end\nend", "def separate_comma (number)\n a = number.to_s.chars.to_a.reverse\n b = a.count/3\n if a.count < 4\n return number.to_s\n elsif a.count == 6\n a.insert(3, \",\")\n return a.join.reverse\n elsif\n c = 3\n b.times do |n|\n a.insert(c, \",\")\n c = c +4\n end\n return a.join.reverse\n end\nend", "def separate_comma_initial(integer)\n a = integer.to_s\n b = a.length\n if b <= 3\n \treturn a\n elsif b > 3\n \tif (b) % 3 == 0\n# So I will attempt to replace 3 with n, and have n change (length/3 - 1) amount of times.\n# I need to figure out how to incorporate a -= counter for n that runs length/3 amount of times.\n# I could make the n in .insert(n, \",\") equal to the number of commas * 3 and use -= to take 3 away\n# from n (length/3-1) amount of times.\n \t\tnumber_of_commas1 = ((b / 3) - 1)\n \t\tn = 3 * number_of_commas1\n \t\tnumber_of_commas1.times do \n \t\ta.insert(n, \",\")\n \t\tn -= 3\n \t\tend\n \t\treturn a\n\n \telsif (b - 1) % 3 == 0\n# This was much easier - I copied and pasted the above, and changed length/3-1 to length-1/3 and n\n# to the number of commas times 3 minus 2.\n\t\tnumber_of_commas2 = ((b - 1) / 3)\n \t\tn = (3 * (number_of_commas2)) - 2\n \t\tnumber_of_commas2.times do \n \t\ta.insert(n, \",\")\n \t\tn -= 3\n \t\tend\n \t\treturn a\n\n \telsif (b - 2) % 3 == 0\n# Similarly, I changed this to length minus 2 divided by 3, and n to number of commas times 3\n# minus 1.\n \t\tnumber_of_commas3 = ((b - 2) / 3)\n \t\tn = (3 * (number_of_commas3)) - 1\n \t\tnumber_of_commas3.times do \n \t\ta.insert(n, \",\")\n \t\tn -= 3\n \t\tend\n \t\treturn a\n\n \tend\n end\nend", "def number_shuffle(number)\n def create_array(three_num_arr)\n result = []\n three_num_arr.each_char do |n|\n sub_string = three_num_arr.delete n\n sub_string.each_char do |s|\n result << (n + s + (sub_string.delete s)).to_i\n end\n end\n return result\n end\n \n result_arr = []\n string_num = number.to_s\n if (string_num.length == 3) \n result_arr = create_array(string_num)\n else \n string_num.each_char do |j|\n create_array(string_num.delete j).each do |i|\n result_arr << j.to_i*1000 + i\n end\n end\n \n end\n puts result_arr\n\n \n\nend", "def convert_to_numbers(multiline_digit)\n chunked = multiline_digit.map { |line| line.chars.each_slice(3).to_a }.transpose\n numbers = chunked.map { |digit| DIGIT_DICTIONARY[digit.flatten.join] ||= \"?\" }\n numbers.join('')\nend", "def first_3_digits_round_down(num, n)\n num.to_s.chars.map.with_index{ |c, i| n > 2 ? \"0\" : c }.join.to_i\nend", "def persistence(n)\n multiples = []\n until n.to_s.chars.count < 2 do\n n = n.to_s.chars.map(&:to_i).inject(:*)\n multiples << n\n end\n multiples.count\nend", "def getThreeDigitNumberStr(thrDigitVal)\n\t\tnumStr = \"\"\n\t\tunless getNumberAsStr[thrDigitVal].blank?\n\t\t\tnumStr = getNumberAsStr[thrDigitVal]\n\t\telse\n\t\t\tif thrDigitVal > 0\n\t\t\t\thundredStr = getNumberAsStr[thrDigitVal/100].blank? ? \"\" : (getNumberAsStr[thrDigitVal/100] + \" \" + l(:label_hundred))\n\t\t\t\ttwoDigStr = getTwoDigitNumberStr(thrDigitVal%100)\n\t\t\t\tnumStr = hundredStr.blank? || twoDigStr.blank? ? (hundredStr + twoDigStr) : (hundredStr + \" \"+ l('support.array.sentence_connector') + twoDigStr)\n\t\t\tend\n\t\tend\n\t\tnumStr = \" \" + numStr unless numStr.blank?\n\t\tnumStr\n\tend", "def find_mult_3(num)\n nums = num.digits\n i = 1\n array = []\n until i > nums.count\n a = nums.permutation(i).to_a.map{ |num| num.join.to_i }\n b = a.select{|num| num != 0 && num % 3 == 0}\n array << b.uniq\n i += 1\n end\n result = array.flatten.uniq\n return [result.count, result.max]\nend", "def represent(number, in_base:)\n digits = \"\"\n\n while number > 0\n digits = CHARS[number % in_base] + digits\n number = number / in_base\n end\n\n digits\n end", "def persistence(n)\n count = 0\n while n > 9 do\n n = n.digits.inject(:*)\n count += 1\n end\n count\nend", "def three_digit_format(n)\r\n # your code here\r\n n.to_s.rjust(3, \"0\")\r\nend", "def separate_comma(number)\nstring = number.to_s\n\nif number < 1000 then\n string\n return string\n\nelsif (string.length % 3) != 0 then\n num_of_comma = (string.length / 3)\n gnirts = string.reverse\n x = 3\n i=0\n until i == num_of_comma\n gnirts.insert(x, \",\")\n i += 1\n x += 4\n end\n return gnirts.reverse\n\nelse (string.length % 3) == 0\n num_of_comma = ((string.length / 3) - 1)\n gnirts = string.reverse\n x = 3\n i=0\n until i == num_of_comma\n gnirts.insert(x, \",\")\n i += 1\n x += 4\n end\n return gnirts.reverse\nend\nend", "def to_text(number, version = :gb)\n unless number.is_a?(String) || number.is_a?(Integer)\n raise ArgumentError.new 'Only Integer or String (that converts to integer) can be parsed'\n end\n\n version = version.to_sym if version.is_a? String\n unless [:uk, :gb, :us].include? version\n raise ArgumentError.new 'Only :uk, :gb or :us versions can be generated'\n end\n\n number = number.to_s if number.is_a? Integer\n number.strip!\n\n # strip prefix\n number[0] = '' if number[0] == '+' or number[0] == '-'\n\n # 0\n return 'zero' if number.length == 1 and number == '0'\n\n # 1..999\n return get_hundreds number, version if number.length < 4\n\n # 999 <\n i = 0\n portions = []\n portion_block = []\n number.reverse!\n\n number.each_char do |c|\n portion_block.push c\n i += 1\n\n if i % 3 == 0\n block_clone = portion_block.clone\n portions.push block_clone\n portion_block.clear\n i = 0\n end\n end\n\n portions.push portion_block unless portion_block.empty?\n portions.reverse!\n\n final_number = ''\n i = portions.length - 1\n portions.each do |p|\n p.reverse!\n p_in_text = get_hundreds(p.join.to_i.to_s, version)\n final_number += p_in_text\n final_number += ' ' + @scale[i] + ' ' if p_in_text != ''\n i -= 1\n end\n final_number.strip!\n end", "def getSet(n)\n\t((n%8).to_s(2).rjust(3,\"0\"))\nend", "def separate_comma(number)\n array = number.to_s.split('') #creates an array from number w/ digits\n number_commas = array.size/3.0 #how many commas\n if array.size < 4 #this is a 3 digit number\n return number.to_s #return number no comma needed\n elsif array.size%3 == 0\n n = -4\n (number_commas.to_i-1).times do |i|\n array.insert(n, ',')\n n -= 4\n end\n return array.join(\"\")\n else\n n = -4\n number_commas.to_i.times do |i|\n array.insert(n, ',')\n n -= 4\n end\n return array.join(\"\")\n end\nend", "def createPhoneNumber(numbers)\n result = []\n while numbers.count > 4\n result << numbers.take(3)\n numbers = numbers.drop(3)\n end\n result << numbers\n return \"(#{ result[0].join }) #{ result[1].join }-#{ result[2].join }\"\nend", "def map_and_remove_three(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 5 && number_to_digits[7].subset?(digits) }\n map_and_remove(3, digits, digits_to_number, number_to_digits, input)\nend", "def separate_comma(number)\n comma_separated_number = number.to_s.reverse.split('').each_slice(3).map {|obj| obj.push(\",\") }.join.chop.reverse\nend", "def separate_comma(num)\n chars = num.to_s.split('')\n comma_count = chars.size/3\n return num.to_s if chars.size < 4\n\n if chars.size % 3 == 0\n comma_count -= 1\n end\n\n n = -4\n comma_count.to_i.times do |i|\n chars.insert(n, ',')\n n -= 4\n end\n chars.join(\"\")\nend", "def separate_comma(num)\n numbers = num.to_s.split('')\n size = numbers.size/3.0\n if numbers.size < 4\n return num.to_s\n elsif numbers.size%3 == 0\n comma = -4\n (size.to_i-1).times do |x|\n numbers.insert(comma, ',')\n comma -= 4\n end\n strings = ''\n return numbers.join(\"\")\n else\n comma = -4\n size.to_i.times do |x|\n numbers.insert(comma, ',')\n comma -= 4\n end\n return numbers.join(\"\")\n end\nend", "def separate_comma(int)\n\n result = []\n\n int.to_s.split(\"\").reverse.each_slice(3) do |slice|\n slice << \",\"\n result << slice\n end\n\n p result.flatten.join.chop.reverse\n\nend", "def busqueda6\n 9899.step(999999999999999999999,9899){|x|break (x) unless (p x).to_s =~ /[^0-2]/}\nend", "def add_digits(number)\r\n total = 0\r\n number.to_s.split(\"\").each do |n|\r\n total += n.to_i\r\n end\r\n if total.to_s.length > 1\r\n div_by_3(@total)\r\n end\r\n total\r\nend", "def separate_comma(number)\n\tinput_length = number.to_s.length\n\tif input_length>3\n\t\tcounter = 1\n\t\toutput_number = \"\"\n\t\tnumber.to_s.reverse.each_char do |x|\n\t\t\tif counter % 3 == 0 && number.to_s.length!=counter\n\t\t\t\toutput_number = output_number + x + \",\"\n\t\t\telse\n\t\t\t\toutput_number += x\n\t\t\tend\n\t\t\tcounter +=1\n\t\tend\n\t\treturn output_number.reverse\n\telse\n\t\treturn number.to_s\n\tend\nend", "def dig_number(number)\n arr_dig = number.to_s.chars\n count = arr_dig.size\n arr_dig.map {|dig| dig.to_i ** count} \nend", "def create_string(value, n)\n value.length < 3 ? value * n : value[0..2] * n\nend", "def separate_comma (number)\n\nnumber\n.to_s\n.reverse\n.split(\"\")\n.map.with_index {|x, i| ((i+1)%3 == 0 && number.to_s.length - (i+1) > 0 ? x << \",\" : x)}\n.join\n.reverse\n\nend", "def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend", "def digits\n @digits ||= numbers.insert(3, digit(numbers).to_s)\n end", "def separate_comma(number)\n comma_array = number.to_s.chars.reverse.each_slice(3)\n comma_array.map(&:join).join(\",\").reverse\nend", "def brut_force_solution\n (1...1000).inject(0){|sum, digit| ((digit % 3 == 0) || (digit % 5 == 0)) ? sum += digit : sum}\nend", "def separate_comma(number)\n number = number.to_s\n if number.length < 4\n return number\n else\n new_number = []\n number.reverse.split('').each_with_index do |x, i|\n new_number.push(x)\n if (i + 1) % 3 == 0\n new_number.push(\",\")\n end\n end\n return new_number.reverse.join\n end\nend", "def expanded_form(num)\n array = num.to_s.split(\"\")\n length = num.to_s.size - 1\n numbers_array = []\n\n array.each do |number|\n numbers_array << number.to_i * 10**(length)\n length -= 1\n end\n\n numbers_array.delete_if {|i| i == 0} # cleans up 0s from array. For example: expanded_form(70304)\n numbers_array.join(\" + \")\n\nend", "def always_three_again(number)\n\tnumber = (((number + 5) * 2 - 4) / 2 - number).to_s\n\t\nend", "def slices(n)\n digits.each_cons(n).to_a\n end", "def last_n_digits(num, n)\r\n # your code goes here\r\n num % 10**n\r\nend", "def four_digit_parse(num)\n thousands = get_high_order(num,1000)\n num = get_remainder(num, 1000)\n hundreds = get_high_order(num, 100)\n num = get_remainder(num, 100)\n tens = get_high_order(num, 10)\n ones = get_remainder(num, 10)\n \n print \"The number is #{thousands} \" + pluralize(\"thousand\", thousands)\n print \" #{hundreds} \" + pluralize(\"hundred\", hundreds) + \" #{tens} \"\n print pluralize(\"ten\", tens) + \" and #{ones} \" + pluralize(\"one\", ones) + \".\\n\"\nend", "def separate_comma(num)\n\tif num >= 1000\n\t\tarr = num.to_s.reverse.split(//)\n# There's a way to iterate here, ASK AT OFFICE HOURS arr.map!.with_index {|x,y} x + \",\" if y % 3}???\n\t\tnew_arr = []\n\t\tidx = 0\n\t\twhile (idx + 1) < arr.length\n\t\t\tif (idx + 1) % 3 == 0\n\t\t\t\tnew_arr.push(arr[idx] + \",\")\n\t\t\t\tidx += 1\n\t\t\telse\n\t\t\t\tnew_arr.push(arr[idx])\n\t\t\t\tidx += 1\n\t\t\tend\n\t\tend\n\t\tstr = new_arr.push(arr[idx]).join.reverse\n\t\treturn str\n\telse\n\t\treturn num.to_s\n\tend\nend", "def separate_comma(num)\n return num.to_s if num.to_s.length <= 3\n\n new_num = \"\"\n num = num.to_s.reverse\n\n i = 0\n while num.length - i > 3\n 3.times do\n new_num << num[i]\n i += 1\n end\n new_num << \",\"\n end\n\n while i < num.length\n new_num << num[i]\n i += 1\n end\n\n new_num.reverse\nend", "def pure_number(n)\n arr = []\n arr[0] = \"\"\n blocks = 0\n displacement = 0\n i = 1\n while(i <= n)\n blocks = blocks + 1 if(is_power_of_2?(i+1))\n if(is_4_series?(i, blocks))\n displacement = power_of_num(2, blocks-1)\n arr[i] = \"4\" + arr[i-displacement] + \"4\"\n else\n displacement = power_of_num(2, blocks) \n arr[i] = \"5\" + arr[i-displacement] + \"5\"\n end\n i+=1\n end\n arr\nend", "def parse_large_numbers(str)\n # (?<year>(.*)億)(?<oku>(.*)万)\n splited = Numeja::JA_上数.keys.reverse.map do |ja_digit|\n index = str.index(ja_digit)\n next if index.nil?\n unit = str.slice!(0, index)\n digit = str.slice!(0, 1)\n {\n digit: digit,\n unit: unit\n }\n end\n splited.push(\n digit: '',\n unit: str\n ).compact\n end", "def nhs_numberize\n return self unless length == 10\n self[0..2] + ' ' + self[3..5] + ' ' + self[6..9]\n end", "def number_with_delimiter(n, delim = ',')\n n.to_i.to_s.reverse.chars.each_slice(3).map(&:join).join(delim).reverse\n end", "def third_of_an_inning_handler(innings)\n innings_string = innings.to_s\n whole_innings = innings_string[0..(innings_string.length - 2)]\n decimal_num = innings_string[(innings_string.length - 2)..innings_string.length].to_f\n whole_innings_string = whole_innings.to_f\n convert_third_of_inning(decimal_num, whole_innings_string, innings)\n end", "def slippery_numbers(n)\nend", "def separate_comma (num)\n rev_num = num.to_s.reverse\n count = rev_num.length/3.1\n for i in 1..count\n num = rev_num.insert(4*i-1, \",\").reverse\n end\n num\nend", "def numwords( number, hashargs={} )\n\t\tnum = number.to_s\n\t\tconfig = NumwordDefaults.merge( hashargs )\n\t\traise \"Bad chunking option: #{config[:group]}\" unless\n\t\t\tconfig[:group].between?( 0, 3 )\n\n\t\t# Array of number parts: first is everything to the left of the first\n\t\t# decimal, followed by any groups of decimal-delimted numbers after that\n\t\tparts = []\n\n\t\t# Wordify any sign prefix\n\t\tsign = (/\\A\\s*\\+/ =~ num) ? 'plus' : (/\\A\\s*\\-/ =~ num) ? 'minus' : ''\n\n\t\t# Strip any ordinal suffixes\n\t\tord = true if num.sub!( /(st|nd|rd|th)\\Z/, '' )\n\n\t\t# Split the number into chunks delimited by '.'\n\t\tchunks = if !config[:decimal].empty? then\n\t\t\t\t\t if config[:group].nonzero?\n\t\t\t\t\t\t num.split(/\\./)\n\t\t\t\t\t else\n\t\t\t\t\t\t num.split(/\\./, 2)\n\t\t\t\t\t end\n\t\t\t\t else\n\t\t\t\t\t [ num ]\n\t\t\t\t end\n\n\t\t# Wordify each chunk, pushing arrays into the parts array\n\t\tchunks.each_with_index {|chunk,section|\n\t\t\tchunk.gsub!( /\\D+/, '' )\n\n\t\t\t# If there's nothing in this chunk of the number, set it to zero\n\t\t\t# unless it's the whole-number part, in which case just push an\n\t\t\t# empty array.\n\t\t\tif chunk.empty?\n\t\t\t\tif section.zero?\n\t\t\t\t\tparts.push []\n\t\t\t\t\tnext \n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Split the number section into wordified parts unless this is the\n\t\t\t# second or succeeding part of a non-group number\n\t\t\tunless config[:group].zero? && section.nonzero?\n\t\t\t\tparts.push number_to_words( chunk, config )\n\t\t\telse\n\t\t\t\tparts.push number_to_words( chunk, config.merge(:group => 1) )\n\t\t\tend\t\t\t\t\t\n\t\t}\n\n\t\tdebug_msg \"Parts => #{parts.inspect}\"\n\t\t\n\t\t# Turn the last word of the whole-number part back into an ordinal if\n\t\t# the original number came in that way.\n\t\tif ord && !parts[0].empty?\n\t\t\tparts[0][-1] = ordinal( parts[0].last )\n\t\tend\n\n\t\t# If the caller's expecting an Array return, just flatten and return the\n\t\t# parts array.\n\t\tif config[:asArray]\n\t\t\tunless sign.empty?\n\t\t\t\tparts[0].unshift( sign )\n\t\t\tend\n\t\t\treturn parts.flatten\n\t\tend\n\n\t\t# Catenate each sub-parts array into a whole number part and one or more\n\t\t# post-decimal parts. If grouping is turned on, all sub-parts get joined\n\t\t# with commas, otherwise just the whole-number part is.\n\t\tif config[:group].zero?\n\t\t\tif parts[0].size > 1\n\n\t\t\t\t# Join all but the last part together with commas\n\t\t\t\twholenum = parts[0][0...-1].join( config[:comma] )\n\n\t\t\t\t# If the last part is just a single word, append it to the\n\t\t\t\t# wholenum part with an 'and'. This is to get things like 'three\n\t\t\t\t# thousand and three' instead of 'three thousand, three'.\n\t\t\t\tif /^\\s*(\\S+)\\s*$/ =~ parts[0].last\n\t\t\t\t\twholenum += config[:and] + parts[0].last\n\t\t\t\telse\n\t\t\t\t\twholenum += config[:comma] + parts[0].last\n\t\t\t\tend\n\t\t\telse\n\t\t\t\twholenum = parts[0][0]\n\t\t\tend\n\t\t\tdecimals = parts[1..-1].collect {|part| part.join(\" \")}\n\n\t\t\tdebug_msg \"Wholenum: #{wholenum.inspect}; decimals: #{decimals.inspect}\"\n\n\t\t\t# Join with the configured decimal; if it's empty, just join with\n\t\t\t# spaces.\n\t\t\tunless config[:decimal].empty?\n\t\t\t\treturn sign + ([ wholenum ] + decimals).\n\t\t\t\t\tjoin( \" #{config[:decimal]} \" ).strip\n\t\t\telse\n\t\t\t\treturn sign + ([ wholenum ] + decimals).\n\t\t\t\t\tjoin( \" \" ).strip\n\t\t\tend\n\t\telse\n\t\t\treturn parts.compact.\n\t\t\t\tseparate( config[:decimal] ).\n\t\t\t\tdelete_if {|el| el.empty?}.\n\t\t\t\tjoin( config[:comma] ).\n\t\t\t\tstrip\n\t\tend\n\tend", "def digitize(n)\n split_array_numbers = n.to_s.split(//).map { |x| x.to_i}.reverse\nend", "def con10to62(id)\n\tnew_id = \"0000\"\n\tfor i in 0..3\n\t\tdiv = id / 62**(3 - i)\n\t\tif div > -1 && div < 10\n\t\t\t#0-9\n\t\t\tnew_id.setbyte(i, (div + 48))\n\t\telsif div > 9 && div < 36\n\t\t\t#A-Z\n\t\t\tnew_id.setbyte(i, (div + 55))\n\t\telsif div > 35 && div < 62\n\t\t\t#a-z\n\t\t\tnew_id.setbyte(i, (div + 36))\n\t\telse\n\t\t\t#error\n\t\t\treturn -1\n\t\tend\n\t\tid = id % 62**(3 - i)\n\tend\n\treturn new_id\nend", "def get_first_digit n \n n / 10**length(n) \nend", "def separate_comma(number)\n if number.to_s.length < 3\n puts number\n else number.to_s.length >= 4\n puts number.to_s.chars.to_a.reverse.each_slice(3).map(&:join).join(\",\").reverse\n end\nend", "def split_in_two(number, length)\n [number.slice(0, length), number.slice(length, 10 - length)]\n end", "def separate_comma(n)\n rev_string = n.to_s.reverse\n with_commas = rev_string.insert(3, \",\")\n output = with_commas.reverse\n \n if n.to_s.length < 7\n if n.to_s.length < 4\n with_commas = rev_string.insert(3, \",\")\n \t output = with_commas.reverse\n puts n\n elsif \n n.to_s.length % 3 == 0\n with_commas = rev_string.insert(3, \",\")\n \t output = with_commas.reverse\n puts output\n elsif\n n.to_s.length % 3 == 1\n with_commas = rev_string.insert(3, \",\")\n \t output = with_commas.reverse\n puts output\n else\n n.to_s.length % 3 == 2\n with_commas = rev_string.insert(3, \",\")\n \t output = with_commas.reverse\n puts output\n end\n else\n mil_or_more = with_commas.insert(7, \",\")\n big_num = mil_or_more.reverse\n puts big_num\n end \nend", "def print_numbers_divisible_by_three\n index = 1\n while index <= 1000\n if index % 3 == 0\n puts index\n end\n index += 1\n end\nend", "def separate_comma(num)\n num.to_s.reverse.chars.each_slice(3).to_a.map{|sub_array| sub_array.join }.join(\",\").reverse \nend", "def dv11 n\n if n.length < 2\n return nil\n end\n\n soma = 0\n l = n.length\n multiplicador = 2\n (1..(l)).each do |i|\n c = n[l-i,1];\n parcela = c.to_i * multiplicador\n soma += parcela\n multiplicador < 9 ? multiplicador += 1 : multiplicador = 2\n end\n\n resto = soma % 11\n\n if (resto >= 0 and resto <= 1)\n digito = 0\n else\n digito = 11 - resto\n end\n return n + digito.to_s\n end", "def split_number(number)\n if number.length > 4\n tokens = []\n\n # reverse & split by doubles\n number.reverse.scan(/.(?:.|$)/) do |token|\n token.reverse!\n if token.length == 1\n tokens.last.prepend token\n else\n tokens << token\n end\n end\n\n # merge back\n tokens.reverse!\n tokens.tap do |tokens|\n tokens.map! { |token| yield token } if block_given?\n end\n else\n yield number if block_given?\n [number]\n end\n end", "def separate_comma(integer)\n number_string = integer.to_s\n char_count = integer.to_s.length\n\n if char_count > 3\n\n -4.step((-char_count - 1), -4) do |x|\n number_string.insert(x, \",\")\n end\n\n return number_string\n else\n return number_string\n end\nend", "def map_and_remove_nine(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 6 && number_to_digits[4].subset?(digits) }\n map_and_remove(9, digits, digits_to_number, number_to_digits, input)\nend", "def separate_comma(i)\n num = i.to_s\n if num.length % 3 == 0 && num.length > 3\n (num.length - 3).step(3, -3) {|v| num.insert(v, \",\")}\n elsif num.length > 3\n (num.length - 3).step(0, -3) {|v| num.insert(v, \",\")}\n end\n num\nend", "def split_number(number, length)\n [number[0...length], number[length..-1]]\n end", "def two_digit_format(n)\n\n arr = n.to_s.split(//)\n \n if arr.length == 0\n return '0' + arr[0]\n elsif arr.length >=3\n return\n else\n return n.to_i\n end\n\nend", "def three_numbers(str)\n digits = str.split.map { |word| word.scan(/\\d+/).sort_by(&:size) }\n digits.each do |set|\n if set.size == 2 && set.first.size == 1 && set.last.size == 2\n set[1], set[2] = set.last[0], set.last[1]\n end\n set.map!(&:to_i).uniq!\n return false unless set.size == 3\n end\n true\nend", "def problem8(text)\n\tdigits = text.split('').map {|x| x.to_i }\n\t\n\treturn -1 if digits.length < 5\n\ti = 0\n\tj = 4\n\t\n\tmax = 1\n\tdigits[0..4].each do |d|\n\t\tmax *= d\n\tend\n\t\n\tmaxdigits = digits[0..4]\n\t\n\tbuffernum = max\n\twhile j < (digits.length - 1)\n\n\t\t#pop left digit\n\t\tif digits[i] == 0\n\t\t\tbuffernum = 1\n\t\t\tdigits[i+1..j].each { |x| buffernum *= x}\n\t\t\tputs buffernum\n\t\telse\n\t\t\tbuffernum /= digits[i]\n\t\tend\n\t\ti += 1\n\n\t\t#push right digit\n\n\t\tj += 1\n\t\tbuffernum *= digits[j]\n\t\tif buffernum > max\n\t\t\tmax = buffernum\n\t\t\tmaxdigits = digits[i..j]\n\t\tend\n\t\t\n\n\n\tend\n\t\n puts \"Max Product : #{max}\"\n\tputs \"Max Digits : #{maxdigits}\"\n\t\n\t\nend", "def expanded_form(num)\n number = num.to_s # This will be \"12\"\n num_digits = num.to_s.length\n split_number = number.split(\"\").reverse # This will be [\"2\",\"1\"]\n expanded_array = []\n 0.upto(num_digits-1) do |n| # This will be 0 up to 1\n single_split_number = split_number[n].to_i*(10**n)\n next if single_split_number == 0\n expanded_array << single_split_number.to_s\n end\n expanded_array.reverse! # This will be [\"10\",\"2\"]\n output_array = expanded_array.join(\" + \") # Final statement\nend", "def num_to_array num\n \n array = []\n div = 100000\n \n while div >= 1\n if (num / div) > 0\n digit = num / div\n array << digit\n num = num - (div * digit)\n end\n div = div / 10\n end\n \n return array\n \nend", "def seperator(num)\n num_string = num.to_s\n num_integer_count = num.to_s.length\n num_counter = num_integer_count\n loop do \n num_counter -= 3\n if num_counter <= 0 \n break \n else \n num_string.insert(num_counter, ',')\n end\n\n end\n num_string\nend", "def featured(integer)\n return \"Error: There is no possible number that fulfills those requirements\" if integer >= 9_876_543_210\n counter = integer + 1\n counter += 1 until counter % 7 == 0 && counter.odd?\n \n loop do\n return counter if counter.digits.uniq.size == counter.digits.size\n counter += 14\n end\nend", "def solution(n)\n n.to_s.reverse.scan(/\\d{1,3}/).join(',').reverse\nend", "def solution(n)\r\n unit = UNITS[n % 10]\r\n dozen = DOZENS[(n % 100) / 10]\r\n hundred = HUNDREDS[(n % 1000) / 100]\r\n thousand = THOUSAND * (n / 1000)\r\n [thousand, hundred, dozen, unit].join\r\nend", "def separate_comma(number)\n\n array = number.to_s.reverse.split(//)\n length = array.length\n\n if length<=6\n x = 0\n elsif length%2 == 0\n x = 1\n else \n x = 2\n end\n\n\n\n if length < 4\n return array.join.reverse.to_s \n else\n i = 3\n while i < length+n do\n array.insert(i, ',')\n i += 4\n end\n end\n return array.join.reverse.to_s\nend", "def splitNumber(val)\n\tresArr = []\n\twhile(val >= 1)\n\t\tresArr.push(val % 10)\n\t\tval = val / 10\n\tend\n\tresArr\nend", "def add_commas(number)\n original = number.to_s\n length = original.length\n result = \"\"\n index = 0\n\n while index < length\n result = \",\" + result if index % 3 == 0 && index != 0\n index += 1\n result = original[ length - index ] + result\n end\n\n result\nend", "def stringy(number)\n digits = []\n counter = 0\n while counter < number do\n digits[counter] = counter.odd? ? 0 : 1\n counter += 1\n end\n digits.join\nend", "def separate_comma(integer)\n\n# Convert integer to a string\n string_integer = integer.to_s\n\n# Get comma count\n comma_num = (string_integer.length - 1)/3\n return string_integer if comma_num == 0\n\n#insert comma every four characters\n comma_num.times {|i| string_integer.insert(-4*(i+1),\",\")}\n return string_integer\nend", "def separate_comma(integer)\n integer = integer.to_s\n length = integer.length\n i = 0\n integer = integer.split(\"\")\n puts integer\n while i < (length - 1)\n if (length - 1) % 3 == 0 && (i % 3 ==0 || i == 0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n elsif (length - 2) % 3 == 0 && ((i-1) % 3 ==0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n elsif (length - 3) % 3 == 0 && ((i-2) % 3 ==0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n end\n i += 1\n end\n puts integer\n integer=integer.join\n p integer\nend", "def persistence(int)\n return 0 if int.digits.length == 1\n\n num = int\n repeats = 0\n loop do\n num = num.digits\n\n num = num.inject { |mem, num| mem * num }\n repeats += 1\n break if num.digits.length < 2\n end\n repeats\nend", "def mod11(number); end", "def zerofill2(n)\n n.to_s.rjust(2, '0')\n end", "def separate_comma ( int )\n int.to_s.split('').to_a().reverse().each_slice(3).to_a.map(&:join).join(\",\").reverse()\nend", "def generate_number_strings(cleaned_multiline_digits)\n cleaned_multiline_digits.map do |multiline_digit|\n convert_to_numbers(multiline_digit)\n end\nend", "def separate_comma(number)\n\tnumber = number.to_s.split('')\n\tsliced_array = []\n\tnumber.reverse.each_slice(3) { |group| sliced_array.push(group) }\n\t# For every slice in the array we need reverse the array then we need to piece it back together adding the comma after every slice (This was a royal pain to figure out) (The constant reversing)\n\tsliced_array.reverse.map{|i| i.reverse.join}.join(\",\")\nend", "def to_modern_roman(number)\n\n\twhile number.to_i <= 3000\n\t\t# split number into an array\n\t\tarray = number.split(//).map { |x| x.to_i }\n\t\tresult =[]\n\t\t# array has length of 4\n\t\tuntil array.length == 4\n\t\tarray.unshift(0)\n\t\tend\n\t\t# 1000s of number\n\t\tif array[-4] < 4 \n\t\t\t\tnum = array[-4]\n\t\t\t\tnum.times { result << \"M\" }\n\t\tend\n\t\t# 100s of number\n\t\tif array[-3] < 4\n\t\t\t\tnum = array[-3]\n\t\t\t\tnum.times { result << \"C\" }\n\t\telsif array[-3] == 4\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"CD\"\n\t\telsif array[-3] == 6\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"DC\"\n\t\telsif array[-3] == 9\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"CM\"\n\t\telse\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"D\" \n\t\t\t\t(num-5).times { result << \"C\" }\n\t\tend\n\t\t# 10s of number\n\t\tif array[-2] < 4\n\t\t\t\tnum = array[-2]\n\t\t\t\tnum.times { result << \"X\" }\n\t\telsif array[-2] == 4\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"XL\"\n\t\telsif array[-2] == 6\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"LX\"\n\t\telsif array[-2] == 9\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"XC\"\n\t\telse\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"L\" \n\t\t\t\t(num-5).times { result << \"X\" }\n\t\tend\n\t\t# single digits of number\n\t\tif array[-1] < 4\n\t\t\t\tnum = array[-1]\n\t\t\t\tnum.times { result << \"I\" }\n\t\telsif array[-1] == 4\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"IV\"\n\t\telsif array[-1] == 6\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"VI\"\n\t\telsif array[-1] == 9\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"IX\"\n\t\telse\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"V\" \n\t\t\t\t(num-5).times { result << \"I\" }\t\n\t\tend\n\t\t# return number in roman numerals\n\t\tputs \"#{number} in New Style Roman Numerals is #{result.join(\"\")}.\"\n\t\texit\n\tend\n\tputs \"Number must be greater than 3000.\"\n\texit\nend", "def amplify(num)\n\tarr = []\n\t(1..num).each do |n|\n \tn % 4 == 0 ? arr << n * 10 : arr << n\n\tend\n\treturn arr\nend" ]
[ "0.7021607", "0.6968924", "0.68689406", "0.65382355", "0.63851935", "0.6312001", "0.6259925", "0.62322783", "0.6174289", "0.615428", "0.61369145", "0.611924", "0.6113153", "0.61028755", "0.60940164", "0.60508156", "0.60093504", "0.60053647", "0.598869", "0.5980942", "0.59760964", "0.5969824", "0.5965728", "0.5960292", "0.59415144", "0.594108", "0.59304285", "0.59166706", "0.5909137", "0.5890319", "0.58624", "0.5849454", "0.5847827", "0.58300793", "0.58197415", "0.5810177", "0.5809497", "0.5809029", "0.58057284", "0.58049816", "0.5802957", "0.57972723", "0.5788898", "0.57749915", "0.5769402", "0.5761713", "0.5760129", "0.5747476", "0.574669", "0.5744576", "0.5742819", "0.5735366", "0.5729766", "0.5724276", "0.5722898", "0.5700176", "0.56884104", "0.5686313", "0.56850094", "0.56746364", "0.56688446", "0.5652345", "0.564408", "0.56421465", "0.564113", "0.56376505", "0.5629648", "0.5629586", "0.5629364", "0.5625615", "0.56230605", "0.5621479", "0.56197906", "0.56068003", "0.5591531", "0.5588957", "0.5588212", "0.55868465", "0.5585884", "0.5585647", "0.55793077", "0.55695176", "0.5567504", "0.5564498", "0.5563136", "0.5562185", "0.55616724", "0.5561653", "0.5556311", "0.5555834", "0.55510503", "0.55477744", "0.5539141", "0.5536786", "0.5535399", "0.5533871", "0.553076", "0.552662", "0.55259466", "0.55248064" ]
0.69161856
2
turn a number into text 0999
def textify(number) return UNITS[number] if number < UNITS.length tens, units = number.divmod(10) hundreds, tens = tens.divmod(10) out = '' out << "#{UNITS[hundreds]} hundred " if hundreds > 0 out << "#{TENS[tens]}" if tens > 0 && number >= 20 out << "-" if tens > 0 && units > 0 out << "#{UNITS[units]}" if units > 0 out.strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_to_s\n case\n when number < 10 then return \"00#{number}\"\n when number < 100 then return \"0#{number}\"\n else return \"#{number}\"\n end\n end", "def number_to_string_with_zero(number, characters_count = 2 )\n num_str = number.to_s\n\n if num_str.length < characters_count\n num_str = '0'*(characters_count - num_str.length ) + num_str\n end\n\n num_str\n end", "def integer_to_string(number)\n result = ''\n loop do\n number, remainder = number.divmod(10)\n # binding.pry\n result.prepend(DIGITS[remainder])\n break if number == 0\n end\n result\nend", "def numberToString(num) \n\t num.to_s \n end", "def number_as_text(name, i)\n \n # puts \"number_as_text\" + [name, i].inspect\n return if i.nil? or i == 0\n \n # reverse the number\n value = i.to_s.reverse\n \n hundreds = \"#{UNITS[value[2].chr.to_i]}-hundred\" if i > 99\n tens = \"#{TENS[value[1].chr.to_i * 10]}\" if i > 9\n units = \"#{UNITS[value[0].chr.to_i]}\" unless value[0].chr == \"0\"\n teens = \"#{TEENS[(i%100)]}\" if TEENS.key?(i % 100)\n concat_parts(hundreds, tens, units, teens, i)\n end", "def int_to_str i\n int_to_digits(i).join('.')\nend", "def human_display(number)\n base_number = digits(number)\n if base_number.length == 11 && base_number.first == '1'\n \"(#{base_number[1..3]}) #{base_number[4..6]}-#{base_number[7..10]}\"\n elsif base_number.length > 0\n \"+#{base_number}\"\n else\n nil\n end\n end", "def handle_hundred (num)\n num2str=''\n if (num%100==0)\n num2str+=NUM_MAP[num/100]+ ' '+ NUM_MAP[100]\n elsif (num%100>=10 && num%100 <= 99)\n num2str+=NUM_MAP[num/100]+ ' '+ NUM_MAP[100]+ ' ' +handle_ten(num%100)\n elsif (num%100>=1 && num%100 <= 9)\n num2str+=NUM_MAP[num/100]+ ' '+ NUM_MAP[100]+ ' ' +handle_bit(num%100)\n end\n return num2str\nend", "def getThreeDigitNumberStr(thrDigitVal)\n\t\tnumStr = \"\"\n\t\tunless getNumberAsStr[thrDigitVal].blank?\n\t\t\tnumStr = getNumberAsStr[thrDigitVal]\n\t\telse\n\t\t\tif thrDigitVal > 0\n\t\t\t\thundredStr = getNumberAsStr[thrDigitVal/100].blank? ? \"\" : (getNumberAsStr[thrDigitVal/100] + \" \" + l(:label_hundred))\n\t\t\t\ttwoDigStr = getTwoDigitNumberStr(thrDigitVal%100)\n\t\t\t\tnumStr = hundredStr.blank? || twoDigStr.blank? ? (hundredStr + twoDigStr) : (hundredStr + \" \"+ l('support.array.sentence_connector') + twoDigStr)\n\t\t\tend\n\t\tend\n\t\tnumStr = \" \" + numStr unless numStr.blank?\n\t\tnumStr\n\tend", "def formata_numero number, opts={}\n number = number.to_s\n opts = { loop: 10, insert: :\"0\" }.merge opts\n # remove as virgulas e pontos caso seja um valor de dinheiro\n number.gsub! /[,\\.\\ ]/ , ''\n (opts[:loop] - number.length).times { number = \"#{opts[:insert]}#{number}\" }\n number\n end", "def numberToString(num)\n \"#{num}\"\nend", "def to_string(number)\n str_array = []\n loop do\n str_array.unshift(number % 10)\n number /= 10\n break if number == 0\n end\n str_array.join\nend", "def integer_to_string(number)\n string = number.digits.reverse.join\nend", "def integer_to_string(number)\n string = number.digits.reverse.join\nend", "def numberToString(num)\r\n num.to_s\r\nend", "def number_to_s(val)\n return @print_decimal_numbers ? val.to_s : ('%02x' % val)\n end", "def format_number(number)\n number = 0 if number.nil?\n number.to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse\n end", "def integer_to_string(num)\n num.digits.reverse.join\nend", "def format_num(num); number_with_delimiter(num) end", "def num_into_string(number)\n puts number.ordinalize\nend", "def display_number\n \"XXXX-XXXX-XXXX-#{last_digits}\"\n end", "def display_number\n \"XXXX-XXXX-XXXX-#{last_digits}\"\n end", "def integer_to_string(int)\n int.digits.map { |num| NUMBERS[num] }.join.reverse\nend", "def print_number(number)\n number.nil? ? \"_\" : (number + 1).to_s\n end", "def numberToString(num)\n num.to_s\nend", "def numberToString(num)\n num.to_s\nend", "def integer_to_string(num)\n\tlookup_table = {0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', \n\t\t\t\t\t5 => '5', 6 =>'6', 7 => '7', 8 => '8', 9 => '9'}\n \n result = ''\n\n if num.is_a? Integer\n num.digits.reverse.each do |number|\n result += lookup_table[number]\n end\n result\n else\n puts \"Invalid entry!\"\n end\nend", "def to_text(number, version = :gb)\n unless number.is_a?(String) || number.is_a?(Integer)\n raise ArgumentError.new 'Only Integer or String (that converts to integer) can be parsed'\n end\n\n version = version.to_sym if version.is_a? String\n unless [:uk, :gb, :us].include? version\n raise ArgumentError.new 'Only :uk, :gb or :us versions can be generated'\n end\n\n number = number.to_s if number.is_a? Integer\n number.strip!\n\n # strip prefix\n number[0] = '' if number[0] == '+' or number[0] == '-'\n\n # 0\n return 'zero' if number.length == 1 and number == '0'\n\n # 1..999\n return get_hundreds number, version if number.length < 4\n\n # 999 <\n i = 0\n portions = []\n portion_block = []\n number.reverse!\n\n number.each_char do |c|\n portion_block.push c\n i += 1\n\n if i % 3 == 0\n block_clone = portion_block.clone\n portions.push block_clone\n portion_block.clear\n i = 0\n end\n end\n\n portions.push portion_block unless portion_block.empty?\n portions.reverse!\n\n final_number = ''\n i = portions.length - 1\n portions.each do |p|\n p.reverse!\n p_in_text = get_hundreds(p.join.to_i.to_s, version)\n final_number += p_in_text\n final_number += ' ' + @scale[i] + ' ' if p_in_text != ''\n i -= 1\n end\n final_number.strip!\n end", "def integer_to_string(number)\n\n\tconversion = {0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5',\n\t\t\t\t 6 => '6', 7 => '7', 8 => '8', 9 => '9' }\n\n\tnumber.digits.reverse.map do |num|\n\t\tconversion[num]\n\tend.join\n\nend", "def two_digits_number(x)\n x < 10 ? \"0#{x}\" : x.to_s\n end", "def handle_ten (num)\n num2str=''\n if (num%10==0)\n num2str+=NUM_MAP[num]\n elsif (num>10 && num<20)\n num2str+=NUM_MAP[num]\n else\n num2str+=NUM_MAP[num/10*10]+'-'+NUM_MAP[num%10]\n end\n return num2str\nend", "def format(number)\n \tif number.to_s.include? '255' and not number.to_s.include? '+'\n \t number = \"+#{number}\"\n \tend\n\n \treturn number\n end", "def to_s\n \"%014d\" % to_i\n end", "def boom(number)\n return number.to_s\nend", "def num_to_string(number)\n case number\n when '1'\n \"one \"\n when '2'\n \"two \"\n when '3'\n \"three \"\n when '4'\n \"four \"\n when '5'\n \"five \"\n when '6'\n \"six \"\n when '7'\n \"seven \"\n when '8'\n \"eight \"\n when '9'\n \"nine \"\n when '10'\n \"ten \"\n when '11'\n \"eleven \"\n when '12'\n \"twelve \"\n when '13'\n \"thirteen \"\n when '14'\n \"fourteen \"\n when '15'\n \"fifteen \"\n when '16'\n \"sixteen \"\n when '17'\n \"seventeen \"\n when '18'\n \"eighteen \"\n when '19'\n 'nineteen '\n when '20'\n \"twenty \"\n when '30'\n \"thirty \"\n when '40'\n \"fourty \"\n when '50'\n \"fifty \"\n when '60'\n \"sixty \"\n when '70'\n \"seventy \"\n when '80'\n \"eighty \"\n when '90'\n \"ninty \"\n else\n \"\"\n end\nend", "def number_to_string(num)\n num.to_s\nend", "def beyond100_en(number)\n return \"#{number}th\" if tens_digit_is_a_one(number)\n\n case number % 10\n when 0, 4, 5, 6, 7, 8, 9\n \"#{number}th\"\n when 1\n \"#{number}st\"\n when 2\n \"#{number}nd\"\n when 3\n \"#{number}rd\"\n end\n end", "def short_number(prenumber,n) \n @str = prenumber.to_s + to_n(Time.now.sec.to_s,2).to_s\n return to_n(@str,n)\n end", "def convert_hundred(val)\n\t\tif val < 19\n\t\t\t@@english_numeral += \"#{BASIC_MAP[val]}\" + ' ' \n\n\t\telse\n\t\t\tnum1 = val%10\n\t\t\tnum2 = val-num1\n\n\t\t\t@@english_numeral += \"#{BASIC_MAP[num2]}\" + ' ' + \"#{BASIC_MAP[num1]}\" + ' '\n\t\tend\n\tend", "def database_number_for(number)\n number == 1 ? \"\" : number.to_s\n end", "def integer_to_string(int)\n int.digits.reverse.join\nend", "def to_en(number)\n return number.to_s unless number.is_a?(Integer)\n case number\n when 1\n \"one\"\n when 2\n \"two\"\n when 3\n \"three\"\n when 4\n \"four\"\n when 5\n \"five\"\n when 6\n \"six\"\n when 7\n \"seven\"\n when 8\n \"eight\"\n when 9\n \"nine\"\n when 10\n \"ten\"\n when 11\n \"eleven\"\n when 12\n \"twelve\"\n when 13\n \"thirteen\"\n when 14\n \"fourteen\"\n when 15\n \"fifteen\"\n when 16\n \"sixteen\"\n when 17\n \"seventeen\"\n when 18\n \"eighteen\"\n when 19\n \"nineteen\"\n when 20\n \"twenty\"\n when 30\n \"thirty\"\n when 40\n \"forty\"\n when 50\n \"fifty\"\n when 60\n \"sixty\"\n when 70\n \"seventy\"\n when 80\n \"eighty\"\n when 90\n \"ninety\"\n when 21 .. 99\n x_one = number % 10\n x_ten = number - x_one\n to_en(x_ten) + \"-\" + to_en(x_one)\n when 100 .. 999\n front_num = number / 100\n rear_num = number % 100\n if rear_num == 0\n to_en(front_num) + \" hundred\"\n else\n to_en(front_num) + \" hundred and \" + to_en(rear_num)\n end\n when 1e3 .. 999999\n front_num = number / 1000\n rear_num = number % 1000\n if rear_num == 0\n to_en(front_num) + \" thousand\"\n else\n to_en(front_num) + \" thousand and \" + to_en(rear_num)\n end\n else\n number.to_s\n end\n end", "def number_to_string (num) \n p num.to_s\nend", "def integer_to_string(number)\n hash_of_integers = { 0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9'}\n \n string =''\n loop do\n\n number, digit = number.divmod(10)\n \n string.prepend(hash_of_integers[digit])\n break if number == 0\n end\n string\nend", "def convert_3_digits_number(value)\n word = ''\n division_result = value / 100\n mod_result = value % 100\n\n if division_result > 0\n word = \"#{LESS_THAN_20[division_result]} hundred\"\n word = \"#{word} \" if mod_result > 0\n end\n\n word = \"#{word}#{convert_2_digits_number(mod_result)}\" if mod_result > 0\n word\n end", "def fancy_number(num)\n \"$\" + num.to_s.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n end", "def to_s()\n result = nil\n \n if @number < 10\n result = WORD_DICT[@number]\n\n elsif number <= 99\n result = two_least_sig\n \n elsif number == 1000\n result = \"one thousand\"\n\n elsif number % 100 == 0\n result = hundreds_component\n\n elsif number <= 999\n result = \"#{hundreds_component} and #{two_least_sig}\"\n end\n\n return result\n end", "def integer_to_string(integer)\n integer.abs.digits.reverse.join\nend", "def integer_to_string(num)\n num.digits.map { |x| INT_CONVERT[x] }.reverse.join\nend", "def three_digit_format(n)\r\n # your code here\r\n n.to_s.rjust(3, \"0\")\r\nend", "def to_s\n \"v#{number}\"\n end", "def integer_to_string(int)\n int_str = ''\n\n loop do\n int, remainder = int.divmod(10)\n int_str.prepend(DIGITS[remainder])\n\n break if int == 0\n end\n\n int_str\nend", "def number_to_string(integer)\n array_of_integers = []\n while integer != 0\n array_of_integers << integer % 10\n integer /= 10\n end\n array_of_integers.reverse.join\nend", "def signed_integer_to_string(num)\n out = num.digits.map { |x| INT_CONVERT[x] }.reverse.join\n return out if num > -1\n -out\nend", "def to_2digit(number)\n if number < 9\n number=\"0\"+number.to_s\n else\n number=number.to_s\n end\n return number\nend", "def number_to_flags(number)\n number.to_s.rjust(3, \"0\")\n end", "def format_num(num)\n num.gsub(/\\D/,\"\")\n # gsub takes two arguments:\n # the first is a regex pattern to match: \\D is any non-digit character\n # the second is what matching elements should be replaced with\nend", "def expanded_form(num)\r\n num.digits.each_with_index.map{| val, idx | val * (10 ** idx)}.select{|x| x != 0}.reverse.join(\" + \")\r\nend", "def print_num(min)\n min.to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse\nend", "def expanded_form(num)\n num.digits.map.with_index { |num, index| \"#{num}\" + '0' * index }\n .delete_if { |nums| nums.start_with? '0' }\n .reverse.join ' + '\nend", "def display_number\n self.class.mask(number)\n end", "def string_from_number(number)\n if @style == :dash\n number = number.to_i\n return \"#{number / Dash::COIN}.#{'%08d' % [number % Dash::COIN]}\".gsub(/0+$/,\"\").gsub(/\\.$/,\".0\")\n elsif @style == :dash_long\n number = number.to_i\n return \"#{number / Dash::COIN}.#{'%08d' % [number % Dash::COIN]}\"\n else\n # TODO: parse other styles\n raise \"Not implemented\"\n end\n end", "def englishNumber(number)\n\tnumber_as_string = \"\" #this is the string we will return\n\tif number == 0\n\t\tnumber_as_string = \"zero\"\n\telsif number == 100\n\t\tnumber_as_string = \"one hundred\"\n\telsif \n\t\t#take care of 1-10\n\t\t#take care of 11-19\n\t\t#take care of 20,30,40,50,60,70,80,90\n\telse\n\t\tnumber_as_string = \"You didn't give me a number between 0 and 100\"\n\tend\n\t\t\n\n\treturn number_as_string\nend", "def double_digit(num)\n if num.to_s.length < 2\n \"0\" + num.to_s\n else\n num.to_s\n end\n end", "def number_to_english(n)\n return \"\" unless n.integer? && n >= 0\n\n numbers_to_name = {\n 1000000 => \"million\",\n 1000 => \"thousand\",\n 100 => \"hundred\",\n 90 => \"ninety\",\n 80 => \"eighty\",\n 70 => \"seventy\",\n 60 => \"sixty\",\n 50 => \"fifty\",\n 40 => \"forty\",\n 30 => \"thirty\",\n 20 => \"twenty\",\n 19=>\"nineteen\",\n 18=>\"eighteen\",\n 17=>\"seventeen\",\n 16=>\"sixteen\",\n 15=>\"fifteen\",\n 14=>\"fourteen\",\n 13=>\"thirteen\",\n 12=>\"twelve\",\n 11 => \"eleven\",\n 10 => \"ten\",\n 9 => \"nine\",\n 8 => \"eight\",\n 7 => \"seven\",\n 6 => \"six\",\n 5 => \"five\",\n 4 => \"four\",\n 3 => \"three\",\n 2 => \"two\",\n 1 => \"one\",\n 0 => \"zero\"\n }\n\n if n < 10\n numbers_to_name[n]\n elsif n < 100\n if n % 10 == 0 || n < 20\n numbers_to_name[n]\n else\n numbers_to_name[(n / 10) * 10] + ' ' + numbers_to_name[(n % 10)]\n end\n elsif n < 1000\n if n % 100 == 0\n numbers_to_name[(n / 100)] + ' ' + numbers_to_name[100]\n else\n numbers_to_name[(n / 100)] + ' ' + numbers_to_name[100] + ' ' + number_to_english(n % 100)\n end\n elsif n <= 99999\n number_to_english(n / 1000) + ' ' + numbers_to_name[1000] + ' ' + number_to_english(n % 1000)\n else\n \"\"\n end\n\nend", "def nice_number(number)\n confline = (!session or !session[:nice_number_digits]) ? Confline.get_value(\"Nice_Number_Digits\") : session[:nice_number_digits]\n nice_number_digits = (confline and confline.to_s.length > 0) ? confline.to_i : 2\n n = \"\"\n n = sprintf(\"%0.#{nice_number_digits}f\", number.to_d) if number\n if session\n session[:nice_number_digits] = nice_number_digits\n n = n.gsub('.', session[:global_decimal]) if session[:change_decimal]\n end\n n\n end", "def replaceNumberToChar(number)\n case number\n when 10\n then\n number = 'T'\n when 11\n then\n number = 'J'\n when 12\n then\n number = 'Q'\n when 13\n then\n number = 'K'\n when 14\n then\n number = 'A'\n end\n number.to_s\nend", "def signed_integer_to_string(number)\n case number <=> 0\n when -1 \n prefix = '-'\n number = -number\n when +1 \n prefix = '+'\n else \n prefix = ''\n end\n prefix + integer_to_string(number)\nend", "def format_id_to_s(id)\n id.to_s.rjust(3, '0')\n end", "def stringy(num, start = 1)\n return 'Positive integer only' unless num.is_a?(Integer) && num > 0\n return 'Invalid starting number' unless start == 1 || start == 0\n\n string = ''\n num.times do\n string << start.to_s\n start = 1 - start\n end\n string\nend", "def n(num)\n num.to_s.reverse.gsub(/...(?=.)/,'\\&,').reverse\n end", "def stringy_hightech(num, zero_start=1)\n half, remainder = num.divmod 2\n\n case zero_start\n when 0 then '01' * half + '0' * remainder\n when 1 then '10' * half + '1' * remainder\n end\nend", "def display_number\n # \n ('X' * (account_number.to_s.length - last_digits.size)) + last_digits\n # account_number.to_s[0..last_digits.size].to_s.size + \n # last_digits.to_s\n end", "def pres(x)\n\tif x<10\n\t\treturn x = \"0\" + x.to_s\n\telse\n\t\treturn x = x.to_s\n\tend\nend", "def format_number(number)\n whole, decimal = number.to_s.split('.')\n if whole.to_i < -999 || whole.to_i > 999\n whole.reverse!.gsub!(/(\\d{3})(?=\\d)/, '\\\\1,').reverse!\n end\n [whole, decimal].compact.join('.')\nend", "def append_ordinal_suffix(num)\n right_most_digit = num % 10\n case right_most_digit\n when 1 \n puts \"#{num}st\"\n when 2\n puts \"#{num}nd\"\n when 3\n puts \"#{num}rd\"\n else\n puts \"#{num}th\"\n end\nend", "def display_number\n self.class.mask(number)\n end", "def nhs_numberize\n return self unless length == 10\n self[0..2] + ' ' + self[3..5] + ' ' + self[6..9]\n end", "def padding(num)\n num >= 10? num.to_s : \"0\" + num.to_s\n end", "def leading_zeroes(max_num_length)\n 101.times do |i|\n num_of_zeroes = max_num_length - i.digits.length\n puts \"0\" * num_of_zeroes + i.to_s\n end\nend", "def format_number(number)\n number.to_s.reverse.gsub(/...(?=.)/,'\\&,').reverse\nend", "def number\n \"#{self.id}\".rjust(8, \"0\")\n end", "def number\n \"#{self.id}\".rjust(8, \"0\")\n end", "def number\n \"#{self.id}\".rjust(8, \"0\")\n end", "def num_to_dashes(num)\n\treturn '-'*num\nend", "def expanded_form(num)\n num = num.digits\n num = num.each_with_index.map do |digit, i|\n if digit != 0\n digit * 10**i\n else\n nil\n end\n end\n return num.compact.reverse.join(' + ')\nend", "def compress_number(num, precision=2)\n if precision > 0\n num_string = sprintf(\"%0.#{precision}f\", num)\n else\n num_string = sprintf(\"%d\", num.round)\n end\n if(num_string =~ /^00$/)\n num_string = \"0 \"\n end\n\n return num_string\n end", "def str_zero(n)\n n.to_s.sub(/\\.?0+$/, '')\nend", "def format_num(int)\n int.to_s.reverse.scan(/\\d{1,3}/).reverse.join(\",\")\nend", "def unit_digit_string(digit)\n case digit\n when 0 then 'zero'\n when 1 then 'one'\n when 2 then 'two'\n when 3 then 'three'\n when 4 then 'four'\n when 5 then 'five'\n when 6 then 'six'\n when 7 then 'seven'\n when 8 then 'eight'\n when 9 then 'nine'\n end\nend", "def dasherize_number(num)\n arr = num.to_s.chars\n arr.each { |char| char.gsub!(char, \"-#{char}-\") if char.to_i.odd? }\n string = arr.join\n string.chop! if string[-1] == '-'\n string[0] = '' if string[0] == '-'\n string.squeeze('-')\nend", "def no_to_use_as_reference\n self.id.to_s.rjust(11, '0')\n end", "def reformat(number)\n num_without_decimal = number.gsub('.','') \n unless num_without_decimal.length == 4\n num_without_decimal = '0' + num_without_decimal \n end\n num_without_decimal\n end", "def dashatize(num)\n num ? num.to_s.scan(/[02468]+|[13579]/).join(\"-\") : \"nil\"\nend", "def to_string(num)\n\tteens = %w[eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen]\n\tones = %w[one two three four five six seven eight nine]\n\ttens = %w[ten twenty thirty forty fifty sixty seventy eighty ninety]\n\n\tdigits = num.to_s.split(\"\").map { |e| e.to_i }.reverse\n\twords = []\n\twrite_and = false\n\n\tdigits.each_with_index do |n, i|\n\t\tnext if n == 0\n\n\t\tif ((i == 2) || (i == 3))\n\t\t\tif write_and\n\t\t\t\twords.push(\"and\")\n\t\t\t\twrite_and = false\n\t\t\tend\n\t\tend\n\n\t\tcase i\n\t\twhen 0\n\t\t\tif (digits[i+1] == 1)\n\t\t\t\twords.push(teens[n-1])\n\t\t\t\tdigits[i+1] = 0\n\t\t\telse\n\t\t\t\twords.push(ones[n-1])\n\t\t\tend\n\n\t\t\twrite_and = true\n\t\twhen 1\n\t\t\twords.push(tens[n-1])\n\n\t\t\twrite_and = true\n\t\twhen 2\n\t\t\twords.push(\"hundred\")\n\t\t\twords.push(ones[n-1])\n\t\twhen 3\n\t\t\twords.push(\"thousand\")\n\t\t\twords.push(ones[n-1])\n\t\tend\n\tend\n\n\treturn words.reverse.join(\"\")\nend", "def getTwoDigitNumberStr(twoDigitVal)\n\t\tnumStr = \"\"\n\t\tunless getNumberAsStr[twoDigitVal].blank?\n\t\t\tnumStr = getNumberAsStr[twoDigitVal]\n\t\telse\n\t\t\tif twoDigitVal > 0\n\t\t\t\tnumStr = getNumberAsStr[(twoDigitVal.to_i/10)*10] + \" \" + getNumberAsStr[twoDigitVal%10]\n\t\t\tend\n\t\tend\n\t\tnumStr = \" \" + numStr unless numStr.blank?\n\t\tnumStr\n\tend", "def number_to_english(n)\n\n numbers_to_name = {\n 1000 => \"thousand\",\n 100 => \"hundred\",\n 90 => \"ninety\",\n 80 => \"eighty\",\n 70 => \"seventy\",\n 60 => \"sixty\",\n 50 => \"fifty\",\n 40 => \"forty\",\n 30 => \"thirty\",\n 20 => \"twenty\",\n 19=>\"nineteen\",\n 18=>\"eighteen\",\n 17=>\"seventeen\",\n 16=>\"sixteen\",\n 15=>\"fifteen\",\n 14=>\"fourteen\",\n 13=>\"thirteen\",\n 12=>\"twelve\",\n 11 => \"eleven\",\n 10 => \"ten\",\n 9 => \"nine\",\n 8 => \"eight\",\n 7 => \"seven\",\n 6 => \"six\",\n 5 => \"five\",\n 4 => \"four\",\n 3 => \"three\",\n 2 => \"two\",\n 1 => \"one\",\n 0 => \"zero\"\n }\n\n\n str = \"\"\n numbers_to_name.each do |num, name|\n\n if n == 0\n return str\n\n elsif n > 99999\n return str\n\n elsif n.to_s.length == 1 && n/num > 0\n return \"#{name}\"\n\n elsif n < 100 && n/num > 0\n\n return \"#{name}\" if n%num == 0\n return \"#{name} \" + number_to_english(n%num)\n\n elsif n/num > 0\n return number_to_english(n/num) + \" #{name} \" + number_to_english(n%num)\n\n end\n\n end\nend", "def intToLocNum(num)\n\tlocNumStr = \"\"\n\twhile num > 0\n\t\tlocNum = Math.log(num, 2).floor\n\t\tnum -= 2**locNum\n\t\tlocNumStr += (97 + locNum).chr\n\tend\n\tlocNumStr.reverse\nend", "def convertToTwoDigitString inInt\n if inInt < 10 \n return \"0\" + inInt.to_s;\n end\n inInt.to_s\n end", "def num_to_s(num, base)\n raise \"Please give a base greater than 1 and less than 16\" if base <= 1 || base > 16\n\n number_string_hash = {0 =>\"0\", 1 =>\"1\", 2 =>\"2\", 3 =>\"3\", 4 =>\"4\", 5 =>\"5\", 6 =>\"6\",\n 7 =>\"7\", 8 =>\"8\", 9 =>\"9\" }\n \n if base > 10\n num = num.to_i(base)\n base = 10\n end\n \n num_string = \"\"\n num_place = 0\n while num > 0\n current_digit = (num / base**num_place) % base\n num = num - (current_digit * (base**num_place))\n num_string.prepend(number_string_hash[current_digit])\n num_place += 1\n end\n num_string\nend" ]
[ "0.7762979", "0.74668497", "0.73332614", "0.73171526", "0.7223777", "0.7205349", "0.72049826", "0.7194729", "0.71696794", "0.71445733", "0.7122663", "0.71006596", "0.7069555", "0.7069555", "0.7022905", "0.7000965", "0.699324", "0.6983694", "0.6974595", "0.69627327", "0.69545716", "0.69545716", "0.6938025", "0.693661", "0.6924122", "0.6924122", "0.6923616", "0.6921662", "0.6915432", "0.690387", "0.6903518", "0.6903037", "0.6884124", "0.6877402", "0.68762326", "0.68697536", "0.6864134", "0.6862192", "0.68499064", "0.6845788", "0.6843033", "0.683931", "0.68184954", "0.68151516", "0.6803772", "0.6799995", "0.67964745", "0.67911214", "0.67843246", "0.6778837", "0.6775885", "0.6775211", "0.67441064", "0.67395175", "0.6727321", "0.6722861", "0.6715233", "0.67025065", "0.66828203", "0.66761285", "0.6670155", "0.66644496", "0.6663471", "0.66575074", "0.6637566", "0.6630559", "0.6621352", "0.66108215", "0.66100186", "0.66039276", "0.6598262", "0.6590835", "0.65907705", "0.6582411", "0.6573254", "0.65599406", "0.6554903", "0.6552602", "0.6546556", "0.6543433", "0.65259445", "0.65126365", "0.65126365", "0.65126365", "0.6509367", "0.650662", "0.6501654", "0.64921534", "0.64907867", "0.648022", "0.64784396", "0.6476663", "0.6474409", "0.6466586", "0.64574", "0.64544207", "0.6448608", "0.64394104", "0.64374995", "0.6426082" ]
0.74288946
2
Returns the Arraypack code that matches this type The endianness is the one of the local OS
def compute_pack_code(size: self.size, integer: self.integer?, unsigned: self.unsigned?) if integer INTEGER_PACK_CODES[[size, unsigned, ModelKit::Types.big_endian?]] else FLOAT_PACK_CODES[[size, ModelKit::Types.big_endian?]] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def native_endian\n if \"\\0\\1\".unpack(\"s\").first == 1\n :big\n elsif \"\\0\\1\".unpack(\"s\").first == 256\n :little\n else\n raise(\"Cannot determine endianness\")\n end\n end", "def protocol_type\n self[:p_type].to_endian(:big)\n end", "def pack_data value\r\n [value].pack('l>').split('').map(&:ord)\r\nend", "def endian\n @options[:endian] \n end", "def hardware_type\n self[:h_type].to_endian(:big)\n end", "def operation\n self[:operation].to_endian(:big)\n end", "def asm\n endian = Const::Endian::ENDIAN[arch]\n [code, jt, jf, k].pack(\"S#{endian}CCL#{endian}\")\n end", "def pack_format\n self.class.get_pack_format\n end", "def to_32i\n raise \"Array requires an even number of elements to pack to 32bits: was #{self.size}\" unless self.size.even?\n self.each_slice(2).map { |(lsb, msb)| [msb, lsb].pack('n*').unpack('N')[0] }\n end", "def data\n bytes = lp_data.bytes.to_a.pack('C*')\n case lp_type\n when 1,2\n bytes.force_encoding('utf-16le').strip\n when 3\n bytes\n when 4\n bytes.unpack('V').first\n when 5\n bytes.unpack('N').first\n when 7\n str = bytes.force_encoding('utf-16le')\n str.split(\"\\0\".encode('utf-16le'))\n when 11\n bytes.unpack('Q<').first\n else\n \"\"\n end\n end", "def packed()\n header = self.version.chr + \n @type.chr + \n @seq_no.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@session_id,4) + \n TacacsPlus.pack_int_net(@length,4)\n return(header)\n end", "def guess_byte_order\n # Assume native, since we don't know what type of file we have.\n :native\n end", "def little_endian?\n @little_endian\n end", "def to_32f_le\n raise \"Array requires an even number of elements to pack to 32bits: was #{self.size}\" unless self.size.even?\n self.each_slice(2).map { |(lsb, msb)| [lsb, msb].pack('n*').unpack('g')[0] }\n end", "def pack_int64_bigendian(value)\n (0..7).map { |index| (value >> (index * 8)) & 0xFF }.reverse.map(&:chr).join\n end", "def byte_arr_to_string arr\n arr.pack(\"c*\")\nend", "def encode_uint8(int); [int].pack(PACK_FORMAT_UINT8); end", "def _int32(typename)\n # Ruby's unpack doesn't give us a big-endian signed integer, so we\n # decode a native signed integer and conditionally swap it\n _read_type(4, typename).unpack(\"N\").pack(\"L\").unpack(\"l\").first\n end", "def little_endian?\n return @endian == :little\n end", "def code\n\t\tself.AsArray[0].type_code\n\tend", "def get_byte(offset) datap[offset].unpack('C*')[0] end", "def _int4b(data)\n data.unpack('V').first\n end", "def pack(p0) end", "def _unpack(bytes)\n if bytes.is_a?(Array) then bytes = bytes.join end\n bytes.unpack('H*')[0].scan(/../).reverse.join.to_i(16)\nend", "def arch_32_bit; :i386; end", "def bytes\n\t\tbin.unpack('C*')\n\tend", "def to_i32a\n len = self.length\n len_w = (len >> 2) + (len & 0x3).to_b.to_i\n\n out = (0..(len_w - 1)).map{ |n| [n, 0] }.to_h\n\n i = 0\n self.split('').each do |s|\n out[i >> 2] |= (s.ord << ((3 - (i & 0x3)) << 3))\n i += 1\n end\n\n out\n end", "def architecture\n data[:architecture]\n end", "def to_s\n [0xFFFFFFFF, @content_data.string].pack('Va*')\n end", "def little?\n @endian == :little\n end", "def i4( num ) ## integer (4 byte / 32bit) to binary (in little endian)\r\n [num].pack( 'V' )\r\n end", "def _int1b(data)\n data.unpack('C').first\n end", "def from_array(array)\n array.pack('U*')\n end", "def encode_uint32(value)\n [value].pack(\"L>\")\n end", "def header_for_array array\n header = array.length << 1 # make room for a low bit of 1\n header = header | 1 # set the low bit to 1\n pack_int header\n end", "def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end", "def endian(type)\n @endian = type\n end", "def native?\n self.class.native @endian || :little\n end", "def encode_to_array\n components = []\n components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)\n components << self.class.encoded_payload(@payload)\n components << FINAL_OCTET\n components\n end", "def order=(endianness)\n @order = endianness\n @int_pack_order = endianness == :little_endian ? 'V' : 'N'\n @double_pack_order = endianness == :little_endian ? 'E' : 'G'\n end", "def short_binary_type; end", "def arch_lookup(sys_type)\n return \"x86_64\" if sys_type == \"x64-based PC\"\n return \"i386\" if sys_type == \"X86-based PC\"\n\n sys_type\n end", "def bytea(value)\n \"'\\\\x#{value.unpack1('H*')}'::bytea\"\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def little?\n @endian == :little\n end", "def p32(*address)\n\treturn address.pack(\"L*\")\nend", "def value\n @bytes.pack('C*')\n end", "def unpack\n @data.unpack('A4cN') \n end", "def from_32i\n self.pack('N*').unpack('n*').each_slice(2).map { |arr| arr.reverse }.flatten\n end", "def get_byte\n get(1).ord\n end", "def arch\n x86_64? ? \"amd64\" : \"i386\"\n end", "def decoder(data)\n result = CKB::Utils.hex_to_bin(data).unpack(\"Q<\")[0]\n return result.to_i\nend", "def to_s\n\t\t\treturn self.each_byte.to_a.pack( 'C*' )\n\t\tend", "def bytes_to_bin(bytes)\n bytes.pack(\"C*\")\n end", "def scan_tiff_endianness(magic_bytes)\n if magic_bytes == LITTLE_ENDIAN_TIFF_HEADER_BYTES\n \"v\"\n elsif magic_bytes == BIG_ENDIAN_TIFF_HEADER_BYTES\n \"n\"\n else\n nil\n end\n end", "def unpack\nraw_bytes.unpack \"NnnCCa6\"\nend", "def encode\n return [Zlib::Deflate.deflate(Marshal.dump(self))].pack('m')\n end", "def encode_uint8(value)\n [value].pack(\"C\")\n end", "def to_bytes()\n\t\treturn self.chars.map(&:ord)\n\tend", "def calculate_doublepulsar_arch(s)\n s == 0 ? ARCH_X86 : ARCH_X64\n end", "def binary_type(devs = nil)\n devs = self.devices if not devs\n devs = [devs].flatten\n ptr = MemoryPointer::new( :cl_program_binary_type )\n return devs.collect { |dev|\n error = OpenCL.clGetProgramBuildInfo(self, dev, BINARY_TYPE, ptr.size, ptr, nil)\n error_check(error)\n [dev, BinaryType::new(ptr.read_cl_program_binary_type)]\n }\n end", "def to_int\ntmp = self.raw_bytes.unpack \"C*\"\ntmp.inject do |r, i|\nr * 256 | i\nend\nend", "def i32s\n little? ? BinUtils.get_sint32_le(read(4)) : BinUtils.get_sint32_be(read(4))\n end", "def set_endianness(e=nil)\n unless [:little, :big].include? e\n raise ArgumentError, \"Unknown endianness (#{e}) for #{self.class}\"\n end\n @int64 = e == :little ? Int64le : Int64be\n @int32 = e == :little ? Int32le : Int32be\n @int16 = e == :little ? Int16le : Int16be\n return e\n end", "def to_s\n [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')\n end", "def to_binary\n # single pass over params for speed\n pack_code = nil\n compression = nil\n each_accessionable_param do |param|\n acc = param.accession\n if !pack_code && (code=ACC_TO_UNPACK_CODE[acc])\n pack_code = code\n end\n if compression.nil?\n compression = \n case acc\n when COMPRESSION_ACC then true\n when NO_COMPRESSION_ACC then false\n end\n end\n end\n # can speed these up:\n unless pack_code\n describe! DEFAULT_DTYPE_ACC\n pack_code = ACC_TO_UNPACK_CODE[DEFAULT_DTYPE_ACC]\n end\n if compression.nil?\n describe! DEFAULT_COMPRESSION_ACC\n compression = \n case DEFAULT_COMPRESSION_ACC\n when COMPRESSION_ACC then true\n when NO_COMPRESSION_ACC then false\n end\n end\n\n # TODO: support faster pack method with nmatrix or narray\n string = self.pack(pack_code) \n string = Zlib::Deflate.deflate(string) if compression\n Base64.strict_encode64(string)\n end", "def _int2b(data)\n data.unpack('v').first\n end", "def decode(data)\n null = data.index(0x00)\n value = data.unpack(\"a#{null}\")[0]\n data = data.slice(null+1, data.length)\n \n n = 0\n types = []\n @lengths.each do |l|\n types[n] = data.unpack(\"#{punpack_string(l)}\")[0]\n data = data.slice(l, data.length)\n n += 1\n end\n\n [value, types, data]\n end", "def version\na = unpack\nv = (a[2] & 0xF000).to_s(16)[0].chr.to_i\nreturn v if (1..5).include? v\nreturn nil\nend", "def get_data\n return @data.unpack(\"C*\")\n end", "def binary_representation(allow_z=true,allow_m=true) #:nodoc:\r\n bin_rep = [@x,@y].pack(\"EE\")\r\n bin_rep += [@z].pack(\"E\") if @with_z and allow_z #Default value so no crash\r\n bin_rep += [@m].pack(\"E\") if @with_m and allow_m #idem\r\n bin_rep\r\n end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def _sint2b(data)\n data.unpack('s').first\n end", "def process_data(type, data)\n case type\n when :boolean\n MuseekBindings::BinUtils.pack_boolean(data)\n when :uint32\n MuseekBindings::BinUtils.pack_uint32(data)\n when :string\n MuseekBindings::BinUtils.pack_string(data)\n end\n end", "def encode\n s = \"#{punpack_string(@ts)}#{punpack_string(@ls)}\"\n [@type, @length, @value].pack(\"#{s}a*\")\n end", "def array2str(type, arr)\n case type\n when :char, :int8\n arr.pack('c*')\n when :uchar, :uint8\n arr.pack('C*')\n when :short, :int16\n arr.pack('s*')\n when :ushort, :uint16\n arr.pack('S*')\n when :int32\n arr.pack('l*')\n when :uint32\n arr.pack('L*')\n when :int\n arr.pack('i!*')\n when :uint\n arr.pack('I!*')\n when :bool\n [arr ? 1 : 0].pack('i!*')\n when :long\n arr.pack('l!*')\n when :ulong\n arr.pack('L!*')\n when :long_long, :int64\n arr.pack('q*')\n when :ulong_long, :uint64\n arr.pack('Q*')\n when :size_t\n arr.pack(SIZET_FORMAT)\n when :float\n arr.pack('f*')\n when :double\n arr.pack('d*')\n when :string, :pointer\n arr.pack('p*')\n else\n raise \"unknown type #{type}\"\n end\n end", "def big_endian?\n @big_endian\n end", "def encode\n s = \"#{@value}\\000\"\n\n n = 0\n @lengths.each do |l|\n s << [@types[n]].pack(\"#{punpack_string(l)}\")\n n += 1\n end\n s\n end", "def pack_dword(w)\n [w & 255, w >> 8].pack(\"c*\")\n end", "def arch\n @header.arch\n end", "def pack\n end", "def pack\n @volume_uuid + [@offset].pack(\"L\")\n end", "def detect_architecture()\r\n\t\tprint_status(\"Attempting to automatically detect the architecture\")\r\n\t\tres = send_serialized_request(\"osarch.bin\")\r\n\t\tif (res.body =~ /(i386|x86)/i)\r\n\t\t\tarch = $1\r\n\t\t\tif (arch =~ /i386|x86/i)\r\n\t\t\t\treturn ARCH_X86\r\n\t\t\t\t# TODO, more\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def actual_arch\n arch = nil\n\n if explicit_arch.nil? == false\n arch = explicit_arch\n elsif datastore['ARCH']\n arch = datastore['ARCH']\n elsif assoc_exploit\n arch = assoc_exploit.target_arch || ARCH_X86\n end\n\n # If we still have an invalid architecture, then we suck.\n if arch.nil?\n raise NoCompatiblePayloadError, \"An architecture could not be determined by the generic payload\"\n elsif arch.kind_of?(String)\n arch = [ arch ]\n end\n\n return arch\n end", "def encode\n type_byte + encode_data\n end", "def to_binary(options = {})\n id_for_pack = options[:for_validation] ? 0 : id\n [1, id_for_pack, expiry, 0, 32, device_token, payload_size, payload].pack(\"cNNccH*na*\")\n end", "def pack(arg)\n [self].pack(arg)\n end", "def bytes\n @slots.map { |s| s.nil? && [0, 0] || [s.hash, s.offset] }\n .flatten\n .pack('V*')\n end", "def pack_format\n \"a#{width}\"\n end", "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def packed?\n @packed\n end", "def i32s\n r = little? ? BinUtils.get_sint32_le(@data, @pos) : BinUtils.get_sint32_be(@data, @pos)\n @pos += 4\n r\n end", "def value\n [offset].pack(\"L\").unpack(\"F\").first\n end", "def get_i32\n res, @data = @data.unpack(\"Na*\")\n self.underrun! unless res\n res - ((res & INT_MASK) << 1)\n end", "def _uint32(typename)\n _read_type(4, typename).unpack(\"N\").first\n end", "def to_s\n [0, 32, @device_token, @payload.length, @payload ].pack(\"CnH*na*\")\n end", "def unpack(p0) end", "def show_endian\n\t\t\tendian_str = \"\"\n\t\t\tcase @elf_endian\n\t\t\twhen ELF_LITTLE_ENDIAN\n\t\t\t\tendian_str = \"2's complement, little endian\"\n\t\t\twhen ELF_BIG_ENDIAN\n\t\t\t\tendian_str = \"2's complement, big endian\"\n\t\t\telse\n\t\t\t\tendian_str = \"Invalid Endian\"\n\t\t\tend\n\t\t\tputs \" Data: #{endian_str}\"\n\t\tend", "def to_hex\n to_octet.unpack('H*').first\n end", "def binmode\n end" ]
[ "0.6694701", "0.6540983", "0.6429136", "0.6191091", "0.61608356", "0.6076408", "0.60125005", "0.5882033", "0.58245844", "0.58080626", "0.57985103", "0.57800794", "0.57346034", "0.570882", "0.5704685", "0.5697191", "0.56304663", "0.5610067", "0.56046456", "0.5602921", "0.558216", "0.5573929", "0.556297", "0.55432093", "0.5533532", "0.5523834", "0.5514131", "0.55075115", "0.5499735", "0.546645", "0.54659617", "0.54650354", "0.5450692", "0.54470503", "0.5440885", "0.54396236", "0.54196525", "0.541828", "0.54059994", "0.5401452", "0.53892386", "0.53689027", "0.536515", "0.53529793", "0.5344266", "0.53027374", "0.5290793", "0.52849907", "0.5282194", "0.5280683", "0.5273058", "0.5271939", "0.52552843", "0.52514327", "0.5244266", "0.5239271", "0.5209194", "0.51989716", "0.5197283", "0.5184743", "0.51709145", "0.5169367", "0.51366127", "0.51321757", "0.51303184", "0.51215744", "0.5117083", "0.51125985", "0.5107137", "0.51017565", "0.5090913", "0.5090887", "0.5080699", "0.5079571", "0.50706065", "0.50559485", "0.5055205", "0.50374", "0.5029473", "0.50203216", "0.50181973", "0.50157523", "0.50147706", "0.5012401", "0.5011747", "0.50039834", "0.49956453", "0.49772716", "0.49709678", "0.4966148", "0.49639124", "0.49597374", "0.49540925", "0.49477115", "0.49437904", "0.4936809", "0.49295014", "0.49266428", "0.49242723", "0.49057972" ]
0.6866169
0
The path used after confirmation.
def after_confirmation_path_for(resource_name, resource) '/' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_confirmation_path_for(resource_name, resource)\n root_path\n end", "def after_confirmation_path_for(resource_name, resource) \n send(\"edit_#{resource.class.name.underscore}_path\",resource)\n end", "def after_confirmation_path_for(resource_name, resource)\n current_dreamer ? account_dreamer_path(current_dreamer) : root_path\n end", "def after_confirmation_path_for(resource_name, resource)\n root_path(resource_name)\n end", "def path\n location.path\n end", "def after_confirmation_path_for(_resource_name, _resource)\n current_user_locations_path\n end", "def after_confirmation_path_for(resource_name, resource)\n logger.debug(\"Users::ConfirmationsController.after_confirmation_path_for\")\n super(resource_name, resource)\n end", "def path\n unless self.delete_marker?\n active_path\n else\n trash_path\n end\n end", "def after_confirmation_path_for(resource_name, resource)\n super(resource_name, resource)\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n root_path\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n root_path\n end", "def after_confirmation_path_for(resource_name, resource, params = {})\n #super(resource_name, resource)\n if signed_in?(resource_name)\n signed_in_root_path(resource)\n else\n home_path()\n end\n end", "def path\n ensure_valid\n @path\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n root_path\n end", "def after_confirmation_path_for(resource_name, resource)\n if Rails.configuration.respond_to?(:confirmation_urls)\n Rails.configuration.confirmation_urls[resource_name][\"confirmation_succeeded\"]\n else\n #In future report this kind of case to System Admin via email\n 'http://'+request.host+':'+request.port.to_s\n end\n end", "def path\n return @path\n end", "def path\n return @path\n end", "def path\n return @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def after_confirmation_path_for(resource_name, resource)\n edit_profile_path(resource.profile)\n end", "def path\n return @path\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n root_path(resource_name)\n end", "def after_confirmation_path_for(resource_name, resource)\r\n users_settings_path\r\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def after_confirmation_path_for(resource_name, resource)\n dm_cms.showpage_path(:locale => DmCore::Language.locale, :slug => 'confirmation_success')\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n current_dreamer ? account_dreamer_path(current_dreamer) : new_session_path(resource_name)\n end", "def full_path\n path\n end", "def after_confirmation_path_for(resource_name, resource)\n unless params[:user].nil?\n admin_path\n else\n new_user_session_path\n end\n #super(resource_name, resource)\n end", "def path\n @location.path\n end", "def after_confirmation_path_for(resource_name, resource)\n \tif signed_in?\n \t signed_in_root_path(resource)\n \telse\n \t new_session_path(resource_name)\n \tend\n end", "def after_confirmation_path_for(resource_name, resource)\n \t'/welcome/index'\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n `window.location.pathname`\n end", "def path\n end", "def path\n\t\trequest.original_fullpath\n\tend", "def success_path\n\t\t\t\t\t\tric_payment_public.done_payment_url(@payment_subject)\n\t\t\t\t\tend", "def confirm\n\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n new_session_path(resource_name) if is_navigational_format?\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n new_session_path(resource_name) if is_navigational_format?\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n new_session_path(resource_name) if is_navigational_format?\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n new_session_path(resource_name) if is_navigational_format?\n end", "def path\n location.nil? ? nil : location.path\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n is_navigational_format? ? sms_confirmation_path(resource_name) : '/'\n end", "def confirmation\n end", "def after_confirmation_path_for(resource_name, resource)\n\nif user_signed_in?\n\nroot_path\n\nelse\n\nnew_user_session_path\n\nend\n\nend", "def after_confirmation_path_for(resource_name, resource)\n if signed_in?(resource_name)\n if resource.is_admin?\n admins_path(resource)\n end\n else\n new_session_path(resource_name)\n end\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n super(resource_name)\n end", "def after_confirmation_path_for(resource_name, resource)\n after_sign_in_path_for(resource) if is_navigational_format?\n end", "def confirm_path?(param)\n confirm_addresses = [\n \"/confirm\"\n ]\n confirm_addresses.any?{ |path| path == param }\n end", "def path\n\t\t@path\n\tend", "def after_confirmation_path_for(resource_name, resource)\n if signed_in?(resource_name)\n signed_in_root_path(resource)\n else\n new_session_path(resource_name)\n end\n end", "def after_confirmation_path_for(resource_name, resource)\n if signed_in?(resource_name)\n signed_in_root_path(resource)\n else\n new_session_path(resource_name)\n end\n end", "def remote_path\n File.join(path, TRIGGER).sub(/^\\//, '')\n end", "def full_path; end", "def current_path\n current_folder.path\n end", "def to_path\n @path\n end", "def path\n Path.new(@tmpname)\n end", "def path\n @j_del.path\n end", "def after_confirmation_to_set_profile_path_for(resource_name, resource)\n auth_confirmation_success_path()\n end", "def path\n nil\n end", "def path() end", "def path() end", "def path() end", "def after_resending_confirmation_instructions_path_for(resource_name)\n logger.debug(\"Users::ConfirmationsController.after_resending_confirmation_instructions_path_for\")\n super(resource_name)\n end", "def after_confirmation_path_for(resource_name, resource)\n after_sign_in_path_for(resource)\n end", "def return_path(value = nil)\n if value.nil?\n @return_path\n else\n @return_path = value\n end\n end", "def original_fullpath; end", "def after_confirmation_path_for(resource_name)\n if signed_in?(resource_name)\n authenticated_path\n else\n login_path\n end\n end", "def after_confirmation_path_for(resource_name, resource)\n after_sign_in_path_for(resource)\n end", "def after_confirmation_path_for(resource_name, resource)\n after_sign_in_path_for(resource)\n end", "def after_confirmation_path_for(resource_name, resource)\n after_sign_in_path_for(resource)\n end", "def after_confirmation_path_for(resource_name, resource)\n after_sign_in_path_for(resource)\n end", "def current_file_path\n current_file.to_path\n end", "def after_confirmation_path_for(resource_name, resource)\n sign_in(resource) \n root_path\n end", "def path\n end", "def path\n end", "def path\n end", "def path_for(dialogue)\n ['', dialogue.model_name.route_key, dialogue.id].join('/')\n end", "def path\n ([*@options['path']].first.split(',').first || '/').strip\n end", "def success_path\n\t\t\t\t\t\tmain_app.root_path\n\t\t\t\t\tend", "def path\n return get_path self\n end", "def path\n request.path\n end", "def path\n driver.getOperaPath()\n end", "def path\n if [email protected]? && File.exists?(@path)\n @path\n end\n end", "def remaining_path\n @remaining_path || Bowser.window.location.path\n end", "def confirm\n end", "def confirm\n end", "def local_backup_path\n local_path\n end", "def path\n tempfile.path\n end", "def path\n @global_page.path\n end", "def file_path\n PATH_USER_DEFAULTS\n end", "def path\n @data[\"path\"].to_s\n end", "def get_current_path\n decompress_value(session['app.current_path']).tap do |path|\n session.delete('app.current_path') if path.blank?\n end\n end" ]
[ "0.66349876", "0.6573877", "0.6555062", "0.65253043", "0.6417593", "0.64080113", "0.6401703", "0.63872176", "0.6336483", "0.6322352", "0.6284309", "0.6257149", "0.6255734", "0.6243767", "0.6235097", "0.6198236", "0.6198236", "0.6198236", "0.618294", "0.618294", "0.618294", "0.618294", "0.6181818", "0.61735946", "0.6162197", "0.6161667", "0.6143161", "0.6143161", "0.6143161", "0.6143161", "0.6119095", "0.6111099", "0.61083204", "0.61060524", "0.6098964", "0.60447747", "0.60398674", "0.6008151", "0.6008151", "0.60039175", "0.6000213", "0.59849346", "0.5968624", "0.59587884", "0.5949041", "0.5949041", "0.5949041", "0.5949041", "0.5944859", "0.5940091", "0.5921025", "0.59152097", "0.5909698", "0.5890123", "0.5880113", "0.58748823", "0.58732885", "0.58636045", "0.58636045", "0.58615595", "0.5856749", "0.5844326", "0.5843173", "0.58426636", "0.5841234", "0.5839513", "0.5832832", "0.581915", "0.581915", "0.581915", "0.58060277", "0.57991004", "0.57979614", "0.579765", "0.57917064", "0.57819927", "0.57819927", "0.57819927", "0.57819927", "0.5770999", "0.5763486", "0.57622963", "0.57622963", "0.57622963", "0.57542664", "0.574664", "0.5744015", "0.5742037", "0.57341087", "0.572719", "0.5711767", "0.57107055", "0.5709715", "0.5709715", "0.5702312", "0.56978214", "0.5694008", "0.56916654", "0.56814885", "0.56780106" ]
0.66043603
1
We only want to be able write a 'name' to the class when the class is 'instantiated'
def initialize(name) @name = name @transactions = [ ] addtransaction("Beggining balance", 0.00) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @name = name\n end", "def initialize(name)\n @name = name #initialize any name\n @@all << self # pushing class into class variable\n end", "def append_class(name); end", "def append_class(name); end", "def initialize name\n @name = name\nend", "def name #use and initlizer to set name as an instance variable\n @name\nend", "def initialize(name) # This initializes our class by using the name variable.\n @name = name\n end", "def initialize(name)\n self.name = name \n end", "def initialize(initial_name)\n #what's important to your object upon its creation?\n puts \"I was created!\"\n @name=name\n end", "def initialize name\n @name = name\n end", "def initialize(name)\n @@count += 1\n @name = name #このクラス内であれば使用できる\n end", "def add_class(name); end", "def add_class(name); end", "def initialize (name)\n @name = name\nend", "def initialize\n @name=\"Abhinav\"\n end", "def initialize\n\t\t@name = \"Jonathan\"\n\tend", "def initialize\n @name = ''\n end", "def initialize name\n @name = name\n end", "def initialize(name) # used to set some defaults\n @name = name # @ instance variables\n end", "def initialize(name)\n @name = name #initializes the name\n end", "def initialize(name)\n @name= name\n end", "def initialize name\n\t\t\t@name = name\n\t\tend", "def initialize(klass, name)\n @klass, @name = klass, name\n end", "def initialize (value1)\n @name = value1\n# try self.name*****\n end", "def initialize(name) # this is a constructor because it gets called whenever we create a new object.\n @name = name\n end", "def initialize(name) #initial with name\n @name = name # set name instance varibale to the passing name\n @@all << self # keep track of all instances by putting each instance into the class variable all array\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def name; super; end", "def name; super; end", "def initialize(name)\r\n @name = name\r\n end", "def initialize(name)\r\n @name = name\r\n end", "def initialize\n @name\n @@all << self\n end", "def initialize name\n\t\t@name = name\n\t\t@@instances << self\n\tend", "def initialize(name)\n @name = name\n \n end", "def initialize(name)\r\n@name = name\r\nend", "def initialize(nameIn)\n @name = nameIn\n end", "def initialize(nameIn)\n @name = nameIn\n end", "def initialize(name)\n self.name = name\n end", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def new\n @entry = @class.new\n @name = @class.name.underscore.humanize.split.map(&:capitalize).join(' ')\n end", "def initialize(name) end", "def initialize(name)\r\n \t\t@name = name\r\n \tend", "def initialize(name=\"anyonone\")\n #a call to the name method\n self.name = name #without self, you are assigning a variable\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n self.name = name\n end", "def initialize(name)\n self.name = name.to_s\n self.attributes = []\n self.single_associations = []\n self.array_associations = []\n self.hash_associations = []\n CLASSES << self\n end", "def initialize(name)\n @name = name #variable class diawali @, akan dibuat ketika object dibuat\n end", "def initialize(name)\n super()\n @name = name.underscore.to_sym\n end", "def initialize(name) # initialize with name\n @name = name # set instance variable name = to the name thats passed\n @@all << self # pushes every instance into the class variable array all\n end", "def initialize(name) # aqui ionicializamos nuestro contructor ahora que instanciemos un objeto este ira primero aqui \n @nombre = name #esta es una variable de instancia \n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n \t\t@name = name\n \tend", "def initialize(name)\n @name = name\n @@all << self\n end", "def initialize(name) #new is initialized with argument for name\n @name = name #HAS A name\n @@all << self #pushes new instances (self) in our class variable upon initialization\n end", "def class_name=(name)\n %x{\n for (var i = 0, length = self.length; i < length; i++) {\n self[i].className = name;\n }\n }\n self\n end", "def initialize(name) #initialize with a name\n @@all << self\n\n @name = name\n end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end" ]
[ "0.7006427", "0.6978709", "0.6959472", "0.6959472", "0.69211197", "0.6901204", "0.6898694", "0.6868788", "0.68578815", "0.6840619", "0.6790834", "0.67635053", "0.67635053", "0.6756377", "0.67373675", "0.6718981", "0.66858524", "0.6679505", "0.66757065", "0.6628029", "0.6626657", "0.66152436", "0.6601415", "0.65757567", "0.6570572", "0.656523", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.6559411", "0.65458953", "0.65458953", "0.6505053", "0.6505053", "0.64955723", "0.6488987", "0.64876807", "0.648559", "0.6478481", "0.6478481", "0.6470051", "0.6465681", "0.6465681", "0.6465681", "0.6465681", "0.6465681", "0.6465681", "0.64650816", "0.64629334", "0.64468306", "0.64407885", "0.64312613", "0.6386915", "0.6386074", "0.63858974", "0.6385461", "0.63721377", "0.63700706", "0.63688016", "0.6368768", "0.6368768", "0.6368768", "0.6368768", "0.6368768", "0.6367853", "0.63656497", "0.63634473", "0.6361007", "0.6357755", "0.6352411", "0.6352411", "0.6352411", "0.6352411", "0.6352411", "0.6352411", "0.6352411" ]
0.0
-1
Calculate the balance based off of all of the transactions that exist within the account. We do this by writing a method called `balance`. Use 'each' method to iterate over the transactions using a 'do' block
def balance balance = 0.00 @transactions.each do |transaction| balance += transaction[:amount] end return balance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def balance\n balance = 0.00\n @transactions.each do | transaction|\n balance += transaction[:amount]\n end\n return balance\n end", "def balance\n # accounts.reduce(0) {|sum, account| sum + account.balance}\n accounts.sum {|account| account.balance}\n\n # total = 0\n # accounts.each {|account| total += account.balance}\n # total\n end", "def balance\n @balance ||= starting_balance + transactions.inject(0) do |result, element|\n result + element.amount\n end\n end", "def balance\n\t\tbalance = 0\n\t\[email protected] do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\n\t\treturn balance\n\tend", "def balance\n transactions.inject(0) do |sum, transaction|\n sum + transaction.amount\n end\n end", "def account_balance\n balance = 0\n deposits.each {|deposit| balance += deposit.amount}\n\n transactions.each do |transaction|\n amount = transaction.price * transaction.num_shares\n transaction.order_type == 'BUY' ? balance -= amount : balance += amount\n end\n return balance.round(2)\n end", "def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end", "def balance\n return false unless Account.exists?(@account_id)\n\n Trade.where(account_id: @account_id).pluck(:amount).reduce(:+) || 0.0\n end", "def balances\n accounts.with_balance\n end", "def balance\n # accounts.reduce(0){|sum, account| sum + account.balance}\n accounts.sum{|account| account.balance} \n end", "def balance\n res = dollars\n\n fund_transactions.each do |tran|\n res += tran.dollars\n end\n\n return res\n end", "def balance\n sum = 0\n @money.each do |k, v|\n sum += k * v\n end\n sum\n end", "def balance(account)\n net_deposits(account) - net_withdraws(account)\n end", "def balance_dollars\n transactions = Transaction.where('contact_id = ?', id)\n .includes(:settled_by)\n\n totalPaid = Money.new(0)\n totalSettled = Money.new(0)\n\n transactions.each do |loan|\n totalPaid = totalPaid + loan.amount_dollars\n\n loan.settled_by.each do |payback|\n totalSettled = totalSettled + payback.amount_dollars\n end\n end\n\n return totalPaid + totalSettled\n end", "def balance\n return @balance if @balance.present?\n\n result = api_customers_command\n\n @balance = [ result[:account_balance_in_btc_normalized], result[:account_balance_in_usd] ]\n end", "def balance\n transactions.inject(:+)\n end", "def balance_for(account)\n @accounts[account]\n end", "def balances()\n request(\"#{@base_url}/account/getbalances\")\n end", "def balance\n self.ledger_entries.sum(:value)\n end", "def balance(account)\n return balances[account] || infer_balance(account) # need to infer the balance if the account is not in ledger's output\n end", "def balance(date = Time.now)\n total = 0\n\n transactions.sort_by(&:transaction_at).each do |transaction|\n break if transaction.transaction_at.end_of_day > date.end_of_day\n\n total += transaction.adjusted_amount\n end\n\n total\n end", "def balance_for( wallet, include_pending_transactions=false )\n\t\tself.log.debug \"Checking balance for wallet %s\" % [ wallet ]\n\n\t\ttotal = self.chain.inject( 0 ) do |sum, block|\n\t\t\tself.log.debug \"Summing from block %d\" % [ block.index ]\n\t\t\tsum + block.transactions.inject( 0 ) do |trsum, transaction|\n\t\t\t\tchange = transaction_change_for( wallet, transaction )\n\t\t\t\tself.log.debug \" txn %p: %+d\" % [ transaction, change ]\n\t\t\t\ttrsum + change\n\t\t\tend\n\t\tend\n\t\tself.log.debug \" total from chain: %p\" % [ total ]\n\n\t\tif include_pending_transactions\n\t\t\ttotal += self.current_transactions.inject( 0 ) do |trsum, transaction|\n\t\t\t\tchange = transaction_change_for( wallet, transaction )\n\t\t\t\tself.log.debug \" %+d\" % [ change ]\n\t\t\t\ttrsum + change\n\t\t\tend\n\t\t\tself.log.debug \" total after pending transactions: %p\" % [ total ]\n\t\tend\n\n\t\treturn total\n\tend", "def balance(account_name=nil)\n request('getbalance', account_name)\n end", "def balance(ending_at=nil)\n return @balance if !!@balance && !ending_at\n if ending_at\n balance_cents = self.transactions.sum(:cents,\n :conditions => [\"created_at < ? AND action NOT IN (?)\", ending_at, ['authorize', 'void']]\n )\n @balance = nil\n Money.new(balance_cents || 0, self.currency)\n else\n @balance = Money.new(self.cents, self.currency)\n end\n end", "def all_wallet_balances\n\t\ttotals = Hash.new {|h,uuid| h[uuid] = 0 }\n\t\ttotals[ GENESIS_WALLET ] = INITIAL_AMOUNT\n\n\t\tself.each_block do |block|\n\t\t\tblock.transactions.each do |tr|\n\t\t\t\ttotals[ tr[:to] ] += tr[:amount]\n\t\t\t\ttotals[ tr[:from] ] -= tr[:amount]\n\t\t\tend\n\t\tend\n\n\t\treturn totals.transform_values {|val| Money.new(val, :zmz) }\n\tend", "def balance\n @balance ||= starting_balance + flights.inject(0) do |result, element|\n result + element.profit\n end\n end", "def balance\n self.all_benefits - self.all_pays\n end", "def balance(account_id)\n balances.by_pk(account_id).one!\n end", "def current_balance\n starting_balance + transactions.sum(:amount)\n end", "def balances\n return @balances_hash if @balances_hash\n ledger_balances = cmd 'bal --balance-format \"%A | %(display_total)\\n\"'\n @balances_hash = Hash[*(ledger_balances.split(\"\\n\")).map{|line| parse_account_line(line)}.flatten]\n end", "def account_balance\n response = execute_command('getbalance')\n parse_response(response)['Credit'].to_f\n end", "def total_balance(id)\n Account.find(id).total\n end", "def balance\n Money.new(\n Revenue.to_account(self).joins(:virtual_revenues).sum('\"virtual_revenues\".\"cents\"').to_i +\n Transfer.to_account(self).sum(:cents) - Transfer.from_account(self).sum(:cents) - \n Purchase.from_account(self).joins(:virtual_purchases).sum('\"virtual_purchases\".\"cents\"').to_i +\n self.initial_balance_in_cents\n )\n end", "def balance(known_balances = {})\n known_balances.has_key?(name) && known_balances[name] ||\n rpc.getbalance(name)\n end", "def balance\n if @options[:verbose]\n warning = \"Coinbase doesn't provide a USD balance because\"\n warning << \" it connects to your bank account. Be careful, \"\n warning << \"because this will withdraw directly from your accounts\"\n warning << \"when you trade live.\"\n logger.warn warning\n end\n @balance ||= [max_float, max_float]\n end", "def balance\n @accounts.values.first\n end", "def balance(date=Date.tomorrow)\n ledger_entries.before_date(date).sum(:debit) - ledger_entries.before_date(date).sum(:credit)\n end", "def account_cash_balance(investor)\n cash_balance = 0\n @hash_row_array.each do |hash|\n price = hash[\"TXN_PRICE\"]\n price[0] = ''\n price_float = price.to_f\n cash_total = price_float * hash[\"TXN_SHARES\"].to_f\n if hash[\"INVESTOR\"] == investor && hash[\"TXN_TYPE\"] == \"BUY\"\n cash_balance += cash_total\n end\n end\n return cash_balance.round(2)\nend", "def balance\n params = {'username' => ENV['ROCK_USERNAME'],\n\t\t 'password' => ENV['ROCK_PASSWORD'],\n 'api_key' => ENV['ROCK_KEY']}\n\n btc_balance = 0.0\n\tusd_balance = 0.0\n\n\tresponse = RestClient.post(\"https://www.therocktrading.com/api/get_balance\", params, {})\n\tr_json = JSON.parse(response)\n\tif (r_json.keys.include?(\"result\"))\n\t r_json[\"result\"].each do |currency|\n if currency[\"currency\"]==\"BTC\"\n \t btc_balance = currency[\"balance\"].to_f\n\t elsif currency[\"currency\"]==\"USD\"\n\t usd_balance = currency[\"balance\"].to_f\n end\n\t end\n \telse\n\t btc_balance = 0.0\n\t usd_balance = 0.0\n\tend\n return [btc_balance, usd_balance]\n end", "def balance\n credit = FineBalance.sum('AMOUNT', :conditions=>{:INCURRED_ID=>self.CHARGE_INCURRED_ID})\n return self.AMOUNT-credit\n end", "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end", "def infer_balance(account)\n sub_accounts = balances.keys.compact.map{|k| k.match(/#{account}:[^:]*/)}.compact\n relevant_accounts = sub_accounts.map(&:to_s).uniq\n relevant_account_balances = relevant_accounts.map{|a| balance(a)}\n balance = relevant_account_balances.reduce({:amount => 0, :currency => nil}){|s,h| {:amount => s[:amount] + h[:amount], :currency => h[:currency]}}\n end", "def balances\n # Very inefficient at this point for a large network...\n self.network_as_users.map { |user|\n {:balance => self.balance_with(user), :user => user}\n }.select {|balance| balance[:balance].to_f != 0.0}\n end", "def total_balance\n\t\tputs \"Total Balance: #{@@accounts.total}\"\n\tend", "def total_balance\n return @checking_account_balance + @saving_account_balance\n end", "def balance\n @client.balance(name)\n end", "def balance\n body = { action: \"balance\", key: @@access_key }\n post_request(body).to_i\n end", "def balance(address)\n json = get_json(\"/rawaddr/#{address}\")\n info(\"Total transactions: #{json['n_tx']}\")\n info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def balance\n entries = @@ledgers.find(\"owner\" => @sender).first['entries']\n\n sum = 0\n entries.each do |entry|\n value = entry['value'].gsub(\"$\",\"\")\n\n if entry['value'][0] == '('\n value = value[1..-2]\n sum = sum - value.to_i\n else\n sum = sum + value.to_i\n end\n end\n\n @t.say(\"The balance is $#{sum}\")\nend", "def update_balances\n @balances = {}\n balance = @starting_balance\n sorted_transactions.each do |t|\n key = t.transaction_at.to_date\n\n balance += t.adjusted_amount\n\n @balances[key] = balance\n end\n\n # fill in missing dates for easy lookup\n last_date = nil\n last_balance = nil\n @balances.keys.sort.each do |date|\n while last_date && last_date < (date - 1.day).to_date\n last_date = (last_date + 1.day).to_date\n @balances[last_date] = last_balance\n end\n\n last_date = date\n last_balance = @balances[date]\n end\n end", "def balance(date = nil)\n return @starting_balance if @transactions.empty?\n\n update_balances\n date = end_date if date.nil?\n\n raise \"Transaction set begins later than this date\" if date < start_date\n raise \"Transaction set ends before this date\" if date > end_date\n\n @balances[date.to_date]\n end", "def balance\n @balance ||= total - amount_paid\n end", "def get_balance\n return balance\n end", "def balance(address)\n uri = Iri.new('https://chain.api.btc.com/v3/address').append(address).append('unspent')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n if json['err_no'] == 1\n @log.info(\"The balance of #{address} is zero (not found)\")\n return 0\n end\n data = json['data']\n if data.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n txns = data['list']\n if txns.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n balance = txns.map { |tx| tx['value'] }.inject(&:+) || 0\n @log.info(\"The balance of #{address} is #{balance}, total txns: #{txns.count}\")\n balance\n end", "def balance(confirmed = true)\n contributions.confirmed(confirmed).sum(:amount)\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n URI(\"https://blockchain.info/rawaddr/#{address}\")\n )\n @log.info(\"Total transactions: #{json['n_tx']}\")\n @log.info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def balance\n request_params = params.permit(:account_id)\n\n balance ||= Actions.new.balance(request_params['account_id'])\n\n return render status: balance[0], json: balance[1]\n end", "def balance(address)\n best_of('balance') do |api|\n api.balance(address)\n end\n end", "def balance\n if self.normal_balance.debit?\n self.amounts.balance\n elsif self.normal_balance.credit?\n - self.amounts.balance\n else\n nil\n end\n end", "def total_balance(confirmed = true)\n balance(confirmed) - payments.sum(:amount)\n end", "def update_balance(transaction_id)\n transaction = Transaction.find(transaction_id)\n account = transaction.account\n balance = account.balance\n\n if transaction.credit == true\n account.update(balance: balance + transaction.amount)\n else\n account.update(balance: balance - transaction.amount)\n end\nend", "def subtract_amount_from(transactions, value)\n transactions.each do |transaction|\n new_balance = transaction.account_balance - value\n transaction.update(:account_balance => new_balance)\n end\n end", "def balance(query = nil)\n Ledger::Balance.get(query)\n end", "def balance\n wallet = Fyb.private.getaccinfo.perform.parse\n btc_label = 'btcBal'\n money_label = Fyb::Configuration.currency.to_s + 'Bal'\n\n btc = BigDecimal.new wallet[btc_label]\n real_money = BigDecimal.new wallet[money_label]\n\n { :btc => btc, Fyb::Configuration.currency => real_money }\n end", "def balance\n JSON.parse(response.body).fetch('balance')\n end", "def get_account_balance(account_id)\n query_api_object AccountBalance, \"/rest/accounts/#{account_id}/balance\"\n end", "def balance\n b = read_attribute(:balance)\n if User.current and User.current.currency\n b.to_d * User.current.currency.exchange_rate.to_d\n else\n b.to_d\n end\n end", "def balance\n rest.get(:getbalance)['data']\n end", "def update_balance(transaction)\n if transaction.succeeded?\n sign = transaction.payment? ? 1 : -1\n self.balance.update_attributes!(amount: (self.balance.amount + (transaction.amount * sign)))\n end\n end", "def balance\n # If in development, return a mocked amount\n return 1234 if Rails.env.development?\n\n # If in production, fetch the user's balance from Tab.\n @balance || begin\n headers = {\n \"Authorization\" => \"Token token=#{Rails.application.secrets.tab_api_key}\",\n \"Content-type\" => \"application/json\"\n }\n result = HTTParty.get(File.join(Rails.application.config.api_url, \"users\", \"#{name}.json\"), headers: headers)\n\n JSON.parse(result.body)[\"balance\"] if result.code == 200\n rescue StandardError # rubocop:disable Lint/SuppressedException\n end\n end", "def pending_balance\n transactions.where(pending: true).sum(:amount)\n end", "def balance\n exception = Exception.new(\"Invalid call\")\n\n Rollbar.error(exception, user: self)\n raise exception\n end", "def get_balance(address)\n #res = get(\"addr/\"+address+\"?noCache=1\")\n #(res['balance'] + res['unconfirmedBalance']).to_BTCFloat\n get(\"addr/\"+address+\"?noCache=1\")['balance'].to_BTCFloat\n end", "def calculate_balance(at=nil)\n if at.nil?\n bal = self.credits.calculate(:sum,:cents) - self.debits.calculate(:sum,:cents)\n self.update_attributes(:cents => bal, :saved_balance_on => Time.zone.now)\n else\n before_balance_date = {:conditions => [\"made_on < ?\",at]}\n bal = self.credits.calculate(:sum,:cents,before_balance_date) - self.debits.calculate(:sum,:cents,before_balance_date)\n end\n return Money.new(bal,self.currency)\n end", "def account_balance\n @account_balance\n end", "def daily_balances(start_date, end_date)\n LedgerAccountHelper.daily_balances(main_ledger_account, start_date, end_date)\n end", "def balance() @address.balance; end", "def get_members_balance(name)\n balance = 0\n events.each do |event|\n if event.payees.include?(name)\n balance += get_each_person_split(event)\n end\n end\n balance\n end", "def calculate_balance_forward\n invoices.each do |invoice|\n if date_range.is_active? && invoice.issue_date < date_range.start_date\n @balances[invoice.customer_id] += invoice.amount_due\n end\n end\n end", "def add_amount_to(transactions, value) \n transactions.each do |transaction|\n new_balance = transaction.account_balance + value\n transaction.update(:account_balance => new_balance)\n end\n end", "def index\n @deposits = Deposit.all\n @balance = 0\n @deposits.each do |d|\n if d.user_id == current_user.id\n @balance = @balance + d.amount\n end\n end\n end", "def balance_to(user)\n shared_projects = user.projects.where('projects.id' => self.project_ids)\n money_from_projects = shared_projects.reduce(0.0) do |sum, project|\n case project.bank\n when user\n sum - self.balance_for(project)\n when self\n sum + user.balance_for(project)\n when nil\n sum + (self.amount_spent_on(project) - user.amount_spent_on(project)) / project.users.count\n else\n sum\n end\n end\n money_from_projects + self.amount_payed_to(user) - self.amount_received_from(user)\n end", "def update_purchase_balance\n update(balance: financial_transactions.sum(:total_amount))\n end", "def getbalance(account = nil, minconf = 1)\n coind.getbalance account, minconf\n end", "def current_balance_active_only\n starting_balance + transactions.active.sum(:amount)\n end", "def balance_delta\n prepared.map(&:amount_with_sign).reduce(:+)\n end", "def balance(address)\n first_one do |api|\n api.balance(address)\n end\n end", "def outstanding_balances(group_custom_biller = nil)\n if group_custom_biller.present?\n # only participations and subscriptions for biller\n invoiceable_reservations = invoiceable_game_passes = []\n else\n invoiceable_reservations = reservations.invoiceable.\n users_with_groups(users).\n includes(:user).\n group_by(&:fetch_owner_id)\n invoiceable_game_passes = game_passes.invoiceable.group_by(&:user_id)\n end\n\n invoiceable_participations = participations_by_biller(group_custom_biller).\n invoiceable.group_by(&:user_id)\n invoiceable_group_subscriptions = group_subscriptions_by_biller(group_custom_biller).\n invoiceable.group_by(&:user_id)\n\n users.map do |user|\n [user.id,\n invoiceable_reservations[user.id].to_a.map { |r| r.outstanding_balance || 0.to_d }.sum.to_d +\n invoiceable_game_passes[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d +\n invoiceable_participations[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d +\n invoiceable_group_subscriptions[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d\n ]\n end.to_h\n end", "def paid_balance\n average = average_amount\n paid_infos.each do |k, v|\n paid_infos[k] = v - average\n end\n end", "def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end", "def balance\n return @balance\n end", "def get_balance(campaigns=[])\n api_call(\"GetBalance\",campaigns)\n end", "def balance(_address)\n raise Sibit::NotSupportedError, 'balance() doesn\\'t work here'\n end", "def balance #same as attr_reader :balance\n @balance\n end", "def get_account_balance\n submit GetAccountBalance.new\n end", "def balance\n parse_balance(post('/api/1/generic/info'))\n end", "def balance\n @balance\n end", "def getbalance(account = nil, minconf = 1)\n @api.request 'getbalance', account, minconf\n end", "def get_coin_balances(options = {})\n body = {\n cmd: \"balances\"\n }\n body[:all] = 1 if options[:all]\n post body\n end", "def return_balance(name)\n return find_account(name)[:balance]\n end" ]
[ "0.807822", "0.8018403", "0.79845005", "0.7948886", "0.7895782", "0.78477263", "0.780683", "0.7769322", "0.76587546", "0.76009876", "0.7558565", "0.751756", "0.7411776", "0.7401691", "0.7399176", "0.7356269", "0.73426634", "0.7307166", "0.7198905", "0.7197284", "0.7195446", "0.71836996", "0.7147285", "0.71429026", "0.71320045", "0.7097345", "0.70529205", "0.7020949", "0.7003955", "0.69764227", "0.69505453", "0.69109327", "0.68969405", "0.6892069", "0.6890276", "0.6876382", "0.67943376", "0.6786395", "0.6750565", "0.6745541", "0.6742439", "0.67298365", "0.67133164", "0.67073435", "0.67042345", "0.6702845", "0.66874826", "0.66646415", "0.6663107", "0.6656923", "0.66565394", "0.6618168", "0.6614288", "0.6609103", "0.6607156", "0.65894604", "0.65804523", "0.6577594", "0.6569798", "0.6557269", "0.6543422", "0.64991844", "0.64958584", "0.6493106", "0.64673895", "0.64656633", "0.645493", "0.6442586", "0.6440823", "0.6438344", "0.64188313", "0.64039695", "0.6401988", "0.64016086", "0.6390803", "0.63838893", "0.63616514", "0.6353563", "0.6346642", "0.6343148", "0.63426095", "0.63424104", "0.633676", "0.63306874", "0.6326876", "0.63117456", "0.6310134", "0.6306721", "0.62973654", "0.62906134", "0.6287635", "0.6275514", "0.6269276", "0.62528276", "0.6252691", "0.6249202", "0.6243905", "0.62396204", "0.62361115", "0.62236625" ]
0.79057163
4
Define a 'to_s' method in order to 'concatenate' the bank accoount balance in the format you awnt along with the bank account name and other details...
def to_s puts "Bank Account:\t#{name}\n" puts "Your current balance is:\t#{sprintf("%0.2f", balance)} USD" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n\t\t puts \"\\nEnding balance:\\nBank Account Name:\\t#{name}\\nBalance:\\t#{balance}\"\n\tend", "def to_s\n\t\t\"Name: #{name}, Balance: #{sprintf(\"%0.2f\", balance)}\"\n\tend", "def to_s\n \"Name: #{name}, Balance: #{sprintf(\"%0.2f\", balance)}\"\n end", "def to_s\n result = ''\n result << 'Balance('\n result << 'currency='\n if [email protected]?\n result << '\"' << @currency.to_s << '\"'\n else\n result << 'null'\n end\n result << ',amount='\n if [email protected]?\n result << @amount.to_s\n else\n result << 'null'\n end\n result << ')'\n result\n end", "def print_balance\n # $50.00\n # \"$\" + balance.to_s + \".00\"\n \"$#{balance}.00\"\n end", "def to_s\n \" #{account}\" +\n (amount ? \" #{amount}\" : \"\") +\n (note ? \" ; #{note}\" : \"\")\n end", "def to_s\n\t\t\t# Really need a money formatter */Sad Panda/*\n\t\t\t\"id: #{@id}, checking: #{@checking}, saving: #{@saving}, total: #{combined_capital}, interest_rate: #{@interest_rate}\"\n\t\tend", "def to_s\r\n\t\t\t\r\n\t\t\t\"#{@name} <email: #{@email}> acct: #{hidden_digits(@deposit_account)}\"\r\n\t\tend", "def to_s\n return \"ID: \" + @id.to_s + \", Balance: $%.2f\" % @balance + \", Date of creation: \" + @creation_date.to_s\n end", "def to_s\n\t\t\"#{@name} <email: #{@email}> acct: #{hidden_digits(@deposit_account)}\"\n\tend", "def to_s\n\n my_string = \"ID: \" + @id.to_s + \", Balance: $%.2f\" % @balance + \", Date of creation: \" + @creation_date.to_s + \", Type: \" + @type + \", Owner(s): \"\n\n # The section below tacks on a nicely formatted representation of owner's or owners'\n # names and IDs.\n\n if owners == nil || owners == [nil]\n my_string = my_string + \"<none>\"\n else\n counter = 0\n owners.each do |owner|\n if counter > 0\n my_string = my_string + \", \"\n end\n my_string = my_string + Bank::Owner.find(owner).name[:first] + \" \" + Bank::Owner.find(owner).name[:last] + \" (ID: \" + owner.to_s + \")\"\n counter += 1\n end\n end\n\n return my_string\n\n end", "def balance_inquiry\n \"$#{'%.2f' % @balance}\"\n end", "def to_s\n if @bankroll < 0\n bankroll = \"-$#{@bankroll.abs.to_s}\"\n else\n bankroll = \"$#{@bankroll.to_s}\"\n end\n return \"#{@name} [#{bankroll}]\"\n end", "def account_name_balance\n name + ' (' + current_balance_display + ')'\n end", "def display_balance\n \"Your balance is $#{@balance}.\"\n end", "def display_balance\n \"Your balance is $#{self.balance}.\"\n end", "def to_s\n result = ''\n result << 'Account('\n result << 'id='\n if [email protected]?\n result << @id.to_s\n else\n result << 'null'\n end\n result << ',name='\n if [email protected]?\n result << '\"' << @name.to_s << '\"'\n else\n result << 'null'\n end\n result << ',state='\n if [email protected]?\n result << @state.to_s\n else\n result << 'null'\n end\n result << ',wallet='\n if [email protected]?\n result << @wallet.to_s\n else\n result << 'null'\n end\n result << ',asset='\n if [email protected]?\n result << @asset.to_s\n else\n result << 'null'\n end\n result << ',orders='\n if @orders.nil?\n result << '[0][]'\n else\n first = true\n result << '[' << @orders.length.to_s << ']['\n @orders.each do |item|\n if !item.nil?\n result << (first ? '' : ',')\n result << item.to_s\n else\n result << (first ? '' : ',')\n result << 'null'\n end\n first = false\n end\n result << ']'\n end\n result << ')'\n result\n end", "def display_balance\n \"Your balance is $#{balance}.\" \n end", "def display_balance\n \"Your balance is $#{@balance}.\"\n end", "def to_string\r\n @id.to_s + ': ' + @billcoins.to_s + ' billcoins '\r\n end", "def pretty_balance\n puts \"You have $#{balance} in the bank\"\n end", "def to_s\n\t\t\"Transaction(#{@label}, #{@amount}, #{@withdrawal}, #{@date})\"\n end", "def formatted_balance\n format_monetary_value(balance)\n end", "def to_s\n result = @name\n if self.has_a_hand and not self.is_dealer\n result += \" [\\$#{@bet.to_s}]\"\n end\n result += \" [\\$#{@bankroll.to_s}]\"\n return result\n end", "def number_with_current_balance\n\t\t\"#{number} -- (#{current_balance.to_currency()})\"\n\tend", "def current_balance_display\n number_to_currency(current_balance)\n end", "def show_current_balance\n return \"Balance: $#{sprintf \"%.2f\", @balance}\"\n end", "def current_balance\n \"EUR. #{sprintf('%.2f', bankaccount.reload.balance)}\"\n end", "def bankroll_to_s\n return \"#@name [\\$#{@bankroll.to_s}]\"\n end", "def bank_bloc(num)\n return \"Total of $\" + num.to_s\nend", "def to_s\n account_number.gsub(/(\\d{2})(\\d{2})(\\d{2})(\\d{3})/, '\\1.\\2.\\3.\\4')\n end", "def display_balance\nputs = \"Your balance is $#{self.balance}.\"\nend", "def to_s\n \"#{@name} at #{MONEY_FORMAT % @price}\" \n end", "def pending_balance_display\n number_to_currency(pending_balance)\n end", "def to_s\r\n x = self.name + \" \" + self.credits.to_s\r\n x= x + \"\\n\" + self.get_items\r\n return x\r\n end", "def to_s\n result = \"[#{@cards.join(\"|\")}]: \"\n if is_soft\n result += total.join(\" or \")\n else\n result += total.to_s\n end\n if is_bust\n result += \" BUSTED\"\n elsif is_bj\n result += \" BLACKJACK\"\n elsif total_high == 21\n result += \" NICE\"\n end\n return result\n end", "def format_balance\n format(\"%.2f\", balance.to_f)\n end", "def to_s\n \"#{self.class} - ofx_id: #{@ofx_id}, date:#{@date}, raw description: #{@raw_description}, type: #{@type} amount: #{@amount}, new balance: #{@new_balance}\"\n end", "def to_s\n '$' + @dollars.to_s + '.' + @cents.to_s\n end", "def balance_display(balance)\n puts \"Your current balance is $#{@balance}.\"\n end", "def to_s; @coins.join \",\" end", "def to_s\n c = self.class.to_s\n super.sub(c, c + \"+Bondage\")\n end", "def format_acct_amount(acct_amount)\n \"%s %s %s\" % [\n format_amount(acct_amount.amount),\n format_account_code(acct_amount.code),\n context.chart_of_accounts.name_for_code(acct_amount.code)\n ]\n end", "def to_s\n s = sprintf(\"%0.#{@currency.decimal_places}f\", amount)\n s.gsub(\".\", decimal_mark)\n end", "def to_s\n str = \"#{@name} sells #{@tea} for $#{@price}\\n\"\n str << \"This place has made $#{profit}\"\n str\n end", "def prt_balance\n b = self.balance\n return \"#{'-' if b.cents<0}#{b.currency.symbol}#{b.abs.to_s}\"\n end", "def to_s\r\n \"#{self.name}, #{self.credits}\"\r\n end", "def to_s\n \"Tax authority: #{@authority}\\n\" +\n \"-Sales Taxes: #{@sales_tax.to_i}% rate on all goods except #{exempt_basic}.\\n\" + \n \"-Import Duty: #{@import_duty.to_i}% rate on all imported goods.\"\n end", "def to_s\n\t\t\"#{@value}-#{@suit}\"\n\tend", "def to_s\n \"[#{date}] #{currency} #{value} - #{description}\"\n end", "def to_s\n \"#{self.name}, #{self.credits}\"\n end", "def print_register\n puts \"#{name}'s' Bank Account\"\n puts \"/\" * 40\n\n puts \"Description\".ljust(30) + \"Amount\".rjust(10)\n puts \"/\" * 40\n @transactions.each do |transaction|\n puts transaction[:description].ljust(30) + sprintf(\"%0.2f\", transaction[:amount]).rjust(10)\n end\n\n puts \"-\" * 40\n\n puts \"Ending Balance:\".ljust(30) + sprintf(\"%0.2f\", balance).rjust(10)\n puts \"-\" * 40\n end", "def to_s\n super() + \", #{@z}\" \n end", "def units_balance\n return \"#{@unit} balance\" if @unit.present?\n 'Balance'\n end", "def to_s\n #Build the string we are going to print\n \ts=\"\"\n\ts=@name+\" \"[email protected]_s\n\ts\n end", "def to_s\n result = \"\"\n self.each { |card | result << \"#{card} \" } \n return result\n end", "def to_s\n [self.rank,self.suit].join\n end", "def to_s\n valid? ? \"%s%s %s%s%s %s%s%s %s%s%s\" % @abn.split('') : \"\"\n end", "def to_s\n output = @value.to_s\n output += \"+#{@variation}\" if @variation\n output\n end", "def inspect\n\n \"#{'%.02f' % (@amount_bigdecimal)} #{@currency}\"\n\n end", "def to_s\n string = \"\"\n @data.each do |expense|\n string << \"#{expense} \"\n end\n string << \"\\n\"\n end", "def to_s\n parts = []\n parts.push cartable.description\n parts.push cartable.player.name(id: true) if cartable.player.present?\n parts.push \"€#{'%.2f' % cartable.cost}\"\n parts.push I18n.t(\"shop.payment.status.#{cartable.status}\", locale: :en) unless cartable.paid?\n parts.join(\", \")\n end", "def to_s\n\t\tstr = \"\"\n\t\[email protected] do |card|\n\t\t\tstr += \"#{card} \"\n\t\tend\t\n\t\tstr.strip\t\n\tend", "def display_amount\n self.symbol + self.to_s\n end", "def non_pending_balance_display\n number_to_currency(non_pending_balance)\n end", "def printbalance\n puts \"Your balance = #{@balance}\"\nend", "def total_amount_to_s\n \"%0.2f\" % total_amount\n end", "def to_s\n \"Name = #{@name}\\nLevel = #{@combatLevel}\\nCultist Change Level = #{@levelChangeAgainstCultistPlayer}\\nPrize = [\" + @prize.to_s + \"] \\nBad Consequence = \" + @badCons.to_s() + \"\\n\"\n end", "def currency_as_string; end", "def inspect\n \"#{\"%0.02f\" % @amount} #{@base_currency}\"\n end", "def to_s\n \"#{bairro} #{logradouro} #{complemento} #{lote}, #{cidade} - #{cidade.estado}\"\n end", "def to_s()\n @name.to_s + \"\\n\" + @address.to_s + \"\\n\" + @phone.to_s + \"\\n\" + @email.to_s\n end", "def show_bankaccount()\n p \"The owner is #{@owner}, and The balance is #{@balance}\"\n end", "def format\n \"#{amount} #{currency}\"\n end", "def to_s\n \"[Peso=#{@peso}, Talla=#{@talla}, Cintura=#{cintura}, Cadera=#{cadera}, Bicipital=#{bicipital}, Tricipital=#{tricipital}, Subescapular=#{subescapular}, Suprailiaco=#{suprailiaco}, Brazo=#{brazo}]:\"\n end", "def to_s\n \"ISBN: #{@isbn}, price: #{@price}\"\n end", "def to_s(options={})\n Money::Formatter.format(self, options)\n end", "def account_summary(account)\n [number_to_currency(account.opportunities.pipeline.map(&:weighted_amount).sum, precision: 0),\n t(:added_by, time_ago: time_ago_in_words(account.created_at), user: account.user_id_full_name),\n t('pluralize.contact', account.contacts_count),\n t('pluralize.opportunity', account.opportunities_count),\n t('pluralize.comment', account.comments.count)].join(', ')\n end", "def to_s\n \t\"#{first_name} #{last_name}\"\n end", "def to_s\n \"#{@numerador}/#{@denominador}\"\n end", "def to_s\n \"ISBN: #{@isbn}, price: #{@price}\"\n end", "def to_s\n return self.suit.to_s + self.rank.to_s\n end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end" ]
[ "0.8387256", "0.8211498", "0.8142312", "0.80810595", "0.7642276", "0.763269", "0.76272583", "0.76263815", "0.7613711", "0.7538851", "0.7439019", "0.7424171", "0.73892504", "0.73821694", "0.72408557", "0.72372615", "0.7201159", "0.7172068", "0.7138719", "0.7118348", "0.711187", "0.70949584", "0.6995642", "0.69754124", "0.69516695", "0.69165105", "0.69147086", "0.6906673", "0.6888368", "0.68558896", "0.68268234", "0.68096197", "0.67992914", "0.67983437", "0.678291", "0.67611593", "0.67564553", "0.66487557", "0.6633271", "0.66207975", "0.65878564", "0.6576066", "0.656968", "0.65659547", "0.65282845", "0.65045387", "0.64996606", "0.64953595", "0.6477157", "0.64751285", "0.64631766", "0.6439832", "0.643784", "0.6435496", "0.64241654", "0.6415893", "0.64124733", "0.63994527", "0.63947564", "0.6393244", "0.638825", "0.63826895", "0.63712853", "0.6359742", "0.6358437", "0.6341566", "0.6320501", "0.6310721", "0.6309306", "0.6300359", "0.62884754", "0.62742144", "0.62723225", "0.6268991", "0.62599206", "0.62555265", "0.62552786", "0.62421423", "0.62405735", "0.6239579", "0.62378186", "0.6234783", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149", "0.623149" ]
0.85379815
0
'to_s' method on 'BankAccount' class which displays 'name' and 'balance'
def to_s puts "\nEnding balance:\nBank Account Name:\t#{name}\nBalance:\t#{balance}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n\t\t puts \"Bank Account:\\t#{name}\\n\"\n\t\t puts \"Your current balance is:\\t#{sprintf(\"%0.2f\", balance)} USD\" \n\tend", "def to_s\n\t\t\"Name: #{name}, Balance: #{sprintf(\"%0.2f\", balance)}\"\n\tend", "def to_s\n \"Name: #{name}, Balance: #{sprintf(\"%0.2f\", balance)}\"\n end", "def account_name_balance\n name + ' (' + current_balance_display + ')'\n end", "def to_s\n result = ''\n result << 'Balance('\n result << 'currency='\n if [email protected]?\n result << '\"' << @currency.to_s << '\"'\n else\n result << 'null'\n end\n result << ',amount='\n if [email protected]?\n result << @amount.to_s\n else\n result << 'null'\n end\n result << ')'\n result\n end", "def bank_account\n @bank_account\n end", "def to_s\n\n my_string = \"ID: \" + @id.to_s + \", Balance: $%.2f\" % @balance + \", Date of creation: \" + @creation_date.to_s + \", Type: \" + @type + \", Owner(s): \"\n\n # The section below tacks on a nicely formatted representation of owner's or owners'\n # names and IDs.\n\n if owners == nil || owners == [nil]\n my_string = my_string + \"<none>\"\n else\n counter = 0\n owners.each do |owner|\n if counter > 0\n my_string = my_string + \", \"\n end\n my_string = my_string + Bank::Owner.find(owner).name[:first] + \" \" + Bank::Owner.find(owner).name[:last] + \" (ID: \" + owner.to_s + \")\"\n counter += 1\n end\n end\n\n return my_string\n\n end", "def show_bankaccount()\n p \"The owner is #{@owner}, and The balance is #{@balance}\"\n end", "def to_s\n return \"ID: \" + @id.to_s + \", Balance: $%.2f\" % @balance + \", Date of creation: \" + @creation_date.to_s\n end", "def display_balance\n \"Your balance is $#{self.balance}.\"\n end", "def to_s\r\n\t\t\t\r\n\t\t\t\"#{@name} <email: #{@email}> acct: #{hidden_digits(@deposit_account)}\"\r\n\t\tend", "def show_balance\n\t\t\treturn @balance\n\t\tend", "def show_balance(user)\n puts \"Name: #{user.name}, balance: #{user.balance}, points: #{user.card_points}\"\n end", "def pretty_balance\n puts \"You have $#{balance} in the bank\"\n end", "def to_s\n\t\t\t# Really need a money formatter */Sad Panda/*\n\t\t\t\"id: #{@id}, checking: #{@checking}, saving: #{@saving}, total: #{combined_capital}, interest_rate: #{@interest_rate}\"\n\t\tend", "def to_s\n\t\t\"#{@name} <email: #{@email}> acct: #{hidden_digits(@deposit_account)}\"\n\tend", "def to_s\n result = ''\n result << 'Account('\n result << 'id='\n if [email protected]?\n result << @id.to_s\n else\n result << 'null'\n end\n result << ',name='\n if [email protected]?\n result << '\"' << @name.to_s << '\"'\n else\n result << 'null'\n end\n result << ',state='\n if [email protected]?\n result << @state.to_s\n else\n result << 'null'\n end\n result << ',wallet='\n if [email protected]?\n result << @wallet.to_s\n else\n result << 'null'\n end\n result << ',asset='\n if [email protected]?\n result << @asset.to_s\n else\n result << 'null'\n end\n result << ',orders='\n if @orders.nil?\n result << '[0][]'\n else\n first = true\n result << '[' << @orders.length.to_s << ']['\n @orders.each do |item|\n if !item.nil?\n result << (first ? '' : ',')\n result << item.to_s\n else\n result << (first ? '' : ',')\n result << 'null'\n end\n first = false\n end\n result << ']'\n end\n result << ')'\n result\n end", "def display_balance\n \"Your balance is $#{@balance}.\"\n end", "def print_register\n puts \"#{name}'s' Bank Account\"\n puts \"/\" * 40\n\n puts \"Description\".ljust(30) + \"Amount\".rjust(10)\n puts \"/\" * 40\n @transactions.each do |transaction|\n puts transaction[:description].ljust(30) + sprintf(\"%0.2f\", transaction[:amount]).rjust(10)\n end\n\n puts \"-\" * 40\n\n puts \"Ending Balance:\".ljust(30) + sprintf(\"%0.2f\", balance).rjust(10)\n puts \"-\" * 40\n end", "def inspect\n \"#<Baron::Bank:#{object_id}>\"\n end", "def display_balance\n \"Your balance is $#{@balance}.\"\n end", "def current_balance\n \"EUR. #{sprintf('%.2f', bankaccount.reload.balance)}\"\n end", "def to_s\n \" #{account}\" +\n (amount ? \" #{amount}\" : \"\") +\n (note ? \" ; #{note}\" : \"\")\n end", "def account_balance\n @account_balance\n end", "def current_balance_display\n number_to_currency(current_balance)\n end", "def display_balance\nputs = \"Your balance is $#{self.balance}.\"\nend", "def name\n fetch('bank.name')\n end", "def display_balance()\n puts \"Balance:$#{@balance}.\"\n returned\n end", "def show_current_balance\n return \"Balance: $#{sprintf \"%.2f\", @balance}\"\n end", "def display_balance\n \"Your balance is $#{balance}.\" \n end", "def print_balance\n # $50.00\n # \"$\" + balance.to_s + \".00\"\n \"$#{balance}.00\"\n end", "def formatted_balance\n format_monetary_value(balance)\n end", "def get_account(acct)\n\t\t$DB.where(account_name: acct).each do |t|\n\t\t\tputs \"#{t[:account_name]}: #{t[:balance]}\"\n\t\tend\n\tend", "def balance_display(balance)\n puts \"Your current balance is $#{@balance}.\"\n end", "def to_s\n \"#{self.class} - ofx_id: #{@ofx_id}, date:#{@date}, raw description: #{@raw_description}, type: #{@type} amount: #{@amount}, new balance: #{@new_balance}\"\n end", "def to_s\n \"#{@name} at #{MONEY_FORMAT % @price}\" \n end", "def to_s\r\n \"#{self.name}, #{self.credits}\"\r\n end", "def balance_inquiry\n \"$#{'%.2f' % @balance}\"\n end", "def inspect\n \"#{'%.2f' % self.amount} #{self.currency}\"\n end", "def inspect\n # These variables currently aren't initialized\n amt, desc, dat, with = @amount, @label, @date, @withdrawal\n amt ||= \"nil\"\n desc ||= \"nil\"\n dat ||= \"nil\"\n\t\twith ||= \"nil\"\n\t\t\n \"Transaction(#{desc}, #{amt}, #{with}, #{form_date})\"\n end", "def print_register\n\t\tputs \"#{name}'s Bank Account\"\n\t\tputs \"-\" * 40\n\n\t\t#prints the description and amount of each transaction in the transaction hash.\n\t\t#applies left formatting and right formatting (ljust(x)/rjust(x))\n\t\tputs \"Description\".ljust(30) + \"Amount\".rjust(10)\n\t\[email protected] do |transaction|\n\t\t\tputs transaction[:description].ljust(30) + sprintf(\"%0.2f\", transaction[:amount]).rjust(10)\n\t\tend\n\n\t\t#prints ending balance after all transactions calculated\n\t\tputs \"-\" * 40\n\t\tputs \"Balance:\".ljust(30) + sprintf(\"%0.2f\", balance).rjust(10)\n\t\tputs \"-\" * 40\n\tend", "def pending_balance_display\n number_to_currency(pending_balance)\n end", "def despositing_adds_transaction_to_bank_statement\n account = BankAccount.new\n account.deposit('10-01-2012', 1000)\n p account\n p account.bank_statement\nend", "def to_string\r\n @id.to_s + ': ' + @billcoins.to_s + ' billcoins '\r\n end", "def balance\n @balance\n end", "def get_balance\n\t\treturn @balance.balance\n\tend", "def account_information\n puts \"====================\"\n puts \"Account information:\"\n puts \"====================\"\n puts \"\\nAccount number: %d\" % [@account_number]\n puts \"\\nTotal money: %d\" % [total_balance]\n puts \"\\nChecking account balance: %d\" % [@checking_account_balance]\n puts \"\\nSaving account balance: %d\" % [@saving_account_balance]\n puts \"\\nInterest rate: %.2f\" % [@interest_rate]\n puts\n end", "def to_s\n \"First name: #{ @first_name }, Last name #{ @last_name}, Username: #{username}\"\n end", "def get_balance\n puts \"Current Balance: #{@balance}\"\n puts \"Current Interest: #{@interest}\"\n puts \"Current Payoff: #{@balance + @interest}\"\n puts\n end", "def to_s\n \"#{self.name}, #{self.credits}\"\n end", "def saving_account_balance\n return @saving_account_balance\n end", "def print_account(account)\n puts \"Email: #{account.email}\"\n puts \"Username: #{account.username}\"\n puts \"First name: #{account.given_name}\"\n puts \"Last name: #{account.surname}\"\n puts \"Status: #{account.status}\"\nend", "def to_s\n\t\t\"Transaction(#{@label}, #{@amount}, #{@withdrawal}, #{@date})\"\n end", "def displayPaymentAccountBalances\n count = 0\n @payment_accounts.each do |payment_account|\n count = count + 1\n @payment_map[count] = {}\n @payment_map[count]['account_id'] = payment_account['account_id']\n @payment_map[count]['account_name'] = payment_account['account_name']\n if payment_account['balance'] > 0\n puts \"#{count}) #{payment_account['account_name'].ljust(24)}: \\x1B[32m#{toCurrency(payment_account['balance']).to_s.rjust(11)} \\x1B[90m(#{toCurrency(payment_account['available'])} Available)\\x1B[0m\"\n else\n puts \"#{count}) #{payment_account['account_name'].ljust(24)}: \\x1B[31m#{toCurrency(payment_account['balance']).to_s.rjust(11)} \\x1B[90m(#{toCurrency(payment_account['available'])} Available)\\x1B[0m\"\n end\n end\n puts \"\\n\"\n end", "def account\n AccountInfoParser.parse(post(\"balance\"))\n end", "def account_information\n\t\t\t{\n\t\t\t\tid: @id,\n\t\t\t\tchecking: @checking,\n\t\t\t\tsaving: @saving,\n\t\t\t\ttotal: combined_capital,\n\t\t\t\tinterest_rate: @interest_rates\n\t\t\t}\n\t\tend", "def to_s\n self.first_name + \" \" + self.last_name\n end", "def inspect\n\n \"#{'%.02f' % (@amount_bigdecimal)} #{@currency}\"\n\n end", "def return_balance(name)\n return find_account(name)[:balance]\n end", "def units_balance\n return \"#{@unit} balance\" if @unit.present?\n 'Balance'\n end", "def get_bank_name()\n return @RESPONSE_HASH['BANK_NAME']\n end", "def to_s\n \"#{name} (#{serial}): Worth #{value}, recorded on #{createdAt}\"\n end", "def bank_name\n @bank = self.class.bank_name_for @ifsc\n end", "def display_driver\n { name: (driver.user.name rescue driver_id), balance: participants[driver_id][:balance].round(1) }\n end", "def bankroll_to_s\n return \"#@name [\\$#{@bankroll.to_s}]\"\n end", "def to_s\n result = @name\n if self.has_a_hand and not self.is_dealer\n result += \" [\\$#{@bet.to_s}]\"\n end\n result += \" [\\$#{@bankroll.to_s}]\"\n return result\n end", "def account_information\n puts \"Account Number: #%d\" % @account_number\n puts \"\\t- Checking Amount: $%d\" % @checking_amount \n puts \"\\t- Saving Amount: $%d\" % @saving_amount\n puts \"\\t- Total Amouunt: $%d\" % (@checking_amount + @saving_amount)\n puts \"\\t- interest Rate: %f%\" % @interest\n end", "def account_information\n puts \"Account Number: #%d\" % @account_number\n puts \"\\t- Checking Amount: $%d\" % @checking_amount \n puts \"\\t- Saving Amount: $%d\" % @saving_amount\n puts \"\\t- Total Amouunt: $%d\" % (@checking_amount + @saving_amount)\n puts \"\\t- interest Rate: %f%\" % @interest\n end", "def total_balance\n\t\tputs \"Total Balance: #{@@accounts.total}\"\n\tend", "def info\n return \"#{self.name} $#{self.price}\"\n end", "def to_s\n \"#{@firstName} #{@lastName}\"\n end", "def to_s\n \"#{@firstName} #{@lastName}\"\n end", "def to_s\n \"#{@firstName} #{@lastName}\"\n end", "def to_s\n \"#{name} #{surname}\"\n end", "def inspect\n \"#{\"%0.02f\" % @amount} #{@base_currency}\"\n end", "def to_s\n if @bankroll < 0\n bankroll = \"-$#{@bankroll.abs.to_s}\"\n else\n bankroll = \"$#{@bankroll.to_s}\"\n end\n return \"#{@name} [#{bankroll}]\"\n end", "def to_s\n \"#{firstname} #{lastname}\"\n end", "def balances\n accounts.with_balance\n end", "def inspect\n \"#{@amount} #{@currency}\" if @amount && @currency\n end", "def to_s \n \"First name: #{@firstName}, Last name: #{@lastName}, username: #{@username}, email: #{@email}\"\n end", "def acct_name\n @name\n end", "def printbalance\n puts \"Your balance = #{@balance}\"\nend", "def show\n puts \"\n ID: #{id}\n Balance: #{balance}\n Date: #{open_date}\"\n end", "def balance #same as attr_reader :balance\n @balance\n end", "def to_s\n \"#{@first_name} #{@last_name}\"\n end", "def print\n\n #Each variable of the array is of type class and the |l| allows you to access\n #each instance of the class individually as you would with a single\n #class type variable \n @ledger.each do |l|\n puts \"#{l.date} #{l.payee} #{l.amount} #{l.currBalance}\"\n end\n\n puts \"Current Balance: #{@balance}\"\n\n end", "def balance_hash\n @money\n end", "def balance\n @accounts.values.first\n end", "def to_s\r\n x = self.name + \" \" + self.credits.to_s\r\n x= x + \"\\n\" + self.get_items\r\n return x\r\n end", "def print_wallet\n\t\tputs \"\\n\\n\\n\"\n\t\tputs \"Your balance: #{@balance.round(2)}\"\n\tend", "def get_balance\n return balance\n end", "def balance client\n puts \"Estimado Sr./Sra #{client.name} #{client.last_name}\"\n puts \"Su saldo es:\"\n puts \"Cuentas de ahorros: Bs. #{client.saving_amount}\".colorize(:blue)\n puts \"Cuentas de corriente: Bs. #{client.check_amount}\".colorize(:blue)\n end", "def to_s\r\n \"Name: #{name}, Age: #{age}\"\r\n end", "def to_s\n \"#{first_name} #{last_name}\"\n end", "def to_s\n \"#{first_name} #{last_name}\"\n end", "def to_s\n self.first_name + \" \" + self.last_name\n end", "def to_s\n self.first_name + \" \" + self.last_name\n end", "def to_s\n \"#{self.name} (#{self.price})\"\n end", "def balance\n return @balance\n end", "def balance\n parse_balance(post('/api/1/generic/info'))\n end" ]
[ "0.80699104", "0.7577288", "0.75023204", "0.7444449", "0.73321867", "0.71332973", "0.7087377", "0.70392287", "0.7020604", "0.70132804", "0.68980277", "0.68922263", "0.6856051", "0.6836574", "0.68342745", "0.68336177", "0.6822332", "0.6816008", "0.67968047", "0.67473096", "0.6713702", "0.6699597", "0.66884845", "0.6680792", "0.66525537", "0.6644721", "0.6567794", "0.65488726", "0.6526245", "0.65241575", "0.6522255", "0.65168804", "0.64898396", "0.64812905", "0.6475395", "0.64541966", "0.6430068", "0.64292675", "0.6424669", "0.6418769", "0.6403163", "0.63994205", "0.6397675", "0.634038", "0.63178897", "0.6292168", "0.6279024", "0.627604", "0.62758154", "0.62752753", "0.62657976", "0.62609035", "0.6247791", "0.6245024", "0.6241795", "0.62386835", "0.6233026", "0.6229365", "0.62246037", "0.62223184", "0.62203604", "0.620258", "0.6197918", "0.61941195", "0.6190148", "0.6189048", "0.6154196", "0.6154196", "0.6152108", "0.61506665", "0.6145545", "0.6145545", "0.6145545", "0.61448085", "0.6142816", "0.61200625", "0.61136776", "0.61130774", "0.6106075", "0.6098314", "0.6097557", "0.6089383", "0.6083065", "0.60773957", "0.607735", "0.6073773", "0.60719264", "0.60591143", "0.60503036", "0.6049136", "0.60485846", "0.60188687", "0.60173017", "0.6013745", "0.6013745", "0.6012117", "0.6012117", "0.5992151", "0.5986738", "0.5985793" ]
0.79877377
1
get input by input id
def by_id(id) @client.request(:get, "/system/inputs/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(id)\n data = @app.client.input id\n Clarinet::Input.new @app, data[:input]\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def find_text_field_id(valuetxt,id)\n\t\tBrowser::LOGGER.reporter_event(\"find_text_field_id\", id)\n\t \tui.form(:action =>valuetxt).text_field(:id => id)\n\t \tend", "def find_element_text_input(browser, element_id=nil, text=nil, execution=false)\n ids = []\n if execution == false\n browser.text_fields().each do |input|\n unless input.attribute_value(:name) == \"\"\n p 'aqui'\n #puts input.attribute_value(:name)\n ids.push(input.attribute_value(:name))\n end\n end\n return ids\n else\n input = browser.text_field(name: element_id)\n if input.exists?\n input.set(text)\n return \"ok\"\n else\n put \"no existe\"\n return nil\n end\n end\nend", "def get_element id\n @elements[id.to_s]\n end", "def getInput(_name)\n return getInputTable()[_name] ;\n end", "def extract_id(cell)\n return nil if cell.nil?\n input = cell.css('input[@name=\"VOLFDNR\"]').first\n return nil if input.nil?\n volfdnr = input[\"value\"]\nend", "def my_input_id\n \"#{self.form.object_name}_#{self.field}\"\n end", "def thelper_find_input_by_name( n = 'commit' )\n find( :xpath, \"//input[contains(@name, '#{ n }')]\" )\n end", "def label_id\n input_dom_id\n end", "def get_other_input_element(value, id, model)\n element_name = model + '[' + id.to_s + ']'\n element_id = model + \"_\" + id.to_s + \"_input\"\n span_id = 'other_'+model+'_' + id.to_s\n input_string = '<br/><span id=\"'+span_id+'\">Please Specify:<input class=\"editable_field\" title=\"option\" type=\"text\" name=\"'+element_name+'\" id=\"'+element_id+'\" value=\"'+value+'\" /></span>'\n return input_string\n end", "def input_control\n InputControl.where(id: self.operation_id).first\n end", "def input(name, value)\n Praline::browser.find_element(:name, name).send_keys(value)\n end", "def get_other_input_element_by_arm(value, id, arm, model)\n element_name = model + '[' + id.to_s + '_' + arm.to_s + ']'\n element_id = model + \"_\" + id.to_s + '_' + arm.to_s + \"_input\"\n span_id = 'other_'+model+'_' + id.to_s + '_' + arm.to_s\n input_string = '<br/><span id=\"'+span_id+'\">Please Specify:<input class=\"editable_field\" title=\"option\" type=\"text\" name=\"'+element_name+'\" id=\"'+element_id+'\" value=\"'+value+'\" /></span>'\n return input_string\n end", "def find_input(attribute_name, options = T.unsafe(nil), &block); end", "def edit\n id = params[:id].presence || 0 \n @element = @@model.find(id)\n end", "def find_by_id(item)\n @driver.find_element(:id, item)\n end", "def locate_input_element(how, what, types, value=nil)\r\n @browser.locate_input_element(how, what, types, value)\r\n end", "def read_element_text_byid(id)\n if element_id(id).text != nil\n return element_id(id).text\n else\n return nil\n end\n end", "def get_id\n params[:id]\n end", "def get_input(device)\n if device.kind_of?(String)\n if device == \"choose\"\n UniMIDI::Input.gets\n else\n UniMIDI::Input.find_by_name(device)\n end\n elsif device.respond_to?(:gets)\n device.open if device.kind_of?(UniMIDI::Input)\n device\n end\n end", "def element_by_id(elem_id)\r\n @web_browser.element_by_id(elem_id)\r\n end", "def find_element_by_id(id)\n (e = @doc.at_css(\"##{id}\")) && NodeProxy.new(e)\n end", "def container_id\n element_id(\"image_input\")\n end", "def get_forms(id)\n id = get_id(id) if id.is_a?(Symbol)\n return @data[id] || @data.first\n end", "def field_by_id(id = nil)\n @fields.find { |h| h[:id] == id.to_s }\n end", "def all_inputs\n HTTParty.get(self.class.url_to(\"#{ id }/inputs\"))\n end", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def get_input;\t@input \t\tend", "def element_by_id(elem_id)\n @web_browser.element_by_id(elem_id)\n end", "def set_user_input\n @user_input = UserInput.find(params[:id])\n end", "def get_question(form_name, id)\n get_form(form_name)[:questions][id]\n end", "def find_id id\n wait { find_element(:id, id) }\nend", "def text_field_element(identifier)\n platform.text_field_for(identifier.clone)\n end", "def first_textfield\n js = textfield_js 'r = r.length > 0 ? $(r[0]) : r;'\n execute_script(js).first\n end", "def input_dom_id(key)\n \"#{object_name}_#{key.to_s}\"\n end", "def set_custom_input\n @custom_input = CustomInput.find(params[:id])\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def set_first_input\n @first_input = FirstInput.find(params[:id])\n end", "def user_name_input \n\t\[email protected]_field(id: @username)\n\tend", "def input\n input_location = @location + \"input\"\n return input_location.exist? ? input_location : nil\n end", "def id\n params[:id] \n end", "def find_by_id_or_username!\n if input_is_id?\n find_by_id!\n else\n find_by_username!\n end\n end", "def input\n @all[:input]\n end", "def id\n get_val(:id)\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def click_text_field_id(id)\n\t\tBrowser::LOGGER.reporter_event(\"click_text_field_id\", id)\n\t \ttextfield = ui.text_field(:id => id)\n\t \ttextfield.click\n\n\t \tend", "def id\n @params[\"id\"]\n end", "def item_id(input_name:, op:)\n fv = op.input(input_name)\n fv.part.try(:id) || fv.item.id\n end", "def id\n params[:id]\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def set_model_input\n @model_input = ModelInput.find(params[:id])\n end", "def [](what)\n %x{\n var result = #@native.getElementById(what);\n\n if (result) {\n return #{DOM(`result`)};\n }\n }\n\n css(what).first || xpath(what).first\n end", "def get_input(regex)\n get_shortcut(regex,'input')\n end", "def filter_input_id\n \"#{self.form.object_name}_#{self.filter_field}\"\n end", "def find_by_id_or_username\n if input_is_id?\n find_by_id\n else\n find_by_username\n end\n end", "def set_input_datum\n @input_datum = InputDatum.find(params[:id])\n end", "def [](name)\n @input[name]\n end", "def get_field_locator(key)\n if @fieldname[key]\n \"#{@locator}//*[contains(@#{@fieldname[key][0]},'#{@fieldname[key][1]}')]#{@fieldname[key][2].nil? ? '/input' : @fieldname[key][2]}\"\n else\n \"#{@locator}//*[//label[text()='#{key}']/@for and contains(@id,//label[text()='#{key}']/@for)]\"\n end\n end", "def nested_form_id_for(id_prefix, id_sufix=\"\")\n if id_sufix.blank?\n page.evaluate_script(%Q{ $(\"[id^='#{id_prefix}']\").attr(\"id\") })\n else\n page.evaluate_script(%Q{\n $(\"input[id^='#{id_prefix}'][id$='#{id_sufix}']\").attr(\"id\")\n })\n end\n end", "def dom_id\n form_node['id']\n end", "def find(id)\n first(\"Id = '#{id}'\")\n end", "def node_from_id(input)\n\n site_id = @context['__site_id']\n \n # Attempt to locate the node.\n node = Rails.cache.fetch \"node_id:#{site_id}:#{input}\" do\n n = node_scope.where(:id => input.to_i).first\n n.blank? ? nil : n.to_liquid\n end\n\n node\n \n end", "def div_by_id(id_name)\n return @browser.div(:id, id_name)\nend", "def find_element(id, model)\n case model.downcase\n when 'work'\n return Work.find(id)\n when 'basicfile'\n return BasicFile.find(id)\n when 'singlefileinstance'\n return SingleFileInstance.find(id)\n when 'orderedinstance'\n return OrderedInstance.find(id)\n when 'person'\n return AuthorityMetadataUnit.find(id)\n else\n raise 'Unknown element type'\n end\n end", "def for\n (id = @label['for']) && page.search(\"##{id}\") || nil\n end", "def password_input \n\t\[email protected]_field(id: @password)\n\tend", "def set_example_input\n @example_input = ExampleInput.find(params[:id])\n end", "def div_by_id_get_text(id_name)\n return div_by_id(id_name)\nend", "def first_textfield\n ele_by_json _textfield_visible\n end", "def id_param\n params[:id]\n end", "def input_myactivity_search(status)\n $browser.find_element(:name, $myactivity_search).send_keys(status)\nend", "def input_id_from_type(type); end", "def id\n hid\n end", "def set_word_input\n @word_input = WordInput.find(params[:id])\n end", "def number\n input(xpath: './/p-inputmask/input').value\n end", "def id\n hid\n end", "def id\n hid\n end", "def get_input\n #Get input from the user\nend", "def getText(text_id)\n\t\tdoc.search(\"text[@id='#{text_id}']\").first\n\tend", "def set_recipe_input\n @recipe_input = RecipeInput.find(params[:id])\n end", "def [](fname)\n fname = fname.to_s\n node = @doc.xpath(\"//field[@id=\\\"#{fname}\\\"]\")\n return nil if node.text.empty?\n\tnode.text\n end", "def extract_id\n selector[:_id]\n end", "def get_field_by_id(id, params = {})\n get(\"/fields/#{id}\", params)\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def locationURNInput\n return @driver.find_element(:xpath, \"//input[@placeholder='location_urn']\")\n end", "def get_param_by_id(id)\n param = nil\n @params.each do |p|\n if p['id'] == id\n param = p\n end\n end\n return param\n end", "def get_param_by_id(id)\n param = nil\n @params.each do |p|\n if p['id'] == id\n param = p\n end\n end\n return param\n end", "def find(id)\n @data[id]\n end", "def find_by_id(class_name)\n class_name.find_by(id: params[:id])\n end", "def find_by_id(input, value)\n hash = nil\n input.each do |input|\n if input[:id] == value\n hash = input\n end\n end\n hash\nend", "def first_textfield\n first_ele EditText\n end", "def first_textfield\n xpath 'textfield'\n end", "def get(element_id)\n unless is_parent_layout?\n return parent_layout.get(element_id)\n end\n @elements[element_id] && @elements[element_id].first\n end", "def sentiment_and_intent() @page.find(input_elements[:sentiment_and_intent]) end", "def focused_element_id\n page.evaluate_script(\"document.activeElement.id\")\n end" ]
[ "0.6733807", "0.638527", "0.638527", "0.638527", "0.638527", "0.63661367", "0.6301012", "0.6256747", "0.6204041", "0.6074685", "0.6043859", "0.5946688", "0.59248525", "0.5852758", "0.58381486", "0.5776141", "0.5753593", "0.57388073", "0.5669311", "0.56363434", "0.5632858", "0.56265444", "0.55858076", "0.5547635", "0.55436707", "0.55399925", "0.5501092", "0.5499693", "0.54954356", "0.5494788", "0.54945153", "0.5478661", "0.5472032", "0.5459542", "0.5443936", "0.5442476", "0.543997", "0.5439532", "0.54250664", "0.53982806", "0.5359733", "0.53482974", "0.53361785", "0.5328515", "0.5328136", "0.5322654", "0.532144", "0.5300404", "0.5289717", "0.5289717", "0.5285671", "0.5275989", "0.5258989", "0.52572227", "0.5247254", "0.52348423", "0.52343905", "0.52261245", "0.52244675", "0.52143705", "0.5180166", "0.5175774", "0.51737297", "0.5162494", "0.5162322", "0.51606536", "0.5149389", "0.51491445", "0.5143926", "0.5140259", "0.5139562", "0.51319236", "0.51319015", "0.512842", "0.5126358", "0.5107316", "0.5074277", "0.5070347", "0.5067045", "0.5066643", "0.50587016", "0.50587016", "0.50558925", "0.5052808", "0.5043308", "0.50198424", "0.501561", "0.5014876", "0.50058365", "0.50046146", "0.49999768", "0.49999768", "0.4999833", "0.49981418", "0.49955767", "0.49939728", "0.49890465", "0.4972029", "0.49697033", "0.496701" ]
0.7148867
0
object for get information about input types
def types @types ||= Types.new(@client) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_type; end", "def types; end", "def types; end", "def types; end", "def types; end", "def types; end", "def get_input_types(env, receiver)\n inputs.map{|input| get_type(env, input, receiver)}\n end", "def type_params; end", "def type_params; end", "def type_params; end", "def type_params; end", "def type_params; end", "def type() end", "def types(types); end", "def explain_types; end", "def get_type\n\n end", "def type(type); end", "def input_name_from_type(type); end", "def input_type_name\n method_descriptor_proto.input_type\n end", "def types=(_arg0); end", "def type\n\tend", "def type\n\tend", "def typeOf _args\n \"typeOf _args;\" \n end", "def type\n\t\t\t@data[\"type\"]\n\t\tend", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def types\n @data.keys & TYPES\n end", "def type\n\t\t@type\n\tend", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end", "def type; end" ]
[ "0.7672311", "0.73917496", "0.73917496", "0.73917496", "0.73917496", "0.73917496", "0.717092", "0.71236235", "0.71236235", "0.71236235", "0.71236235", "0.71236235", "0.693242", "0.688652", "0.6863926", "0.6653785", "0.6562337", "0.6513826", "0.649411", "0.6492718", "0.6424513", "0.6424513", "0.6410862", "0.638966", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.63837284", "0.6381706", "0.63685435", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054", "0.63659054" ]
0.0
-1
convert type name to type
def type_name_to_type(params) type = types.name_to_type(params[:type_name]) params[:type] = type params.delete(:type_name) params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_type(type_name)\n type_name.constantize\n end", "def compute_type(type_name)\n type_name_with_module(type_name).split(\"::\").inject(Object) do |final_type, part| \n final_type = final_type.const_get(part)\n end\n end", "def to_type_name(name, namespace = '')\n return namespace + to_type_name(name) unless namespace.blank?\n name = name.to_s\n name = name.camelize(:upper) if Rails.config.camel_case\n name = name.gsub(/\\W/, '_')\n name\n end", "def type_name\n @type_name ||= StringHelpers.underscore(StringHelpers.demodulize(@value.class.name)).to_sym\n end", "def type_name\n @type_name ||= name.underscore\n end", "def cast_type(name)\n sphinx_attribute(name).type\n end", "def input_name_from_type(type); end", "def get_type(type)\n TYPES[type.downcase]\n end", "def convert_type(type)\n return TYPE_CONVERTER[type]\n end", "def revert_generic_type( type )\n case type\n when /\\Avarchar/\n return :String, :default_size => 255\n when /\\Achar/\n return :String, :fixed => true, :default_size => 255\n when /\\Atext\\z/\n return :String, :text => true\n when /\\A(\\w+)\\([\\s\\d,]+\\)\\z/\n return $1.to_sym\n when /\\A\\w+\\z/\n return type.to_sym\n end\n end", "def readable_type_name(type)\n return TYPE_MAPPING.fetch(type, type)\n end", "def map_type type\n type\n end", "def map_type type\n type\n end", "def to_type(str)\n if str && type && !mapping\n send(\"parse_#{type}\", str)\n elsif str && mapping && mapping.values.map(&:to_s).include?(str)\n mapping.find { |_, v| v.to_s == str.to_s }[0]\n else\n str\n end\n end", "def get_type(property_name, type)\n type ||= property_name\n type = type.to_s.classify if type.is_a?(Symbol)\n name = type.to_s\n base = name.demodulize.to_sym\n base = :Boolean if %i[TrueClass FalseClass].include?(base)\n if base.blank? || (base == :String)\n type = nil\n elsif SCALAR_TYPES.include?(base)\n type = \"Axiom::Types::#{base}\"\n elsif !name.include?('::')\n type = \"Ils::#{name}\"\n end\n type.is_a?(String) ? type.constantize : type\n end", "def type_name *args\n (@type_names ||= { })[args] ||=\n _type_name(args)\n end", "def coerce_type_to_symbol\n @type = @type.to_sym\n end", "def cast_type_literal(type)\n type_literal(:type=>type)\n end", "def set_type_name\n @type_name = TypeName.find(params[:id])\n end", "def type_name( type )\n @type_name_cache[type] ||= begin\n type = \"\" if type.nil?\n type = $1 if type =~ /^(.*?)\\(/\n type.upcase\n end\n end", "def type_name(type)\n case type\n when 'i'\n return _INTL('int')\n when 'b'\n return _INTL('bool')\n when 'f'\n return _INTL('float')\n when 's'\n return _INTL('str')\n else\n return _INTL('arg')\n end\n end", "def fullTypeName(namespace, name)\n #noinspection RubyUnusedLocalVariable\n ns, _ = splitNameSpace(name.to_s) # if it is already a full namespaced name or a standard type, return original\n validNs?(ns, name) || STANDARD_TYPES.member?(name) ? name.to_sym : \"#{combineNsBase(namespace, name)}\".to_sym\nend", "def name\n @type_name\n end", "def infer_type( name )\n as_string = name.to_s\n parts = as_string.split(\"_\")\n if( [\"reg\" , \"obj\" , \"tmp\" , \"self\" , \"const\", \"1\" , \"2\"].include?( parts.last ) )\n parts.pop\n as_string = parts.join(\"_\")\n end\n as_string = \"word\" if as_string == \"name\"\n as_string = \"message\" if as_string == \"next_message\"\n as_string = \"message\" if as_string == \"caller\"\n sym = as_string.camelise.to_sym\n clazz = Parfait.object_space.get_class_by_name(sym)\n raise \"Not implemented/found object #{name}:#{sym}\" unless clazz\n return clazz.instance_type\n end", "def name_to_type(name,metadata)\n # Lookup this metric metadata\n meta=metadata[name]\n return nil if meta.nil?\n\n return meta['type']\n end", "def get_coerce_type_symbol( typ )\n \n case typ\n\n when Symbol then typ\n\n when Class\n\n base_name = typ.to_s.split( /::/ )[ -1 ] # Get last name part\n str =\n base_name.gsub( /(^[A-Z])|([A-Z])/ ) do |m| \n ( $2 ? \"_\" : \"\" ) + m.downcase \n end\n\n str.to_sym\n \n else raise \"Unexpected coerce type indicator: #{typ}\"\n end\n end", "def type_name_resolver; end", "def compute_type(type_name)\n if type_name.start_with?(\"::\")\n # If the type is prefixed with a scope operator then we assume that\n # the type_name is an absolute reference.\n type_name.constantize\n else\n type_candidate = @_type_candidates_cache[type_name]\n if type_candidate && type_constant = type_candidate.safe_constantize\n return type_constant\n end\n\n # Build a list of candidates to search for\n candidates = []\n name.scan(/::|$/) { candidates.unshift \"#{$`}::#{type_name}\" }\n candidates << type_name\n\n candidates.each do |candidate|\n constant = candidate.safe_constantize\n if candidate == constant.to_s\n @_type_candidates_cache[type_name] = candidate\n return constant\n end\n end\n\n raise NameError.new(\"uninitialized constant #{candidates.first}\", candidates.first)\n end\n end", "def type_alias(name, typ)\n raise RuntimeError, \"Attempt to redefine type #{name}\" if RDL.special_types[name]\n case typ\n when String\n t = RDL.parser.scan_str \"#T #{typ}\"\n RDL.special_types[name] = t\n when RDL::Type::Type\n RDL.special_types[name] = typ\n else\n raise RuntimeError, \"Unexpected typ argument #{typ.inspect}\"\n end\n nil\n end", "def type_name\n @type_name ||= self.name.demodulize.underscore\n end", "def klazz\n params[:type].camelize.constantize\n end", "def type_name_with_module(type_name)\n self.name =~ /::/ ? self.name.scan(/(.*)::/).first.first + \"::\" + type_name : type_name\n end", "def polymorphic_type\n type = as.present? ? as : name\n (type.to_s + '_type').to_sym\n end", "def get_type(type_str)\n return :integer if /^\\d+\\.$/.match(type_str)\n return :decimal if /^\\d+\\.\\d+$/.match(type_str)\n return :string\n end", "def type_from_module( object )\n\t\tif ( name = object.name )\n\t\t\tname = name.split( '::' ).collect do |part|\n\t\t\t\tpart.gsub( SNAKE_CASE_SEPARATOR ) do |m|\n\t\t\t\t\t\"%s_%s\" % [ m[0], m[1] ]\n\t\t\t\tend\n\t\t\tend.join( '.' )\n\n\t\t\treturn name.downcase\n\t\telse\n\t\t\treturn \"anonymous_%s_%d\" % [ object.class.name.downcase, object.object_id ]\n\t\tend\n\tend", "def type(type_string)\n Puppet::Pops::Types::TypeParser.singleton.parse(type_string)\n end", "def type_name\n @type_name ||= determine_type_name(descriptor)\n end", "def type_name=(value)\n @values['typeName'] = value\n end", "def type(word)\n type_of_word = @type_map[word]\n while String === type_of_word\n type_of_word = @type_map[type_of_word]\n end\n type_of_word\n end", "def type(key)\n call_with_namespace(:type, key)\n end", "def type_name\n self['type_name']\n end", "def type_name\n @values['typeName']\n end", "def type_name_from_slot(slot_name)\n slot_name[:name][:value].to_s.upcase\n end", "def type(type); end", "def transform_QualifiedName(o, scope)\n Types::TypeFactory.host_class(o.value)\n end", "def type_key\n type.demodulize.underscore\n end", "def creature_type(name)\n puts \"Looking for name #{name}\"\n org.bukkit.entity.EntityType.from_name(name.to_s)\n end", "def type_as(an_ast, a_type)\n if an_ast.nil?\n DynType\n else\n @typetable[an_ast] = a_type\n end\n end", "def type(name)\n @types.fetch(name) { NullType.new }\n end", "def type(name)\n @types.fetch(name) { NullType.new }\n end", "def type_name=(val)\n self['type_name'] = val\n end", "def get_type_for( hash )\n types[hash]\n end", "def type_for(type) \n case\n when type.nil?\n Spira::Types::Any\n when type.is_a?(Symbol) || type.is_a?(String)\n type\n when !(Spira.types[type].nil?)\n Spira.types[type]\n else\n raise TypeError, \"Unrecognized type: #{type}\"\n end\n end", "def xml_schema_type(type_name)\n new.tap do |vt|\n vt.base_type = type_name.to_sym\n end\n end", "def resolve_type(type)\n (@udts ||= {})[type] ||= begin\n sql = <<-sql\n SELECT st.name AS storage_type\n FROM systypes s, systypes st\n WHERE s.type = st.type\n AND st.name NOT IN ('longsysname', 'nchar', 'nvarchar', 'sysname', 'timestamp')\n AND s.name = '#{type}'\n sql\n\n select_one(sql, \"Field type for #{type}\")['storage_type'].strip\n end\n end", "def type_str\n Types.type_str(type)\n end", "def type_for(type)\n case\n when type.nil?\n Spira::Types::Any\n when type.is_a?(Symbol) || type.is_a?(String)\n type\n when Spira.types[type]\n Spira.types[type]\n else\n raise TypeError, \"Unrecognized type: #{type}\"\n end\n end", "def type_to_sym\n type_to_s.to_sym\n end", "def name\n type.to_s.capitalize\n end", "def conv_itype(itype)\n case itype\n when 'concept' : itype\n when 'query_doctrack' : 'query'\n else 'document'\n end\nend", "def type_as_symbol\n underscore(self.type).intern\n end", "def normalize_type\n if self.type.present?\n self.type = self.type.to_s.underscore.strip\n end\n end", "def to_ruby(type_name)\n SIMPLE_TYPES[type_name][1] || lambda {|param| param}\n end", "def lookup_cpptype(t) t = @@typemap[t] and return t end", "def parse_inst_type(type)\n return type.downcase.gsub(\"_\", \".\")\n end", "def assign_type_for(name, associated)\n type = associated ? associated.class.name : nil\n\n send(\"#{name}_type=\", type)\n end", "def find_by_name(name)\n types[name]\n end", "def getType(iTypeName)\n readTypes\n if (@DB.has_key?(iTypeName))\n if (@DB[iTypeName] == nil)\n # Create it\n lType = Type.new(\"#{@RootDir}/#{iTypeName}\", @Context, iTypeName)\n @DB[iTypeName] = lType\n end\n else\n raise RuntimeError.new(\"Unknown type #{iTypeName} from database.\")\n end\n\n return @DB[iTypeName]\n end", "def type\n @type ||= \"#{as}_type\" if polymorphic?\n end", "def type\n @types ||= strip(:type)\n end", "def [](qname)\n if qname.is_a?(Loader::TypedName)\n return nil unless qname.type == :type && qname.name_authority == @name_authority\n qname = qname.name\n end\n\n type = @types[qname] || @types[@dc_to_cc_map[qname.downcase]]\n if type.nil? && [email protected]?\n segments = qname.split(TypeFormatter::NAME_SEGMENT_SEPARATOR)\n first = segments[0]\n type_set_ref = @references[first] || @references[@dc_to_cc_map[first.downcase]]\n if type_set_ref.nil?\n nil\n else\n type_set = type_set_ref.type_set\n case segments.size\n when 1\n type_set\n when 2\n type_set[segments[1]]\n else\n segments.shift\n type_set[segments.join(TypeFormatter::NAME_SEGMENT_SEPARATOR)]\n end\n end\n else\n type\n end\n end", "def convert_to_type(value, type)\n return nil if value.nil?\n\n #Not keen on type hack for case statement\n case type.to_s\n when \"String\"\n value.to_s\n when \"Integer\"\n value.to_i\n when \"Float\"\n value.to_f\n when \"DateTime\"\n DateTime.parse(value.to_s)\n when \"Time\"\n Time.at(value.to_f)\n when \"Date\"\n Date.new(value.year, value.month, value.day)\n when \"TrueClass\"\n convert_boolean(value)\n when \"Boolean\"\n convert_boolean(value)\n else\n type.from_json(value) rescue value\n end\n end", "def type\n m = name.match /.*\\.(.*)/\n m.nil? ? nil : m[1]\n end", "def type_for_attribute(attr_name)\n attr_name = attr_name.to_s\n attribute_types[attr_name]\n end", "def type_for_attribute(attr_name)\n attr_name = attr_name.to_s\n attribute_types[attr_name]\n end", "def type_for_attribute(attr_name)\n attr_name = attr_name.to_s\n attribute_types[attr_name]\n end", "def compute_type(type_name)\n if type_name.match(/^::/)\n # If the type is prefixed with a scope operator then we assume that\n # the type_name is an absolute reference.\n ActiveSupport::Dependencies.constantize(type_name)\n else\n # Build a list of candidates to search for\n candidates = []\n name.scan(/::|$/) { candidates.unshift \"#{$`}::#{type_name}\" }\n candidates << type_name\n\n candidates.each do |candidate|\n begin\n constant = ActiveSupport::Dependencies.constantize(candidate)\n return constant if candidate == constant.to_s\n rescue NameError => e\n # We don't want to swallow NoMethodError < NameError errors\n raise e unless e.instance_of?(NameError)\n end\n end\n\n fail NameError, \"uninitialized constant #{candidates.first}\"\n end\n end", "def type\n Type.new(type_param).yard_type_string\n end", "def get_typed_variable_name(variable_name, input_value, input_type = nil)\n unless input_type\n input_type = case input_value\n when String\n :string\n when Fixnum\n :int\n else\n nil\n end\n end\n if input_type\n \"#{@variable_prefix_types[input_type.to_sym]}#{variable_name}\"\n else\n \"#{variable_name}\"\n end\n end", "def type\n _type.split(\"::\").last.downcase\n end", "def polymorphic_type_param\n \"#{key}_type\".to_sym\n end", "def parse_type(type)\n case type\n when /^int/ then :integer\n when /^tinyint\\(1\\)/ then :boolean\n when /^([^(]+)/ then $1.to_sym\n end\n end", "def type_class(type)\n TYPES[type]\n end", "def type=(val)\n @type = val.to_sym\n end", "def type_to_s\n self.class.to_s.split(':').last.downcase\n end", "def type=(value)\n @type = value.to_sym\n end", "def get(type_name)\n @types ||= {}\n register_default unless @types['document']\n\n type = @types[type_name]\n raise RuntimeError, \"Unknown Type #{type} (know #{@types.keys.join(',')})\" unless type\n\n type\n end", "def compute_type(type_name)\n if type_name.start_with?(\"::\".freeze)\n # If the type is prefixed with a scope operator then we assume that\n # the type_name is an absolute reference.\n ActiveSupport::Dependencies.constantize(type_name)\n else\n type_candidate = @_type_candidates_cache[type_name]\n if type_candidate && type_constant = ActiveSupport::Dependencies.safe_constantize(type_candidate)\n return type_constant\n end\n\n # Build a list of candidates to search for\n candidates = []\n name.scan(/::|$/) { candidates.unshift \"#{$`}::#{type_name}\" }\n candidates << type_name\n\n candidates.each do |candidate|\n constant = ActiveSupport::Dependencies.safe_constantize(candidate)\n if candidate == constant.to_s\n @_type_candidates_cache[type_name] = candidate\n return constant\n end\n end\n\n raise NameError.new(\"uninitialized constant #{candidates.first}\", candidates.first)\n end\n end", "def set_type(name)\n @type = name\n ProcessRecord::TYPE_TABLE[name] = self\n end", "def to_type(object)\n return object.to_mappy_type if object.respond_to?(:to_mappy_type)\n object.class.to_s.underscore\n end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end" ]
[ "0.78128463", "0.7454727", "0.72121674", "0.7013237", "0.6991987", "0.6944398", "0.6943773", "0.6919847", "0.68339336", "0.68222433", "0.68083346", "0.6799456", "0.6799456", "0.6794315", "0.67682964", "0.67156035", "0.67073476", "0.6696575", "0.6661605", "0.66540474", "0.66528636", "0.66439605", "0.6614999", "0.6576124", "0.6560978", "0.6520339", "0.65153235", "0.65151584", "0.6512939", "0.6504131", "0.6493663", "0.643745", "0.6432382", "0.64207435", "0.6414867", "0.6397894", "0.63912547", "0.638609", "0.6370191", "0.6360855", "0.63533443", "0.6346805", "0.6340925", "0.63407695", "0.63326794", "0.6326798", "0.63266486", "0.63233405", "0.63123137", "0.63123137", "0.63076115", "0.63041645", "0.63040257", "0.63008106", "0.6294185", "0.6278784", "0.62723213", "0.6260616", "0.62591887", "0.62264323", "0.6225691", "0.62206244", "0.62186366", "0.62131864", "0.6210859", "0.6191921", "0.6178609", "0.6165915", "0.61642176", "0.61506426", "0.61505044", "0.6140525", "0.6139913", "0.61275303", "0.61275303", "0.61275303", "0.6123565", "0.6118298", "0.61051065", "0.61043054", "0.6103442", "0.60858667", "0.6075787", "0.6075252", "0.6072997", "0.60716456", "0.60714966", "0.6068574", "0.6067137", "0.6060471", "0.60602444", "0.60602444", "0.60602444", "0.60602444", "0.60602444", "0.60602444", "0.60602444", "0.60602444", "0.60602444", "0.60602444" ]
0.7729922
1
Round a number to a specific decimal place.
def round_to(decimal_places) to_f.round(decimal_places) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_to(decimal_places)\n (self * 10**decimal_places).round.to_f / 10**decimal_places\n end", "def round_float(float, places); end", "def round(number, precision)\n ((number * 10**precision).round.to_f) / (10**precision)\n end", "def round(float, decimal_places)\n sprintf(\"%.#{decimal_places}f\", float)\n end", "def round(value)\n numeric_transformation(value) {|n| n.round}\n end", "def round(num, decimals=3)\n return \"\" unless num\n \"%.#{decimals}f\" % num\n end", "def round(value, decimal)\n round_to_significance(value, decimal_to_significance(decimal), :round)\n end", "def round_to(precision=0)\n mulitplier = 10.0 ** (precision)\n (((((self)*mulitplier).round).to_f)/mulitplier)\n end", "def float_round(number)\n\t\tnumber.round if number.respond_to? :round\n\tend", "def round(float)\n float.round\n end", "def round(value)\n # If the number is within epsilon of X.5, round up.\n return value.ceil if (value % 1) - 0.5 > -0.00001\n value.round\n end", "def my_round(num)\r\n # your code goes here\r\n num.round\r\nend", "def round value\n Float(format('%.5g', value))\n end", "def round_float(fp_number, d_place)\n assert_nothing_raised do\n return (fp_number * 10**d_place).round.to_f / 10**d_place\n end\n end", "def ROUND(value, precision = 0)\n value.round(precision)\n end", "def dround(x)\r\n ((1000.0*x).round/1000.0).to_f\r\nend", "def round(n, precision)\n factor = 10**precision.to_i\n (n * factor).round.to_f / factor\n end", "def FLOOR(value, precision = 0)\n value.floor(precision)\n end", "def rounded_number\n\t\t(number * 20).ceil / 20.to_f\n\tend", "def round(n=0)\n sprintf(\"%#{n}.#{n}f\", self).to_f\n end", "def human_round number, base_precision = 0\n #FIXME there is an algorithm for this. What is it?\n precision = base_precision\n if number < 10\n precision = base_precision + 1\n end\n if number < 1\n precision = base_precision + 2\n end\n f_number = sprintf \"%.#{precision}f\", number\nend", "def round_of(no,n=0)\n (no * (10.0 ** n)).round * (10.0 ** (-n))\n end", "def round_to(value, significance)\n round_to_significance(value, significance, :round)\n end", "def format_rounded(number)\n if number > 20\n number.to_i\n else\n sprintf('%0.1f', number)\n end\n end", "def round(value)\n ( (value.to_f + @min_margin) / @multiple_of ).ceil * @multiple_of\n end", "def round_prec(digits)\n #This is a stub, used for indexing\n end", "def round(value)\n # If the number is within epsilon of X.5, round up (or down for negative\n # numbers).\n mod = value % 1\n mod_is_half = (mod - 0.5).abs < Script::Value::Number.epsilon\n if value > 0\n !mod_is_half && mod < 0.5 ? value.floor : value.ceil\n else\n mod_is_half || mod < 0.5 ? value.floor : value.ceil\n end\n end", "def round_f (num)\n (num * 100).round / 100.0\nend", "def round(precision = nil)\n if precision\n magnitude = 10.0 ** precision\n (self * magnitude).round / magnitude\n else\n super()\n end\n end", "def decimals(n, rounded=true)\n digits 10, n, rounded\n end", "def round_down_number(float)\n\tn = 4.9\n\tn.floor\nend", "def round(precision = nil)\n\t\tif precision\n\t\t\tmagnitude = 10.0 ** precision\n\t\t\t(self * magnitude).round / magnitude\n\t\telse\n\t\t\tprecisionless_round\n\t\tend\n\tend", "def floor(value, decimal)\n round_to_significance(value, decimal_to_significance(decimal), :floor)\n end", "def round(precision = 0)\n return 0 if @numerator == 0\n return @numerator if @denominator == 1\n\n adj = (10 ** precision.abs).to_i\n adj = Rational(1, adj) if precision < 0\n\n value = self * adj\n\n value = if self > 0\n (value + Rational(1,2)).floor\n else\n (value - Rational(1,2)).ceil\n end\n\n result = Rational(value, adj)\n\n return result.numerator if result.denominator == 1\n result\n end", "def round\n @round || (to ? to.round - 1 : 0)\n end", "def round(int, scale = 10)\n (int + scale - 1) / scale * scale\nend", "def round_up_number(float)\n\tn = 3.142\n\tn.ceil\nend", "def on_call_round(context, expression)\n number = on_call_number(context, expression)\n\n return number.nan? ? number : number.round.to_f\n end", "def ieee754_round (number)\r\n [number].pack('f').unpack('f*')[0].to_i\r\n end", "def round_to_nearest_cash_value; end", "def round(digits = nil)\n rounded_value = digits ? value.round(digits) : value.round\n self.class.new(rounded_value, unit)\n end", "def round_to_nearest_cash_value\n unless currency.smallest_denomination\n raise UndefinedSmallestDenomination, 'Smallest denomination of this currency is not defined'\n end\n smallest_denomination = currency.smallest_denomination\n value = (to_d / smallest_denomination).\n round(currency.decimal_places, self.class.rounding_mode)\n value * smallest_denomination\n end", "def round_up(number)\n multiple = (number * 100).round().to_int\n (multiple % 5 == 0 ? multiple: multiple + 5 - (multiple % 5)) / 100.00\n end", "def round() end", "def roundcent(amount)\n return ((amount * 100).round)/100\n end", "def round_numbers\n numbers = [5.45, 3.99, 4.67, 1.49, 3.14, 9.41]\nend", "def nice_number(x, round = true)\n exp = Math.log10(x).floor\n f = x / 10 ** exp\n if round\n if f < 1.5; nf = 1\n elsif f < 3; nf = 2\n elsif f < 7; nf = 5\n else nf = 10\n end\n else\n if f <= 1; nf = 1\n elsif f <= 2; nf = 2\n elsif f <= 5; nf = 5\n else nf = 10\n end\n end\n nf * 10 ** exp\n end", "def round_to(num, target_divisor)\n num + (num % target_divisor)\nend", "def round_to(num, target_divisor)\n num + (num % target_divisor)\nend", "def round_rate(rate)\n Float(format('%.5g', rate))\n end", "def round_tax(amt)\n ((amt * @nearest_cent).ceil / @nearest_cent)\n end", "def round(degrees_F = 68, exponent = 2) \r\n ((convert degrees_F) * 10.0 ** exponent).round / 10.0 ** exponent\r\n# convert degrees_F.round(exponent) \r\nend", "def ceil(value, decimal)\n round_to_significance(value, decimal_to_significance(decimal), :ceil)\n end", "def round_down_number(float)\n float.floor\nend", "def round_down_number(float)\n float.floor\nend", "def round_up_number(float)\n float.ceil\nend", "def round_up_number(float)\n float.ceil\nend", "def round\n self.dup.round!\n end", "def round; self.dup.round!; end", "def number_solution(value)\n value.round(2)\nend", "def jround(num, sf, pre = \"\", is_percent: false, show_percent: true, min_places: nil)\n num = num || 0\n num *= 100 if is_percent\n after = (is_percent and show_percent) ? \"%%\" : \"\"\n places = (0 == num) ? 1 : (Math.log10 num).floor + 1\n if places > sf\n return (\"%#{pre}.#{sf}g#{after}\" % num)\n else\n fto = min_places ? [min_places, sf - places].min : sf - places\n return (\"%#{pre}.#{fto}f#{after}\" % num)\n end #if places > sf\nend", "def round_five_down(n)\n n.to_s[/\\d+\\.\\d{3}/][-1] == \"5\" ? n.to_s[/\\d+\\.\\d{2}/].to_f : n.round(2)\n end", "def rounder5(to_round)\n to_round.round(5)\n end", "def round_tax (t)\n r = BigDecimal( 0.05.to_s )\n (t / r).round * r\n end", "def rounding_method; end", "def round_down_number(float)\n float.to_i\nend", "def round_up_number(float)\nend", "def value_round(resolution,value)\n y=1\n resolution.times {|n| y=y*10}\n if resolution == 0\n value = (value.round)/y\n else\n value = (value.round)/(y*1.0)\n end\nend", "def round_to_coin(coin)\n coef = 1.0/coin\n val = (cents * coef).floor / coef\n Money.new(val, currency)\n end", "def decimal_places=(value)\n @decimal_places = value\n end", "def round_tax(tax)\n\t\t(tax * 20.0).ceil / 20.0\n\tend", "def round_dollar_amt ( dollar_amt )\n dollar_amt.slice!(/\\..*$/)\n dollar_amt = Integer(dollar_amt)\n end", "def number_with_precision(number, precision=3)\n \"%01.#{precision}f\" % number\n rescue\n number\n end", "def round_down_number(float)\nend", "def round(rounding_mode = self.class.rounding_mode)\n if self.class.infinite_precision\n build_new(to_d.round(currency.decimal_places, rounding_mode), currency)\n else\n self\n end\n end", "def number_with_precision\n\t\t\"%.2f\" % number\n\tend", "def round_float(f)\n retval = f == f.to_i ? f.to_i : f\n return retval\n end", "def round(digits=0)\n\t\t\ta = to_ary\n\t\t\tself.class.make(a[0].round, a[1].round)\n\t# self.class.make(a[0].round(digits), a[1].round(digits))\n\t\tend", "def solution(value)\n value.round(2)\nend", "def mround(zeroes = false)\n if !zeroes\n y = self.round(2)\n y.modulo(1) == 0 ? y.to_i.to_s : '%.2f' % y\n else\n '%.2f' % self\n end\n end", "def two_decimal_places(n)\n puts n.round(2)\n raise NotImplementedError.new \"TODO: two_decimal_places\"\nend", "def decimal_places; end", "def numero(num, places = 0)\n num = num.to_f if num.is_a? String\n num = num.to_f if num.is_a? BigDecimal\n num = 0 if num.nil?\n places = [0, places].max\n # \"%.#{places}f\" % num.round(places)\n # sprintf(\"%#{places}f\", num.round(places))\n format(\"%.#{places}f\", num.round(places))\nend", "def ceil_to(value, significance)\n round_to_significance(value, significance, :ceil)\n end", "def convert_third_of_inning(decimal, whole_num, original)\n if decimal == 0.1\n whole_num += 0.33\n whole_num.to_s\n elsif decimal == 0.2\n whole_num += 0.66\n whole_num.to_s\n else\n original\n end\n end", "def round_numbers\n numbers = [5.45, 3.99, 4.67, 1.49, 3.14, 9.41]\n\n # numbers.map { |number| number.round }\n numbers.map(&:round)\nend", "def floor_to(value, significance)\n round_to_significance(value, significance, :floor)\n end", "def precision(f)\n return (f * GeoRecord::SCALE).round.to_f / GeoRecord::SCALE\n end", "def neat_numbers(number, roundto = 2) # round to 0 or 2)\n number = if roundto == 2\n format '%.2f', number\n else\n number.round\n end\n # regex to add commas\n number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\\\1,').reverse\n end", "def round\n end", "def round\n raise StandardError.new(\"Not enough numbers on stack\") if @stack.length<1\n num = pop\n result = num.round\n push(result)\n return result\n end", "def rounded_rating\n return nil unless rating_average\n\n floor = rating_average.floor\n\n decimal_part = rating_average % 1\n\n decimal_part = if decimal_part < 0.33\n 0\n elsif decimal_part < 0.66\n 0.5\n else\n 1\n end\n\n floor + decimal_part\n end", "def decimal_places\n if subunit_to_unit == 1\n 0\n elsif subunit_to_unit % 10 == 0\n Math.log10(subunit_to_unit).to_s.to_i\n else\n Math.log10(subunit_to_unit).to_s.to_i+1\n end\n end", "def round(rounding_mode = T.unsafe(nil), rounding_precision = T.unsafe(nil)); end", "def eround(decimal_points = 0)\n (\"%.#{decimal_points}e\" % self).to_f\n end", "def number_with_precision(number, options = {})\n SitemapGenerator::Utilities.symbolize_keys!(options)\n\n number = begin\n Float(number)\n rescue ArgumentError, TypeError\n if options[:raise]\n raise InvalidNumberError, number\n else\n return number\n end\n end\n\n defaults = {\n :separator => \".\",\n :delimiter => \",\",\n :precision => 3,\n :significant => false,\n :strip_insignificant_zeros => false\n }\n precision_defaults = {\n :delimiter => \"\"\n }\n defaults = defaults.merge(precision_defaults)\n\n options = SitemapGenerator::Utilities.reverse_merge(options, defaults) # Allow the user to unset default values: Eg.: :significant => false\n precision = options.delete :precision\n significant = options.delete :significant\n strip_insignificant_zeros = options.delete :strip_insignificant_zeros\n\n if significant and precision > 0\n if number == 0\n digits, rounded_number = 1, 0\n else\n digits = (Math.log10(number.abs) + 1).floor\n rounded_number = (SitemapGenerator::BigDecimal.new(number.to_s) / SitemapGenerator::BigDecimal.new((10 ** (digits - precision)).to_f.to_s)).round.to_f * 10 ** (digits - precision)\n digits = (Math.log10(rounded_number.abs) + 1).floor # After rounding, the number of digits may have changed\n end\n precision = precision - digits\n precision = precision > 0 ? precision : 0 #don't let it be negative\n else\n rounded_number = SitemapGenerator::Utilities.round(SitemapGenerator::BigDecimal.new(number.to_s), precision).to_f\n end\n formatted_number = number_with_delimiter(\"%01.#{precision}f\" % rounded_number, options)\n if strip_insignificant_zeros\n escaped_separator = Regexp.escape(options[:separator])\n formatted_number.sub(/(#{escaped_separator})(\\d*[1-9])?0+\\z/, '\\1\\2').sub(/#{escaped_separator}\\z/, '')\n else\n formatted_number\n end\n\n end", "def solution(value)\n # enter your solution here\n value.round(2)\nend", "def decimate(number)\n rounded = (number*100).to_i / 100.0\n if number == rounded\n usd = Money.new(number, \"USD\")\n puts \"$#{usd}:\"\n # printf \"$#{usd}:\"\n # fails\n # printf \"%.02f\\n\", number\n else\n printf \"%g\\n\", number\n end\nend", "def priceify_number(number)\n format('%.2f', number)\n end", "def ceil\n round :ceil\n end" ]
[ "0.78908336", "0.7612533", "0.7508967", "0.72463775", "0.7228234", "0.7209074", "0.71764493", "0.710768", "0.70920944", "0.69875723", "0.6935608", "0.688703", "0.68320155", "0.6830204", "0.6829868", "0.67793876", "0.6665382", "0.6662287", "0.6660315", "0.66397274", "0.65818065", "0.6562773", "0.6548484", "0.65230316", "0.65040964", "0.64930207", "0.64845085", "0.647537", "0.6421696", "0.6419779", "0.63725907", "0.6288016", "0.62453234", "0.62243444", "0.61813766", "0.6163865", "0.6160788", "0.61146486", "0.61016506", "0.6100698", "0.6075941", "0.6030199", "0.6020066", "0.6003348", "0.5979915", "0.59752274", "0.59739304", "0.59720725", "0.59720725", "0.59690267", "0.5962327", "0.5953805", "0.5944599", "0.59163195", "0.59163195", "0.5909773", "0.5909773", "0.58898985", "0.5862333", "0.5846", "0.5835016", "0.5813457", "0.5799508", "0.5780216", "0.5774602", "0.575984", "0.57591945", "0.57479835", "0.57272524", "0.5704581", "0.56950575", "0.56897444", "0.568806", "0.56777674", "0.56523067", "0.5647081", "0.5645304", "0.564481", "0.56249166", "0.56205076", "0.5596162", "0.55932987", "0.5585288", "0.55657464", "0.5557667", "0.5548176", "0.55449516", "0.55305874", "0.5500316", "0.54999906", "0.5493292", "0.5476556", "0.5472877", "0.546306", "0.5456578", "0.5456413", "0.5455124", "0.54548705", "0.5440855", "0.5429512" ]
0.8062596
0
SNMP walking routine, with some added features delay after higher number of queries
def dowalk(mngr,query) rows = Array.new count = 0 query.each do |oid| start_oid = SNMP::ObjectId.new(oid) next_oid = start_oid while next_oid.subtree_of?(start_oid) begin response = mngr.get_next(next_oid) varbind = response.varbind_list.first rescue puts "[-] error while quering for #{next_oid}" break end break if not varbind.oid.subtree_of?(start_oid) next_oid = varbind.oid count += 1 # need to make below values as variables # we don't want to cause high CPU on the devices rows.push(varbind.value) if count >= 100 sleep 0.1 puts "[!] query count reached first limit - slowing down" if count == 100 end if count >= 1000 puts "[!] query count reached second limit - stopping" break end end end rows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_snmp\n\n # onvide le tableau des résultats précédents\n @deltas.clear\n # var temporaire pour détecter le changement de valeur d'index dans la liste de résultats\n tmp_index = ''\n\n # requête SNMP get :\n # la requête renvoie une ligne par index, cette ligne peut être in ou out,\n # les lignes in et out de chaque index se suivent forcément.\n response = @manager.get(@oids) \n response.each_varbind do |oid|\n # récupération de la valeur de l'index sur la ligne de résultat : chaîne après le \".\"\n index = oid.name.to_s.split('.')[1].to_s\n if (tmp_index == index) then\n # si le nom est le même que la ligne lue précédente, on vient donc de lire la 2° ligne => out\n # on supprime le dernier élément du tableau @out et on y ajoute au début la mesure out.\n # idem avec le timestamp de la mesure.\n @out[index].shift\n @out[index].push(oid.value.to_i)\n @ts[index].shift\n @ts[index].push(Time.now.to_i)\n\n # calcul du delta in et out par intervalle de ts_delta\n ts_delta = @ts[index][1] - @ts[index][0]\n out_delta = (@out[index][1] - @out[index][0]) / ts_delta\n in_delta = (@in[index][1] - @in[index][0]) / ts_delta\n\n # récupération de l'objet Interface de cet index\n iface = @interfaces[index]\n\n # création d'un hash de résultat de la mesure pour chaque index\n # et ajout de ce hash dans le tableau @port_names\n port_delta = { name: iface.name, descr: iface.descr, speed: iface.speed ,octInOut: [in_delta, out_delta] }\n @deltas.push(port_delta)\n else\n # index == tmp_index, donc on lit la première ligne d'index => in\n # on supprime le dernier élément du tableau @in et on y ajoute au début la mesure in\n @in[index].shift\n @in[index].push(oid.value.to_i)\n tmp_index = index\n end\n end\n return @deltas \n end", "def poll_cycle\n NewRelic::PlatformLogger.debug(\"Starting poll cycle for '#{hostname}'\")\n\n # SNMP Stuff here\n snmp = SNMP::Manager.new(:host => hostname, :port => port, :community => snmp_community)\n\n #\n # Test our SNMP connection, return if we fail to connect so the entire agent doesn't quit\n #\n begin\n product_name = snmp.get_value([\"1.3.6.1.4.1.3375.2.1.4.1.0\"]).first\n NewRelic::PlatformLogger.debug(\"Found F5 device of type: '#{product_name}'\")\n rescue SNMP::RequestTimeout\n NewRelic::PlatformLogger.error(\"Unable to connect to device: '#{hostname}', skipping...\")\n snmp.close\n return\n rescue => e\n NewRelic::PlatformLogger.error(e)\n snmp.close\n return\n end\n\n\n # Platform metrics\n NewRelic::PlatformLogger.debug(\"Collecting Platform stats\")\n @platform ||= NewRelic::F5Plugin::Platform.new\n @platform.poll(self, snmp)\n\n # Device wide metrics\n NewRelic::PlatformLogger.debug(\"Collecting System stats\")\n @system ||= NewRelic::F5Plugin::Device.new\n @system.poll(self, snmp)\n\n # Device Interface metrics\n NewRelic::PlatformLogger.debug(\"Collecting Interface stats\")\n @interfaces ||= NewRelic::F5Plugin::Interfaces.new\n @interfaces.poll(self, snmp)\n\n # Node stats\n NewRelic::PlatformLogger.debug(\"Collecting Node stats\")\n @nodes ||= NewRelic::F5Plugin::Nodes.new\n @nodes.poll(self, snmp)\n\n # Collect virtual server statistics\n NewRelic::PlatformLogger.debug(\"Collecting Virtual Server stats\")\n @virtuals ||= NewRelic::F5Plugin::Virtuals.new\n @virtuals.poll(self, snmp)\n\n # Collect pool statistics\n NewRelic::PlatformLogger.debug(\"Collecting Pool stats\")\n @pools ||= NewRelic::F5Plugin::Pools.new\n @pools.poll(self, snmp)\n\n # iRule statistics\n NewRelic::PlatformLogger.debug(\"Collecting iRule stats\")\n @rules ||= NewRelic::F5Plugin::Rules.new\n @rules.poll(self, snmp)\n\n # Collect snat pool statistics\n NewRelic::PlatformLogger.debug(\"Collecting SNAT Pool stats\")\n @snatpools ||= NewRelic::F5Plugin::SnatPools.new\n @snatpools.poll(self, snmp)\n\n # Collect Client SSL Profile statistics\n NewRelic::PlatformLogger.debug(\"Collecting Client SSL Profile stats\")\n @clientssl ||= NewRelic::F5Plugin::ClientSsl.new\n @clientssl.poll(self, snmp)\n\n # Collect Global SSL statistics\n NewRelic::PlatformLogger.debug(\"Collecting Global SSL stats\")\n @globalssl ||= NewRelic::F5Plugin::GlobalSsl.new\n @globalssl.poll(self, snmp)\n\n # Cleanup snmp connection\n snmp.close\n end", "def poll(agent, snmp)\n @snmp_manager = snmp\n\n unless get_names.empty?\n throughput_in = get_throughput_in\n throughput_in.each_key { |m| agent.report_counter_metric m, \"bits/sec\", throughput_in[m] } unless throughput_in.nil?\n\n throughput_out = get_throughput_out\n throughput_out.each_key { |m| agent.report_counter_metric m, \"bits/sec\", throughput_out[m] } unless throughput_out.nil?\n\n packets_in = get_packets_in\n packets_in.each_key { |m| agent.report_counter_metric m, \"pkts/sec\", packets_in[m] } unless packets_in.nil?\n\n packets_out = get_packets_out\n packets_out.each_key { |m| agent.report_counter_metric m, \"pkts/sec\", packets_out[m] } unless packets_out.nil?\n\n mcast_in = get_mcast_in\n mcast_in.each_key { |m| agent.report_counter_metric m, \"pkts/sec\", mcast_in[m] } unless mcast_in.nil?\n\n mcast_out = get_mcast_out\n mcast_out.each_key { |m| agent.report_counter_metric m, \"pkts/sec\", mcast_out[m] } unless mcast_out.nil?\n\n errors_in = get_errors_in\n errors_in.each_key { |m| agent.report_counter_metric m, \"errors/sec\", errors_in[m] } unless errors_in.nil?\n\n errors_out = get_errors_out\n errors_out.each_key { |m| agent.report_counter_metric m, \"errors/sec\", errors_out[m] } unless errors_out.nil?\n\n drops_in = get_drops_in\n drops_in.each_key { |m| agent.report_counter_metric m, \"drops/sec\", drops_in[m] } unless drops_in.nil?\n\n drops_out = get_drops_out\n drops_out.each_key { |m| agent.report_counter_metric m, \"drops/sec\", drops_out[m] } unless drops_out.nil?\n\n collisions = get_collisions\n collisions.each_key { |m| agent.report_counter_metric m, \"collisions/sec\", collisions[m] } unless collisions.nil?\n\n status = get_status\n status.each_key { |m| agent.report_metric m, status[m][:label], status[m][:count] } unless status.nil?\n end\n end", "def walk(oids, args = {})\n request = SnmpWalkRequest.new(self, oids, args.merge(:version => :SNMPv2c))\n SnmpConnection.pending_requests << request\n return request\n end", "def poison()\n\t puts \"ARP Poisining started...\"\n\t\t while true do\n\t\t \t@v_packet.to_w(@ifname)\n\t\t \tsleep(1)\n\t\t \t@r_packet.to_w(@ifname)\n\t\t \tsleep(1)\n\t\t end\n\tend", "def run\n sleep INTERVAL\n loop do\n start = Time.now\n @db.purge\n first_id = @db_id_seen+1\n @db_id_seen, records = @db.nodes_down(first_id)\n sleep INFLIGHT_WAIT\n records = records.all\n @graphite.add @db.id_range(first_id, @db_id_seen).all if @graphite\n @buffer.push records.map { |record| record.peer }\n @buffer.exceed_median? ? @alarm.set(@buffer) : @alarm.clear(@buffer)\n delay = INTERVAL-(Time.now-start)\n # in case delay happens to be too big\n if delay > INTERVAL\n delay = INTERVAL\n Log.warn \"delay became larger than #{INTERVAL}, capping it. (did ntp just sync?)\"\n end\n if delay > 0\n sleep delay\n else\n Log.error \"Analyzer loop took longer than #{INTERVAL}, wanted to sleep for #{delay}s\"\n end\n end\n end", "def latency; end", "def power(status)\n #This is so that tdtool is not polled too much. Now only once per minute\n `tdtool -l > /tmp/tdtoollist.txt`\n #Lets go through all the SUTs\n $sut.each do |ip, sut|\n #Initialize HASH and save label of the device in it\n status[ip] = {}\n status[ip]['label'] = sut[:label]\n #Check the power status on the socket. Assuming that TDTOOLs data is updated.\n tdtool = `cat /tmp/tdtoollist.txt |grep -P '#{sut[:switch]}\\t'`\n tdtool = tdtool.split(\"\\t\")[2].to_s\n tdtool.gsub!(/\\s+/, '')\n #Lets give nice colours depending what the data is\n if tdtool == \"ON\"\n status[ip]['powercolor'] = \"color:green;\"\n elsif tdtool == \"OFF\"\n status[ip]['powercolor'] = \"color:orange;\"\n else\n #This is mainly for devices that do not have power socket installed yet, currently only ATP12\n tdtool = '???'\n status[ip]['powercolor'] = \"color:white;\"\n end\n status[ip]['power'] = tdtool\n #Lets pass the ip we got has to the ping function to determine whether the device is online or offline\n if up?(ip)\n #Save the gathered data, in this case ONLINE, to status HASH. Also give nice colours to the data.\n status[ip]['ping'] = \"ONLINE\"\n status[ip]['pingcolor'] = \"color:green;\"\n next\n else\n #Save the gathered data, in this case OFFLINE, to status HASH. Also give nice colours to the data.\n status[ip]['ping'] = \"OFFLINE\"\n status[ip]['pingcolor'] = \"color:white;\"\n next\n end\n end\nend", "def handle_addrs count = 32\n @node.addrs.weighted_sample(count.to_i) do |addr|\n Time.now.tv_sec + 7200 - addr.time\n end.map do |addr|\n [addr.ip, addr.port, Time.now.tv_sec - addr.time] rescue nil\n end.compact\n end", "def simulate_latency\n sleep 0.5\n end", "def poll(agent, snmp)\n @snmp_manager = snmp\n @f5_agent = agent\n\n unless get_names.empty?\n get_requests\n get_conns_current\n get_conns_total\n get_packets_in\n get_packets_out\n get_throughput_in\n get_throughput_out\n get_cpu_usage_1m\n end\n end", "def query\n process_switch(@oid) do |oid,value|\n case oid.to_str\n when @oid[0]; @status = (value == '1' ? 'ok' : (value == '3' ? 'Critical' : 'Non-critical')) \n when @oid[1], @oid[2], @oid[3]; @txt_result += value.gsub(/;/,\"\\n\")\n when @oid[4]; @txt_result += ( value == '0' ? \"PowerSupply1: Off\\n\" : (value == '1' ? \"PowerSupply1: On\\n\" : \"PowerSupply1: Missing\\n\") )\n when @oid[5]; @txt_result += ( value == '0' ? \"PowerSupply2: Off\\n\" : (value == '1' ? \"PowerSupply2: On\\n\" : \"PowerSupply2: Missing\\n\") )\n when @oid[6]; @txt_result += ( value == '1' ? \"Have Panic Dump in Flash\\n\" : \"\" )\n else STDERR.puts \"Unknown OID '#{oid}' '#{value}'\"\n end\n end\n end", "def poll(agent, snmp)\n @snmp_manager = snmp\n @f5_agent = agent\n\n unless get_names.empty?\n get_requests\n get_conns_current\n get_conns_total\n get_packets_in\n get_packets_out\n get_throughput_in\n get_throughput_out\n end\n end", "def run_batch(batch)\n\n\t\t@results = {}\n\t\t@aliases = {}\n\n\t\tprint_status(\"Sending probes to #{batch[0]}->#{batch[-1]} (#{batch.length} hosts)\")\n\n\t\tbegin\n\t\t\tudp_sock = nil\n\t\t\tidx = 0\n\n\t\t\t# Create an unbound UDP socket if no CHOST is specified, otherwise\n\t\t\t# create a UDP socket bound to CHOST (in order to avail of pivoting)\n\t\t\tudp_sock = Rex::Socket::Udp.create( { 'LocalHost' => datastore['CHOST'] || nil, 'Context' => {'Msf' => framework, 'MsfExploit' => self} })\n\t\t\tadd_socket(udp_sock)\n\n\t\t\t# Try three times since NTP servers can be a bit busy\n\t\t\t1.upto(3) do\n\t\t\tbatch.each do |ip|\n\t\t\t\tnext if @results[ip]\n\n\t\t\t\tbegin\n\t\t\t\t\tdata = probe_pkt_ntp(ip)\n\t\t\t\t\tudp_sock.sendto(data, ip, datastore['RPORT'].to_i, 0)\n\t\t\t\trescue ::Interrupt\n\t\t\t\t\traise $!\n\t\t\t\trescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused\n\t\t\t\t\tnil\n\t\t\t\tend\n\n\t\t\t\tif (idx % 30 == 0)\n\t\t\t\t\twhile (r = udp_sock.recvfrom(65535, 0.1) and r[1])\n\t\t\t\t\t\tparse_reply(r)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tidx += 1\n\t\t\tend\n\t\t\tend\n\n\t\t\twhile (r = udp_sock.recvfrom(65535, 10) and r[1])\n\t\t\t\tparse_reply(r)\n\t\t\tend\n\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Unknown error: #{e.class} #{e}\")\n\t\tend\n\n\t\[email protected] do |k|\n\n\t\t\treport_service(\n\t\t\t\t:host => k,\n\t\t\t\t:proto => 'udp',\n\t\t\t\t:port => datastore['RPORT'].to_i,\n\t\t\t\t:name => 'NTP'\n\t\t\t)\n\n\t\t\treport_note(\n\t\t\t\t:host => k,\n\t\t\t\t:proto => 'udp',\n\t\t\t\t:port => datastore['RPORT'].to_i,\n\t\t\t\t:type => 'ntp.monlist',\n\t\t\t\t:data => {:monlist => @results[k]}\n\t\t\t)\n\n\t\t\tif (@aliases[k] and @aliases[k].keys[0] != k)\n\t\t\t\treport_note(\n\t\t\t\t\t:host => k,\n\t\t\t\t\t:proto => 'udp',\n\t\t\t\t\t:port => datastore['RPORT'].to_i,\n\t\t\t\t\t:type => 'ntp.addresses',\n\t\t\t\t\t:data => {:addresses => @aliases[k].keys}\n\t\t\t\t)\n\t\t\tend\n\n\t\t\tif (datastore['StoreNTPClients'])\n\t\t\t\tprint_status(\"#{k} Storing #{@results[k].length} NTP client hosts in the database...\")\n\t\t\t\t@results[k].each do |r|\n\t\t\t\t\tmaddr,mport,mserv = r\n\t\t\t\t\treport_note(:host => maddr, :type => 'ntp.client.history', :data => {:address => maddr, :port => mport, :server => mserv})\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\tend", "def snmp_brute(target, passwords)\n while(true)\n count=0\n f=File.open(@@outdir + 'snmp-success.txt', 'a+')\n passwords.each do |cs|\n begin\n manager = SNMP::Manager.new(:Host => target, :Port => @@ports['SNMP'], :Community => cs.chomp)\n sys_time = manager.get_value(\"sysUpTime.0\")\n manager.close if manager\n if count.to_i == 0\n f.puts \"Host: #{target}:#{@@ports['SNMP']}\"\n f.puts \"Service: SNMP\"\n end\n count = count.to_i + 1\n f.puts \"Pass: #{cs.chomp}\"\n print_good(\"Pass: #{cs.chomp}\")\n\n # Dump Some Basic Info to further confirm\n @wite_access=false\n snmpdump=@@outdir + host + '-snmp_dump.txt'\n f=File.open(snmpdump, 'w+')\n f.puts \"Host: #{host}\"\n f.puts \"Pass: #{cs.chomp}\"\n snmp_write_check(target, cs.chomp)\n\n break # Bail out on success\n rescue SNMP::RequestTimeout => e\n print_error(\"Bad Pass: #{cs.chomp}\")\n end\n end\n break\n end\n f.close\n end", "def wait_for_rx\n sleep DATA_REFRESH_RATE + @latency\n end", "def snmp_basic(manager)\n # Grab some basic info using OID values which should be fairly generic in nature\n target = \"#{manager.config[:host]}:#{manager.config[:port]}\"\n cstring = manager.config[:community]\n snmp_version = manager.config[:version]\n sys_name = manager.get_value(\"sysName.0\")\n sys_descr = manager.get_value(\"sysDescr.0\")\n sys_time = manager.get_value(\"sysUpTime.0\")\n\n print_good(\"Target: #{target}\")\n print_good(\"Community String: #{cstring}\")\n print_good(\"Read Access: Enabled\")\n print_good(\"Write Access: Enabled\") if @wite_access\n print_good(\"Write Access: Disabled\") unless @wite_access\n if snmp_version\n print_good(\"SNMP Version: #{snmp_version}\")\n else\n print_error(\"Unable to determine SNMP Version in use?\")\n end\n if sys_name\n print_good(\"System Name: #{sys_name}\")\n else\n print_error(\"Unable to determine system name!\")\n end\n if sys_descr\n print_good(\"System Description: \\n#{sys_descr}\")\n else\n print_error(\"Unable to find system description!\")\n end\n if sys_time\n print_good(\"System Uptime: #{sys_time}\")\n else\n print_error(\"Unable to find system uptime!\")\n end\n end", "def parse!\n self.interface_stats = Hash.new { |hash,key| hash[key] = {} }\n \n interface_names = Hash[self.raw_output.scan(/IF-MIB::ifDescr.(\\d+) = STRING: (\\w+)/m)]\n interface_types = Hash[self.raw_output.scan(/IF-MIB::ifType.(\\d+) = INTEGER: ([a-zA-Z0-9\\(\\)]+)/)]\n mac_addresses = Hash[self.raw_output.scan(/IF-MIB::ifPhysAddress.(\\d+) = STRING: ([0-9a-f:]+)/)]\n \n link_states = Hash[self.raw_output.scan(/IF-MIB::ifOperStatus.(\\d+) = INTEGER: (\\w+)\\(\\d\\)/)]\n octets_in = Hash[self.raw_output.scan(/IF-MIB::ifInOctets.(\\d+) = Counter32: (\\d+)/)]\n octets_out = Hash[self.raw_output.scan(/IF-MIB::ifOutOctets.(\\d+) = Counter32: (\\d+)/)]\n errors_in = Hash[self.raw_output.scan(/IF-MIB::ifInErrors.(\\d+) = Counter32: (\\d+)/)]\n errors_out = Hash[self.raw_output.scan(/IF-MIB::ifOutErrors.(\\d+) = Counter32: (\\d+)/)]\n \n interface_names.keys.each do |index|\n self.interface_stats[index][:name] = interface_names[index]\n self.interface_stats[index][:type] = interface_types[index]\n self.interface_stats[index][:mac] = mac_addresses[index]\n self.interface_stats[index][:in] = octets_in[index].to_i\n self.interface_stats[index][:out] = octets_out[index].to_i\n self.interface_stats[index][:errors_in] = errors_in[index].to_i\n self.interface_stats[index][:errors_out] = errors_out[index].to_i\n self.interface_stats[index][:up] = link_states[index] == \"up\"\n end\n \n self.interface_stats\n end", "def start_compute_hits_thread\n Thread.new do\n interval = @driver.config['update_routing_interval'].to_i\n while true\n sleep(interval)\n routing = estimate_hits\n\n # Send updated values to the supernodes\n ping_msg = Protocol::Ping.new(routing.authority,routing.hub,routing.authority_prime,routing.hub_prime,routing.supernode?)\n ping_msg.ctime = DateTime.now\n sns = @supernode_table.supernodes\n group = ThreadGroup.new\n sns.each do |sn|\n t = Thread.new(sn) do |sn|\n ping(sn.socket,ping_msg) unless sn.socket.nil?\n end\n group.add(t)\n end\n group.list.each { |t| t.join }\n end\n end\n end", "def walk(oids, options = {})\n each_session do |session|\n session.walk(oids).each { |oid, value|\n puts \"#{MIB.translate(oid)}(#{oid}) = #{value}\"\n }\n end\n \"WALK\"\n end", "def process_switch(ifTable_columns)\n begin\n SNMP::Manager.open(:Host => @hostname, :Community => \"#{@snmp_community}\", :Version => :SNMPv2c) do |manager|\n response = manager.get(ifTable_columns) \n response.each_varbind do |vb| \n yield vb.name, vb.value.to_s\n end\n end\n rescue Exception => message\n STDERR.puts \"#{@name}: #{message}\"\n @txt_result += \"#{@name}: #{message}\"\n end\n end", "def chat\n # Do not buffer stdout\n STDOUT.sync = true\n\n @running=true\n while @running\n $DEBUG.puts \"Waiting for command...\"\n command = $stdin.gets\n break if not command\n command.chomp!.upcase!\n\n $DEBUG.puts \"<<#{command}\"\n\n case command\n when \"PING\"\n $DEBUG.puts \"New request! Answering\"\n $DEBUG.puts \">>PONG\"\n puts \"PONG\"\n\n when \"GET\",\"GETNEXT\"\n $DEBUG.puts \"Now get OID\"\n oid=$stdin.gets.chomp\n $DEBUG.puts \"<<#{oid}\"\n $DEBUG.puts \"Got OID '#{oid}'\"\n oid = oid.sub(/^\\./,\"\").split(\".\").collect {|s| s.to_i }\n $DEBUG.puts \"Calling #{command.downcase}(#{SNMPPass.num2oid(oid)})\"\n case command\n when \"GET\"\n [email protected](oid)\n when \"GETNEXT\"\n [email protected](oid)\n else # never gets here\n raise \"Invalid command STATE! #{command}\"\n end\n\n if node == nil or (value=node.value) == nil\n $DEBUG.puts \"#{command} #{SNMPPass.num2oid(oid)} not found\"\n puts \"NONE\"\n next\n end\n\n $DEBUG.puts \"#{SNMPPass.num2oid(node.oid)} found with value: #{value.inspect}, type #{node.type}\"\n $DEBUG.puts \">>#{SNMPPass.num2oid(node.oid)}\"\n puts SNMPPass.num2oid(node.oid)\n $DEBUG.puts \">>#{node.type}\"\n puts node.type\n if not SNMPPass.istype_numeric?(node.type)\n value=\"#{value}\"\n else\n case node.type\n when COUNTER32\n # Start all over again after 2**32\n value=\"#{(value % 1 << 32).to_i.to_s}\"\n when COUNTER64\n # Start all over again after 2**64\n value=\"#{(value % 1 << 64).to_i.to_s}\"\n else\n value=\"#{value.to_i.to_s}\"\n end\n end\n $DEBUG.puts \">>#{value}\"\n puts value\n\n $DEBUG.puts \"Finished command!\"\n $DEBUG.flush\n\n when \"SET\"\n # Not yet needed any kind of set comand\n put \"not-writable\"\n else\n raise \"Unknown command '#{command}'\"\n end\n end\n end", "def migrate\n metrics_list = []\n timestamp = Time.now.to_i.to_s\n ipstring = @option[:ip_address].gsub '.', '-'\n\n # @result.each_pair do |key, value|\n # puts \"|#{key}|\"\n # value.each_pair do |ifname, ifvalue|\n # puts \"|#{ifname}|#{ifvalue}|\"\n # end\n # end\n [[:InSpeed, :InOctets], [:OutSpeed, :OutOctets]].each do |item|\n @result.each_pair do |vlannm, vlanvalue|\n #puts \"|#{vlannm}|\"\n if @exvlan.include? vlannm\n next\n end\n sorted = Hash[vlanvalue.sort_by {|a, b| -b[item[1]].to_i}]\n index = 0\n sorted.each_pair do |ifname, ifvalue|\n if @tops.to_i > 0 && index >= @tops.to_i\n break\n end\n index += 1\n\n #puts \"--#{ifname}, #{ifvalue}\"\n info = {\n :sn => ipstring + \"-\" + timestamp + \"-\" + ifname,\n :target => @option[:org_env] + \".\" + @option[:basetarget] +\n \".#{ipstring}.traffic.#{vlannm}.#{item[0]}\",\n :instance => ifname,\n :status => ifvalue[item[0]],\n :details => \"top#{index}\",\n :timestamp => Time.now().to_i() * 1000,\n :duration => 0,\n :attachments => []\n }\n #puts info\n metrics = Metrics.new(@option[:pin_code], info)\n #puts metrics\n metrics_list << metrics\n end\n end\n end\n\n merged = Metrics.merge(metrics_list)\n end", "def interconnect_mrm_rx(port)\n#ring frames\n#Test\n#TestPropagate\n#TestMgrNAck\n#TopologyChange\n#LinkUp\n#LinkDown\n\n test \"interconnect_mrm_rx port #{port}\" do\n primary = (port == $ring_port0) ? true : false\n in_ring = (port == $ring_port_in) ? true : false\n\n t_i(\"Create MC_Test frame\")\n frame = frame_create(MC_TEST, SC_STRING, 0, 0, \"mrp\")\n rx_ifh = rx_ifh_create(IGNORE, $ts.dut.port_list[port])\n\n sleep 2\n\n test \"Check LOC active\" do\n status = $ts.dut.call(\"mesa_mrp_status_get\", 0)\n status = primary ? status[\"p_status\"] : status[\"s_status\"]\n if (!in_ring && status[\"tst_loc\"] != true)\n t_e(\"Unexpected tst_loc #{status[\"tst_loc\"]}\")\n end\n end\n\n test \"Transmit TST frame on ring port to see no forwarding\" do\n frametx = frame.dup + \"mrp_tst t_sa #{UC_NUMBER_O} c_seq_num 1 \"\n frame_tx(frametx, port, \"\", \"\", \"\", \"\")\n end\n\n test \"Check status\" do\n status = $ts.dut.call(\"mesa_mrp_status_get\", 0)\n status = primary ? status[\"p_status\"] : status[\"s_status\"]\n if (!in_ring && status[\"tst_loc\"] == true)\n t_e(\"Unexpected tst_loc #{status[\"tst_loc\"]}\")\n end\n end\n\n sleep 2\n\n test \"Check LOC active\" do\n status = $ts.dut.call(\"mesa_mrp_status_get\", 0)\n status = primary ? status[\"p_status\"] : status[\"s_status\"]\n if (status[\"tst_loc\"] != true)\n t_e(\"Unexpected tst_loc #{status[\"tst_loc\"]}\")\n end\n end\n\n test \"Transmit Propagate frame on ring port to check forwarding and no copy to CPU\" do\n frametx = frame.dup + \"mrp_prop_nack \"\n framerx = in_ring ? \"\" : frametx\n primary ? frame_tx(frametx, port, \"\", framerx, \"\", \"\") : frame_tx(frametx, port, framerx, \"\", \"\", \"\")\n end\n\n test \"Transmit MgrNAck frame on ring port to see forwarding and no copy to CPU\" do\n frametx = frame.dup + \"mrp_prop_nack t_s_type 1 \"\n framerx = in_ring ? \"\" : frametx\n primary ? frame_tx(frametx, port, \"\", framerx, \"\", \"\") : frame_tx(frametx, port, framerx, \"\", \"\", \"\")\n end\n\n t_i(\"Create MC_Control frame\")\n frame = frame_create(MC_CONTROL, SC_STRING, 0, 0, \"mrp\")\n\n test \"Transmit Topology frame on ring port to see no copy to CPU and no forwarding\" do\n frametx = frame.dup + \"mrp_topo \"\n frame_tx(frametx, port, \"\", \"\", \"\", \"\")\n end\n\n test \"Transmit LinkChange LinkDown frame on ring port to see copy to CPU and no forwarding\" do\n frametx = frame.dup + \"mrp_lnk \"\n cpy_cpu = in_ring ? \"\" : rx_ifh + frametx\n frame_tx(frametx, port, \"\", \"\", \"\", cpy_cpu)\n end\n\n test \"Transmit LinkChange LinkUp frame on ring port to see copy to CPU and no forwarding\" do\n frametx = frame.dup + \"mrp_lnk t_type 5 \"\n cpy_cpu = in_ring ? \"\" : rx_ifh + frametx\n frame_tx(frametx, port, \"\", \"\", \"\", cpy_cpu)\n end\n end\nend", "def move(pid, num_punters, map, claimed, rem, setup=false, tbl=nil)\n sites = map['sites']\n rivers = map['rivers']\n mines = map['mines']\n _format = \"\"\"\nInvoke C++ program with the following format:\nn m k pid np\ns_1 t_1 c_1\n...\ns_m t_m c_m (edges)\na_1 ... a_k (mines)\nmode\nextra\n\n0 <= s_i, t_i < m\n-1 <= c_i < np (-1: not claimed)\n0 <= a_i < n\n\n\nif mode == 'state'\n extra == ''\n The C++ program should return\n 'tbl (state)'\n where state is a string representing a state (without spaces)\nif mode == 'run'\n extra looks like:\ntbl\nai_kind\n The C++ program should return\n 'pass'\n or\n 'claim s t'\n in one line.\n \"\"\"\n n = sites.size\n m = rivers.size\n k = mines.size\n np = num_punters\n edges = []\n cl = {}\n for c in claimed\n cl[[c[1], c[2]]] = c[0]\n end\n for e in rivers\n col = -1\n if cl[[e['source'], e['target']]]\n col = cl[[e['source'], e['target']]]\n end\n edges << [e['source'], e['target'], col]\n end\n io = IO.popen(File.expand_path(File.dirname($0)) + '/core', 'r+')\n io.puts(\"#{n} #{m} #{k} #{pid} #{np} #{rem}\")\n for i in 0 ... m\n io.puts(edges[i].join(' '))\n end\n mine_ids = []\n for i in 0 ... k\n mine_ids << (mines[i]).to_s\n end\n io.puts(mine_ids.join(' '))\n ai_kind = @ai_kind\n if ai_kind == 'hybrid'\n # Choose AI type by np, size, and so on\n if np == 2\n ai_kind = 'two_player_minmax'\n elsif np >= 4\n ai_kind = 'mine_connect'\n else\n ai_kind = 'greedy'\n end\n end\n if setup\n io.puts('setup')\n else\n io.puts('run')\n io.puts(tbl)\n io.puts(ai_kind)\n end\n io.close_write\n eval = 0\n STDERR.puts(\"playing as punter #{pid} (total = #{num_punters})\")\n while answer = io.gets.chomp.split\n if answer[0] != 'info'\n break\n end\n # info eval (turns) (value)\n if answer[1] == 'eval'\n turns = answer[2].to_i\n eval = answer[3].to_i\n if turns >= 0\n STDERR.puts(\"evaluation: turns=#{turns}, value=#{eval}\")\n else\n STDERR.puts(\"full evaluation: value=#{eval}\")\n end\n end\n end\n if answer[0] == 'pass'\n return {'pass' => {'punter' => pid}}, eval\n end\n if answer[0] == 'claim'\n s = answer[1].to_i\n t = answer[2].to_i\n return {'claim' => {'punter' => pid, 'source' => s, 'target' => t}}, eval\n end\n if answer[0] == 'tbl'\n STDERR.puts(\"Got tbl (tbl size = #{answer[1].size})\")\n return answer[1]\n end\n end", "def on_getaddr\n #addrs = @node.addrs.select{|a| a.time > Time.now.to_i - 10800 }.shuffle[0..250]\n #p \"<< addr (#{addrs.size})\"\n #send_data P::Addr.pkt(*addrs)\n end", "def poll_next_packet; end", "def speed_up\n self.speed += 5\n info\n end", "def speed_up\n self.speed += 5\n info\n end", "def run_owamp(remote)\n #owping_bin = \"/usr/local/bin/owping\" # FIXME before release\n owping_bin = settings.binaries[\"owping\"]\n owping_opts = \"-c 1000 -i .01 -n m #{remote}\"\n results = {}\n # Run test a-b\n Open3.popen3(\"#{owping_bin} #{owping_opts}\") do |stdin, stdout, stderr, thread|\n { :out => stdout, :err => stderr }.each do |key, stream|\n Thread.abort_on_exception=true\n te = Thread.new do\n until (raw_line = stream.gets).nil? do\n if res = raw_line.match(/---.*to\\s\\[#{remote}/)\n direction = :local\n end\n if res = raw_line.match(/---.*from\\s\\[#{remote}/)\n direction = :remote\n end\n if res = raw_line.match(/^(?<sent>\\d+)\\ssent,\\s(?<lost>\\d+)\\slost\\s\\((?<percentage>\\d+\\.\\d+%)\\),\\s(?<duplicates>\\d+)\\sduplicates$/)\n loss = { :loss => res[\"percentage\"] }\n if results[direction]\n results[direction].merge loss\n else\n results[direction] = loss\n end\n end\n if res = raw_line.match(/^one-way delay min\\/median\\/max = (?<min>\\d+(?:\\.\\d+)?)\\/(?<median>\\d+(?:\\.\\d+)?)\\/(?<max>\\d+(?:\\.\\d+)?) ms/)\n results[direction][:min] = res[\"min\"]\n results[direction][:median] = res[\"median\"]\n results[direction][:max] = res[\"max\"]\n end\n if res = raw_line.match(/^one-way jitter = (?<jitter>\\d+(?:\\.\\d+)?) ms/)\n results[direction][:jitter] = res[\"jitter\"]\n end\n end\n end\n te.join\n end\n thread.join\n end\n results\n end", "def stats_loop\n sleep 5\n loop do\n @launcher.events.debug \"statsd: notify statsd\"\n begin\n stats = PumaStats.new(fetch_stats)\n @statsd.client.gauge('puma_workers', stats.workers)\n @statsd.client.gauge('puma_booted_workers', stats.booted_workers)\n @statsd.client.gauge('puma_backlog', stats.backlog)\n @statsd.client.gauge('puma_running', stats.running)\n @statsd.client.gauge('puma_pool_capacity', stats.pool_capacity)\n @statsd.client.gauge('puma_max_threads', stats.max_threads)\n rescue StandardError => e\n @launcher.events.error \"! statsd: notify stats failed:\\n #{e.to_s}\\n #{e.backtrace.join(\"\\n \")}\"\n ensure\n sleep 2\n end\n end\n end", "def query\n process_switch(@oid) do |oid,value|\n case oid.to_str\n when @oid[0]; @txt_result += value.gsub(/;/,\"\\n\")\n \n when @oid[1]; @txt_result += \"Temperature Sensor 1 #{value.to_s} C \" + set_status(value.to_f, 60.0, 80.0) \n when @oid[2]; @txt_result += \"Temperature Sensor 2 #{value} C \" + set_status(value.to_f, 60.0, 80.0) \n when @oid[3]; @txt_result += \"Temperature Sensor 3 #{value} C Fan Ctl\\n\" #Fan Ctl, has no limits we care about\n when @oid[4]; @txt_result += \"Temperature Sensor 4 #{value} C Fan Ctl\\n\" #Fan Ctl, has no limits we care about\n when @oid[5]; @txt_result += \"Temperature Sensor 5 #{value} C Fan Ctl\\n\" #Fan Ctl, has no limits we care about\n when @oid[6]; @txt_result += \"Temperature Sensor 6 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[7]; @txt_result += \"Temperature Sensor 7 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[8]; @txt_result += \"Temperature Sensor 8 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[9]; @txt_result += \"Temperature Sensor 9 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[10]; @txt_result += \"Temperature Sensor 10 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n when @oid[11]; @txt_result += \"Temperature Sensor 11 #{value} C \" + set_status(value.to_f, 100.0, 120.0) \n\n when @oid[12]; @txt_result += \"Fan 1 RPM #{value} \" + set_fan_status(value.to_i) #Not present in our switches\n when @oid[13]; @txt_result += \"Fan 2 RPM #{value} \" + set_fan_status(value.to_i) #Not present in our switches\n when @oid[14]; @txt_result += \"Fan 3 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[15]; @txt_result += \"Fan 4 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[16]; @txt_result += \"Fan 5 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[17]; @txt_result += \"Fan 6 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[18]; @txt_result += \"Fan 7 RPM #{value} \" + set_fan_status(value.to_i) \n when @oid[19]; @txt_result += \"Fan 8 RPM #{value} \" + set_fan_status(value.to_i) \n\n when @oid[20]; @txt_result += ( value == '0' ? \"PowerSupply1: Off\\n\" : (value == '1' ? \"PowerSupply1: On\\n\" : \"PowerSupply1: Missing\\n\") ); @status_as_int = 3 if value == '0'\n when @oid[21]; @txt_result += ( value == '0' ? \"PowerSupply2: Off\\n\" : (value == '1' ? \"PowerSupply2: On\\n\" : \"PowerSupply2: Missing\\n\") ); @status_as_int = 3 if value == '0'\n \n when @oid[22]; @txt_result += ( value == '1' ? \"Have Panic Dump in Flash\\n\" : \"\" ); @status_as_int = 2 if value == '1' && @status_as_int != 3\n else STDERR.puts \"Unknown OID '#{oid}' '#{value}'\"\n end\n end\n \n @status = calc_status\n end", "def query_snmp(opts=nil)\n self.options = opts unless opts.nil?\n\n exit_code = nil\n exit_message = []\n index = 0\n has_rollup = false\n\n if results_cache.empty?\n debug(\"No results\\n\")\n exit_code = Nagios::UNKNOWN\n exit_message = [\"Invalid SNMP community string specified or snmp is disabled\"]\n else\n\n # concrete subclasses implement checks method\n checks.each do |check|\n unless results = results_cache[check[:name]]\n debug(\"No results for check %s\\n\" % check[:name])\n next\n end\n\n # Loop on possibly multiple lines of output\n results.each_line do |line|\n next unless line =~ check[:response]\n status = $1\n\n # Iterate over the expected return codes from a check.\n # line_exit_code,line_message = check[:codes][status]\n check[:codes].keys.each do |code|\n # Might want to support regex codes.\n # For now add support for 'any' value.\n next unless status == code || code == :any\n\n # Map to a nagios code\n # check[:codes][code] maps to a pair of ( nagios_code, message )\n line_exit_code = check[:codes][code][0]\n\n # Does it matter that index = 0?\n # Yes, currently rollup check must be first\n if index == 0 && check[:rollup]\n # Base the overall exit code only on the first check if it is marked as rollup.\n exit_code = line_exit_code\n exit_message = [\"OK\"] if exit_code == Nagios::OK\n has_rollup = true\n else\n\n # Sub checks only affect the message but not the exit code for rollups\n unless has_rollup\n exit_code = Status.worst_case(line_exit_code, exit_code)\n end\n\n # Only affect the message if not OK\n if exit_code != Nagios::OK && line_exit_code != Nagios::OK\n\n # Here, instead of the message being static, we generalized this\n # to call a custom function by symbol name, sending it the check value.\n # Main application thus far is to blow up a bit string.\n line_exit_message = build_message(check[:codes][code][1], status)\n prefix = \"\"\n\n unless check[:display].nil? || check[:display].empty?\n prefix = \"%s:\" % check[:display]\n end\n unless line_exit_message.empty?\n exit_message << \"%s%s\" % [prefix, line_exit_message]\n end\n end\n\n end\n end\n end\n index += 1\n end\n end\n # In case no checks ran or other pathological\n # cases lead to no assignments\n exit_code ||= Nagios::UNKNOWN\n if exit_message.empty?\n if exit_code == Nagios::OK\n exit_message = \"OK\"\n else\n exit_message = \"Unknown\"\n end\n else\n exit_message = exit_message.uniq.join(\",\")\n end\n\n Status.new(exit_code, exit_message)\n end", "def tick events\n @outerlimit = (battlefield_width + battlefield_height) * 3\n #print \"mode=#{@mode},stage=#{@stage},dir=#{@dir},walldir=#{@walldir}\\n\"\n #print \"at (#{x},#{y}) at time #{time},res=#{@trk_res}\\n\"\n #mode nil is startup and initialize variables\n #STDOUT.flush\n # ###########\n # # Sensors\n # ###########\n @since_evade += 1\n @sincehit += 1\n @sincehit = 0 if not events['got_hit'].empty?\n events['got_hit'].each{|e| @hit_filter += e.first}\n @hit_filter *= 0.99\n if events['robot_scanned'].empty?\n @sinceblip += 1\n @closest = @outerlimit\n #print\"\\n\" \n else\n @closest = events['robot_scanned'].collect{|e| e.first}.sort.first\n @sinceblip = 0\n #print \",blip=#{@closest}\\n\"\n end\n # ###########\n # # High level logic - state machine\n # ###########\n #print \"sincehit=#{@sincehit},closest=#{@closest},range=#{@range}\\n\"\n #mode 0 is orient tank\n if @mode == 0\n @stage = 0\n @range = @outerlimit\n @mode = 1 if aimrad(@dir*90)\n #mode 1 find range of nearest target\n elsif @mode == 1\n #setup radar for a scan\n if @stage==0\n aimrad(@dir*90 + 180,60,1)\n @range = min(@range,@closest)\n @stage +=1\n #continue around for full circle\n elsif @stage == 1\n @range = min(@range,@closest)\n if aimrad(@dir*90,60,1)\n #did we see a bot?\n if @range == @outerlimit\n @stage = 0 \n else\n @mode = 2\n @stage = 0\n end\n end\n end\n #mode 2: find the nearestbot\n elsif @mode == 2\n #start next circle to re find the closest bot\n if @stage == 0\n #print \"range is #{@range}\\n\"\n aimrad(@dir*90 + 180,60,1)\n @stage +=1\n #continue scan for the closest bot\n elsif @stage == 1\n #print \"dir=#{@dir},angle=#{radar_heading}, closest=#{@closest}\\n\"\n if @closest < @range * 1.25\n @range = @closest\n @mode = 3\n @stage = 0\n @tangle = radar_heading\n #print \"found target at angle #{@tangle}\\n\"\n #if we finished the scan, and didn't find close target, recompute range\n elsif aimrad(@dir*90,60,1)\n @mode = 0\n @stage =0\n end\n end\n #mode 3 is tracking bot\n elsif @mode == 3\n #entry from previous mode, determine whether to scan ccw or cw\n if @stage == 0\n @trk_dir,@trk_res,@stage = -1,4,2\n #first scan in this direction\n elsif @stage == 1\n if @closest < @range * 1.25\n @range = @closest\n @trk_dir = -@trk_dir\n @trk_res = max(@trk_res - 1,0)\n @mytrack.add(x,y,@radar_heading, @range , time) if @trk_res < 3\n else\n @stage = 2\n end\n #second scan in this direction\n elsif @stage == 2\n if @closest < @range * 1.25\n @range = @closest\n @trk_dir = -@trk_dir\n @trk_res = max(@trk_res - 1,0)\n @mytrack.add(x,y,@radar_heading, @range , time) if @trk_res < 3\n @stage = 1\n else\n @trk_dir = -@trk_dir\n @trk_res = min(@trk_res + 2,4)\n @stage = 3\n end\n #the target bot has moved out of our window, expand the window\n elsif @stage == 3\n if @closest < @range * 1.25\n @range = @closest\n @trk_dir = - @trk_dir\n @trk_res = max(@trk_res - 2,0)\n @mytrack.add(x,y,@radar_heading, @range , time) if @trk_res < 3\n @stage = 1\n elsif @trk_res < 6\n @trk_dir = - @trk_dir\n @trk_res = @trk_res +1\n else\n #we lost our target, reaquire from scratch\n @mode = 0\n @stage = 0\n end\n end\n @tangle += @@ScanRes[@trk_res] * @trk_dir\n aimrad(@tangle)\n #print\"tangle=#{@tangle}, res=#{@@ScanRes[@trk_res]}, rot=#{@trk_dir}\\n\"\n elsif @mode == 4\n #determine which corner to go to from a corner\n if @stage == 0\n @stage += 1 if aimrad(@dir*90 + 95*@walldir)\n #first scan in direction of prev corner\n elsif @stage == 1\n aimrad(@dir*90 + 60*@walldir)\n @stage += 1\n #save count of robots in next corner, and swing radar to previous corner\n elsif @stage == 2\n @prevCorner = events['robot_scanned'].size\n aimrad(@dir*90 + 30*@walldir)\n @stage += 1\n elsif @stage == 3\n aimrad(@dir*90 -5*@walldir)\n @stage += 1\n elsif @stage == 4\n @nextCorner = events['robot_scanned'].size\n #print \"next corner=#{@nextCorner}, prev corner=#{@prevCorner}\\n\"\n if @nextCorner > @prevCorner\n @dir = (@dir + @walldir)%4\n @walldir *= -1\n end\n @stage = 0\n @mode = 0\n end\n elsif @mode == 5\n #determine which corner to go to from middle of wall\n if @stage == 0\n @stage += 1 if aimrad(@dir*90 - 5*@walldir)\n #first scan in direction of prev corner\n elsif @stage == 1\n aimrad(@dir*90 + 30*@walldir)\n @stage += 1\n #save count of robots in next corner, and swing radar to previous corner\n elsif @stage == 2\n @nextCorner = events['robot_scanned'].size\n aimrad(@dir*90 + 150*@walldir)\n @stage += 1\n elsif @stage == 3\n @stage += 1 \n aimrad(@dir*90 -150*@walldir)\n elsif @stage == 4\n aimrad(@dir*90 -185*@walldir)\n @stage += 1\n elsif @stage == 5 \n @prevCorner = events['robot_scanned'].size\n #print \"next corner=#{@nextCorner}, prev corner=#{@prevCorner}\\n\"\n if @nextCorner > @prevCorner\n @dir = (@dir + 2)%4\n @walldir *= -1\n end\n @stage = 0\n @mode = 0\n end\n end\n #compute the distances to the four walls\n walls = [battlefield_width - x,y,x,battlefield_height - y]\n #hug the wall, if we are slightly off the wall, than move back to the wall\n toleftwall,torightwall = walls[(@dir+1)%4],walls[(@dir-1)%4]\n #print \"wallroom left=#{toleftwall}, right=#{torightwall}\\n\"\n if toleftwall > 80 and toleftwall < 200\n aimtank(@dir * 90 + 20)\n elsif torightwall > 80 and torightwall < 200\n aimtank(@dir * 90 - 20)\n else\n aimtank(@dir * 90)\n end\n #If we reach a corner or wall, turn towards farthest corner on this wall\n if walls[@dir] < 100\n if toleftwall > torightwall\n @walldir = 1 #we are now going ccw\n @dir = (@dir+1)%4 # turn ccw\n #print \"turn left\\n\" \n else\n @walldir = -1 #we are now going cw\n @dir = (@dir-1)%4 #turn cw\n #print \"turn right\\n\" \n end\n #don't check corners at T junction\n if toleftwall > 100 and torightwall > 100\n @mode = 5 # determin weather it is safer ahead or behind\n @stage = 0\n else\n @mode = 4 # determin if previous corner was safer\n @stage = 0\n end\n #If we are getting hammered, turn now to evade damage\n # once we evade, avoid making another evasive manuver or we will turn in circles\n elsif @hit_filter > 400 and @since_evade > 100\n @dir = (@dir+@walldir)%4\n @hit_filter = 0\n @since_evade = 0\n end\n accelerate 1\n aim = @mytrack.predict(x,y,time) || (@dir * 90)%360\n aimgun(aim)\n fire 0.1\n doturns #we already computed our turns, now execute them\n STDOUT.flush\n end", "def get_feature_values\n out = File.open(\"#{$prepare_dir}/refseq_genes_result.tsv\", \"w\")\n template = File.read(\"#{@base_dir}/sparql/create_refseq2up_tsv.rq.erb\")\n stats = {}\n @refseq_list.each {|refseq|\n retry_cnt = 0 #prevent from infinite loop\n rsid = refseq [\"refseq_id\"]\n #next unless (rsid == \"NZ_CP011382.1\" || rsid == \"NC_003272.1\" || rsid == \"NC_000010.11\") #TODO delete\n query_text = ERB.new(template).result(binding)\n begin\n result = \"\"\n puts rsid\n @sparql_ep.query(query_text, :format => 'json') do |json|\n result += json\n end\n $stderr.puts \"success get featurs of #{rsid} .\"\n result = JSON.parse(result)[\"results\"][\"bindings\"]\n rescue # when occures timeout or json parse error\n retry_cnt += 1\n $stderr.puts \"error get featurs of #{rsid} .\"\n if retry_cnt <= 10\n $stderr.puts \"start retry after 30 sec...\"\n sleep 30\n retry\n else #prevent from infinite loop\n $stderr.puts \"finally, cloudn't get featurs of #{rsid} . Please check the data or environment\"\n next\n end\n end\n result.each do |entry|\n refseq_data = [\n entry['taxonomy_id']['value'],\n entry['gene']['value'],\n entry['gene_label']['value']\n ]\n if entry['protein_id']\n refseq_data.push(entry['protein_id']['value'])\n else\n refseq_data.push(\"\")\n end\n if entry['insdc_gene_id']\n refseq_data.push(entry['insdc_gene_id']['value'])\n else\n refseq_data.push(\"\")\n end\n out.puts refseq_data.join(\"\\t\")\n end\n }\n out.flush\n out.close\nend", "def link_statistics(iface, net_counters)\n so = shell_out(\"ip -d -s link\")\n tmp_int = nil\n on_rx = true\n xdp_mode = nil\n so.stdout.lines do |line|\n if line =~ IPROUTE_INT_REGEX\n tmp_int = $2\n iface[tmp_int] ||= Mash.new\n net_counters[tmp_int] ||= Mash.new\n end\n\n if /^\\s+(ip6tnl|ipip)/.match?(line)\n iface[tmp_int][:tunnel_info] = {}\n words = line.split\n words.each_with_index do |word, index|\n case word\n when \"external\"\n iface[tmp_int][:tunnel_info][word] = true\n when \"any\", \"ipip6\", \"ip6ip6\"\n iface[tmp_int][:tunnel_info][:proto] = word\n when \"remote\",\n \"local\",\n \"encaplimit\",\n \"hoplimit\",\n \"tclass\",\n \"flowlabel\",\n \"addrgenmode\",\n \"numtxqueues\",\n \"numrxqueues\",\n \"gso_max_size\",\n \"gso_max_segs\"\n iface[tmp_int][:tunnel_info][word] = words[index + 1]\n end\n end\n end\n\n if line =~ /(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)/\n int = on_rx ? :rx : :tx\n net_counters[tmp_int][int] ||= Mash.new\n net_counters[tmp_int][int][:bytes] = $1\n net_counters[tmp_int][int][:packets] = $2\n net_counters[tmp_int][int][:errors] = $3\n net_counters[tmp_int][int][:drop] = $4\n if int == :rx\n net_counters[tmp_int][int][:overrun] = $5\n else\n net_counters[tmp_int][int][:carrier] = $5\n net_counters[tmp_int][int][:collisions] = $6\n end\n\n on_rx = !on_rx\n end\n\n if line =~ /qlen (\\d+)/\n net_counters[tmp_int][:tx] ||= Mash.new\n net_counters[tmp_int][:tx][:queuelen] = $1\n end\n\n if line =~ /vlan id (\\d+)/ || line =~ /vlan protocol ([\\w\\.]+) id (\\d+)/\n if $2\n tmp_prot = $1\n tmp_id = $2\n else\n tmp_id = $1\n end\n iface[tmp_int][:vlan] ||= Mash.new\n iface[tmp_int][:vlan][:id] = tmp_id\n iface[tmp_int][:vlan][:protocol] = tmp_prot if tmp_prot\n\n vlan_flags = line.scan(/(REORDER_HDR|GVRP|LOOSE_BINDING)/)\n if vlan_flags.length > 0\n iface[tmp_int][:vlan][:flags] = vlan_flags.flatten.uniq\n end\n end\n\n # https://rubular.com/r/JRp6lNANmpcLV5\n if line =~ /\\sstate (\\w+)/\n iface[tmp_int][\"state\"] = $1.downcase\n end\n\n if line.include?(\"xdp\")\n mode = line.scan(/\\s(xdp|xdpgeneric|xdpoffload|xdpmulti)\\s/).flatten[0]\n # Fetches and sets the mode from the first line.\n unless mode.nil?\n iface[tmp_int][:xdp] = {}\n if mode.eql?(\"xdp\")\n # In case of xdpdrv, mode is xdp,\n # to keep it consistent, keeping mode as xdpdrv.\n mode = \"xdpdrv\"\n end\n xdp_mode = mode\n iface[tmp_int][:xdp][:attached] = []\n end\n\n if line =~ %r{prog/(\\w+) id (\\d+) tag (\\w+)}\n mode = $1.eql?(\"xdp\") ? xdp_mode : $1\n iface[tmp_int][:xdp][:attached] << {\n mode: mode,\n id: $2,\n tag: $3,\n }\n end\n end\n end\n iface\n end", "def runspoof(arp_packet_target,arp_packet_router)\n # Send out both packets\n #puts \"Spoofing....\"\n caught=false\n while caught==false do\n sleep 1\n arp_packet_target.to_w(@interface)\n arp_packet_router.to_w(@interface)\n end\nend", "def sniff(iface)\n pp 'Sniffing...'\n cap = Capture.new(:iface => iface, :start => true, :filter => 'udp and port 53', :save => true)\n cap.stream.each do |p|\n packet = Packet.parse p\n\n $dnsQuery = packet.payload[2].unpack('h*')[0].chr+packet.payload[3].unpack('h*')[0].chr\n\n if $dnsQuery == '10'\n domain, trans_id = get_info(packet)\n\n #generate_spoofDNS(domain, trans_id, packet)\n sendResponse(packet, domain)\n end\n\n end\n\nend", "def times_walked_to(state); end", "def gather_measurements(outage, filter_tracker)\n reverse_problem = outage.pings_towards_src.empty?\n forward_problem = (outage.spoofed_tr.nil? || !outage.spoofed_tr.reached?(outage.dst))\n\n outage.direction = @failure_analyzer.infer_direction(reverse_problem, forward_problem)\n @logger.debug { \"direction: #{outage.direction}\" }\n\n # HistoricalForwardHop objects\n outage.historical_tr, outage.historical_trace_timestamp = retrieve_historical_tr(outage.src, outage.dst)\n\n @logger.debug { \"Finding historical revtrs for #{outage.historical_tr.length} hops\" }\n outage.historical_tr.each do |hop|\n # thread out on this to make it faster? Ask Dave for a faster\n # way?\n hop.reverse_path = fetch_historical_revtr(outage.src, hop.ip)\n end\n\n outage.historical_revtr = fetch_historical_revtr(outage.src, outage.dst)\n\n @logger.debug { \"historical paths fetched\" }\n\n # maybe not accurate given multiple threads, but fukit\n tr_time = Time.new\n outage.measurement_times << [\"tr_time\", tr_time]\n outage.tr = @isolation_issuer.issue_normal_traceroutes(outage.src, outage.dst)[outage.dst]\n\n @logger.debug { \"traceroutes issued\" }\n\n ## I see empty measurements from time to time, which shouldn't happen\n if outage.tr.empty?\n @logger.warn { \"empty traceroute! #{outage.src} #{outage.dst}\" }\n restart_atd(outage.src)\n sleep 10\n tr_time2 = Time.new\n outage.tr = @isolation_issuer.issue_normal_traceroutes(outage.src, outage.dst)[outage.dst]\n if outage.tr.empty?\n @logger.warn { \"traceroute still empty! (#{outage.src}, #{outage.dst})\" } \n @node_2_failed_measurements[outage.src] += 1\n end\n end\n\n # Set to the # of times measurements were reissued. False of\n # measurements succeeded on the first attempt\n measurements_reissued = false\n\n if outage.paths_diverge?\n # path divergence!\n # reissue traceroute and spoofed traceroute until they don't\n # diverge\n measurements_reissued = 1\n\n 3.times do \n sleep 30\n outage.tr = @isolation_issuer.issue_normal_traceroutes(outage.src, outage.dst)[outage.dst]\n @isolation_issuer.issue_spoofed_traceroutes!({[outage.src,outage.dst] => outage})\n\n break if !outage.paths_diverge?\n measurements_reissued += 1\n end\n end\n\n # TODO: implement retries for symmetric traceroutes? (in an attempt to\n # fill in the gaps of the missing ground truth data)\n\n # We would like to know whether the hops on the historicalfoward/reverse/historicalreverse paths\n # are pingeable from the source.\n outage.measurement_times << [\"non-revtr pings\", Time.new]\n # Note that outage.ping_responsive() is computed on demand. The return\n # value here is only used to check if need to reissue pings\n responsive_hops, non_responsive_hops = @isolation_issuer.check_reachability!(outage)\n responsive_ips, non_responsive_ips = hops_to_uniq_ips(responsive_hops), hops_to_uniq_ips(non_responsive_hops)\n\n @logger.debug { \"non-revtr pings issued\" }\n\n ## Moar empty measurements!\n if responsive_ips.empty?\n @logger.warn { \"empty pings! (#{outage.src}, #{outage.dst} #{responsive_ips.size + non_responsive_ips.size} ips: [#{non_responsive_ips.join(\",\")}])\" }\n\n @node2emptypings[outage.src].push_empty\n restart_atd(outage.src)\n sleep 10\n responsive_hops, non_responsive_hops = @isolation_issuer.check_reachability!(outage)\n responsive_ips, non_responsive_ips = hops_to_uniq_ips(responsive_hops), hops_to_uniq_ips(non_responsive_hops)\n if responsive_ips.empty?\n @logger.warn { \"pings still empty! (#{outage.src}, #{outage.dst} #{responsive_ips.size + non_responsive_ips.size} ips: [#{non_responsive_ips.join(\",\")}])\" } \n @node_2_failed_measurements[outage.src] += 1\n @node2emptypings[outage.src].push_empty\n else\n @node2emptypings[outage.src].push_nonempty\n end\n else\n @node2emptypings[outage.src].push_nonempty\n end\n\n outage.measurement_times << [\"pings_to_nonresponsive_hops\", Time.new]\n @isolation_issuer.check_pingability_from_other_vps!(outage.connected, non_responsive_hops)\n\n @logger.debug { \"pings to non-responsive hops issued\" }\n\n if outage.direction != Direction.REVERSE and outage.direction != Direction.BOTH\n # Only issue spoofed revtrs for forward outages (since spoofed\n # revtrs take a looooong time to measure)\n outage.measurement_times << [\"revtr\", Time.new]\n outage.spoofed_revtr = issue_revtr(outage.src, outage.dst, outage.historical_tr.map { |hop| hop.ip })\n else\n # Else, just set it to an empty path\n outage.spoofed_revtr = SpoofedReversePath.new(outage.src, outage.dst)\n end\n\n @logger.debug { \"spoofed_revtr issued\" }\n\n if outage.spoofed_revtr.valid?\n # Issue pings to all hops on the spoofed revtr\n outage.measurement_times << [\"revtr pings\", Time.new]\n @isolation_issuer.check_reachbility_for_revtr!(outage)\n\n @logger.debug { \"revtr pings issued\" }\n end\n\n outage.measurement_times << [\"measurements completed\", Time.new]\n\n # Fetch wether each hop is has been pingable from at least one VP in\n # the past\n fetch_historical_pingability!(outage)\n\n @logger.debug { \"historical pingability fetched\" }\n\n # Issue ground truth measurements (forward path from dst -> src)\n if outage.symmetric\n outage.dst_tr = @isolation_issuer.issue_normal_traceroutes(outage.dst_hostname, outage.src_ip)[outage.src_ip]\n @logger.debug { \"destination's tr issued. valid?:#{outage.dst_tr.valid?}\" }\n\n splice_alternate_paths(outage)\n @logger.debug { \"alternate path splicing complete\" }\n end\n\n\t fempty = @node2emptypings[outage.src].fraction_empty\n if fempty > FailureIsolation::EmptyPingsThreshold\n @logger.info { \"scheduling #{outage.src} for swap_out\" }\n SwapFilters.empty_pings!(outage, filter_tracker)\n end\n end", "def read_live\n\t#incident number counter\n\ti = 0\n\tstream = PacketFu::Capture.new(:start => true, :iface => 'en0', :promisc => true)\n\t#stream.show_live()\n\tstream.stream.each do |raw|\n\t\tpkt = PacketFu::Packet.parse(raw)\n\t\tif pkt.is_tcp?\n\t\t\t#update incident number\n\t\t\ti= i + 1\n\n\t\t\t#get the source IP address of the scan\n\t\t\tsIP = pkt.ip_saddr\n\n\t\t\t#get all protocols used in packet\n\t\t\tprotocol = pkt.proto\n\n\t\t\t#get last protocol used\n\t\t\tp = protocol.last\n\t\t\t\n\t\t\t#NULL scan\n\t\t\tif pkt.tcp_flags.urg == 0 && pkt.tcp_flags.ack == 0 && pkt.tcp_flags.psh == 0 &&\n\t\t\t\tpkt.tcp_flags.rst == 0 && pkt.tcp_flags.syn == 0 && pkt.tcp_flags.fin == 0\n\t\t\t\tputs i.to_s + \". ALERT: NULL scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\t\t\t\n\t\t\t#FIN scan\n\t\t\tif pkt.tcp_flags.urg == 0 && pkt.tcp_flags.ack == 0 && pkt.tcp_flags.psh == 0 &&\n\t\t\t\tpkt.tcp_flags.rst == 0 && pkt.tcp_flags.syn == 0 && pkt.tcp_flags.fin == 1\n\t\t\t\tputs i.to_s + \". ALERT: FIN scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\t\t\t\n\t\t\t#Xmas scan\n\t\t\tif pkt.tcp_flags.urg == 1 && pkt.tcp_flags.ack == 0 && pkt.tcp_flags.psh == 1 &&\n\t\t\t\tpkt.tcp_flags.rst == 0 && pkt.tcp_flags.syn == 0 && pkt.tcp_flags.fin == 1\n\t\t\t\tputs i.to_s + \". ALERT: XMAS scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\t\t\t\t\n\n\t\t\t#Other Nmap scans\n\t\t\tif pkt.payload.scan(/\\x4E\\x6D\\x61\\x70/)\n\t\t\t\tputs i.to_s + \". ALERT: Nmap scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\t\t\t\n\t\t\t#Nikto scan \n\t\t\tif pkt.payload.scan(/\\x4E\\x69\\x6B\\x74\\x6F\\x0A/)\n\t\t\t\tputs i.to_s + \". ALERT: Nikto scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\n\t\t\t#Credit card leak \n\t\t\tif pkt.payload.scan(/4\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) || pkt.payload.scan(/5\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) || pkt.payload.scan(/6011(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) || pkt.payload.scan(/3\\d{3}(\\s|-)?\\d{6}(\\s|-)?\\d{5}/)\n\t\t\t\tputs i.to_s + \". ALERT: Credit card leaked in the clear from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\t\tend\n\tend\t\t\t\nend", "def run( nodes )\n\t\tsuper do |host, snmp|\n\t\t\tself.check_battery( host, snmp )\n\t\tend\n\tend", "def timing(stat, ms, sample_rate=1); send stat, ms, 'ms', sample_rate end", "def ping(cmd)\n\tdst = cmd[0]\n next_hop = $next[dst]\n if next_hop == \"NA\" || next_hop == $hostname\n STDOUT.puts \"PING ERROR: HOST UNREACHABLE\"\n return\n end\n n = cmd[1].to_i\n delay = cmd[2].to_i\n client = $clients[next_hop]\n\n # This will iterate through the number of pings given on the command line. It will setup the \n # proper message for pingCallBack and adds the current time to the ping table with the key\n # of the sequence number. It will then check if ping_table has that key still (should be removed\n # by pingCallBack) so if it still exists, then the host was not reached.\n for seq_id in (0..(n - 1))\n msg = Msg.new\n msg.setConfig(\"type\", 3)\n msg.setConfig(\"code\", 0)\n msg.setMessage($hostname + \" \" + dst + \" \" + seq_id.to_s)\n $ping_table[seq_id.to_s] = $currtime\n sendMessage(client, msg)\n Thread.new {\n seq_id_ = seq_id\n sleep($ping_timeout)\n if $ping_table.has_key?(seq_id_.to_s)\n STDOUT.puts \"PING ERROR: HOST UNREACHABLE\"\n end\n $ping_table.delete(seq_id_.to_s)\n }\n sleep(delay)\n end\nend", "def igmp(rule_name, info)\n\n # Go to the advanced page\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Diagnostics\" page.\n begin\n @ff.link(:text, 'IGMP Proxy').click\n self.msg(rule_name, :info, 'Go to \\'IGMP Proxy\\' page', 'Done!')\n rescue\n self.msg(rule_name, :error, 'Go to \\'IGMP Proxy\\' page', 'Wrong!')\n return\n end \n \n # Check for the keys\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'igmp','Some key NOT found.')\n return\n end \n \n # \"IGMP Proxy (Enable/Disable)\"\n if info.has_key?('IGMP Proxy (Enable/Disable)')\n case info['IGMP Proxy (Enable/Disable)']\n when 'Enabled'\n @ff.select_list(:id, 'sym_igmp_proxy_config').select_value('1')\n self.msg(rule_name, :info, 'IGMP Proxy (Enable/Disable)', 'Enabled')\n when 'Disabled'\n @ff.select_list(:id, 'sym_igmp_proxy_config').select_value('0')\n self.msg(rule_name, :info, 'IGMP Proxy (Enable/Disable)', 'Disabled')\n else\n self.msg(rule_name, :error, 'igmp proxy', 'unknown option')\n return\n end\n end \n \n # IGMPv1, IGMPv2 or IGMPv3?\n if info.has_key?('IGMP Proxy Querier Version')\n case info['IGMP Proxy Querier Version']\n when 'IGMPv1'\n @ff.select_list(:id, 'sym_igmp_proxy_qcm').select_value(\"1\")\n self.msg(rule_name, :info, 'IGMP Proxy Querier Version', 'IGMPv1')\n when 'IGMPv2'\n @ff.select_list(:id, 'sym_igmp_proxy_qcm').select_value(\"2\")\n self.msg(rule_name, :info, 'IGMP Proxy Querier Version', 'IGMPv2')\n when 'IGMPv3'\n @ff.select_list(:id, 'sym_igmp_proxy_qcm').select_value(\"3\")\n self.msg(rule_name, :info, 'IGMP Proxy Querier Version', 'IGMPv3')\n else\n self.msg(rule_name, :error, 'IGMP Proxy Querier Version', 'unknown version')\n end\n end \n \n # Output the result in page.\n \n # Find the table.\n sTable = false\n @ff.tables.each do |t|\n if ( t.text.include? 'Upstream Interface' and\n t.text.include? 'Upstream Multicast Filtering' and \n ( not t.text.include? 'IGMP Proxy Querier Version') and\n t.row_count > 2 )then\n sTable = t\n break\n end\n end\n \n if sTable == false\n # Wrong here\n self.msg(rule_name,:error,'IGMP Proxy','Did NOT find the target table.')\n return\n end\n \n i = 0\n # Find the row\n sTable.each do |row|\n \n # not for first line\n if row.text.include?'Upstream Multicast Filtering' then\n next\n end\n \n # not for second line\n if row.text.include?'Upstream Interface' then\n next\n end \n \n # not for last line\n if row.text.include?'New Multicast Address' then\n next\n end\n \n i = i+1\n strUpstreamInterface = \"Upstream Interface\" + i.to_s\n strMulticastAddress = \"Multicast Address\" + i.to_s\n strIPSubnet = \"IP Subnet\" + i.to_s\n \n # Find the cell\n self.msg(rule_name,:info,strUpstreamInterface,row[1])\n self.msg(rule_name,:info,strMulticastAddress,row[2])\n self.msg(rule_name,:info,strIPSubnet,row[3])\n \n end\n \n # Apply for the change.\n @ff.link(:text,'Apply').click\n \n # Output the result.\n self.msg(rule_name,:info,'IGMP Proxy','SUCCESS') \n \n end", "def update_stats\n @request_count += 1\n discover_server_periodically if(time_to_discover? && !@disconnected_connections.empty?)\n end", "def do_poll\n\t\tdo_send(Commands[:request_bus] + \":#{ControlBus[:a_bus]}\", :priority => 99)\n\t\tdo_send(Commands[:request_bus] + \":#{ControlBus[:b_bus]}\", :priority => 99)\n\t\tdo_send(Commands[:request_bus] + \":#{ControlBus[:pgm]}\", :priority => 99)\n\t\tdo_send(Commands[:request_bus] + \":#{ControlBus[:pvw]}\", :priority => 99)\n\t\tdo_send(Commands[:request_bus] + \":#{ControlBus[:key_f]}\", :priority => 99)\n\t\tdo_send(Commands[:request_bus] + \":#{ControlBus[:key_s]}\", :priority => 99)\n\t\tdo_send(Commands[:request_bus] + \":#{ControlBus[:p_in_p]}\", :priority => 99)\n\t\tdo_send(Commands[:request_bus] + \":#{ControlBus[:aux]}\", :priority => 99)\n\tend", "def monitor\n @summary = @vm.summary\n @state = state_to_c(@summary.runtime.powerState)\n\n if @state != 'a'\n @used_cpu = 0\n @used_memory = 0\n\n @net_rx = 0\n @net_tx = 0\n\n return\n end\n\n @used_memory = @summary.quickStats.hostMemoryUsage * 1024\n\n host = VIDriver::host\n cpuMhz = host.cpuMhz.to_f\n @used_cpu =\n ((@summary.quickStats.overallCpuUsage.to_f / cpuMhz) * 100).to_s\n @used_cpu = sprintf('%.2f',@used_cpu).to_s\n\n vm_stats = VIDriver::retrieve_stats([@vm],\n [\"net.packetsRx\",\"net.packetsTx\"])\n @net_rx = 0\n @net_tx = 0\n\n if vm_stats[@vm] && vm_stats[@vm][:metrics]\n if vm_stats[@vm][:metrics][\"net.packetsRx\"]\n @net_rx = vm_stats[@vm][:metrics][\"net.packetsRx\"].first\n end\n\n if vm_stats[@vm][:metrics][\"net.packetsTx\"]\n @net_tx = vm_stats[@vm][:metrics][\"net.packetsTx\"].first\n end\n end\n\n # Check for negative values\n @used_memory = 0 if @used_memory.to_i < 0\n @used_cpu = 0 if @used_cpu.to_i < 0\n @net_rx = 0 if @net_rx.to_i < 0\n @net_tx = 0 if @net_tx.to_i < 0\n end", "def monitor_poll_vm\n reset_monitor\n\n return unless @vm.get_vm_id\n\n @state = state_to_c(@vm['summary.runtime.powerState'])\n\n if @state != VM_STATE[:active]\n reset_monitor\n return\n end\n\n cpu_mhz = @vm['runtime.host.summary.hardware.cpuMhz'].to_f\n\n @monitor[:used_memory] = @vm['summary.quickStats.hostMemoryUsage'] *\n 1024\n\n used_cpu = @vm['summary.quickStats.overallCpuUsage'].to_f / cpu_mhz\n used_cpu = (used_cpu * 100).to_s\n @monitor[:used_cpu] = format('%.2f', used_cpu).to_s\n\n # Check for negative values\n @monitor[:used_memory] = 0 if @monitor[:used_memory].to_i < 0\n @monitor[:used_cpu] = 0 if @monitor[:used_cpu].to_i < 0\n\n guest_ip_addresses = []\n unless @vm['guest.net'].empty?\n @vm['guest.net'].each do |net|\n next unless net.ipConfig\n next if net.ipConfig.ipAddress.empty?\n\n net.ipConfig.ipAddress.each do |ip|\n guest_ip_addresses << ip.ipAddress\n end\n end\n end\n\n @guest_ip_addresses = guest_ip_addresses.join(',')\n\n pm = @vm['_connection'].serviceInstance.content.perfManager\n\n provider = pm.provider_summary(@vm.item)\n\n refresh_rate = provider.refreshRate\n\n stats = {}\n\n if @one_vm['MONITORING/LAST_MON'] &&\n @one_vm['MONITORING/LAST_MON'].to_i != 0\n # Real time data stores max 1 hour. 1 minute has 3 samples\n interval = (Time.now.to_i -\n @one_vm['MONITORING/LAST_MON'].to_i)\n\n # If last poll was more than hour ago get 3 minutes,\n # else calculate how many samples since last poll\n if interval > 3600\n samples = 9\n else\n samples = (interval / refresh_rate) + 1\n end\n samples > 0 ? max_samples = samples : max_samples = 1\n\n stats = pm.retrieve_stats(\n [@vm.item],\n ['net.transmitted', 'net.bytesRx', 'net.bytesTx',\n 'net.received', 'virtualDisk.numberReadAveraged',\n 'virtualDisk.numberWriteAveraged', 'virtualDisk.read',\n 'virtualDisk.write'],\n interval => refresh_rate, max_samples => max_samples\n ) rescue {}\n else\n # First poll, get at least latest 3 minutes = 9 samples\n stats = pm.retrieve_stats(\n [@vm.item],\n ['net.transmitted', 'net.bytesRx', 'net.bytesTx',\n 'net.received', 'virtualDisk.numberReadAveraged',\n 'virtualDisk.numberWriteAveraged', 'virtualDisk.read',\n 'virtualDisk.write'],\n interval => refresh_rate, max_samples => 9\n ) rescue {}\n end\n\n if !stats.empty? && !stats.first[1][:metrics].empty?\n metrics = stats.first[1][:metrics]\n\n nettx_kbpersec = 0\n if metrics['net.transmitted']\n metrics['net.transmitted'].each do |sample|\n nettx_kbpersec += sample if sample > 0\n end\n end\n\n netrx_kbpersec = 0\n if metrics['net.bytesRx']\n metrics['net.bytesRx'].each do |sample|\n netrx_kbpersec += sample if sample > 0\n end\n end\n\n read_kbpersec = 0\n if metrics['virtualDisk.read']\n metrics['virtualDisk.read'].each do |sample|\n read_kbpersec += sample if sample > 0\n end\n end\n\n read_iops = 0\n if metrics['virtualDisk.numberReadAveraged']\n metrics['virtualDisk.numberReadAveraged'].each do |sample|\n read_iops += sample if sample > 0\n end\n end\n\n write_kbpersec = 0\n if metrics['virtualDisk.write']\n metrics['virtualDisk.write'].each do |sample|\n write_kbpersec += sample if sample > 0\n end\n end\n\n write_iops = 0\n if metrics['virtualDisk.numberWriteAveraged']\n metrics['virtualDisk.numberWriteAveraged'].each do |sample|\n write_iops += sample if sample > 0\n end\n end\n\n else\n nettx_kbpersec = 0\n netrx_kbpersec = 0\n read_kbpersec = 0\n read_iops = 0\n write_kbpersec = 0\n write_iops = 0\n end\n\n # Accumulate values if present\n if @one_item && @one_item['MONITORING/NETTX']\n previous_nettx = @one_item['MONITORING/NETTX'].to_i\n else\n previous_nettx = 0\n end\n\n if @one_item && @one_item['MONITORING/NETRX']\n previous_netrx = @one_item['MONITORING/NETRX'].to_i\n else\n previous_netrx = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDIOPS']\n previous_diskrdiops = @one_item['MONITORING/DISKRDIOPS'].to_i\n else\n previous_diskrdiops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRIOPS']\n previous_diskwriops = @one_item['MONITORING/DISKWRIOPS'].to_i\n else\n previous_diskwriops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDBYTES']\n previous_diskrdbytes = @one_item['MONITORING/DISKRDBYTES'].to_i\n else\n previous_diskrdbytes = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRBYTES']\n previous_diskwrbytes = @one_item['MONITORING/DISKWRBYTES'].to_i\n else\n previous_diskwrbytes = 0\n end\n\n @monitor[:nettx] = previous_nettx +\n (nettx_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:netrx] = previous_netrx +\n (netrx_kbpersec * 1024 * refresh_rate).to_i\n\n @monitor[:diskrdiops] = previous_diskrdiops + read_iops\n @monitor[:diskwriops] = previous_diskwriops + write_iops\n @monitor[:diskrdbytes] = previous_diskrdbytes +\n (read_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:diskwrbytes] = previous_diskwrbytes +\n (write_kbpersec * 1024 * refresh_rate).to_i\n end", "def poll_stats\n curr_time = Time.now\n # After some timeout, send the incremental difference to Hastur\n if curr_time - @last_stat_flush > @stats_interval\n Hastur.counter(\"router.num_msgs\", @num_msgs, curr_time)\n # reset stats\n @num_msgs = 0\n @last_stat_flush = curr_time\n end\n end", "def process_cmd(cmd)\n try_again=true #initialize Try_again\n begin\n $logger.debug \"process_cmd #{@state} => #{cmd}\"\n\t \n if (cmd == NOMON)\n systemlog_msg=\"Stopping Monitoring, still connected to instrument\"\n SystemLog.log(systemlog_msg,systemlog_msg,SystemLog::MESSAGE,instr_id)\n if (@state == Analyzer::INGRESS)\n stop_ingress()\n elsif (@state == Analyzer::DOWNSTREAM)\n stop_performance()\n elsif (@state == Analyzer::DISCONNECTED)\n conn_instr()\n elsif (@state == Analyzer::CONNECTED)\n #Do Nothing\n end\n elsif (cmd == TSWITCH)\n test_switch()\n elsif(cmd == AUTOCO)\n auto_connect()\n elsif (cmd == FIRMWARE)\n $logger.debug \"UPGRADING FIRMWARE\"\n systemlog_msg=\"Upgrading Firmware\"\n SystemLog.log(systemlog_msg,systemlog_msg,SystemLog::MESSAGE,instr_id)\n if (@state == Analyzer::INGRESS)\n #Do Nothing\n elsif (@state == Analyzer::CONNECTED)\n upgrade_firmware()\n elsif (@state == Analyzer::DISCONNECTED)\n conn_instr()\n upgrade_firmware()\n elsif (@state == Analyzer::DOWNSTREAM)\n #Do Nothing\n end\n elsif (cmd == INGRESS)\n systemlog_msg=\"Switching to Ingress Mode\"\n SystemLog.log(systemlog_msg,systemlog_msg,SystemLog::MESSAGE,instr_id)\n if (@state == Analyzer::CONNECTED)\n start_ingress()\n elsif (@state == Analyzer::DOWNSTREAM)\n stop_performance()\n start_ingress()\n elsif (@state == Analyzer::DISCONNECTED)\n conn_instr()\n start_ingress()\n elsif (@state == Analyzer::INGRESS)\n #Do Nothing\n end\n elsif (cmd == DOWNSTREAM)\n systemlog_msg=\"Switching to Downstream Mode\"\n SystemLog.log(systemlog_msg,systemlog_msg,SystemLog::MESSAGE,instr_id)\n if (@state == Analyzer::INGRESS)\n stop_ingress()\n start_performance()\n elsif (@state == Analyzer::CONNECTED)\n start_performance()\n elsif (@state == Analyzer::DISCONNECTED)\n conn_instr()\n start_performance()\n elsif (@state == Analyzer::DOWNSTREAM)\n #Do Nothing\n end\n elsif (cmd == HEARTBEAT)\n elsif (cmd == MAINT)\n systemlog_msg=\"Switching to Maintenance Mode. Disconnecting from instrument.\"\n SystemLog.log(systemlog_msg,systemlog_msg,SystemLog::MESSAGE,instr_id)\n if (@state == Analyzer::DISCONNECTED)\n $logger.debug \"#Do Nothing\"\n #Do Nothing\n elsif (@state == Analyzer::CONNECTED)\n disconn_instr()\n elsif (@state == Analyzer::INGRESS)\n stop_ingress()\n disconn_instr()\n elsif (@state == Analyzer::DOWNSTREAM)\n stop_performance()\n disconn_instr()\n else\n systemlog_msg=\"Unrecognized State: #{@state}\"\n SystemLog.log(systemlog_msg,systemlog_msg,SystemLog::WARNING,instr_id)\n end\n elsif (cmd == SHUTDOWN)\n shutdown()\n else\n systemlog_msg= \"command #{cmd} are not handled.\"\n SystemLog.log(systemlog_msg,systemlog_msg,SystemLog::WARNING,instr_id)\n end\n rescue Mysql::Error => ex\n $logger.debug \"Mysql Error #{ex.message}\"\n retry\n end\n end", "def get_route(curr_pos, end_time, pmap, tws, twe) \n ans = []\n starting_tuple = curr_pos << 0 # 0 is the waiting time\n ans << starting_tuple # [y, x, time unit]\n \n\t\n\t\n max_y = pmap.length - 1 \n max_x = pmap[0].length - 1\n \n highest_score = 0.0\n \n\ttime_for_score = 0.0\n\ttime_for_get_ans = 0.0\n\t\n\ttemp = -1\n\ttemp1 = 0\n\tfor y in 0..max_y\n\t\ttemp1 = pmap[y].count(temp)+ temp1 \n\tend\n\t\n\tno_of_pokemon = (pmap.length*pmap[0].length - temp1)\n\t\n\tnumber_of_loops = 0.7541*Math.log(no_of_pokemon,E) + 0.9829\n\t\n\n\t\n\t\n for h in 0...number_of_loops\n pmap1 = Marshal.load(Marshal.dump(pmap))\n tws1 = Marshal.load(Marshal.dump(tws))\n twe1 = Marshal.load(Marshal.dump(twe))\n\t\t\n time_taken = Time.now\n sortedArrayByRatioDistStart1 = []\n ans1 = []\n ans1 = getArrayResultsWithStartingPokemon(starting_tuple, pmap1, tws1, twe1, sortedArrayByRatioDistStart1, end_time, h)\n\t\ttime_for_get_ans = Time.now - time_taken + time_for_get_ans\n\t\t\n\t\tpmap1 = Marshal.load(Marshal.dump(pmap))\n tws1 = Marshal.load(Marshal.dump(tws))\n twe1 = Marshal.load(Marshal.dump(twe))\n\t\t\n\t\ttime_taken = Time.now\n score_time1 = get_score(ans1, pmap1, tws1, twe1)\n route_score1 = score_time1[0].round\n route_time1 = score_time1[1].round(3)\n time_for_score = Time.now - time_taken + time_for_score\n\t\t\n if highest_score <= route_score1\n final_ans = ans1\n highest_score = route_score1\n end\n\t\t\n\t\t\n end\n \n\n return final_ans\nend", "def throttles; end", "def feed(tape)\n tokr = /(\\d+)\\s+(\\w+)\\s+([^#]+)/ # Split out the pid, opcode, and the arguments as one string\n tape.split(\"\\n\").each do |line|\n md = line.match(tokr)\n pid = md[1].to_i\n op = md[2]\n args = md[3]\n\n if op.match /[aA]lloc/\n a = args.split(\" \").map { |i| i.to_i } #each operation has a different way of handling arguments\n load :pid => pid, :op => :alloc, :text => a[0], :data => a[1]\n elsif op.match(/\\d+/)\n load :pid => pid, :op => :alloc, :text => op.to_i, :data => args.to_i\n elsif op.match /[hH]alt/\n load :pid => pid, :op => :halt\n elsif op.match /[Rr]ead/\n a = args.match(/([a-z])(\\d+)\\s+(\\d+)/)\n if a[1] == 'd'\n seg = :data\n elsif a[1] == 't'\n seg = :text\n end\n off = a[2].to_i\n size = a[3].to_i\n load :pid => pid, :op => :read, :segment => seg, :offset => off, :size => size\n end\n end\n end", "def scan_for_open \n ssids_open = []\n response = @wpa.scan\n count_no_ssid = 0\n count_scanned = 0\n count_skipped = 0\n count_wpa = 0\n\n @wpa.scan_results.each do |r|\n count_scanned += 1\n # TODO:\n # - figure out how to add networks without an ssid\n # - maybe have a global regex like Officejet for ignoring ssids\n unless r.ssid\n count_no_ssid += 1\n next\n end\n if Wpa.is_ssid_current(r.ssid) \n #@report.push [curr: [r.bssid, r.ssid, r.flags]]\n next\n end\n unless r.flags == '[ESS]'\n count_wpa += 1\n next\n end\n ssids_open.push(r)\n end\n @report.unshift \"#{Time.now} wpa:#{count_wpa} hid:#{count_no_ssid} / #{count_scanned}\"\n return ssids_open\nend", "def performMeasurements()\n\n # Define the grid offsets\n grid = [];\n delta = (3.5/$freq.to_f * 1000.0)/2.0;\n max_deviation = delta * 4.0;\n\n pos = [];\n pos << 0.0;\n pos << max_deviation;\n grid << pos;\n\n pos = [];\n pos << 0.0;\n pos << delta;\n grid << pos;\n\n pos = [];\n pos << 0.0;\n pos << 0.0;\n grid << pos;\n\n pos = [];\n pos << 0.0;\n pos << -delta;\n grid << pos;\n\n pos = [];\n pos << 0.0;\n pos << -max_deviation;\n grid << pos;\n\n pos = [];\n pos << -max_deviation;\n pos << 0.0;\n grid << pos;\n\n pos = [];\n pos << -delta;\n pos << 0.0;\n grid << pos;\n\n pos = [];\n pos << 0.0;\n pos << 0.0;\n grid << pos;\n\n pos = [];\n pos << delta;\n pos << 0.0;\n grid << pos;\n\n pos = [];\n pos << max_deviation;\n pos << 0.0;\n grid << pos;\n\n puts \"[start]\";\n puts \"Performing measurements for antennas #{getAntList(',')}\";\n\n # Initialize the hashmap of all the measurements.\n @ants.each do |a|\n @measurements[a.name] = [];\n end\n\n # First, perform the measurement for the detault offsets\n # Should already be tracking\n t = Time.new.localtime\n timeString = \"Current Time : \" + t.to_s\n `sleep 10`;\n\n puts \"Getting default center measurements\";\n @ants.each do |a|\n meas = Measurement.new(a.pmDefault);\n `sleep 12`;\n meas.setPwr(\"x\", a.getPwrAvg(\"x\").split(/\\s+/)[2]);\n meas.setPwr(\"y\", a.getPwrAvg(\"y\").split(/\\s+/)[2]);\n @measurements[a.name] << meas;\n\n begin\n file = File.open($defaultPMValuesFilename, \"a+\");\n if(timeString != nil)\n file.write(timeString + \"\\n\");\n timeString = nil;\n end\n file.write(a.name + \",\" + meas.to_s + \"\\n\") ;\n rescue IOError => e\n $stderr.puts \"Trouble saving default PM values: \" + e.to_s;\n exit(1);\n ensure\n file.close unless file.nil?\n end\n end\n\n # For testing, stop here and make sure the default PM values\n # were written to the file.\n #exit(0);\n\n # Offset the PM for each grid position, then get the power for that\n # position.\n grid.each_with_index do |g, i|\n x = g[0];\n y = g[1];\n puts \"\\nGrid position #{(i+1).to_s}, Offsetting PM #{g[0]},#{g[1]}\\n\";\n @ants.each do |a|\n a.offsetPm(x, y);\n end\n puts \"Tracking #{@targetName}\";\n track(@targetName);\n `sleep 5`;\n @ants.each do |a|\n #Commented out for testin\n meas = Measurement.new(a.offsetPM);\n `sleep 12`;\n meas.setPwr(\"x\", a.getPwrAvg(\"x\").split(/\\s+/)[2]);\n meas.setPwr(\"y\", a.getPwrAvg(\"y\").split(/\\s+/)[2]);\n @measurements[a.name] << meas;\n end\n end\n\n # Set PM back to default\n @ants.each do |a|\n a.offsetPm(0.0, 0.0);\n end\n\n\n puts \"Finished measurements for antennas #{getAntList(',')}\";\n puts \"[end]\";\n\n\n @ants.each do |a|\n # Get the Az/El of the antenna for reporting purposes\n azel = getAzEl(a.name);\n\n offsets_xy = Measurement.calcOffset(a.name, \"xy\", @measurements[a.name]);\n offsets_x = Measurement.calcOffset(a.name, \"x\", @measurements[a.name]);\n offsets_y = Measurement.calcOffset(a.name, \"y\", @measurements[a.name]);\n time1 = Time.new.localtime.to_s\n #1a,\n #Tue Jul 19 10:47:38 -0700 2016,\n #GPS-BIIR-11--PRN-19-,\n #205.643,59.481,\n #290.7950,77.7110,290.773043159548,77.3966612701321,0.0219568404518782,0.314338729867927\n #offset.az, offset.el, o2, o1, (o2.to_f - offset.az.to_f).abs(), (o1.to_f - offset.el.to_f).abs() \n str = a.name + \",\" + time1 + \",\" + $satName + \",\" + azel[0] + \",\" + azel[1] + \",\" + \n offsets_xy[0].to_s + \",\" + \n offsets_xy[1].to_s + \",\" + \n offsets_xy[2].to_s + \",\" + \n offsets_xy[3].to_s + \",\" + \n offsets_xy[4].to_s + \",\" + \n offsets_xy[5].to_s;\n fname = a.name + \".pnt\";\n File.open(fname, 'a+') {|f| f.write(str + \"\\n\") }\n\n str2 = a.name + \"\\n\";\n @measurements[a.name].each do |m|\n str2 = str2 + m.to_s + \"\\n\";\n end\n str2 = str2 + str + \"\\n\";\n File.open(\"allants.pnt\", 'a+') {|f| f.write(str2 + \"\\n\") }\n\n time1 = Time.new.localtime\n\n # Output the results to \"corr.pnt\"\n\n str3 = \"\\nant: \" + a.name; \n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" Date: \" + time1.to_s;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" Sat: \" + $satName; \n\n puts \" Elev X: \" + Measurement.getMeasString(\"el\", \"x\", @measurements[a.name]);\n puts \" Elev Y: \" + Measurement.getMeasString(\"el\", \"y\", @measurements[a.name]);\n puts \" Az X: \" + Measurement.getMeasString(\"az\", \"x\", @measurements[a.name]);\n puts \" Az Y: \" + Measurement.getMeasString(\"az\", \"y\", @measurements[a.name]);\n File.open(\"corr.pnt\", 'a+') {|f| f.write(\" Elev X: \" + \n Measurement.getMeasString(\"el\", \"x\", @measurements[a.name]) + \"\\n\") }\n File.open(\"corr.pnt\", 'a+') {|f| f.write(\" Elev Y: \" + \n Measurement.getMeasString(\"el\", \"y\", @measurements[a.name]) + \"\\n\") }\n File.open(\"corr.pnt\", 'a+') {|f| f.write(\" Az X: \" + \n Measurement.getMeasString(\"az\", \"x\", @measurements[a.name]) + \"\\n\") }\n File.open(\"corr.pnt\", 'a+') {|f| f.write(\" Az Y: \" + \n Measurement.getMeasString(\"az\", \"y\", @measurements[a.name]) + \"\\n\") }\n\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" Az/El: \" + azel[0].to_s + \" \" + azel[1].to_s; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" Orig: \" + offsets_xy[0].to_s + \" \" + offsets_xy[1].to_s; \n puts str3;\n str3 = \" atasetpmoffsets --absolute #{a.name} #{offsets_xy[0].to_s} #{offsets_xy[1].to_s}\"; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\\n\") }\n str3 = \" XY New: \" + offsets_xy[2].to_s + \" \" + offsets_xy[3].to_s; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" XY Diff: \" + offsets_xy[4].to_s + \" \" + offsets_xy[5].to_s; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" Cmd: atasetpmoffsets --absolute #{a.name} #{offsets_xy[2].to_s} #{offsets_xy[3].to_s}\"; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n\n str3 = \" X New: \" + offsets_x[2].to_s + \" \" + offsets_x[3].to_s; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" X Diff: \" + offsets_x[4].to_s + \" \" + offsets_x[5].to_s; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" Cmd: atasetpmoffsets --absolute #{a.name} #{offsets_x[2].to_s} #{offsets_x[3].to_s}\"; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n\n str3 = \" Y New: \" + offsets_y[2].to_s + \" \" + offsets_y[3].to_s; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" Y Diff: \" + offsets_y[4].to_s + \" \" + offsets_y[5].to_s; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n str3 = \" Cmd: atasetpmoffsets --absolute #{a.name} #{offsets_y[2].to_s} #{offsets_y[3].to_s}\"; \n puts str3;\n File.open(\"corr.pnt\", 'a+') {|f| f.write(str3 + \"\\n\") }\n\n end\n end", "def lag_ports(switch)\n out = %x(snmpwalk -v2c -c public #{SWITCH} IF-MIB::ifType)\n lagports = out.split(\"\\n\").select do |line|\n line.match(\"ieee8023adLag\")\n end.map do |line|\n line.match(/[0-9]+/)\n end\nend", "def get_router_ipaddr()\n SNMP::Manager.open(\n :Host => RouterIP,\n :Community => SNMPpw,\n :Timeout => 60,\n :Retries => 5\n ) do |manager|\n # XXX Timeout on the next line (or the one below) will kick us out.\n response = manager.get([\"ip.21.1.7.0.0.0.0\"])\n response.each_varbind do |vb|\n default_route = \"#{vb.value.to_s}\"\n # puts \"ip.21.1.7.#{default_route}\"\n response = manager.get([\"ip.21.1.7.#{default_route}\"])\n response.each_varbind do |vb|\n my_ipaddr = \"#{vb.value.to_s}\"\n # puts my_ipaddr\n return my_ipaddr\n end\n end\n end\nend", "def test_hammer_time(r)\n flag = true\n ntime = $ntime_max - 100000\n pair = $result[r].values[0].pairs[0] # just pick one pair ????\n \n while (ntime > 0 and flag)\n # puts ntime\n hammer_row(r, pair[0], pair[1], ntime)\n ntime -= 100000\n end\nend", "def update_arp_table(network)\n for i in 1..254 do \n `ping -c 1 #{network}.#{i} 2&>1;` \n end\nend", "def latency\n runopts(:latency)\n end", "def inner_loop\n return if @stop\n\n data = @socket.readpartial 4096\n driver.parse data unless data.nil? or data.empty?\n end", "def setup_timers\n EM.run do\n EM.defer do\n update_index=0\n while true\n fetch_varz(update_index)\n update_index=update_index+1\n if update_index > Config.timeout_check\n update_index=0\n end\n sleep 1\n end\n end\n end\n end", "def device_find(login, imei_list)\n input_json = {:login => login, :imei_list => imei_list}\n ime_list_approved = []\n ime_list_notapproved = []\n resp = {}\n begin\n thr2 = Thread.new do\n for t in imei_list\n prof_name1 = mongo_client.get_profile_name_from_imei(t)\n if prof_name1[:code]==200\n begin\n permiss1 = mongo_client.check_login_profile_permiss(login, prof_name1[:body][\"profile\"])\n p \"permiss1\"\n p permiss1\n if permiss1[:code]==200\n ime_list_approved.append(t)\n else\n ime_list_notapproved.append({:imei => t, :error => permiss1})\n end\n rescue\n ime_list_notapproved.append({:imei => t, :error => {:code => 405, :result => \"Unknown error when check_login_profile_permiss imei #{t.to_s}\"}})\n end\n else\n ime_list_notapproved.append({:imei => t, :error => prof_name1})\n end\n end\n begin\n if ime_list_approved != []\n data = mongo_client.get_imei_info_from_db(ime_list_approved)\n\n resp = {:code => 200, :result => \"Request completed successfully\", :data => {:approved_list => data, :unapproved_list => ime_list_notapproved}}\n\n else\n resp = {:code => 404, :result => \"Invalidate data\", :data => {:approved_list => [], :unapproved_list => ime_list_notapproved}}\n end\n rescue\n resp = {:code => 504, :result => \"Unsuccessfully data transfer\"}\n end\n end\n rescue\n resp = {:code => 507, :result => \"Unknown SDK error\"}\n end\n thr2.join\n mongo_client.audit_logger(\"device_find\", remote_ip, input_json, resp, real_ip)\n resp\n end", "def dump\n\t\tprint_status(\"Dumping a bunch of info from the 'mgmt' OID......\")\n\t\tdumpz=[]\n\t\[email protected]('mgmt') { |x| dumpz << x }\n\t\tif dumpz.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\tputs \"[*] \".light_green + \"SNMP MGMT Dump\".light_yellow + \": \".white\n\t\t\tdumpz.each do |entry|\n\t\t\t\tprint_good(\"#{entry}\")\n\t\t\tend\n\t\tend\n\tend", "def poll_cycle\n\n puts \"---------------------\"\n puts \"#{host}\"\n puts \"---------------------\"\n data = twemproxy_data()\n\n summary_ejections = 0\n summary_client_connections = 0\n summary_requests = 0\n summary_server_connections = 0\n summary_server_errors = 0\n summary_in_queue = 0\n summary_out_queue = 0\n summary_servers = 0\n data.keys.find_all{|k| data[k].is_a?(Hash)}.each do |pool|\n summary_client_connections += metric_total(\"client connections/#{pool}\", data[pool]['client_connections'], \"connections\")\n summary_ejections += metric_total(\"server ejections/#{pool}\", data[pool]['server_ejects'], \"ejects\")\n\n data[pool].keys.find_all{|k| data[pool][k].is_a?(Hash)}.each do |server|\n summary_servers += 1\n summary_requests += metric_value(\"server requests/#{pool}/#{server}\", data[pool][server]['requests'], \"requests\")\n summary_server_connections += metric_total(\"server connections/#{pool}/#{server}\", data[pool][server]['server_connections'], \"connections\")\n summary_server_errors += metric_value(\"server errors/#{pool}/#{server}\", data[pool][server]['server_err'], \"errors\")\n summary_in_queue += metric_total(\"in queue/#{pool}/#{server}\", data[pool][server]['in_queue'], \"ops\")\n summary_out_queue += metric_total(\"out queue/#{pool}/#{server}\", data[pool][server]['out_queue'], \"ops\")\n metric_value(\"request bytes/#{pool}/#{server}\", data[pool][server]['request_bytes'], \"bytes\")\n metric_value(\"response bytes/#{pool}/#{server}\", data[pool][server]['response_bytes'], \"bytes\")\n end\n end\n\n metric_total \"total ejections\", summary_ejections, \"ejects\"\n metric_total \"total client connections\", summary_client_connections, \"connections\"\n metric_total \"total server requests\", summary_requests, \"requests\"\n metric_total \"total server connections\", summary_server_connections, \"connections\"\n metric_total \"total server errors\", summary_server_errors, \"errors\"\n metric_total \"total in queue\", summary_in_queue, \"ops\"\n metric_total \"total out queue\", summary_out_queue, \"ops\"\n metric_total \"total servers\", summary_servers, \"servers\"\n metric_total \"percent up\", (((summary_servers - summary_ejections) / summary_servers) * 100.0), \"%\"\n end", "def run\n agent\n EM.add_periodic_timer(1) do\n @@recent_latency = (Time.now.to_f - @last)\n agent.timing 'reactor.latency', @@recent_latency\n @last = Time.now.to_f\n end\n end", "def ping_nodes\n\t\twhile true\n\t\t\tsleep(rand(60))\n\t\t\tn = rand(@neighbour_nodes.count)\n\t\t\tnode = @neighbour_nodes[n]\n\t\t\ts = UDPSocket.new\n\t\t\tbegin\n\t\t\t\tTimeout::timeout(10){ \n\t\t\t\t\tputs \"Pinging #{node}\"\n\t\t\t\t\tsend_message [\"PING\", @info], 0, node.host, node.port\n\t\t\t\t\t@waiting = true\n\t\t\t\t\twhile waiting?\n\t\t\t\t\t\tsleep(0.2)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\trescue Timeout::Error => ex\n\t\t\t\tif waiting?\n\t\t\t\t\tputs \"Conenction to #{node} timed out, sending DROP_NODE to all remaining nodes\"\n\t\t\t\t\t@neighbour_nodes - [node]\n\t\t\t\t\t@neighbour_nodes.each do |n|\n\t\t\t\t\t\tsend_message [\"DROP_NODE\", node], 0, n.host, n.port\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Socket::Error => ex\n\t\t\t\tputs \"Connection to #{node} failed, trying again in 60 seconds\"\n\t\t\trescue => ex\n\t\t\t\tputs ex.message\n\t\t\tend\n\t\tend\n\tend", "def latency_of(dist)\n len=(dist == 0) ? OVERHEAD_INNER : OVERHEAD_OUTER + dist\n if len <= 300 # [cm]\n #Copper cable\n len*4.4E-9 #HP BladeSystem c-Class 40G QSFP+ to QSFP+ Direct Attach Copper Cable\n else\n # Optical cable \n len*5.2E-9 #Speed of light in glass= 190000km/sec\n end\nend", "def modify_SCAN(inst_inf,mode,new_signal_db)\n signal = XMLParse::get_PortList(@root,inst_inf.ModuleName)\n if signal.size == 0 && new_signal_db != nil\n signal = new_signal_db\n end\n signal_db = Hash.new\n signal.each do |key,value|\n if FICE_DB::SCAN_NAME.index(key) != nil\n signal_db[key] = value\n end\n end\n\n # For Multi-Hier\n upper_module,inst_name = resolve_MultiHier(inst_inf)\n \n signal_db.each do |name,value|\n if value.Type == \"input\"\n printf(\"@I:SCAN/TEST: Force change to PullDown at %s.%s\\n\",inst_name,name)\n # Change PULLDOWN\n signal = FICE_DB::SignalInf.new( \n :name => \"1'b0\",\n :type => \"constant\" \n )\n XMLParse::change_Connection(@root,upper_module,inst_name,{\"#{name}\" => [signal]},nil)\n printf(\"Done\\n\") \n elsif value.Type == \"output\"\n # Do nothing( Keep Oringinal Wire )\n=begin\n # Change OPEN\n signal = FICE_DB::SignalInf.new( \n :name => nil,\n :type => \"open\" \n )\n XMLParse::change_Connection(@root,upper_module,inst_name,{\"#{name}\" => [signal]},nil)\n printf(\"Done\\n\") \n=end\n end\n end\n \n\n \n=begin\n # Port Direction Check ( only input/inout is allowd in pulldown )\n if sig.Type == \"input\" || sig.Type == \"inout\"\n con = con_db.PIN_INF[sig.Name][i]\n const = make_ConstantValue(sig,0)\n printf(\"\\tadd Connection(PULLDOWN:%s)\\n\",const)\n signal = FICE_DB::SignalInf.new( \n :name => const, \n :type => \"constant\", \n :msb => sig.MSB, \n :lsb => sig.LSB, \n :portion => sig.BusPortion, \n :word_top => sig.WordTop, \n :word_buttom => sig.WordButtom)\n # connect port to PULLDOWN in instantiation1\n XMLParse::change_Connection(@root,upper_module,inst_name,{\"#{sig.Name}\" => [signal]},con_db)\n @circuit_inf.add_connect(inst_inf.InstName+\".\"+sig.Name,connect_file_type,inst_inf.ModuleName,con,signal)\n printf(\"Done\\n\") \n else\n # Error of port-direction\n printf \"\\n\"\n FMakeMessage.PrintError( :category => \"CONNECT\", :no => 211, :pin_name => sig.Name, :direction => sig.Type, :verilog => inst_inf.ReplaceVerilogFile)\n end\n=end\n end", "def run events\n events.each do |event| \n interprete event\n end\n# return\n puts \"Statistics:\"\n @counts.each do |k,v|\n puts \"#{k.inspect} =>\"\n i = 0\n step = 6\n while i < v.size\n puts \"\\t#{v[i,step]}\"\n i += step\n end\n end\n end", "def onping(&blk); super; end", "def start_threads\n \n # generate computers cache model shortcuts\n Main.active.clusters.each do |computers|\n computers.each { |c| Main.active.computers_cache[c.id]=c }\n end\n\n # load user names from yppassed\n # TODO: move to user model class?\n #IO.popen(\"ypcat passwd\").each { |line|\n # Main.active.user_list.add(line.split(\":\").values_at(0, 4)) \n #}\n\n refresh = Thread.new {\n session[:old_timestamp] = 0\n\n while true\n puts \"refresh start\"\n # update prectab data\n if Prectab.changed?\n Main.active.computers_cache.each_value {|computer| computer.prectab = [nil,nil]; computer.color_changed; computer.user_changed }\n Debug.log.debug \"working prectab\"\n scatter_prectab(Prectab.now,0)\n scatter_prectab(Prectab.soon,1)\n end\n\n # update computers_cache\n comps = Computer.updated_after session[:old_timestamp]\n comps.each do |computer| \n cache_computer = Main.active.computers_cache[computer.id]\n if cache_computer\n cache_computer.User = computer.user \n cache_computer.Color = computer.color\n end\n end\n session[:old_timestamp] = Time.now.strftime(\"%j%H%M%S\")\n\n # update printers\n @printers.each { |p| p.update_job_count; p.update_accepts; p.update_snmp }\n puts \"refresh end\"\n sleep 20\n end \n }\n \n # read data from scanner and dispatch\n require 'socket'\n begin\n socket = TCPSocket.new('localhost', 7887)\n rescue Errno::ECONNREFUSED\n Main.active.status = [\"Scanner\", t('scanner.no_connection'), \"important\",-1]\n else\n scanner = Thread.new {\n Debug.log.debug \"starting scanner thread ...\"\n while true\n scan = socket.recvfrom(25)\n type, Main.active.scan_string = check_scanner_string(scan[0])\n Debug.log.debug \"Scanner says #{scan} #{type}, #{Main.active.scan_string}\"\n \n case type\n when :card\n accounts = User.find_accounts_by_barcode(Main.active.scan_string)\n fill_accounts(accounts)\n when :matrikel\n accounts = Account.find_accounts_by_barcode(Main.active.scan_string)\n fill_accounts(accounts)\n when :key\n pc = Main.active.computers_cache[Main.active.scan_string]\n puts pc\n unless Main.active.account_list.empty?\n table_register(pc)\n else\n case pc.user\n when \"\"\n Main.active.status = [\"#{pc.id}\", \"ist schon frei\", \"key\",0] \n else\n Main.active.status = [\"#{pc.user}\", \"von <b>#{pc.id}</b> abgemeldet\", \"trashcan_full\",1]\n end\n key_clear(pc)\n end\n else\n Debug.log.debug \"#{type}, #{Main.active.scan_string}\"\n end\n \n sleep 1 # wait some time for next scan atempt\n end\n }\n end\n end", "def process_walk\n\t\tprint_status('Enumerating Running Process.....')\n\t\tpsz=[] #process name\n\t\[email protected]('mib-2.25.4.2.1.2') { |x| psz << x.value }\n\t\tif psz.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\tps_present = [['PID', 'Process', 'Path']]\n\t\t\tpidz=[] #PID valud\n\t\t\[email protected]('mib-2.25.4.2.1.1') { |x| pidz << x.value }\n\n\t\t\tpathz=[] #Path of process\n\t\t\[email protected]('mib-2.25.4.2.1.4') do |path|\n\t\t\t\tif path.value.chomp != '' and not path.nil?\n\t\t\t\t\tpathz << path.value\n\t\t\t\telse\n\t\t\t\t\tpathz << \" - \"\n\t\t\t\tend\n\t\t\tend\n\t\t\tcount=0\n\t\t\twhile count.to_i < psz.size\n\t\t\t\tps_present << [[ \"#{pidz[count]}\", \"#{psz[count]}\", \"#{pathz[count]}\" ]]\n\t\t\t\tcount = count.to_i + 1\n\t\t\tend\n\n\t\t\ttable = ps_present.to_table(:first_row_is_head => true)\n\t\t\tputs table.to_s\n\t\tend\n\tend", "def start\n super\n @snmptrap = SNMP::TrapListener.new(:Host => @host, :Port => @port) do |manager|\n manager.on_trap_default do |trap|\n trap_events = Hash.new\n tag = @tag\n timestamp = Engine.now\n raise(\"Unknown Trap Format\", trap) unless trap.kind_of?(SNMP::SNMPv1_Trap) or trap.kind_of?(SNMP::SNMPv2_Trap)\n trap.each_varbind do |vb|\n trap_events[vb.name.to_s] = vb.value.to_s\n end\n trap_events['host'] = trap.source_ip\n if @trap_format == 'tojson'\n require 'json'\n trap_events.to_json\n end\n router.emit(tag, timestamp, trap_events)\n end\n end\n end", "def setup_heartbeat_timer; end", "def update_state\n Thread.new do\n Dictionary.commands.each do |zone, _commands|\n Dictionary.commands[zone].each do |command, info|\n info[:values].each do |value, _|\n next unless value == 'QSTN'\n\n send_recv(Parser.parse(\"#{command}QSTN\"))\n end\n end\n end\n end\n end", "def main\n #server=TCPServer::new('10.0.0.60',port)\n @server=TCPServer::new(@port)\n $logger.debug \"Running on Port #{@port}\"\n begin\n if defined?(Fcntl::FD_CLOEXEC)\n @server.fcntl(Fcntl::FD_CLOEXEC,1)\n end\n @server.listen(5)\n #@[email protected]_nonblock\n rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR\n IO.select([@server])\n retry\n end\n Analyzer.find(:all).each { |analyzer|\n # If on start if analyzer is in downstream mode and ingress then restart the processl\n if (analyzer.cmd_port.nil?) && ((analyzer.status == Analyzer::INGRESS) || (analyzer.status == Analyzer::DOWNSTREAM))\n port=get_port(analyzer.id)\n $logger.error \"We don't have a port number for #{analyzer.id}, assigning it #{port}\"\n analyzer.update_attributes({:cmd_port=>port})\n elsif (!analyzer.cmd_port.nil?) && ((analyzer.status == Analyzer::INGRESS) || (analyzer.status == Analyzer::DOWNSTREAM))\n @ports_analyzer[analyzer.cmd_port - @start_port]=analyzer.id\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n #analyzer.update_attributes({:status=>Analyzer::DISCONNECTED})\n }\n an_count=Analyzer.find(:all).size\n try_count=Array.new(an_count,0)\n while(1)\n Analyzer.find(:all).each { |analyzer|\n if (!analyzer.cmd_port.nil?)\n @ports_analyzer[analyzer.cmd_port - @start_port]=analyzer.id\n try_count[analyzer.id]=0 if try_count[analyzer.id].nil?\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n }\n time=Time.now()\n selected_socket_list=IO.select([@server],nil,nil,5)\n if (selected_socket_list.nil?)\n $logger.debug \"Nothing to send Do a heartbeat\"\n #logger.debugs @ports_analyzer.inspect()\n @ports_analyzer.each_index { |port_index|\n analyzer_id=@ports_analyzer[port_index]\n port=nil\n if !analyzer_id.nil?\n port=get_port(analyzer_id)\n end\n\n unless port.nil?\n try_count[analyzer_id] +=1\n request=Net::HTTP.new('localhost',port)\n $logger.debug \"Do a heartbeat on #{port}\"\n #tries=0\n flag=true\n begin\n #sleep 5\n #tries +=1\n $logger.debug \"TRY # #{try_count[analyzer_id]}\"\n\n response=request.get(\"/\")\n rescue Timeout::Error #Instrument not responding. Lets kill the process.\n flag=false\n anl=Analyzer.find(analyzer_id)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n Process.kill(\"TERM\", anl.pid)\n else\n SystemLog.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\",nil,SystemLog::MESSAGE,analyzer_id)\n anl.update_attribute({:pid=>0})\n end\n rescue\n #sleep 5\n #$logger.debug \"Try again\"\n flag=false\n if (try_count[analyzer_id] > 5)\n try_count[analyzer_id]=0\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n SystemLog.log(\"(Re)Starting the monitor server #{Analyzer.find(analyzer_id).ip}\",nil,SystemLog::MESSAGE,analyzer_id)\n start_monitor(analyzer_id, port)\n end\n end\n if flag==true\n try_count[analyzer_id]=0\n end\n $logger.debug response.inspect()\n end\n diff=Time.now-time\n if diff < 5\n sleep (5-diff)\n end\n }\n else\n selected_socket=selected_socket_list[0].first()\n @sock=selected_socket.accept\n process()\n end\n end\n end", "def separate_online_blocks(timeout = 0.0)\n pre_end = 0.0\n new_ol_ary = Array.new\n new_ol = Online.new(@src_ipaddr)\n @ol.each{|v|\n if new_ol.ol_empty?\n new_ol.make(@src_ipaddr)\n new_ol.add_ol(v)\n else\n if v['volume_begin'] - pre_end < timeout + OL_SEQ_EPS\n new_ol.add_ol(v)\n else\n new_ol_ary << new_ol.dup\n new_ol.clear\n new_ol.add_ol(v)\n end\n end\n pre_end = v['volume_end']\n }\n return new_ol_ary\n end", "def query_interfaces(command,array)\n command.each_line do |line|\n array.push(line).flatten if line =~ /w[1-8]g1/ .. line =~ /TX/\n end\n end", "def summarize_gtp_info(sequence_number, options)\n gtp_data = [\n @gtp_session[sequence_number][:REQUEST][:pkt_time] ? @gtp_session[sequence_number][:REQUEST][:pkt_time].iso8601(6) : nil,\n @gtp_session[sequence_number][:RESPONSE][:pkt_time] ? @gtp_session[sequence_number][:RESPONSE][:pkt_time].iso8601(6) : nil,\n @gtp_session[sequence_number][:REQUEST][:pkt_time] ? @gtp_session[sequence_number][:REQUEST][:pkt_time].to_f.to_s : nil,\n @gtp_session[sequence_number][:RESPONSE][:pkt_time] ? @gtp_session[sequence_number][:RESPONSE][:pkt_time].to_f.to_s : nil,\n @gtp_session[sequence_number][:REQUEST][:message_type], \n @gtp_session[sequence_number][:REQUEST][:teid], @gtp_session[sequence_number][:RESPONSE][:teid], \n @gtp_session[sequence_number][:REQUEST][:paa], @gtp_session[sequence_number][:RESPONSE][:paa], \n @gtp_session[sequence_number][:REQUEST][:imsi_mcc], \n @gtp_session[sequence_number][:REQUEST][:imsi_mnc], \n @gtp_session[sequence_number][:REQUEST][:imsi_msin], \n @gtp_session[sequence_number][:REQUEST][:uli_mcc], \n @gtp_session[sequence_number][:REQUEST][:uli_mnc], \n @gtp_session[sequence_number][:REQUEST][:uli_enb_id], \n @gtp_session[sequence_number][:REQUEST][:uli_cell_id], \n ]\n \n if options[:gtp_all] == true\n gtp_data.concat([\n @gtp_session[sequence_number][:REQUEST][:uli_lac], \n @gtp_session[sequence_number][:REQUEST][:uli_ci], \n @gtp_session[sequence_number][:REQUEST][:uli_sac], \n @gtp_session[sequence_number][:REQUEST][:uli_rac], \n @gtp_session[sequence_number][:REQUEST][:uli_tac], \n @gtp_session[sequence_number][:REQUEST][:uli_eci], \n @gtp_session[sequence_number][:RESPONSE][:cause_val], \n @gtp_session[sequence_number][:RESPONSE][:cause_pce], \n @gtp_session[sequence_number][:RESPONSE][:cause_bce], \n @gtp_session[sequence_number][:RESPONSE][:cause_cs], \n @gtp_session[sequence_number][:REQUEST][:apn], \n @gtp_session[sequence_number][:REQUEST][:recovery], @gtp_session[sequence_number][:RESPONSE][:recovery], \n @gtp_session[sequence_number][:REQUEST][:ambr_up_link], @gtp_session[sequence_number][:RESPONSE][:ambr_up_link], \n @gtp_session[sequence_number][:REQUEST][:ambr_down_link], @gtp_session[sequence_number][:RESPONSE][:ambr_down_link], \n @gtp_session[sequence_number][:REQUEST][:ebi], @gtp_session[sequence_number][:RESPONSE][:ebi], \n @gtp_session[sequence_number][:REQUEST][:mei], \n @gtp_session[sequence_number][:REQUEST][:msisdn_country_code], \n @gtp_session[sequence_number][:REQUEST][:msisdn_address_digits], \n @gtp_session[sequence_number][:REQUEST][:indication_daf], \n @gtp_session[sequence_number][:REQUEST][:indication_dtf], \n @gtp_session[sequence_number][:REQUEST][:indication_hi], \n @gtp_session[sequence_number][:REQUEST][:indication_dfi], \n @gtp_session[sequence_number][:REQUEST][:indication_oi], \n @gtp_session[sequence_number][:REQUEST][:indication_isrsi], \n @gtp_session[sequence_number][:REQUEST][:indication_israi], \n @gtp_session[sequence_number][:REQUEST][:indication_sgwci], \n @gtp_session[sequence_number][:REQUEST][:indication_sqci], \n @gtp_session[sequence_number][:REQUEST][:indication_uimsi], \n @gtp_session[sequence_number][:REQUEST][:indication_cfsi], \n @gtp_session[sequence_number][:REQUEST][:indication_crsi], \n @gtp_session[sequence_number][:REQUEST][:indication_ps], \n @gtp_session[sequence_number][:REQUEST][:indication_pt], \n @gtp_session[sequence_number][:REQUEST][:indication_si], \n @gtp_session[sequence_number][:REQUEST][:indication_msv], \n @gtp_session[sequence_number][:REQUEST][:indication_retloc], \n @gtp_session[sequence_number][:REQUEST][:indication_pbic], \n @gtp_session[sequence_number][:REQUEST][:indication_srni], \n @gtp_session[sequence_number][:REQUEST][:indication_s6af], \n @gtp_session[sequence_number][:REQUEST][:indication_s4af], \n @gtp_session[sequence_number][:REQUEST][:indication_mbmdt], \n @gtp_session[sequence_number][:REQUEST][:indication_israu], \n @gtp_session[sequence_number][:REQUEST][:indication_ccrsi], \n @gtp_session[sequence_number][:REQUEST][:pco], @gtp_session[sequence_number][:RESPONSE][:pco], \n @gtp_session[sequence_number][:REQUEST][:rat_type], \n @gtp_session[sequence_number][:REQUEST][:serving_network_mcc], \n @gtp_session[sequence_number][:REQUEST][:serving_network_mnc], \n @gtp_session[sequence_number][:REQUEST][:charging_characteristics], \n @gtp_session[sequence_number][:REQUEST][:sender_f_teid_v4v6], @gtp_session[sequence_number][:REQUEST][:pgw_f_teid_v4v6],\n @gtp_session[sequence_number][:RESPONSE][:sender_f_teid_v4v6], @gtp_session[sequence_number][:RESPONSE][:pgw_f_teid_v4v6], \n @gtp_session[sequence_number][:REQUEST][:sender_f_teid_interface], @gtp_session[sequence_number][:REQUEST][:pgw_f_teid_interface],\n @gtp_session[sequence_number][:RESPONSE][:sender_f_teid_interface], @gtp_session[sequence_number][:RESPONSE][:pgw_f_teid_interface], \n @gtp_session[sequence_number][:REQUEST][:sender_f_teid_grekey], @gtp_session[sequence_number][:REQUEST][:pgw_f_teid_grekey],\n @gtp_session[sequence_number][:RESPONSE][:sender_f_teid_grekey], @gtp_session[sequence_number][:RESPONSE][:pgw_f_teid_grekey], \n @gtp_session[sequence_number][:REQUEST][:sender_f_teid_addr], @gtp_session[sequence_number][:REQUEST][:pgw_f_teid_addr], \n @gtp_session[sequence_number][:RESPONSE][:sender_f_teid_addr], @gtp_session[sequence_number][:RESPONSE][:pgw_f_teid_addr], \n @gtp_session[sequence_number][:REQUEST][:bearer_ebi], @gtp_session[sequence_number][:RESPONSE][:bearer_ebi], \n @gtp_session[sequence_number][:RESPONSE][:bearer_cause_val], \n @gtp_session[sequence_number][:RESPONSE][:bearer_cause_pce], \n @gtp_session[sequence_number][:RESPONSE][:bearer_cause_bce], \n @gtp_session[sequence_number][:RESPONSE][:bearer_cause_cs], \n @gtp_session[sequence_number][:REQUEST][:bearer_tft], @gtp_session[sequence_number][:RESPONSE][:bearer_tft], \n @gtp_session[sequence_number][:RESPONSE][:bearer_charging_id], \n @gtp_session[sequence_number][:REQUEST][:bearer_qos_pvi], @gtp_session[sequence_number][:RESPONSE][:bearer_qos_pvi], \n @gtp_session[sequence_number][:REQUEST][:bearer_qos_pl], @gtp_session[sequence_number][:RESPONSE][:bearer_qos_pl], \n @gtp_session[sequence_number][:REQUEST][:bearer_qos_pci], @gtp_session[sequence_number][:RESPONSE][:bearer_qos_pci], \n @gtp_session[sequence_number][:REQUEST][:bearer_qos_label_qci], @gtp_session[sequence_number][:RESPONSE][:bearer_qos_label_qci], \n @gtp_session[sequence_number][:REQUEST][:bearer_qos_max_uplink], @gtp_session[sequence_number][:RESPONSE][:bearer_qos_max_uplink], \n @gtp_session[sequence_number][:REQUEST][:bearer_qos_max_downlink], @gtp_session[sequence_number][:RESPONSE][:bearer_qos_max_downlink], \n @gtp_session[sequence_number][:REQUEST][:bearer_qos_guaranteed_uplink], @gtp_session[sequence_number][:RESPONSE][:bearer_qos_guaranteed_uplink], \n @gtp_session[sequence_number][:REQUEST][:bearer_qos_guaranteed_downlink], @gtp_session[sequence_number][:RESPONSE][:bearer_qos_guaranteed_downlink], \n @gtp_session[sequence_number][:RESPONSE][:bearer_flags_ppc], \n @gtp_session[sequence_number][:RESPONSE][:bearer_flags_vb], \n @gtp_session[sequence_number][:RESPONSE][:bearer_flags_vind], \n @gtp_session[sequence_number][:RESPONSE][:bearer_flags_asi], \n @gtp_session[sequence_number][:REQUEST][:bearer_f_teid_v4v6], @gtp_session[sequence_number][:RESPONSE][:bearer_f_teid_v4v6], \n @gtp_session[sequence_number][:REQUEST][:bearer_f_teid_interface], @gtp_session[sequence_number][:RESPONSE][:bearer_f_teid_interface], \n @gtp_session[sequence_number][:REQUEST][:bearer_f_teid_gre_key], @gtp_session[sequence_number][:RESPONSE][:bearer_f_teid_gre_key], \n @gtp_session[sequence_number][:REQUEST][:bearer_f_teid_addr], @gtp_session[sequence_number][:RESPONSE][:bearer_f_teid_addr], \n @gtp_session[sequence_number][:REQUEST][:trace_info_mcc], \n @gtp_session[sequence_number][:REQUEST][:trace_info_mnc], \n @gtp_session[sequence_number][:REQUEST][:trace_info_id], \n @gtp_session[sequence_number][:REQUEST][:trace_info_triggering_events], \n @gtp_session[sequence_number][:REQUEST][:trace_info_list_of_ne_types], \n @gtp_session[sequence_number][:REQUEST][:trace_info_session_trace_depth], \n @gtp_session[sequence_number][:REQUEST][:trace_info_list_of_interfaces], \n @gtp_session[sequence_number][:REQUEST][:trace_info_ip_addr_of_trace_collection_entity], \n @gtp_session[sequence_number][:REQUEST][:pdn_type], \n @gtp_session[sequence_number][:REQUEST][:ue_time_zone], \n @gtp_session[sequence_number][:REQUEST][:ue_time_zone_daylight_saving_time], \n @gtp_session[sequence_number][:REQUEST][:apn_restriction], @gtp_session[sequence_number][:RESPONSE][:apn_restriction], \n @gtp_session[sequence_number][:REQUEST][:selection_mode], \n @gtp_session[sequence_number][:RESPONSE][:change_reporting_action], \n @gtp_session[sequence_number][:RESPONSE][:fqdn], \n @gtp_session[sequence_number][:REQUEST][:fq_csid_num_of_csids], @gtp_session[sequence_number][:RESPONSE][:fq_csid_num_of_csids], \n @gtp_session[sequence_number][:REQUEST][:fq_csid_node_id_type], @gtp_session[sequence_number][:RESPONSE][:fq_csid_node_id_type], \n @gtp_session[sequence_number][:REQUEST][:fq_csid_node_id], @gtp_session[sequence_number][:RESPONSE][:fq_csid_node_id], \n @gtp_session[sequence_number][:REQUEST][:fq_csid_pdn_csid], @gtp_session[sequence_number][:RESPONSE][:fq_csid_pdn_csid], \n @gtp_session[sequence_number][:REQUEST][:uci_mcc], \n @gtp_session[sequence_number][:REQUEST][:uci_mnc], \n @gtp_session[sequence_number][:REQUEST][:uci_csg_id], \n @gtp_session[sequence_number][:REQUEST][:uci_cmi], \n @gtp_session[sequence_number][:REQUEST][:uci_lcsg], \n @gtp_session[sequence_number][:REQUEST][:uci_access_mode], \n @gtp_session[sequence_number][:RESPONSE][:csg_information_reporting_action_ucicsg], \n @gtp_session[sequence_number][:RESPONSE][:csg_information_reporting_action_ucishc], \n @gtp_session[sequence_number][:RESPONSE][:csg_information_reporting_action_uciuhc], \n @gtp_session[sequence_number][:RESPONSE][:ldn], \n @gtp_session[sequence_number][:RESPONSE][:epc_timer_val], \n @gtp_session[sequence_number][:RESPONSE][:epc_timer_unit], \n @gtp_session[sequence_number][:REQUEST][:signalling_priority_indication], \n @gtp_session[sequence_number][:REQUEST][:apco], @gtp_session[sequence_number][:RESPONSE][:apco], \n @gtp_session[sequence_number][:RESPONSE][:hnb_information_reporting], \n @gtp_session[sequence_number][:RESPONSE][:ip4cp_subnet_prefix_length], \n @gtp_session[sequence_number][:RESPONSE][:ip4cp_ipv4_default_router_addr], \n @gtp_session[sequence_number][:REQUEST][:twan_identifier_bssidi], \n @gtp_session[sequence_number][:REQUEST][:twan_identifier_ssid], \n @gtp_session[sequence_number][:REQUEST][:twan_identifier_bssid], \n @gtp_session[sequence_number][:REQUEST][:private_extension_enterprise_id], @gtp_session[sequence_number][:RESPONSE][:private_extension_enterprise_id], \n @gtp_session[sequence_number][:REQUEST][:private_extension_proprietary_val], @gtp_session[sequence_number][:RESPONSE][:private_extension_proprietary_val], \n ])\n end\n\n return gtp_data\n end", "def answer_pings\n\t\t@ping_thread = Thread.new do \n\t\t\tbegin\n\t\t\t\tloop do \n\t\t\t\t\tpkt = @tap.recv\n\t\t\t\t\tp pkt\n=begin\t\t\t\t\t\n\t\t\t\t\ticmp = icmp_offset(pkt)\n\t\t\t\t\tif icmp and pkt[icmp] == \"\\x08\" #type == Echo Request\n\t\t\t\t\t\tpkt[icmp, 1] = \"\\x00\"\n\t\t\t\t\t\tpkt[26, 4], pkt[30, 4] = pkt[30, 4], pkt[26, 4]\n\t\t\t\t\t\[email protected](pkt)\n\t\t\t\t\tend\n=end\t\t\t\n\t\t\t\tend\n\t\t\trescue Object\n\t\t\t\t$stderr.puts $!\n\t\t\t\t$stderr.puts $@\n\t\t\t\tKernel.exit(1)\n\t\t\tend\n\t\tend\n\tend", "def answer_pings\n\t\t@ping_thread = Thread.new do \n\t\t\tbegin\n\t\t\t\tloop do \n\t\t\t\t\tpkt = @tap.recv\n\t\t\t\t\ticmp = icmp_offset(pkt)\n\t\t\t\t\tif icmp and pkt[icmp] == \"\\x08\" #type == Echo Request\n\t\t\t\t\t\tpkt[icmp, 1] = \"\\x00\"\n\t\t\t\t\t\tpkt[26, 4], pkt[30, 4] = pkt[30, 4], pkt[26, 4]\n\t\t\t\t\t\[email protected](pkt)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Object\n\t\t\t\t$stderr.puts $!\n\t\t\t\t$stderr.puts $@\n\t\t\t\tKernel.exit(1)\n\t\t\tend\n\t\tend\n\tend", "def monitor(stats)\n reset_monitor\n\n refresh_rate = 20 # 20 seconds between samples (realtime)\n\n @state = state_to_c(@vm.vm_info['summary.runtime.powerState'])\n\n return if @state != VM_STATE[:active]\n\n cpu_mhz = @vm.vm_info[:esx_host_cpu]\n\n # rubocop:disable Layout/LineLength\n @monitor[:used_memory] = @vm.vm_info['summary.quickStats.hostMemoryUsage'].to_i * 1024\n # rubocop:enable Layout/LineLength\n used_cpu = @vm.vm_info['summary.quickStats.overallCpuUsage'].to_f \\\n / cpu_mhz\n used_cpu = (used_cpu * 100).to_s\n # rubocop:disable Style/FormatStringToken\n @monitor[:used_cpu] = format('%.2f', used_cpu).to_s\n # rubocop:enable Style/FormatStringToken\n\n # Check for negative values\n @monitor[:used_memory] = 0 if @monitor[:used_memory].to_i < 0\n @monitor[:used_cpu] = 0 if @monitor[:used_cpu].to_i < 0\n\n guest_ip_addresses = []\n unless @vm['guest.net'].empty?\n @vm.vm_info['guest.net'].each do |net|\n next unless net.ipConfig\n next if net.ipConfig.ipAddress.empty?\n\n net.ipConfig.ipAddress.each do |ip|\n guest_ip_addresses << ip.ipAddress\n end\n end\n end\n\n @guest_ip_addresses = guest_ip_addresses.join(',')\n\n if stats.key?(@item)\n metrics = stats[@item][:metrics]\n\n nettx_kbpersec = 0\n if metrics['net.transmitted']\n metrics['net.transmitted'].each do |sample|\n nettx_kbpersec += sample if sample > 0\n end\n end\n\n netrx_kbpersec = 0\n if metrics['net.bytesRx']\n metrics['net.bytesRx'].each do |sample|\n netrx_kbpersec += sample if sample > 0\n end\n end\n\n read_kbpersec = 0\n if metrics['virtualDisk.read']\n metrics['virtualDisk.read'].each do |sample|\n read_kbpersec += sample if sample > 0\n end\n end\n\n read_iops = 0\n if metrics['virtualDisk.numberReadAveraged']\n metrics['virtualDisk.numberReadAveraged'].each do |sample|\n read_iops += sample if sample > 0\n end\n end\n\n write_kbpersec = 0\n if metrics['virtualDisk.write']\n metrics['virtualDisk.write'].each do |sample|\n write_kbpersec += sample if sample > 0\n end\n end\n\n write_iops = 0\n if metrics['virtualDisk.numberWriteAveraged']\n metrics['virtualDisk.numberWriteAveraged'].each do |sample|\n write_iops += sample if sample > 0\n end\n end\n else\n nettx_kbpersec = 0\n netrx_kbpersec = 0\n read_kbpersec = 0\n read_iops = 0\n write_kbpersec = 0\n write_iops = 0\n end\n\n # Accumulate values if present\n if @one_item && @one_item['MONITORING/NETTX']\n previous_nettx = @one_item['MONITORING/NETTX'].to_i\n else\n previous_nettx = 0\n end\n\n if @one_item && @one_item['MONITORING/NETRX']\n previous_netrx = @one_item['MONITORING/NETRX'].to_i\n else\n previous_netrx = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDIOPS']\n previous_diskrdiops = @one_item['MONITORING/DISKRDIOPS'].to_i\n else\n previous_diskrdiops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRIOPS']\n previous_diskwriops = @one_item['MONITORING/DISKWRIOPS'].to_i\n else\n previous_diskwriops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDBYTES']\n previous_diskrdbytes = @one_item['MONITORING/DISKRDBYTES'].to_i\n else\n previous_diskrdbytes = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRBYTES']\n previous_diskwrbytes = @one_item['MONITORING/DISKWRBYTES'].to_i\n else\n previous_diskwrbytes = 0\n end\n\n @monitor[:nettx] = previous_nettx +\n (nettx_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:netrx] = previous_netrx +\n (netrx_kbpersec * 1024 * refresh_rate).to_i\n\n @monitor[:diskrdiops] = previous_diskrdiops + read_iops\n @monitor[:diskwriops] = previous_diskwriops + write_iops\n @monitor[:diskrdbytes] = previous_diskrdbytes +\n (read_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:diskwrbytes] = previous_diskwrbytes +\n (write_kbpersec * 1024 * refresh_rate).to_i\n end", "def go_faster\n ping_check \"go_faster\"\n end", "def bulk(host, community, oids)\n non_repeaters = oids.pop\n max_repetitions = oids.pop\n SNMP::Manager.open(:Host => host, :Version => :SNMPv2c,\n :Community => community) do |manager|\n response = manager.get_bulk(non_repeaters, max_repetitions, oids)\n response.each_varbind do |varbind|\n yield varbind\n end\n end\nend", "def igmp_prototype(rule_name, info)\n\n # get to the advanced page\n self.goto_advanced(rule_name, info)\n \n # and the igmp proxy page\n @ff.link(:text, 'IGMP Proxy').click\n \n case info['action']\n when 'set'\n \n # Enabled/Disabled\n if info.has_key?('proxy')\n case info['proxy'].downcase\n when 'enabled'\n @ff.select_list(:id, 'sym_igmp_proxy_config').select_value('1')\n self.msg(rule_name, :info, 'igmp_proxy', 'Enabled')\n when 'disabled'\n @ff.select_list(:id, 'sym_igmp_proxy_config').select_value('0')\n self.msg(rule_name, :info, 'igmp_proxy', 'Disabled')\n else\n self.msg(rule_name, :error, 'igmp proxy', 'unknown option')\n return\n end\n end\n\n # IGMPv1, IGMPv2 or IGMPv3\n if info.has_key?('version')\n case info['version']\n when 'IGMPv1'\n @ff.select_list(:id, 'sym_igmp_proxy_qcm').select_value(\"1\")\n self.msg(rule_name, :info, 'igmp_version', 'IGMPv1')\n when 'IGMPv2'\n @ff.select_list(:id, 'sym_igmp_proxy_qcm').select_value(\"2\")\n self.msg(rule_name, :info, 'igmp_version', 'IGMPv2')\n when 'IGMPv3'\n @f.select_list(:id, 'sym_igmp_proxy_qcm').select_value(\"3\")\n self.msg(rule_name, :info, 'igmp_version', 'IGMPv3')\n else\n self.msg(rule_name, :error, 'igmp_version', 'unknown version')\n end\n end\n \n # upstream and downstream routes have somewhat different info\n # no easy way to combine code\n if info.has_key?('upstream')\n u = info['upstream']\n if u.has_key?('add')\n u['add'].each do |route|\n\n @re_int_route =~ route.to_s\n match = Regexp.last_match\n \n # we've got multiple links with 'New Multicast Address'\n # on this page - fine the innermost upstream table\n found = false\n @ff.tables.each do |t|\n if t.text.include? 'Upstream Multicast Filtering'\n found = t\n end\n end\n found.link(:text, 'New Multicast Address').click\n\n # add the route\n begin\n @ff.select_list(:id, 'sym_upstream_mcf_intf').select_value(match[1])\n rescue\n self.msg(rule_name, :error, 'igmp-upstream', 'could not set interface name')\n return\n end\n \n # address\n @ff.text_field(:name, 'sym_upstream_mcf_addr0').set(match[2])\n @ff.text_field(:name, 'sym_upstream_mcf_addr1').set(match[3])\n @ff.text_field(:name, 'sym_upstream_mcf_addr2').set(match[4])\n @ff.text_field(:name, 'sym_upstream_mcf_addr3').set(match[5])\n\n # mask\n @ff.text_field(:name, 'sym_upstream_mcf_mask0').set(match[6])\n @ff.text_field(:name, 'sym_upstream_mcf_mask1').set(match[7])\n @ff.text_field(:name, 'sym_upstream_mcf_mask2').set(match[8])\n @ff.text_field(:name, 'sym_upstream_mcf_mask3').set(match[9])\n \n @ff.link(:text, 'Apply').click\n\n # look for the error page. if found, log it and back out\n if @ff.text.include? 'Input Errors'\n self.msg(rule_name, :error, 'igmp-route '+route.to_s, 'did not add route')\n @ff.link(:text, 'Cancel').click\n @ff.link(:text, 'Cancel').click\n end\n end\n end\n \n if u.has_key?('remove')\n u['remove'].each do |route|\n\n @re_int_route =~ route.to_s\n match = Regexp.last_match\n \n # we've got multiple links with 'New Multicast Address'\n # on this page - fine the innermost upstream table\n found = false\n @ff.tables.each do |t|\n if t.text.include? 'Upstream Multicast Filtering'\n found = t\n end\n end\n \n # on the correct table, find the right row\n int_info = route[0].split(':')\n route_info = int_info[1].split('/')\n found.each do |row|\n \n # this needs to be expanded as new interfaces are discovered\n case int_info[0]\n when 'eth1'\n long_int = 'Broadband Ethernet'\n when 'clink1'\n long_int = 'Broadband Coax'\n when 'ppp1'\n long_int = 'WAN PPPoE (over Coax)'\n else\n self.msg(rule_name, :error, 'upstream-remove', 'unknown interface: '+ data['interface'].to_s)\n return\n end\n \n # make sure the route info matches and then remove it\n if row[1].to_s == long_int and row[2].to_s == route_info[0] and row[3].to_s == route_info[1]\n row.link(:title, 'Remove').click\n end\n end\n end\n end\n end\n \n if info.has_key?('downstream')\n d = info['downstream']\n if d.has_key?('add')\n d['add'].each do |route, data|\n if not data.has_key?('host')\n self.msg(rule_name, :error, 'igmp-downstream', 'No valid host/mask found')\n return\n end\n @re_int_route =~ route.to_s\n match = Regexp.last_match\n \n @re_route =~ data['host']\n hmatch = Regexp.last_match\n \n # we've got multiple links with 'New Multicast Address'\n # on this page - fine the innermost downstream table\n found = false\n @ff.tables.each do |t|\n if t.text.include? 'Downstream Multicast Filtering'\n found = t\n end\n end\n found.link(:text, 'New Multicast Address').click\n\n # add the route\n begin\n @ff.select_list(:id, 'sym_downstream_mcf_intf').select_value(match[1])\n rescue\n self.msg(rule_name, :error, 'igmp-downstream', 'could not set interface name')\n return\n end\n \n # address\n @ff.text_field(:name, 'sym_downstream_mcf_mcaddr0').set(match[2])\n @ff.text_field(:name, 'sym_downstream_mcf_mcaddr1').set(match[3])\n @ff.text_field(:name, 'sym_downstream_mcf_mcaddr2').set(match[4])\n @ff.text_field(:name, 'sym_downstream_mcf_mcaddr3').set(match[5])\n\n # mask\n @ff.text_field(:name, 'sym_downstream_mcf_mcmask0').set(match[6])\n @ff.text_field(:name, 'sym_downstream_mcf_mcmask1').set(match[7])\n @ff.text_field(:name, 'sym_downstream_mcf_mcmask2').set(match[8])\n @ff.text_field(:name, 'sym_downstream_mcf_mcmask3').set(match[9])\n \n # host\n @ff.text_field(:name, 'sym_downstream_mcf_hostaddr0').set(hmatch[1])\n @ff.text_field(:name, 'sym_downstream_mcf_hostaddr1').set(hmatch[2])\n @ff.text_field(:name, 'sym_downstream_mcf_hostaddr2').set(hmatch[3])\n @ff.text_field(:name, 'sym_downstream_mcf_hostaddr3').set(hmatch[4])\n\n # host mask\n @ff.text_field(:name, 'sym_downstream_mcf_hostmask0').set(hmatch[5])\n @ff.text_field(:name, 'sym_downstream_mcf_hostmask1').set(hmatch[6])\n @ff.text_field(:name, 'sym_downstream_mcf_hostmask2').set(hmatch[7])\n @ff.text_field(:name, 'sym_downstream_mcf_hostmask3').set(hmatch[8])\n \n @ff.link(:text, 'Apply').click\n\n # look for the error page. if found, log it and back out\n if @ff.text.include? 'Input Errors'\n self.msg(rule_name, :error, 'igmp-route '+route.to_s, 'did not add route')\n @ff.link(:text, 'Cancel').click\n @ff.link(:text, 'Cancel').click\n end\n end\n end\n \n if d.has_key?('remove')\n d['remove'].each do |route, data|\n\n @re_int_route =~ route.to_s\n match = Regexp.last_match\n\n if not data.has_key?('host')\n self.msg(rule_name, :error, 'igmp-downstream', 'No valid host/mask found')\n return\n end\n @re_route =~ data['host']\n hmatch = Regexp.last_match\n \n # we've got multiple links with 'New Multicast Address'\n # on this page - fine the innermost downstream table\n found = false\n @ff.tables.each do |t|\n if t.text.include? 'Downstream Multicast Filtering'\n found = t\n end\n end\n\n # on the correct table, find the right row\n int_info = route.split(':')\n route_info = int_info[1].split('/')\n host_info = data['host'].split('/')\n\n found.each do |row|\n\n # this needs to be expanded as new interfaces are discovered\n case int_info[0]\n when 'eth0-1'\n long_int = 'LAN Ethernet 1'\n when 'eth0-2'\n long_int = 'LAN Ethernet 2'\n when 'eth0-3'\n long_int = 'LAN Ethernet 3'\n when 'eth0-4'\n long_int = 'LAN Ethernet 4'\n when 'clink0'\n long_int = 'LAN Coax'\n else\n self.msg(rule_name, :error, 'downstream-remove', 'unknown interface: '+ data['interface'].to_s)\n return\n end\n\n # make sure the route info matches and then remove it\n if row[1].to_s == long_int and \\\n row[2].to_s == route_info[0] and row[3].to_s == route_info[1] and \\\n row[4].to_s = host_info[0] and row[5].to_s == host_info[1]\n row.link(:title, 'Remove').click\n end\n end\n end\n end\n end\n \n # save things\n @ff.link(:text, 'Apply').click\n \n when 'get'\n \n out = {'action' => 'get', 'section' => 'igmp'}\n\n # turned on and version info?\n out['proxy'] = @ff.select_list(:id, 'sym_igmp_proxy_config').getSelectedItems[0]\n out['version'] = @ff.select_list(:id, 'sym_igmp_proxy_qcm').getSelectedItems[0]\n\n upstream = false\n downstream = false\n @ff.tables.each do |t|\n if t.text.include? 'Upstream Multicast Filtering'\n upstream = t\n end\n if t.text.include? 'Downstream Multicast Filtering'\n downstream = t\n end\n end\n\n # grab the upstream routes\n out['upstream'] = { 'add' => {} }\n upstream.each do |row|\n if row.link(:title, 'Edit').exists?\n case row[1].text\n when 'Broadband Ethernet'\n int_name = 'eth1'\n when 'Broadband Coax'\n int_name = 'clink1'\n when 'WAN PPPoE (over Coax)'\n int_name = 'ppp1'\n else\n self.msg(rule_name, :error, 'igmp-get', 'bad upstream interface found - ' + row[1].text)\n return\n end\n route_name = int_name + ':' + row[2].text + '/' + row[3].text\n out['upstream']['add'][route_name] = 'unused value'\n end\n end\n\n # grab the downstream routes\n out['downstream'] = { 'add' => {} }\n downstream.each do |row|\n if row.link(:title, 'Edit').exists?\n case row[1].text\n when 'LAN Coax'\n int_name = 'clink0'\n when 'LAN Ethernet 1'\n int_name = 'eth0-1'\n when 'LAN Ethernet 2'\n int_name = 'eth0-2'\n when 'LAN Ethernet 3'\n int_name = 'eth0-3'\n when 'LAN Ethernet 4'\n int_name = 'eth0-4'\n else\n self.msg(rule_name, :error, 'igmp-get', 'bad downstream interface found - ' + row[1].text)\n return\n end\n route_name = int_name + ':' + row[2].text + '/' + row[3].text\n host_name = row[4].text + '/' + row[5].text\n out['downstream']['add'][route_name] = { 'host', host_name}\n end\n end\n \n @out[rule_name] = out\n else\n self.msg(rule_name, :error, 'igmp-action', 'unknown/missing action')\n return\n end \n end", "def ping_stats(url, time)\n\n logger.info \"ping_stats:start: url = #{url}, time = #{time.to_i}\"\n\n jsonResponse = rest_call(url)\n response_hash = JSON.parse(jsonResponse)\n nodes = response_hash['nodes']\n\n this_node = nodes.select { |node| node.has_key?('thisNode') && node['thisNode'] == true }.first\n\n if this_node != nil\n nodes.each do |node|\n if node['otpNode'] != this_node['otpNode']\n hostname = URI.parse(\"http://#{node['hostname']}\").host.downcase\n ping_time = time_socket_open_close(hostname, '22')\n write_to_graphite( construct_metric_name(\"#{this_node['otpNode'].gsub('.','-')}.ping.#{hostname.gsub('.','-')}\", CONST_NODE_LEVEL), ping_time, time)\n end\n end\n else\n logger.info 'No nodes found with thisNode == true'\n end\n\n logger.info 'ping_stats:end: Completed'\n end", "def get_onevms(ping = false)\n\n vms = []\n\n begin\n #xml_parser = XML::Parser.string( %x[ cat /tmp/onevm-list.xml ] )\n xml_parser = XML::Parser.string( %x[ onevm list -x ] )\n xml_doc = xml_parser.parse\n rescue\n #return nil\n return []\n end\n\n while xml_doc.next?\n puts xml_doc.next.class\n end\n\n xml_doc.find('//VM_POOL/VM').each do |xml_vm|\n\n # These must exist\n xml_id = xml_vm.find_first('ID') or next\n xml_name = xml_vm.find_first('NAME') or next\n xml_stat = xml_vm.find_first('STATE') or next\n xml_lcm_stat = xml_vm.find_first('LCM_STATE') or next\n\n xml_hyperv = xml_vm.find_first('HISTORY_RECORDS/HISTORY/HOSTNAME')\n\n addr = []\n xml_vm.find('TEMPLATE/NIC').each do |xml_nic|\n xml_ip = xml_nic.find_first('IP') or next\n ip = xml_ip.content\n addr << {\n :ip => ip,\n :host => get_fqdn(ip),\n :ping => ping ? ping?(ip) : nil,\n }\n end\n\n vm = {\n :id => xml_id.content.to_i,\n :name => xml_name.content,\n :hyperv => xml_hyperv ? xml_hyperv.content : '',\n :stat => xml_stat.content.to_i,\n :lcmstat => xml_lcm_stat.content.to_i,\n :addr => addr\n }\n\n vms << vm\n\n end\n\n return vms\n\nend", "def process_results(agent)\n links = ScraperWiki.select(\"link FROM links\")\n links.collect{ |x| x['link'] }.each do | link |\n load_details(agent, link)\n delete_link(link)\n sleep 10\n end\n ScraperWiki.save_var(INDEX, 0)\nend", "def process_results(agent)\n links = ScraperWiki.select(\"link FROM links\")\n links.collect{ |x| x['link'] }.each do | link |\n load_details(agent, link)\n delete_link(link)\n sleep 10\n end\n ScraperWiki.save_var(INDEX, 0)\nend", "def packets; end", "def routeChecker( target_id )\n Thread.new{\n pingMesg = { :type => \"PING\", :target_id => target_id, :sender_id => @guid, :ip_address => @localInetAddr.ip, \\\n :port => @localInetAddr.port }.to_json\n nh, m, n = nextCheckHop( target_id )\n if nh.ip != nil\n @s.send pingMesg, 0, nh.ip, nh.port\n t = Time.now.sec\n t2 = t + 10\n @checkAckWait[ nh.guid ] = 0\n while t < t2\n if @checkAckWait[ nh.guid ] == 2\n break\n end\n k = Time.now.sec\n if k != t\n t += 1\n end\n end\n end\n removeAddr( nh.guid )\n }\n end", "def\trouter_init wash_list = Array.new, ap_probes = Array.new\n\t\n\tnil_wash = false\n\tnil_probes = false\n\t\n\tif wash_list.nil?\n\t\tnil_wash = true\n\t\twash_list = Array.new\n\tend\n\t\n\tif ap_probes.nil?\n\t\tnil_probes = true\n\t\tap_probes = Array.new \n\tend\n\t\n\trouters = Array.new\n\tCSV.foreach(\"scan_out.csv\") do |row|\n\t\t\n\t\tif row[13] != nil && row[13] =~ /\\S/ && row[13].length > 0\n\t\t\tr = Router.new\n\t\t\tr.bssid = row[0]\n\t\t\tr.beacons = row[9].to_i\n\t\t\tr.data = row[10].to_i\n\t\t\tr.channel = row[3].to_i\n\t\t\tr.power = row[8].to_i\n\t\t\tr.privacy = row[5]\n\t\t\tessid = String.new\n\t\t\tfor i in 0..row[13].length - 1\n\t\t\t\tessid << row[13][i] if i > 0\n\t\t\tend\n\t\t\tr.essid = essid\n\t\t\t\n\t\t\tif !nil_probes\n\t\t\t\tap_probes.each do |ap|\n\t\t\t\t\tr.probes = ap[\"probes\"] if r.essid == ap[\"essid\"]\n\t\t\t\tend\t\t\n\t\t\tend\n\t\t\t\n\t\t\tif !nil_wash\n\t\t\t\twash_list.each do |ap|\n\t\t\t\t\tif ap.wps == \"No\"\n\t\t\t\t\t\tap.wps = \"Yes\"\n\t\t\t\t\telsif ap.wps == \"Yes\"\n\t\t\t\t\t\tap.wps = \"No\"\n\t\t\t\t\tend\n\t\t\t\t\tr.wps = ap.wps\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\trouters << r\n\t\tend\n\t\t\t\t\n\tend\n\t\n\tsystem(\"clear\")\n\t\n\treturn routers\nend", "def post_init\n @m_search_count.times do\n if send_datagram(@search, MULTICAST_IP, MULTICAST_PORT) > 0\n log \"Sent datagram search:\\n#{@search}\"\n end\n end\n end", "def run\n super\n\n # Allow the user to set the port ranges\n #ports = _get_option \"ports\"\n\n # Get range, or host\n to_scan = _get_entity_attribute \"name\"\n\n # Create a tempfile to store results\n temp_file = \"#{Dir::tmpdir}/nmap_scan_#{rand(100000000)}.xml\"\n\n # Check to see if nmap is in the path, and raise an error if not\n return \"Unable to find nmap\" unless _unsafe_system(\"sudo nmap\") =~ /http:\\/\\/nmap.org/\n\n\n # Check for IPv6\n # XXX - SECURITY!\n nmap_options = \"\"\n nmap_options << \"-6 \" if to_scan =~ /:/\n #nmap_options << \"-p #{ports}\" if ports\n\n # shell out to nmap and run the scan\n @task_log.log \"Scanning #{to_scan} and storing in #{temp_file}\"\n @task_log.log \"NMap options: #{nmap_options}\"\n nmap_string = \"nmap #{to_scan} #{nmap_options} -P0 --top-ports 100 --min-parallelism 10 -oX #{temp_file}\"\n @task_log.log \"Running... #{nmap_string}\"\n _unsafe_system(nmap_string)\n\n # Gather the XML and parse\n #@task_log.log \"Raw Result:\\n #{File.open(temp_file).read}\"\n @task_log.log \"Parsing #{temp_file}\"\n\n parser = ::Nmap::Parser.parsefile(temp_file)\n\n # Create entities for each discovered service\n parser.hosts(\"up\") do |host|\n\n @task_log.log \"Handling nmap data for #{host.addr}\"\n\n # Handle the case of a netblock or domain - where we will need to create host entity(s)\n if @entity[\"type\"] == \"NetBlock\" or @entity[\"type\"] == \"DnsRecord\"\n host_entity = _create_entity(\"IpAddress\", { :name => host.addr } )\n else\n host_entity = @entity # We already have a host\n end\n\n [:tcp, :udp].each do |proto_type|\n\n host.getports(proto_type, \"open\") do |port|\n\n # Create a NetSvc for each open port\n entity = _create_entity(\"NetSvc\", {\n :name => \"#{host.addr}:#{port.num}/#{port.proto}\",\n :ip_address => \"#{host.addr}\",\n :port_num => port.num,\n :proto => port.proto,\n :fingerprint => \"#{port.service.name}\"})\n\n # Go ahead and create webapps if this is a known webapp port\n if entity.attributes[:proto] == \"tcp\" &&\n [80,443,8080,8081,8443].include?(entity.attributes[:port_num])\n\n # determine if this is an SSL application\n ssl = true if [443,8443].include?(entity.attributes[:port_num])\n protocol = ssl ? \"https://\" : \"http://\" # construct uri\n uri = \"#{protocol}#{host.addr}:#{entity.attributes[:port_num]}\"\n _create_entity(\"Uri\", :name => uri, :uri => uri ) # create an entity\n\n # and create the entities if we have dns\n host.hostnames.each do |hostname|\n uri = \"#{protocol}#{hostname}:#{entity.attributes[:port_num]}\"\n _create_entity(\"Uri\", :name => uri )\n end\n\n end # end if\n\n end # end host.getports\n end # end tcp/udp\n end # end parser\n\n # Clean up!\n begin\n File.delete(temp_file)\n rescue Errno::EPERM\n @task_log.error \"Unable to delete file\"\n end\n\n end", "def spoof_and_receive_probes(receiver2spoofer2targets, settings={ :probe_type => :rr, :retry => false }, &probe_requests_to_destinations )\n # thread out on receivers\n # iterate through until the next one will add too many targets\n # each time, add the targets to the receiver targets\n # and append to a receiver hash its targets\n # once i hit the limit, call receive, then thread out over the spoofers\n settings[ :probe_type ]=:rr if not settings.include?( :probe_type )\n settings[ :retry ]=false if not settings.include?( :retry )\n trivial_timeout=15\n results=[]\n unsuccessful_receivers=[]\n receiver_threads=[]\n privates=[]\n blacklisted=[]\n receiver2spoofer2targets.values.each {|spoofer2targets|\n spoofer2targets.each{|spoofer,targets|\n spoofer2targets[spoofer],privates,blacklisted=inspect_targets(targets,privates,blacklisted,@controller_log)\n }\n spoofer2targets.delete_if {|spoofer,targets| targets.empty?}\n }\n log { \"spoof_and_receive_probes(}, receiver2spoofer2targets: #{receiver2spoofer2targets.inspect}\" }\n for receiver in receiver2spoofer2targets.keys\n log {\"receiver is \" + receiver + \" total targs \" + receiver2spoofer2targets[receiver].values.collect{|requests| probe_requests_to_destinations.call(requests)}.flatten.length.to_s + \" total spoofers \" + receiver2spoofer2targets[receiver].length.to_s}\n receiver_threads << Thread.new(receiver,settings[:retry]) { |my_receiver_name,my_retry_command|\n begin # exception block for the receiver thread\n total_targets=receiver2spoofer2targets[my_receiver_name].values.collect{|requests| probe_requests_to_destinations.call(requests)}.flatten.length.to_s\n Thread.current[:receiver]=my_receiver_name\n Thread.current[:success]=false # false until proven true\n\n # may throw UnknownVPError\n my_receiver=self.get_vp(my_receiver_name)\n fid=0\n Timeout::timeout(trivial_timeout, SockTimeout.new(\"#{my_receiver_name} timed out after #{trivial_timeout} getting ready to receive spoofed #{settings[:probe_type].to_s}\")) {\n fid=case settings[:probe_type]\n when :rr\n my_receiver.receive_spoofed_rr\n when :ts\n my_receiver.receive_spoofed_ts\n when :tr\n my_receiver.receive_spoofed_tr\n end\n }\n # while i theoretically could catch the timeout here and assume that it might\n # still be receiving, in practice i'll need the fid to fetch the file later\n # could modify that if it ends up being a problem\n\n holes_to_punch=[]\n probes_to_send=Hash.new { |hash, key| hash[key] = [] }\n spoofer_count=0\n log {\"Before each_pair: #{my_receiver_name} #{receiver2spoofer2targets.inspect}\"}\n receiver2spoofer2targets[my_receiver_name].each_pair{|spoofer,targets|\n log {\"Before while loop: #{my_receiver_name} spoofer #{spoofer} targets #{targets.inspect}\"}\n spoofer_count += 1\n while targets.length>0\n log {\"top of targets.length loop: spoofer for #{my_receiver_name} is \" + spoofer + \" #{targets.length} \" + probe_requests_to_destinations.call(targets).join(\",\")}\n if (holes_to_punch.length + targets.length >= $MAX_HOLES) or (spoofer_count==receiver2spoofer2targets[my_receiver_name].keys.length)\n num_to_take=[$MAX_HOLES-holes_to_punch.length,targets.length].min\n init_length=holes_to_punch.length\n probes_to_send[spoofer] += targets[0...num_to_take]\n holes_to_punch += probe_requests_to_destinations.call(targets[0...num_to_take])\n targets[0...num_to_take]=[]\n log {\"before send probes: spoofer for #{my_receiver_name} is \" + spoofer + \" down to #{targets.length} \" }\n # send probes\n log {my_receiver_name + \" punching holes \" + holes_to_punch.join(\" \")}\n begin\n receiver_timeout=Controller::calculate_ping_timeout(holes_to_punch.length)\n Timeout::timeout(receiver_timeout, SockTimeout.new(\"#{my_receiver_name} timed out after #{receiver_timeout} punching #{holes_to_punch.length} holes\")) {\n my_receiver.punch_holes(holes_to_punch)\n }\n # handle timeouts a bit differently bc it\n # still might have punched some holes\n # so we continue even if it fails the 2nd time\n rescue SockTimeout\n if my_retry_command\n my_retry_command=false\n sleep 2\n retry\n else\n log {\"#{my_receiver_name} timed out punching holes EXCEPTION! \" + $!.to_s }\n end\n rescue java.lang.OutOfMemoryError => e\n raise \"OOM here! #{e.backtrace.inspect}\"\n rescue Exception\n if my_retry_command\n my_retry_command=false\n sleep 2\n retry\n else\n # we raise here to get to the\n # quarantine\n # no point in spoofing\n raise\n end\n end # send probes\n sleep 2\n spoofer_threads=[]\n max_length=probes_to_send.values.collect{|x| x.length}.max\n spoofer_timeout=Controller::calculate_spoof_timeout(max_length)\n for spoofer_key in probes_to_send.keys\n spoofer_threads << Thread.new(spoofer_key){|my_spoofer_name|\n begin # exception block for spoofer thread\n Thread.current[:host] = my_spoofer_name\n\n # may raise UnknownVPError\n my_spoofer=self.get_vp(my_spoofer_name)\n log {\"spoofing as #{my_receiver_name} from #{my_spoofer_name}: #{probes_to_send[my_spoofer_name].length} #{probe_requests_to_destinations.call(probes_to_send[my_spoofer_name]).join(\" \")}\"}\n\n Timeout::timeout(spoofer_timeout, SockTimeout.new(\"#{my_spoofer_name} timed out after #{spoofer_timeout} spoofing #{probes_to_send[my_spoofer_name].length} probes as #{my_receiver_name}\")){\n case settings[:probe_type]\n when :rr\n my_spoofer.spoof_rr({$pl_host2ip[my_receiver_name] => probes_to_send[my_spoofer_name]})\n when :ts\n my_spoofer.spoof_ts({$pl_host2ip[my_receiver_name] => probes_to_send[my_spoofer_name]})\n when :tr\n my_spoofer.spoof_tr({$pl_host2ip[my_receiver_name] => probes_to_send[my_spoofer_name]})\n end\n }\n rescue java.lang.OutOfMemoryError => e\n raise \"OOM here! #{e.backtrace.inspect}\"\n rescue Exception\n if settings.include?(:backtrace)\n $!.set_backtrace($!.backtrace + settings[:backtrace])\n end\n log { \"Spoofer error\" }\n quarantine(my_spoofer_name,( settings.include?(:maxalert) ? settings[:maxalert] : TEXT ),$!)\n end # exception block for spoofer thread\n }\n end # for spoofer_key in probes_to_send.keys\n # need to make sure the other threads all end (w timeouts if nothing else) to\n # make sure join returns\n spoofer_threads.each{|t|\n log {\"Waiting for spoofer #{t[:host]}\"}\n t.join\n }\n log {\"bottom of targets.length loop: spoofer for #{my_receiver_name} was \" + spoofer + \" down to #{targets.length} \" }\n holes_to_punch=[]\n probes_to_send.clear\n else # ^-- if $MAX_HOLES_TO_PUNCH or spoofer_count == # spoofers\n holes_to_punch += probe_requests_to_destinations.call(targets)\n probes_to_send[spoofer] += targets\n targets=[]\n end\n end # while targets.size>0\n } # receiver2spoofer2targets[my_receiver_name].each_pair{|spoofer,targets|\n\n\n # sleep to make sure last probes get back\n sleep 2\n fetch_timeout= 20 + (total_targets.to_f/100.0).round\n Timeout::timeout(fetch_timeout, SockTimeout.new(\"#{my_receiver_name} timed out after #{fetch_timeout} trying to kill and retrieve #{fid}\")) {\n probes=my_receiver.kill_and_retrieve(fid)\n log {\"Saving results for \" + my_receiver_name}\n Thread.current[:results]=probes\n Thread.current[:success]=true\n }\n # end exception block for the receiver thread\n rescue java.lang.OutOfMemoryError => e\n raise \"OOM here! #{e.backtrace.inspect}\"\n rescue Exception\n if my_retry_command\n my_retry_command=false\n sleep 2\n retry\n else\n if settings.include?(:backtrace)\n $!.set_backtrace($!.backtrace + settings[:backtrace])\n end\n quarantine(my_receiver_name,( settings.include?(:maxalert) ? settings[:maxalert] : TEXT ),$!)\n end\n end # exception block for receiver thread\n } # receiver_threads << Thread.new\nend # for receiver in\nreceiver_threads.each{|rt|\n log {\"Waiting for receiver #{rt[:receiver]}\"}\n # need to make sure the other threads all end (w timeouts if nothing else) to\n # make sure join returns\n rt.join\n if rt[:success]\n log {\"Adding results for #{rt[:receiver]}\"}\n results << [rt[:results],rt[:receiver]]\n else\n unsuccessful_receivers << rt[:receiver]\n end\n}\nreturn results,unsuccessful_receivers,privates,blacklisted\nend", "def get_results(in_progress)\nhostname2pid = {}\nin_progress.each { |pid, hostname|\n hostname2pid[hostname] = pid\n}\nissue_command_on_hosts(hostname2pid, 30){ |vp, pid| vp.get_results(pid) }\nend", "def server_timing; end", "def run\n start = rand(20)\n puts \" Starting at: #{@locations[start].name}\"\n tripDesc = \"\" # human-readable List of moves for current trip segment\n @locations[start].visited = true\n visited = 1\n totalTime = 0\n while visited < 20\n group = group_nearest(start)\n best_time = 9999999999\n\n for i in 0..3\n result = getBestPath(start, group[i]) if group[i]\n if result[0] < best_time\n best_time = result[0]\n best_path = result[1]\n best_dest = group[i]\n end\n end\n tripDesc << best_path\n totalTime += best_time\n @locations[best_dest].visited = true\n start = best_dest\n visited += 1\n end\n\n puts \"*********** Total Trip Time = #{secondstoHMS(totalTime)} **************\"\n confirm = \"Complete.\\n\"\n for i in 0..19\n confirm = \"Error, not all locations visited!!\\n\" if !@locations[i].visited\n end\n tripDesc << confirm\n return [totalTime, tripDesc]\n\n end" ]
[ "0.60458696", "0.5830391", "0.5748571", "0.5390206", "0.5268302", "0.5173195", "0.5167503", "0.51394403", "0.5131706", "0.51232564", "0.5115241", "0.51023436", "0.5062055", "0.5061355", "0.50398415", "0.50072736", "0.49784082", "0.49765942", "0.4960694", "0.49400786", "0.492389", "0.49152973", "0.4904961", "0.48901954", "0.48839065", "0.4881297", "0.48802945", "0.4879895", "0.4879895", "0.48413113", "0.48350587", "0.4824879", "0.48043752", "0.47871092", "0.47519794", "0.47505397", "0.47051817", "0.47040397", "0.47004235", "0.46900028", "0.46890542", "0.4684807", "0.46798766", "0.46702024", "0.46680447", "0.46528277", "0.4650861", "0.4646688", "0.46224195", "0.46083352", "0.46032852", "0.46021953", "0.4597178", "0.4594738", "0.4591328", "0.45906207", "0.4584792", "0.45833364", "0.4569729", "0.45694855", "0.45618778", "0.45553777", "0.45547292", "0.45502877", "0.45498767", "0.45364353", "0.4528483", "0.4525634", "0.45116836", "0.4492565", "0.44903627", "0.4484079", "0.4477406", "0.44758376", "0.4471802", "0.44693726", "0.4463735", "0.44624197", "0.44621405", "0.44567677", "0.4455082", "0.44547305", "0.44545135", "0.4450238", "0.44366586", "0.4432484", "0.44268972", "0.44148508", "0.44120777", "0.440074", "0.440074", "0.44001776", "0.4398961", "0.4396293", "0.43954778", "0.43951708", "0.43900052", "0.43883932", "0.43876308", "0.43855962" ]
0.6307447
0
this simple transform should match the basic ActiveRecord::Result format for db results.
def as_hash as_json.with_indifferent_access.tap do |rec| rec.transform_values! do |value| if value.is_a?(Time) || value.is_a?(DateTime) ymdhms = value.utc.strftime("%Y-%m-%d %H:%M:%S") subseconds = value.utc.strftime(".%6N").to_f.to_s.sub(/^0\./, "") "#{ymdhms}.#{subseconds}" else value.as_json end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_result(result)\n end", "def run(result)\r\n\t\t\r\n\t\tcolumn_names = Array.new #store the column names\r\n\t\tfields = result.fetch_fields #get all the fields\r\n\t\tfields.each do |field|\r\n\t\t\tcolumn_names << field.name #push a field into the coumn_names\r\n\t\tend\r\n\t\t\r\n\t\trow_count = result.num_rows #get the number of rows in the Mysql::Result\r\n\t\tinitial_data = Array.new #payload holder\r\n\t\t\r\n\t\tresult.data_seek(0) #Seek the cursor to the beginning of the data\r\n\t\twhile row = result.fetch_row\r\n\t\t\tinitial_data << row # add a row to the payload\r\n\t\tend\r\n\t\t\t\t\r\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\r\n\t\tresult = asrecordset\r\n\t\treturn result\r\n\tend", "def run(result)\t\t\n\t\tcolumn_names = result.fields #store the column names\n\t\trow_count = result.num_tuples #get the number of rows in the result\n\t\tinitial_data = Array.new #payload holder\n result.each do |item|\n intial_data << item.to_ary\n end\t\t\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\n\t\tresult = asrecordset\n\t\tresults\n\tend", "def queryAndConvert() \n\t\tres = self.query()\n\t\treturn res.convert()\n end", "def run(results)\n columns_names = rows.first.inject([]) {|m, kv| m << kv[0]; m}\n row_count = rows.size\n initial_data = results.all.map {|r| columns.map {|c| r[c]}}\n asrecordset = ASRecordset.new(row_count,column_names,initial_data)\n \tresult = asrecordset\n \treturn result\n end", "def reformat_query_results(results)\n return embed_table_in_results results\n end", "def build_result(columns:, rows:, column_types: {})\n ActiveRecord::Result.new(columns, rows, column_types)\n end", "def prepare_result; end", "def format_result(result)\n result\n end", "def format_result(result)\n result\n end", "def result_set_to_data(result_set, aggregate: false)\n # use ResultSet#ok method to determine status of a (potentially) aggregate result before serializing\n result_set_status = result_set.ok ? 'success' : 'failure'\n scrubbed_results = result_set.map do |result|\n scrub_stack_trace(result.to_data)\n end\n\n if aggregate\n {\n status: result_set_status,\n result: scrubbed_results\n }\n else\n # If there was only one target, return the first result on its own\n scrubbed_results.first\n end\n end", "def result\n ActiveRecord::Base.connection.select_all(sql).entries\n end", "def normalize_result(ar_res)\n res = []\n ar_res.each do |r|\n c = []\n columns.each do |col| \n if r.attributes[col[:id]] then\n c << r.send(col[:id].intern)\n else\n c << ''\n end\n end\n res << c\n end\n res\n end", "def adapt_result(result)\n if pre_simplecov_0_18_result?(result)\n adapt_pre_simplecov_0_18_result(result)\n else\n result\n end\n end", "def resultset; end", "def normalize_sqlite_result(result)\n data = result.select { |hash| hash.select!{|key, val| !key.is_a? Numeric }}\n data = data.first\n end", "def transform; end", "def to_format\n unwrap_dry_result if resource.is_a?(Dry::Monads::Result)\n\n super\n end", "def make_result_info\n end", "def single_result(results)\n result = results.first\n\n result.meta = results.meta\n\n result.linked_data = results.linked_data if results.respond_to? :linked_data\n\n return result\n end", "def transform\n end", "def original_result; end", "def process_result_set(result, opts=OPTS)\n meta = result.getMetaData\n if fetch_size = opts[:fetch_size]\n result.setFetchSize(fetch_size)\n end\n\n converters = []\n self.columns = meta.getColumnCount.times.map do |i|\n col = i + 1\n converters << TypeConverter::MAP[meta.getColumnType(col)]\n meta.getColumnLabel(col)\n end\n\n fetch_as_array = opts[:as] == :array\n while result.next\n row = fetch_as_array ? [] : {}\n _columns.each_with_index do |column, i|\n k = fetch_as_array ? i : column\n col = i+1\n row[k] = converters[i].call(result, col, opts)\n end\n yield row\n end\n ensure\n result.close\n end", "def result\n query_group.with_context do\n if primary.summarise?\n summary_result\n else\n simple_result\n end\n end\n end", "def result_metadata\n return nil if @fields.empty?\n Result.new @fields\n end", "def result_as(formatter)\n formatter.new(@result).format\n end", "def result\n meta.fetch(:result, :one)\n end", "def set_values_from(result)\n @arguments = Arguments.new(result[0]['arguments'])\n @return_type = result[0]['return_type']\n @query = \"SELECT * FROM %s.%s(%s)\" % [\n quoted_schema,\n quoted_name,\n @arguments.to_params\n ]\n end", "def objectify_records(result)\n result[:records] = result[:records].collect do |rec|\n MemoryRecord.new.init(rec[0], rec[1])\n end\n result\n end", "def parse_results(results)\n results.rows.collect do |row|\n record = {}\n row.each_with_index{|val, i| \n val = val.force_encoding('utf-8') if val\n record[results.fields[i].name] = val\n }\n \n record\n end\n end", "def prepare_result(result, opts={})\n ret = {}\n result.each do |key, val|\n ret[key] = prepare_api_field(key, val)\n end\n return ret\n end", "def transform_row(row)\n row\n end", "def as_transformed_action_result(obj)\n is_action_result, data = if obj.kind_of?(Blacksheep::ActionResult)\n [ true, obj.data ]\n else\n [ false, obj ]\n end\n converted_data = case @case\n when 'snake', 'as_is'\n data\n when 'camel'\n camelize_keys(data)\n else\n raise Blacksheep::Error, \"unknown_case #{@case}\"\n end\n\n is_action_result ? obj.set_data(converted_data) : ActionResult.new(converted_data, :ok)\n end", "def as_row(result, columns)\n columns.map { |column| column.format_value(result) }\n end", "def process_result\n end", "def normalize(result)\n case result\n when String, true, false\n { result: result }\n else\n result\n end\n end", "def result\n end", "def raw_results\n results\n end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end", "def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end", "def transformation\n end", "def raw\n results\n end", "def exec_query(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n result_array = result_as_array(result)\n if ArVer::GTEQ_4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end", "def cast\n p @result\n end", "def result?; end", "def transform\n raise 'Implement this method in subclass'\n end", "def create_result_rec(query_type, filter, result_struct, tbl_rec, rec)\r\n # If this isn't a select query or if it is a select query, but\r\n # the table record class is simply a Struct, then we will use\r\n # a Struct for the result record type.\r\n if query_type != :select\r\n result_rec = result_struct.new(*filter.collect { |f|\r\n tbl_rec.send(\"#{f}_upd_res\".to_sym) })\r\n elsif @record_class == 'Struct'\r\n result_rec = result_struct.new(*filter.collect do |f|\r\n if tbl_rec.send(f).kb_nil?\r\n nil\r\n else\r\n tbl_rec.send(f)\r\n end\r\n end)\r\n else\r\n if Object.full_const_get(@record_class).respond_to?(:kb_create)\r\n result_rec = Object.full_const_get(@record_class\r\n ).kb_create(*@field_names.collect do |f|\r\n # Just a warning here: If you specify a filter on\r\n # a select, you are only going to get those fields\r\n # you specified in the result set, EVEN IF\r\n # record_class is a custom class instead of Struct.\r\n if filter.include?(f)\r\n if tbl_rec.send(f).kb_nil?\r\n nil\r\n else\r\n tbl_rec.send(f)\r\n end\r\n else\r\n nil\r\n end\r\n end)\r\n elsif Object.full_const_get(@record_class).respond_to?(\r\n :kb_defaults)\r\n result_rec = Object.full_const_get(@record_class).new(\r\n *@field_names.collect do |f|\r\n if tbl_rec.send(f).kb_nil?\r\n nil\r\n else\r\n tbl_rec.send(f) || Object.full_const_get(\r\n @record_class).kb_defaults[@field_names.index(f)]\r\n end\r\n end)\r\n else\r\n result_rec = Object.full_const_get(@record_class).allocate\r\n @field_names.each do |fn|\r\n if tbl_rec.send(fn).kb_nil?\r\n result_rec.send(\"#{fn}=\", nil)\r\n else\r\n result_rec.send(\"#{fn}=\", tbl_rec.send(fn))\r\n end\r\n end\r\n end\r\n end\r\n\r\n unless query_type == :select\r\n result_rec.fpos = rec[-2]\r\n result_rec.line_length = rec[-1]\r\n end\r\n return result_rec\r\n end", "def db_query_transform__subquery query, tmp_table=\"resultset_table\"\n \"(#{query}) as #{tmp_table}\"\n end", "def result\n Hash[\n metadata.map do |key, value|\n [key, PostgresValue.for(value).result]\n end\n ]\n end", "def result\n\n end", "def result_to_rows(result)\n result.rows.map do |row|\n typed_row = result.columns.zip(row).map do |column_name, value|\n typed_value = result.column_types[column_name].send(:type_cast, value)\n [column_name.to_sym, typed_value]\n end\n Hash[typed_row]\n end\n end", "def result_errors_to_active_model(key, result)\n unless result.success?\n if result.errors.is_a? Array\n result.errors.each do |error|\n errors.add key, error\n end\n else\n result.errors.each do |hash_key, error_hash|\n error_hash.each do |attr, message|\n errors.add key, message[0]\n end\n end\n end\n end\n end", "def result_to_s\n self.class.construct_value @result\n end", "def process_result (result)\n\t\t\tif result[\"release_date\"] && !result[\"release_date\"].eql?(\"\")\n\t\t\t\tdate_obj = Date.parse(result[\"release_date\"])\n\t\t\t\tresult[\"date\"] = date_obj.to_formatted_s(:long)\n\t\t\telse \n\t\t\t\tresult[\"date\"] = \"None\"\n\t\t\tend\n\t\t\treturn result\n\t\tend", "def prettify_generated_result(result)\n pretty_result = {}\n pretty_key = \"\"\n pretty_values = {}\n if (result['_id']['type'] == 'population')\n pretty_key = \"Populations\"\n pretty_values = {\n 'Target Population' => result['value']['values']['target_pop_sum'],\n 'Filtered Population' => result['value']['values']['filtered_pop_sum'],\n 'Unfound Population' => result['value']['values']['unfound_pop_sum'],\n 'Total Population' => result['value']['values']['total_pop_sum']\n }\n elsif (result['_id']['type'] == 'group')\n self.query.query_structure['extract']['groups'].each do |group|\n pretty_key << group['title'].capitalize\n pretty_key << \": #{result['_id'][group['title']]}\"\n pretty_key << \", \" unless (group == self.query.query_structure['extract']['groups'].last)\n end\n self.query.query_structure['extract']['selections'].each do |selection|\n pretty_values[selection['title']] = {}\n selection['aggregation'].each do |aggregation|\n case aggregation\n when \"sum\"\n pretty_values[selection['title']]['sum'] = result['value']['values'][selection['title'] + '_sum']\n when \"frequency\"\n pretty_values[selection['title']]['frequency'] = result['value']['values'][selection['title'] + '_frequency']\n when \"mean\"\n pretty_values[selection['title']]['mean'] = result['value']['values'][selection['title'] + '_mean']\n when \"median\"\n pretty_values[selection['title']]['median'] = result['value']['values'][selection['title'] + '_median']\n when \"mode\"\n pretty_values[selection['title']]['mode'] = result['value']['values'][selection['title'] + '_mode']\n end\n end\n end\n end\n \n pretty_key = \"Results\" if pretty_key.empty?\n pretty_result['_id'] = pretty_key\n pretty_result['value'] = pretty_values\n\n return pretty_result\n end", "def process_result\n if @result.present?\n @result.map do |admin_tag, url_hash|\n url_hash.map do |url, entity_list|\n entity_list.each do |entity|\n entity.symbolize_keys!\n save_and_relate_entity(entity[:name], entity[:url], [admin_tag], \"person\", ADMIN_SOURCE)\n end\n end\n end\n end\n end", "def test_explain_sql_with_mysql2_activerecord_result\n return unless defined?(::ActiveRecord::Result)\n\n config = {:adapter => 'mysql2'}\n sql = 'SELECT * FROM spells where id=1'\n\n columns = %w[id select_type table type possible_keys key key_len ref rows Extra]\n rows = [['1', 'SIMPLE', 'spells', 'const', 'PRIMARY', 'PRIMARY', '4', 'const', '1', '']]\n activerecord_result = ::ActiveRecord::Result.new(columns, rows)\n explainer = lambda { |statement| activerecord_result }\n\n statement = NewRelic::Agent::Database::Statement.new(sql, config, explainer)\n result = NewRelic::Agent::Database.explain_sql(statement)\n\n assert_equal([columns, rows], result)\n end", "def perform\n @result ||= Result.new(model, strategy, super)\n end", "def exercise2\n @content = ActiveRecord::Base.connection.execute(\"\n SELECT\n gr.name as group_name,\n u.name as user_name,\n sum(m.mapviews) as groups_count\n FROM (((users as u\n INNER JOIN groups_users as gu ON u.id=gu.user_id)\n INNER JOIN groups as gr ON gr.id = gu.group_id)\n INNER JOIN maps as m ON m.user_id = u.id)\n GROUP BY (gr.name, u.name)\n ORDER BY gr.name, groups_count DESC;\");\n\n @results2 = []\n\n index = 0\n @content.each do |r|\n @results2[index] = Result2.new r\n index = index + 1;\n end\n\n return @results2\n end", "def result\n map_value(converted_value: value.adapter.id_to_uri(value.value))\n end", "def transforms; end", "def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end", "def store_result()\n #This is a stub, used for indexing\n end", "def execute(obj)\n return convert(obj) if check(obj)\n return obj\n end", "def aggregate\n #response = Result.collection.map_reduce(self.map_fn(), _reduce(), :raw => true, :out => {:inline => true}, :query => {:execution_id => id})\n response = Result.where(execution_id: id).map_reduce(self.map_fn(), self.query.reduce).out(inline: true).raw()\n results = response['results']\n if results\n self.aggregate_result = {}\n results.each do |result|\n result = prettify_generated_result(result) if self.query.generated? && result['value']['rereduced']\n self.aggregate_result[result['_id']] = result['value']\n end\n save!\n end\n end", "def result_type(result_type='mixed')\n @query[:result_type] = result_type\n self\n end", "def result\n\n fields['__result__']\n end", "def exec_raw(sql, options = {})\n cursor = $connection.exec(sql)\n if(options[:return_hash])\n recordset, = pack_cursor(cursor, :return => \"hash\")\n return recordset\n else\n return_data = []\n while current_row = cursor.fetch()\n return_data.push(current_row)\n end\n return return_data\n end\n end", "def merged_result; end", "def result_class\n const_defined?('Result') ? const_get('Result') : define_result_class\n end", "def result\n\t\t@result\n\tend", "def exercise1\n @content = ActiveRecord::Base.connection.execute(\"\n SELECT\n u.name as user_name,\n COUNT(gr.name) as groups_count,\n CONCAT('[', COALESCE(STRING_AGG(gr.name, ', ' ), ''),']') as groups\n FROM ((users as u\n LEFT JOIN groups_users as gu ON u.id=gu.user_id)\n LEFT JOIN groups as gr ON gr.id = gu.group_id)\n GROUP BY user_name\n ORDER BY groups_count;\");\n\n @results1 = []\n\n index = 0\n @content.each do |r|\n @results1[index] = Result1.new r\n index = index + 1;\n end\n\n return @results1\n end", "def convert_to_json(result)\n opts = roda_class.opts\n serializer = opts[:json_result_serializer]\n\n if opts[:json_result_include_request]\n serializer.call(result, self)\n else\n serializer.call(result)\n end\n end", "def result()\n end", "def normalize_query_result_subject(subject)\n subject.kind_of?(Array) && !subject.empty? && is_well_formed_query_result?(subject[0]) ? subject[0] : subject\n end", "def result\n # cast it to datetime for storage, to preserve milliseconds and date\n map_value(converted_value:\n RDF::Literal.new(\n value.value.to_datetime,\n datatype: PermissiveSchema.valkyrie_time\n ))\n end", "def each\n return unless @result\n\n @result.each(as: :hash, symbolize_keys: true) do |row|\n next unless row # This sometimes happens when streaming results...\n row = Hash[row.map { |k, v| [k, v.to_s] }] if @type_translation == :string\n yield row\n end\n end", "def result\n Valkyrie::Persistence::Shared::JSONValueMapper.new(value).result.symbolize_keys\n end", "def run_and_transform; end", "def transform_values!; end", "def fetch\n @result = Result.new(data, :query => self)\n end", "def fetch\n row = @result.fetch\n return row unless @bind_result\n row.zip(@bind_result).map do |col, type|\n if col.nil?\n nil\n elsif [Numeric, Integer, Fixnum].include? type\n col.to_i\n elsif type == String\n col.to_s\n elsif type == Float && !col.is_a?(Float)\n col.to_i.to_f\n elsif type == Mysql::Time && !col.is_a?(Mysql::Time)\n if col.to_s =~ /\\A\\d+\\z/\n i = col.to_s.to_i\n if i < 100000000\n y = i/10000\n m = i/100%100\n d = i%100\n h, mm, s = 0\n else\n y = i/10000000000\n m = i/100000000%100\n d = i/1000000%100\n h = i/10000%100\n mm= i/100%100\n s = i%100\n end\n if y < 70\n y += 2000\n elsif y < 100\n y += 1900\n end\n Mysql::Time.new(y, m, d, h, mm, s)\n else\n Mysql::Time.new\n end\n else\n col\n end\n end\n end", "def show\n authorize! :show, :transform\n @results = TransformResult.order(timestamp: :desc).limit(20)\n render formats: :json\n end", "def compose\n case type\n when :integrated\n formated_query\n when :separated\n \"select #{target_column_names} from #{config[:object]} #{where_clause}\"\n end\n end", "def use_single?(results)\n if(results.class.superclass.to_s == 'ActiveRecord::Base')\n return true\n end\n false\n end", "def execute\n # First, execute the SQL, applying the valid after_filters\n ret = apply_after_filters(execute_sql)\n\n # Set changed property to true\n changed\n\n # Notify all observers of the ids of the current result\n # set\n notify_observers(\n ret.collect{|instance| instance.send(model.primary_key)},\n self\n )\n\n # Reset the Query\n reset!\n\n # Return the results\n ret\n end", "def process(result)\n result\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_id\n ))\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_id\n ))\n end", "def result\n results.first\n end", "def process_row(row)\n row.to_s\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_int\n ))\n end", "def add_result(res)\n change_cursor { |c|\n saved_format = c.char_format # moving changes char format\n c.move_position document.character_count - 1\n c.char_format = saved_format\n\n ANSIToQt.insert(c, res)\n }\n end", "def transformations; end" ]
[ "0.65641856", "0.63239527", "0.6277784", "0.625738", "0.6240135", "0.6147244", "0.6090655", "0.60887426", "0.6047224", "0.6002277", "0.58922297", "0.5813438", "0.5788314", "0.57540905", "0.57431394", "0.5714857", "0.571229", "0.57055676", "0.5686092", "0.56828535", "0.5672716", "0.56683314", "0.56482196", "0.5642573", "0.5636267", "0.5593955", "0.55917466", "0.55180484", "0.55167216", "0.55058515", "0.5487635", "0.5485395", "0.54819906", "0.54806364", "0.5432612", "0.54062456", "0.5403492", "0.539324", "0.53925294", "0.53925294", "0.53925294", "0.53925294", "0.53925294", "0.53925294", "0.53925294", "0.53925294", "0.53867066", "0.5383449", "0.537743", "0.5345981", "0.5326179", "0.5326097", "0.53042495", "0.5298467", "0.5271811", "0.5261805", "0.52542627", "0.52444696", "0.52024597", "0.5198269", "0.51890916", "0.51845413", "0.518265", "0.518108", "0.5175362", "0.5174352", "0.5172897", "0.515677", "0.5152865", "0.5149231", "0.5146757", "0.5142117", "0.5110957", "0.5107373", "0.510422", "0.5092985", "0.50841", "0.50800574", "0.50762296", "0.50758904", "0.50639737", "0.506252", "0.50587827", "0.50554544", "0.5047887", "0.5046007", "0.5038048", "0.5020639", "0.50174826", "0.5013879", "0.5012653", "0.5004399", "0.5001019", "0.49998638", "0.4999677", "0.4999677", "0.4996328", "0.49916592", "0.4990023", "0.49825627", "0.49778363" ]
0.0
-1
GET /tipo_filtros/1 GET /tipo_filtros/1.xml
def show @tipo_filtro = TipoFiltro.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @tipo_filtro } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tipo_filtro = TipoFiltro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_filtro }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_recibo }\n end\n end", "def index\n @tipo_lancamentos = TipoLancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_lancamentos }\n end\n end", "def show\n @filtro_vehiculo = FiltroVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @filtro_vehiculo }\n end\n end", "def index\n @tipo_restaurantes = TipoRestaurante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_restaurantes }\n end\n end", "def index\n @tipo_contas = TipoConta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_contas }\n end\n end", "def show\n @tipo_vinculo = TipoVinculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_vinculo }\n end\n end", "def show\n @tipo_contrato = TipoContrato.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_contrato }\n end\n end", "def show\n @tipo_lista = TipoLista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_lista }\n end\n end", "def index\n @tipo_notas = TipoNota.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_notas }\n end\n end", "def show\n @tipo_iva = TipoIva.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_iva }\n end\n end", "def show\n @tipo_lancamento = TipoLancamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_lancamento }\n end\n end", "def show\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_restaurante }\n end\n end", "def index\n @telefonos = @persona.telefonos.find(:all, :order => \"tipo ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @telefonos }\n end\n end", "def show\n @tipo_pago = TipoPago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_pago }\n end\n end", "def index\n @search = TipoRecibo.search(params[:search])\n @tipo_recibos = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @tipo_recibos }\n end\n end", "def show\n @tipo_fuente = TipoFuente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_fuente }\n end\n end", "def show\n @titulacionesdoctipo = Titulacionesdoctipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @titulacionesdoctipo }\n end\n end", "def show\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_de_documento }\n end\n end", "def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_vehiculo }\n end\n end", "def show\n @tipo_proy = TipoProy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_proy }\n end\n end", "def show\n @tipo_controles = TipoControle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_controles }\n end\n end", "def index\n @tiposcontratos = Tiposcontrato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tiposcontratos }\n end\n end", "def show\n @tipo_articulo = TipoArticulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_articulo }\n end\n end", "def index\n @descriptor_genericos = DescriptorGenerico.paginate(:per_page => 20, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @descriptor_genericos }\n end\n end", "def show\n @tipo_conta = TipoConta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_conta }\n end\n end", "def index\n @tipos_pagamentos = TiposPagamento.find(:all, :order => \"nome\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipos_pagamentos }\n end\n end", "def show\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_nota }\n end\n end", "def index\n @datos = Dato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datos }\n end\n end", "def show\n @tipo_curso = TipoCurso.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_curso }\n end\n end", "def lista\n @receitas = Receita.all\n\n respond_to do |format|\n format.html # lista.html.erb\n format.xml { render :xml => @receitas }\n end\n end", "def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end", "def index\n @typetaches = @paramun.typetaches\n\n respond_to do |format|\n if @typetaches.empty?\n format.xml { render request.format.to_sym => \"ttypErreurA0\" } ## Aucun Typetache collecté\n else\n format.xml { render xml: @typetaches }\n end\n end\n end", "def index\n @ordens = Orden.where(:estado => \"Pendiente por Recolectar\").order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ordens }\n end\n end", "def show\n @tiposproceso = Tiposproceso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tiposproceso }\n end\n end", "def show\n @tipo_de_exercicio = TipoDeExercicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_de_exercicio }\n end\n end", "def show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_usuario }\n end\n end", "def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end", "def index\n @ficha_tematicas = FichaTematica.busqueda(params[:page], params[:generico], params[:buscar])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ficha_tematicas }\n end\n end", "def index\n # @ideias = Ideia.all\n @ideias = Ideia.where(:status => '3')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ideias }\n end\n end", "def index\n @perfis = Perfil.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @perfis }\n end\n end", "def index\n @foros = Foro.paginate(:per_page => 20, :page => params[:page], :order => 'id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @foros }\n end\n end", "def index\n @categoria_comidas = CategoriaComida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categoria_comidas }\n end\n end", "def index\n @cantores = Cantor.paginate :page => params[:page], :order => 'nome ASC', :per_page => 20\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cantores }\n end\n end", "def show\n @sotto_categoria = SottoCategoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sotto_categoria }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @filter_param }\n end\n end", "def index\n @tipo_usuarios = TipoUsuario.all\n @tipo_usuarios = @tipo_usuarios.paginate :page => params[:page], :order => 'created_at DESC', :per_page => 10\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_usuarios }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ciclos }\n end\n end", "def index\n @unidades = Unidad.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @unidades }\n end\n end", "def show\n @regiaos = Regiao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiaos }\n end\n end", "def index\n @viviendastipostramites = Viviendastipostramite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @viviendastipostramites }\n end\n end", "def new\n @filtro_vehiculo = FiltroVehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @filtro_vehiculo }\n end\n end", "def index\r\n @doctipos = Doctipo.find(:all)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @doctipos }\r\n end\r\n end", "def show\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tservicio }\n end\n end", "def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end", "def index\n @activos = Activo.all\n @marcas = Marca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activos }\n end\n end", "def index\n @parametros_financeiros = ParametroFinanceiro.find(:all, :conditions => [\"entidade_id = ?\", current_usuario.entidade], :order => 'tipo_documento_id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @parametros_financeiros }\n end\n end", "def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def show\n @tipo_telefone = TipoTelefone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end", "def index\n @lancamentos = Lancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lancamentos }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @departamento }\n end\n end", "def index\n debugger\n @receitas = Receita.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receitas }\n end\n end", "def show\n @tipos_pagamento = TiposPagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipos_pagamento }\n end\n end", "def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end", "def show\n @contratosinterventoria = Contratosinterventoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contratosinterventoria }\n end\n end", "def show\r\n @doctipo = Doctipo.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @doctipo }\r\n end\r\n end", "def index\n @clienteles = @paramun.clienteles\n\n respond_to do |format|\n if @clienteles.empty?\n format.xml { render request.format.to_sym => \"ccliErreurA\" } ## Aucune Clientele\n else \n format.xml { render xml: @clienteles }\n end\n end\n end", "def show\n @title_view = 'Tipo de Denuncias'\n @request_and_complaint_complaint_type = RequestAndComplaint::ComplaintType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request_and_complaint_complaint_type }\n end\n end", "def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def index\n @partido_politicos = PartidoPolitico.paginate(:per_page => 20, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partido_politicos }\n end\n end", "def show\n @valor_sistema = ValorSistema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @valor_sistema }\n end\n end", "def index\n @glosarios = Glosario.busqueda(params[:page],params[:generico], params[:buscar], 20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @glosarios }\n end\n end", "def index\n @personals = Personal.all\n\n cadena = getpersonals(@personals)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => cadena }\n end\n end", "def show\n @parametro = Parametro.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @parametro }\n end\n end", "def index\n @tipo_de_servicios = TipoDeServicio.all\n end", "def show\n @tarifas = Tarifas.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tarifas }\n end\n end", "def show\n @tiposcontrato = Tiposcontrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tiposcontrato }\n end\n end", "def show\n @coleccionista = Coleccionista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coleccionista }\n end\n end", "def index\n @periodistas = Periodista.listado(params[:page],params[:buscar], params[:departamento],params[:tipo_medio_id] , params[:institucion_periodistica_id])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @periodistas }\n format.print{ @periodistas = Periodista.find(:all, :order => \"idDepartamento, nombre\"); render :layout => 'imprimir' }\n end\n end", "def show\n @parametro = Parametro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @parametro }\n end\n end", "def show\n @lance_unico = LanceUnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lance_unico }\n end\n end", "def index # exibe todos os itens\n @restaurantes = Restaurante.all.order :id\n #Restaurante.order :id\n respond_to do |format|\n format.html\n format.xml{render xml: @restaurantes}\n format.json{render json: @restaurantes}\n end\n end", "def index\n @funcionarios = Funcionario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @funcionarios }\n end\n end", "def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end", "def index\n @q = Servidor.ransack(params[:q])\n @q.sorts = 'nome'\n @servidores = @q.result.page params[:page]\n respond_to do |format|\n format.html\n format.csv do\n send_data @servidores.except(:limit, :offset).to_csv, filename: \"concentradores -#{Date.today}.csv\"\n end\n end\n end", "def index\n @feria2009beneficiarios = Feria2009beneficiario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2009beneficiarios }\n end\n end", "def index\n @feria2010beneficiarios = Feria2010beneficiario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010beneficiarios }\n end\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def show\n @categoria_do_recebimento = CategoriaDoRecebimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @categoria_do_recebimento }\n end\n end", "def index\n @departamentos = Departamento.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @departamentos }\n end\n end", "def show\n @descriptor_generico = DescriptorGenerico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @descriptor_generico }\n end\n end", "def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end", "def show\n @orc_ficha = OrcFicha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_ficha }\n end\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def consultar\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @usuario }\n end\n end", "def index\n @inv_types = InvType.order(\"id desc\").paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @inv_types }\n end\n end", "def recolectores\n @personas = Persona.where(:empleados_id => 2).order(\"apellido ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @personas }\n end\n end", "def show\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @barrio }\n end\n end", "def index\n #@search = Serie.scoped_search(params[:search])\n @series = Serie.do_nivel(@nivel).order(\"nome asc\",\"codigo asc\").paginate :page => params[:page], :per_page => 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @series }\n end\n end", "def show\n @relatestagiario = Relatestagiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end" ]
[ "0.6745605", "0.67398536", "0.67234206", "0.66814137", "0.6667591", "0.6607687", "0.6565387", "0.65368515", "0.6532929", "0.65316063", "0.65131414", "0.6459779", "0.6449398", "0.6445603", "0.64389354", "0.64235866", "0.6374168", "0.6371245", "0.63584244", "0.63544554", "0.63467383", "0.6328741", "0.6321175", "0.6320216", "0.63103145", "0.6309029", "0.63020533", "0.6299567", "0.6275336", "0.625054", "0.62324697", "0.62302524", "0.6227857", "0.6218428", "0.6208309", "0.61951435", "0.61874753", "0.6163657", "0.61456066", "0.6143304", "0.6113044", "0.61126804", "0.61045575", "0.6099554", "0.6095491", "0.6094705", "0.6094209", "0.60934734", "0.60893637", "0.6068579", "0.60589427", "0.6053459", "0.6031301", "0.6011969", "0.6000357", "0.5993931", "0.5986769", "0.5984252", "0.5978955", "0.59753543", "0.5974842", "0.59679836", "0.5964503", "0.5953444", "0.59459853", "0.5939123", "0.59347403", "0.5927731", "0.59270495", "0.5926268", "0.5923694", "0.5922449", "0.59166384", "0.5913322", "0.59043384", "0.59014446", "0.5897992", "0.58979225", "0.58966273", "0.5894254", "0.5885627", "0.5884654", "0.58836985", "0.5881529", "0.5876171", "0.5875595", "0.58671707", "0.58622384", "0.58594173", "0.58587736", "0.5857015", "0.5856735", "0.5854333", "0.5853128", "0.58484614", "0.5848273", "0.58372444", "0.5836974", "0.5829871", "0.58290404" ]
0.74712145
0
GET /tipo_filtros/new GET /tipo_filtros/new.xml
def new @tipo_filtro = TipoFiltro.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @tipo_filtro } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tipo_contrato = TipoContrato.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_contrato }\n end\n end", "def new\n @filtro_vehiculo = FiltroVehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @filtro_vehiculo }\n end\n end", "def new\n @tipo_lista = TipoLista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_lista }\n end\n end", "def new\n @tipo_iva = TipoIva.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_iva }\n end\n end", "def new\n @tipo_pago = TipoPago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_pago }\n end\n end", "def create\n @tipo_filtro = TipoFiltro.new(params[:tipo_filtro])\n\n respond_to do |format|\n if @tipo_filtro.save\n format.html { redirect_to(@tipo_filtro, :notice => 'TipoFiltro was successfully created.') }\n format.xml { render :xml => @tipo_filtro, :status => :created, :location => @tipo_filtro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_filtro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @tipo_nota = TipoNota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_nota }\n end\n end", "def new\n @titulacionesdoctipo = Titulacionesdoctipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @titulacionesdoctipo }\n end\n end", "def new\n @tipo_lancamento = TipoLancamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_lancamento }\n end\n end", "def new\n @tipo_recibo = TipoRecibo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_recibo }\n end\n end", "def new\n @tipo_proy = TipoProy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_proy }\n end\n end", "def new\n @tiposproceso = Tiposproceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiposproceso }\n end\n end", "def new\n @tipo_fuente = TipoFuente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_fuente }\n end\n end", "def new\n @tipo_articulo = TipoArticulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_articulo }\n end\n end", "def new\n @tipo_restaurante = TipoRestaurante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_restaurante }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @filter_param }\n end\n end", "def new\n @tipo_curso = TipoCurso.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_curso }\n end\n end", "def new\n @tipo_conta = TipoConta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_conta }\n end\n end", "def new\n @tipo_controles = TipoControle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_controles }\n end\n end", "def new\n @ponto = Ponto.new\n @t = params[:estagiario_id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @tipo_vehiculo = TipoVehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_vehiculo }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @tipo_usuario = TipoUsuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_usuario }\n end\n end", "def new\n @tipo_de_documento = TipoDeDocumento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_de_documento }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n @tipo_de_exercicio = TipoDeExercicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_de_exercicio }\n end\n end", "def new\n @tservicio = Tservicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tservicio }\n end\n end", "def new\n @regiaos = Regiao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiaos }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "def new\n @tiposcontrato = Tiposcontrato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiposcontrato }\n end\n end", "def new\n @tipo_vinculo = TipoVinculo.new\n\n respond_to do |format|\n format.html { render :action => \"edit\" }# new.html.erb\n format.xml { render :xml => @tipo_vinculo }\n end\n end", "def new\n @tipos_pagamento = TiposPagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipos_pagamento }\n end\n end", "def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @coleccionista = Coleccionista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coleccionista }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\n end\n end", "def new\n @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end", "def new\n @periodista = Periodista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periodista }\n end\n end", "def new\n @pagamento = Pagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagamento }\n end\n end", "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def new\n @voto = Voto.new\n\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @ponto }\n #end\n end", "def new\n @sotto_categoria = SottoCategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sotto_categoria }\n end\n end", "def new\n @contratosinterventoria = Contratosinterventoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contratosinterventoria }\n end\n end", "def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end", "def new\n @contrato = Contrato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contrato }\n end\n end", "def new\n $flaggravaprof = 1\n @temposervico = TempoServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temposervico }\n end\n end", "def new\n @receita = Receita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def new\n @pagare = Pagare.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagare }\n end\n end", "def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @precio }\n end\n end", "def new\n @tcliente = Tcliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tcliente }\n end\n end", "def new\n @vicariato = Vicariato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vicariato }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @lista_precio = ListaPrecio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lista_precio }\n end\n end", "def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def new\n @pagina = Pagina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagina }\n end\n end", "def new\n @pagos_detalhe = PagosDetalhe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagos_detalhe }\n end\n end", "def new\n @tipos_movimiento = TiposMovimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipos_movimiento }\n end\n end", "def new\n @silo = Silo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @silo }\n end\n end", "def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def new\n @movimento = Movimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movimento }\n end\n end", "def new\n @movimento = Movimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movimento }\n end\n end", "def new\n @sitio = Sitio.new\n @categorias = Categoria.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitio }\n end\n end", "def new\n @unidades = Unidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @unidades }\n end\n end", "def new\n @feria2010observacion = Feria2010observacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end", "def new\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aviso }\n end\n end", "def new\n @proceso = Proceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proceso }\n end\n end", "def new\n @remocao = Remocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @remocao }\n end\n end", "def new\n @asistencia = Asistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def new\n @tipo_telefone = TipoTelefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end", "def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def new\n @dato = Dato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dato }\n end\n end", "def new\n @dato = Dato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dato }\n end\n end", "def new\n @tarifas = Tarifas.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tarifas }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end", "def new\n @parametro = Parametro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @parametro }\n end\n end", "def new\n @noticia = Noticia.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noticia }\n end\n end", "def new\n @historico = Historico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @historico }\n end\n end", "def new\n @protocolo = Protocolo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end", "def new\n @poblacionesespecial = Poblacionesespecial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poblacionesespecial }\n end\n end", "def new\n @platillo = Platillo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @platillo }\n end\n end", "def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end", "def new\n @lotto_type = LottoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lotto_type }\n end\n end", "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def new\n @periodos = Periodo.all.collect{|p|[\"#{t p.inicio.strftime(\"%B\")} - #{t p.fim.strftime(\"%B\")}\",p.id]}\n @requisicao = Requisicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requisicao }\n end\n end", "def new\n @activo = Activo.new\n @marcas = Marca.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activo }\n end\n end", "def new\n @categoria = Categoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categoria }\n end\n end", "def new\n @nivel = Nivel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nivel }\n end\n end", "def new\n @lance_unico = LanceUnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lance_unico }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @premio }\n end\n end", "def new\n @inscripcione = Inscripcione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inscripcione }\n end\n end", "def new\n @tramo = Tramo.new\n @proyecto_id = params[:proyecto_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tramo }\n end\n end", "def new\n @curta = Curta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curta }\n end\n end", "def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end", "def new\n @orc_ficha = OrcFicha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @orc_ficha }\n end\n end", "def new\n @descriptor_generico = DescriptorGenerico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @descriptor_generico }\n end\n end", "def new\n @valor_sistema = ValorSistema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @valor_sistema }\n end\n end", "def new\n @funcionario = Funcionario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @funcionario }\n end\n end", "def new\n @suministro = Suministro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suministro }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @aniversario = Aniversario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aniversario }\n end\n end" ]
[ "0.7308088", "0.7290275", "0.7287951", "0.72796077", "0.72324795", "0.719996", "0.71888715", "0.71723896", "0.71500176", "0.7144853", "0.7112831", "0.71056485", "0.70973086", "0.7060862", "0.70558125", "0.70540124", "0.7034022", "0.7032434", "0.70183146", "0.6988104", "0.6984064", "0.696835", "0.6966423", "0.695249", "0.693926", "0.6915924", "0.69088626", "0.69028246", "0.68849653", "0.68820477", "0.6861196", "0.68589354", "0.6849078", "0.6834619", "0.6825197", "0.6818539", "0.6796216", "0.6795893", "0.679488", "0.6792499", "0.6791934", "0.6786896", "0.67822784", "0.6781828", "0.6775068", "0.67741454", "0.6766807", "0.67590994", "0.6748797", "0.67430407", "0.6725429", "0.6724592", "0.6716472", "0.6715601", "0.6715511", "0.67034", "0.6688791", "0.66740936", "0.6672502", "0.6672502", "0.66641587", "0.6663025", "0.6654419", "0.66541886", "0.6653247", "0.66524076", "0.66481555", "0.6648155", "0.6645156", "0.66440713", "0.66440713", "0.6641208", "0.6639228", "0.66382396", "0.6635659", "0.6633906", "0.6632996", "0.66234213", "0.66189295", "0.66114515", "0.6607087", "0.6606883", "0.6603203", "0.659326", "0.6592929", "0.6585202", "0.6583302", "0.6574668", "0.6574062", "0.6569663", "0.65643734", "0.65575486", "0.65544534", "0.6553916", "0.65504616", "0.65483177", "0.6543718", "0.6542588", "0.6540537", "0.65305686" ]
0.8075629
0
POST /tipo_filtros POST /tipo_filtros.xml
def create @tipo_filtro = TipoFiltro.new(params[:tipo_filtro]) respond_to do |format| if @tipo_filtro.save format.html { redirect_to(@tipo_filtro, :notice => 'TipoFiltro was successfully created.') } format.xml { render :xml => @tipo_filtro, :status => :created, :location => @tipo_filtro } else format.html { render :action => "new" } format.xml { render :xml => @tipo_filtro.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tipo_filtro = TipoFiltro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_filtro }\n end\n end", "def show\n @tipo_filtro = TipoFiltro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_filtro }\n end\n end", "def resource_params\n params.require(:tratamiento).permit(:tipo)\n end", "def solicitacao_tipo_params\n params.require(:solicitacao_tipo).permit(:tipo)\n end", "def destroy\n @tipo_filtro = TipoFiltro.find(params[:id])\n @tipo_filtro.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_filtros_url) }\n format.xml { head :ok }\n end\n end", "def new\n @filtro_vehiculo = FiltroVehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @filtro_vehiculo }\n end\n end", "def index\n @typetaches = @paramun.typetaches\n\n respond_to do |format|\n if @typetaches.empty?\n format.xml { render request.format.to_sym => \"ttypErreurA0\" } ## Aucun Typetache collecté\n else\n format.xml { render xml: @typetaches }\n end\n end\n end", "def create\n @filtro_vehiculo = FiltroVehiculo.new(params[:filtro_vehiculo])\n\n respond_to do |format|\n if @filtro_vehiculo.save\n format.html { redirect_to(@filtro_vehiculo, :notice => 'FiltroVehiculo was successfully created.') }\n format.xml { render :xml => @filtro_vehiculo, :status => :created, :location => @filtro_vehiculo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @filtro_vehiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tipo_params\n params.require(:tipo).permit(:descricao)\n end", "def especies_filtros\n return unless tiene_filtros?\n self.taxones = Especie.select(:id).select(\"#{Scat.attribute_alias(:catalogo_id)} AS catalogo_id\").joins(:scat).distinct\n por_especie_id\n por_nombre\n #estatus\n #solo_publicos\n estado_conservacion\n tipo_distribucion\n uso\n formas_crecimiento\n ambiente\n\n #return unless por_id_o_nombre\n #categoria_por_nivel\n end", "def index\n @tipo_restaurantes = TipoRestaurante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_restaurantes }\n end\n end", "def reuniao_params\n params.require(:reuniao).permit(:titulo, :data, :horaInicio, :horaFim, :status, :local_id, :pautum_id, :atum_id, :category_id)\n end", "def new\n \n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n respond_to do |format|\n unless @selecciones.empty?\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n @orden = Orden.new(:direccion_entrega=>usuario_actual.direccion)\n t = Time.now\n fecha = t.strftime(\"%Y-%m-%d\")\n client = Savon::Client.new(\"http://192.168.1.121/DistribuidorFIF/webservices/servicio.php?wsdl\")\n preorden = \"<solicitud_pedido>\n <num_orden>001</num_orden>\n <nombre_comercio>Tukiosquito</nombre_comercio>\n <fecha_solicitud>\"+fecha.to_s+\"</fecha_solicitud>\n <nombre_cliente>\"+usuario_actual.nombre+\" \"+usuario_actual.apellido+\"</nombre_cliente>\n <direccion_comercio>\n <avenida>Sucre</avenida>\n <calle>-</calle>\n <edificio_casa>CC Millenium</edificio_casa>\n <local_apt>C1-15</local_apt>\n <parroquia>Leoncio Martinez</parroquia>\n <municipio>Sucre</municipio>\n <ciudad>Caracas</ciudad>\n <estado>Miranda</estado>\n <pais>Venezuela</pais>\n </direccion_comercio>\n <direccion_destino>\n <avenida>Santa Rosa</avenida>\n <calle>Tierras Rojas</calle>\n <edificio_casa>Villa Magica</edificio_casa>\n <local_apt>69</local_apt>\n <parroquia> </parroquia>\n <municipio>Zamora</municipio>\n <ciudad>Cua</ciudad>\n <estado>Miranda</estado>\n <pais>Venezuela</pais>\n </direccion_destino>\"\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n preorden = preorden+\"\n <articulo>\n <id>\"+p.id.to_s+\"</id>\n <descripcion>\"+p.descripcion+\"</descripcion>\n <peso>\"+p.peso.to_s+\"</peso>\n <cantidad>\"+seleccion.cantidad.to_s+\"</cantidad>\n <precio>\"+p.precio.to_s+\"</precio>\n </articulo>\"\n end\n preorden = preorden+\"</solicitud_pedido>\"\n response = client.request :ejemplo, body: { \"value\" => preorden } \n if response.success? \n respuesta = response.to_hash[:ejemplo_response][:return]\n datos = XmlSimple.xml_in(respuesta)\n end\n\n @precio_envio = datos[\"num_orden\"][0]\n #@arreglo = XmlSimple.xml_in('')\n #@xml = XmlSimple.xml_out(@arreglo, { 'RootName' => 'solicitud_pedido' })\n #url = 'http://192.168.1.101/Antonio/tukyosquito/proyecto/servicio/servicio.php'\n #cotizacion = SOAP::RPC::Driver.new(url)\n #cotizacion.add_method('obtener','asd')\n #tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n #@respuesta = cotizacion.obtener('123')\n format.html # new.html.erb\n else\n format.html { redirect_to carrito_path, notice: 'No tiene productos agregados al carro de compras para generar una orden.' }\n end\n end\n end", "def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end", "def pagamento_params\n params.require(:pagamento).permit(:datapgto, :valor, :status, :fornecedor_id)\n end", "def index\n @tipo_lancamentos = TipoLancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_lancamentos }\n end\n end", "def filtering_params(params)\n params.slice(:id, :tipo)\n end", "def lista\n @receitas = Receita.all\n\n respond_to do |format|\n format.html # lista.html.erb\n format.xml { render :xml => @receitas }\n end\n end", "def index\n @q = Repuesto.search(params[:q])\n @repuestos = @q.result.order('codigo ASC')\n\n tipo = params[:tipo]\n if tipo == \"Insumo\"\n @repuestos = @repuestos.where(\"familia = 'Insumo'\")\n elsif tipo == \"Lubricante\"\n @repuestos = @repuestos.where(\"familia = 'Lubricante'\")\n elsif tipo == \"Neumatico\"\n @repuestos = @repuestos.where(\"familia = 'Neumáticos'\")\n elsif tipo == \"Pintura\"\n @repuestos = @repuestos.where(\"familia = 'Pintura'\")\n elsif tipo == \"Repuesto\"\n @repuestos = @repuestos.where(\"familia = 'Repuesto'\")\n elsif tipo == \"Seguridad\"\n @repuestos = @repuestos.where(\"familia = 'Seguridad'\")\n elsif tipo == \"Faltantes\"\n @repuestos = @repuestos.where(\"stock < stock_minimo\")\n end\n end", "def create\n params[:orgao][:tipo_atendimento_ids] ||= []\n\trespond_to do |format|\n if @orgao.save\n format.html { redirect_to @orgao, notice: \"Local de atendimento: #{@orgao.nome}, foi criado com sucesso.\" }\n format.json { render json: @orgao, status: :created, location: @orgao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orgao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://localhost:3001/servicios/wsdl\")\n tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n total_pagar = params[:orden][:total]\n pago = '<Message>\n <Request>\n <numero_tdc>'+tdc.numero+'</numero_tdc>\n <nombre_tarjetahabiente>'+tdc.tarjetahabiente+'</nombre_tarjetahabiente>\n <fecha_vencimiento>'+tdc.mes_vencimiento+'/'+tdc.ano_vencimiento+'</fecha_vencimiento>\n <codigo_seguridad>'+tdc.codigo+'</codigo_seguridad>\n <tipo_tarjeta>'+tdc.tipo+'</tipo_tarjeta>\n <direccion_cobro>'+tdc.direccion+'</direccion_cobro>\n <total_pagar>'+total_pagar+'</total_pagar>\n <cuenta_receptora>'+cuenta_receptora+'</cuenta_receptora>\n </Request>\n </Message>'\n #response = client.request :verificar_pago, body: { \"value\" => pago } \n #if response.success?\n # data = response.to_hash[:verificar_pago_response][:value][:response].first\n # @respuesta = XmlSimple.xml_in(data)\n #end\n\n #NAMESPACE = 'pagotdc'\n #URL = 'http://localhost:8080/'\n #banco = SOAP::RPC::Driver.new(URL, NAMESPACE)\n #banco.add_method('verificar_pago', 'numero_tdc', 'nombre_tarjetahabiente', 'fecha_vencimiento', 'codigo_seguridad', 'tipo_tarjeta', 'direccion_cobro', 'total_pagar', 'cuenta_receptora')\n #\n \n #respuesta = banco.verificar_pago(tdc.numero, tdc.tarjetahabiente, tdc.mes_vencimiento.to_s+'/'+tdc.ano_vencimiento.to_s, tdc.codigo, tdc.tipo, params[:orden][:total], tdc.direccion)\n \n if true #respuesta.ack.eql?(0)\n params[:orden][:cliente_id] = usuario_actual.id\n params[:orden][:total] = Seleccion.precio_total(usuario_actual.id)\n params[:orden][:fecha_entrega] = \"0000-00-00\"\n @orden = Orden.new(params[:orden])\n \n if @orden.save\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n @venta = Venta.new(:producto_id=>p.id, \n :orden_id=>@orden.id,\n :categoria_id=>p.categoria_id, \n :cantidad=>seleccion.cantidad,\n :costo=>p.precio)\n @venta.save\n end\n \n Seleccion.vaciar_carro(usuario_actual.id)\n respond_to do |format|\n format.html { redirect_to ver_ordenes_path, notice: 'Orden generada correctamente.' }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\", notice: respuesta.mensaje }\n end\n end\n end", "def detalhar_filtro(nome_filtro)\n @tamanho_lista = detalhar_btns.size\n @indice = 0\n\n while(@indice < @tamanho_lista)\n\n puts @tamanho_lista\n puts linhas_registros_tds[@indice].text\n\n if(linhas_registros_tds[@indice].text == \"filtro_automacao\")\n detalhar_btns[@indice].click\n @indice = @tamanho_lista\n end\n\n @indice += 1\n\n end\n end", "def evolucao_tipo_params\n params.require(:evolucao_tipo).permit(:nome, :inativo, campos_attributes: [ :id, :nome, :titulo, :requerido, :tipo_campo, :_destroy ])\n end", "def index\n @tipo_notas = TipoNota.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_notas }\n end\n end", "def create\r\n @doctipo = Doctipo.new(params[:doctipo])\r\n \r\n\r\n respond_to do |format|\r\n if @doctipo.save\r\n \r\n flash[:notice] = 'EL tipo d edocumento fue creado exitosamente.'\r\n format.html { redirect_to(flash[:back] || @doctipo) }\r\n format.xml { render :xml => @doctipo, :status => :created, :location => @doctipo }\r\n\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @doctipo.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def index\n @tipo_contas = TipoConta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_contas }\n end\n end", "def create\n @tipo_lista = TipoLista.new(params[:tipo_lista])\n\n respond_to do |format|\n if @tipo_lista.save\n format.html { redirect_to(@tipo_lista, :notice => 'Tipo lista cadastrado com sucesso.') }\n format.xml { render :xml => @tipo_lista, :status => :created, :location => @tipo_lista }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_lista.errors, :status => :unprocessable_entity }\n end\n end\n end", "def busca\n\t\t@anuncios = Anuncio.where(\"descricao LIKE :filtro OR titulo LIKE :filtro OR categoria LIKE :filtro\", {:filtro => \"%#{params[:filtro]}%\"})\n\tend", "def index\n @search = TipoRecibo.search(params[:search])\n @tipo_recibos = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @tipo_recibos }\n end\n end", "def tipo_params\n params.require(:tipo).permit(:nombre)\n end", "def tipo_params\n params.require(:tipo).permit(:nombre)\n end", "def tipo_de_servicio_params\n params.require(:tipo_de_servicio).permit(:nombre)\n end", "def set_tipo_de_servicio\n @tipo_de_servicio = TipoDeServicio.find(params[:id])\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 new\n @titulacionesdoctipo = Titulacionesdoctipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @titulacionesdoctipo }\n end\n end", "def index\n @ficha_tematicas = FichaTematica.busqueda(params[:page], params[:generico], params[:buscar])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ficha_tematicas }\n end\n end", "def resultados\n if params[:checklist] == '1'\n self.taxones = taxones.datos_arbol_con_filtros\n checklist\n else\n self.taxones = taxones.select_basico.order(:nombre_cientifico)\n return if formato == 'xlsx'\n\n self.taxones = taxones.offset(offset).limit(por_pagina)\n\n # Si solo escribio un nombre\n if params[:id].blank? && params[:nombre].present?\n taxones.each do |t|\n t.cual_nombre_comun_coincidio(params[:nombre])\n end\n end\n end # End checklist\n end", "def index\n @tiposcontratos = Tiposcontrato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tiposcontratos }\n end\n end", "def index\n @tipo_de_servicios = TipoDeServicio.all\n end", "def fio_titulo_params\r\n params.require(:fio_titulo).permit(:tipo)\r\n end", "def filtro_particular(conscaso, params_filtro)\n return conscaso\n end", "def treino_params\n params.require(:treino).permit(:aluno_id, :funcionario_id, :tipo_exercicio_id, :dataTreino)\n end", "def tipo_veiculo_params\n params.require(:tipo_veiculo).permit(:tipo)\n end", "def filter_params\n params.fetch(:filter, {}).permit(:text, :type)\n end", "def tipo_fornecedor_params\n params.require(:tipo_fornecedor).permit(:nome, :condominio_id, :tenant_id)\n end", "def extrato_params\n params[:extrato].permit(:valor, :tipo_operacao_id, :nova_conta_id)\n end", "def tipo_venda_params\n params.require(:tipo_venda).permit(:tipo)\n end", "def tipo_de_pago_params\n params.require(:tipo_de_pago).permit(:nombre)\n end", "def new\n @ponto = Ponto.new\n @t = params[:estagiario_id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def servico_pacote_params\n params.require(:servico_pacote).permit(:dataInicio, :dataRetorno, :destino, :localSaida, :nomeTrans, :veiculo, :cnpjTrans, :precoTrans, :nomeHotel, :cnpjHotel, :descHotel, :descQuarto, :precoHotel, :descPacote, :precoPacote, :status)\n end", "def predio_params\n params.require(:predio).permit(:cd_sindico, :nm_sindico, :nm_predio, :cd_numero, :cd_bloco, :cd_cep, :ds_endereco, :ds_municipio, :ds_regioesSociais, :cd_telefone)\n end", "def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n log(\"Se ha creado la nomina #{@lt}\", 0)\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: 'La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end", "def tipoapreensao_params\n params.require(:tipoapreensao).permit(:ttpcodigo, :ttpatualiza)\n end", "def tarifas_servicio_params\n params.require(:tarifas_servicio).permit(:PKSERVICIO, :SER_DESCRIPCION, :SER_NOTAS)\n end", "def index \n # listagem de documentos\n @tipo_documento = []\n if !params[:tipo] or params[:tipo][:tipo_documento_id].blank?\n @tipo_documento << ['- Selecione -',''] \n else\n TipoDocumento.find_all_by_id( params[:tipo][:tipo_documento_id]).each do |t|\n @tipo_documento << [t.tipo, t.id]\n end\n end\n TipoDocumento.all.each do |t|\n @tipo_documento << [t.tipo, t.id] if !@tipo_documento.include? [t.tipo, t.id]\n end\n \n \n # Novo Documento\n @documento = Documento.new\n \n # Listagem de Documentos\n @documentos = [] \n condition = ''\n if current_usuario.entidade.nil?\n condition = \"and cliente_id = #{current_usuario.id}\" \n else\n condition = \"and cartorio_id = #{current_usuario.entidade_id}\" \n end\n \n if params[:tipo] and !params[:tipo][:tipo_documento_id].blank?\n @documentos = Documento.all(:conditions => \"tipo_documento_id = #{params[:tipo][:tipo_documento_id]} #{condition}\" ).paginate(:page =>params[:page], :per_page =>10)\n end\n \n \n # Resposta \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end", "def index\n @telefonos = @persona.telefonos.find(:all, :order => \"tipo ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @telefonos }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_recibo }\n end\n end", "def index\n tipo_elemento_id = params[:tipo_elemento_id]\n @elementos = Elemento.where(:tipo_elemento_id => tipo_elemento_id).search(params[:search], params[:page])\n end", "def filter_pedido_atestado(acesso)\n @curso = params[:curso]\n # @curso_busca = Curso.where(\"id in #{params[:curso_id]}\")\n @nivel = params[:nivel]\n @situacao = params[:situacao_id]\n @situacao_busca = Situacao.where(\"id in #{acesso}\")\n \n if @situacao.to_s != \"\"\n filtro = \"situacao_id = #{@situacao}\"\n else\n filtro = \"situacao_id in #{acesso}\"\n end\n\n if @curso.to_s != \"\"\n filtro += \" and curso_id = '\" + @curso.to_s + \"'\"\n end\n\n if @nivel.to_s != \"\"\n idCurso = \"\"\n cursos = Curso.where(nivelEscolaridade: @nivel)\n cursos.each do |curso|\n idCurso = idCurso + curso.id.to_s + \",\"\n end\n idCurso = idCurso[0..(idCurso.length-2)]\n filtro += \" and curso_id in (\" + idCurso + \")\"\n end\n\n @pedido_atestados = PedidoAtestado.where(filtro).order(\"created_at\")\n end", "def tipos_usuario_params\r\n params.require(:tipos_usuario).permit(:tipo)\r\n end", "def index\n @filterrific = initialize_filterrific(\n DirectorTesisRegistro,\n params[:filterrific],\n select_options:{\n sorted_by: DirectorTesisRegistro.options_for_sorted_by\n },\n ) or return\n @director_tesis_registros = @filterrific.find.where(revisado: false).order(\"created_at DESC\").page(params[:pagina])\n\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n # There is an issue with the persisted param_set. Reset it.\n puts \"Se tuvieron que restablecer los valores: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n end", "def index\n @q = Servidor.ransack(params[:q])\n @q.sorts = 'nome'\n @servidores = @q.result.page params[:page]\n respond_to do |format|\n format.html\n format.csv do\n send_data @servidores.except(:limit, :offset).to_csv, filename: \"concentradores -#{Date.today}.csv\"\n end\n end\n end", "def create_filter(**args)\n params = parameters(args) do\n required_params :name, :conditions, :type\n optional_params :name, :conditions, :type\n end\n request(:post, 'filters', params)\n end", "def servico_params\n params.require(:servico).permit(:nome, :descricao, :status)\n end", "def create\n @tipo_contrato = TipoContrato.new(params[:tipo_contrato])\n \n respond_to do |format|\n if @tipo_contrato.save\n flash[:notice] = 'TiposContratos creada correctamente.'\n format.html { params[:oper].nil? ? redirect_to(@tipo_contrato) : render(:text => \"Ok\")}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_contrato.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @titulo = \"Todos los proveedores\"\n unless params[:filtro].nil?\n proveedores = []\n if FiltroListaProveedores::FILTROS.include?(params[:filtro]) and not params[:valor].nil?\n case params[:filtro]\n when \"categoria\"\n @categoria = Categoria.find(params[:valor])\n proveedores = @categoria.nil? ? [] : @categoria.proveedores\n @cant_resultados = proveedores.size\n @titulo = @categoria.nombre\n when \"tipo\"\n existe_tipo = Proveedor::TIPO_EMPRESA.include?(params[:valor])\n @tipo = existe_tipo ? params[:valor].to_s.humanize : nil\n proveedores = existe_tipo ? Proveedor.where(:tipo_proveedor => params[:valor]) : []\n @cant_resultados = proveedores.size\n @titulo = existe_tipo ? @tipo : \"Por tipo\"\n when \"ubicacion\"\n @ubicacion = UbicacionGeografica.find(params[:valor])\n unless @ubicacion.nil? or @ubicacion.tipo != 'estado'\n #case @ubicacion.tipo\n #when 'pais'\n # proveedores = @ubicacion.proveedores_de_pais\n #when 'estado'\n proveedores = @ubicacion.proveedores\n #when 'municipio'\n # proveedores = @ubicacion.proveedores_de_municipio\n #when 'localidad'\n # proveedores = @ubicacion.proveedores_de_localidad\n #end\n end\n @cant_resultados = proveedores.size\n @titulo = @ubicacion.tipo.humanize+\" \"[email protected]\n end\n end\n else\n proveedores = Proveedor.order('created_at DESC')\n end\n @cant_resultados = proveedores.size\n @proveedores = proveedores.includes(:localidad,:municipio,:estado).order('created_at DESC').page(params[:p])\n @titulo += \" (\"+@cant_resultados.to_s+\")\"\n add_breadcrumb :index, :proveedores_path\n @categorias = Categoria.con_proveedores\n @categorias_meta = \"\"\n for c in @categorias\n @categorias_meta += c.nombre+\", \"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proveedores }\n end\n end", "def tipo_de_imovel_params\n params.require(:tipo_de_imovel).permit(:descricao, :tipoDeContrato, :valor)\n end", "def new\n @tipo_restaurante = TipoRestaurante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_restaurante }\n end\n end", "def index\n @from = \"#{params['from']}\".to_date rescue nil\n @to = \"#{params['to']}\".to_date rescue nil\n @estado = \"#{params['estado']}\"\n\n p \"filtering by from: #{@from} & to: #{@to} & estado: #{@estado}\"\n \n @pedidos = Pedido.all\n @pedidos = @pedidos.where(\"fecha_entrega >= (?)\", @from) if @from\n @pedidos = @pedidos.where(\"fecha_entrega <= (?)\", @to) if @to\n @pedidos = @pedidos.where(\"estado ilike ? \", \"%#{@estado}%\") if @estado\n @pedidos = @pedidos.order(fecha: :desc, id: :desc)\n\n @estados = Pedido.select('distinct lower(estado) estado').map(&:estado)\n @estados = @estados.select{|e| !e.include?('pagado paypal')}\n @estados.push('pagado paypal')\n \n end", "def incluir_filtro\n incluir_filtro_btn.click\n end", "def tipo_funcionario_params\n params.require(:tipo_funcionario).permit(:tipo)\n end", "def new\n @tipo_lista = TipoLista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_lista }\n end\n end", "def add_type_paiement\n data = params[:type_id]\n\n #recherche et suppression\n query = Modepaiement.find(data)\n query.status = 1\n if query.save\n redirect_to parametre_type_paiement_path\n end\n end", "def recursoshumanos_tipo_vinculo_params\n params.require(:recursoshumanos_tipo_vinculo).permit(:nome)\n end", "def campos_filtro1_gen\n campos_filtro1\n end", "def tipo_consulta_params\n params.require(:tipo_consulta).permit(:nome, :duracao)\n end", "def abrir_filtro\n wait_until_btn_selecione_visible\n btn_selecione.click\n end", "def tipoocorrencium_params\n params.require(:tipoocorrencium).permit(:desc_tipoocorrencia)\n end", "def new\n @tipo_iva = TipoIva.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_iva }\n end\n end", "def index\n if params[:buscar].nil?\n @nota_destacadas = NotaDestacada.paginate(:per_page => 20, :page => params[:page])\n else\n @nota_destacadas = NotaDestacada.paginate(:per_page => 20, :page => params[:page], :conditions => [\"titulo LIKE ? OR resumen LIKE ?\", '%' + params[:buscar] + '%', '%' + params[:buscar] + '%'])\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nota_destacadas }\n end\n end", "def create\n @utilizador = Utilizador.find(current_utilizador.id)\n @patrocinio = @utilizador.patrocinios.build(params[:patrocinio])\n\n respond_to do |format|\n if @patrocinio.save\n @@filter_id = @patrocinio.id\n format.html { redirect_to @patrocinio, notice: 'Patrocinio was successfully created.' }\n format.json { render json: @patrocinio, status: :created, location: @patrocinio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patrocinio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_usuario = TipoUsuario.new(tipo_usuario_params)\n @tipo_usuarios = TipoUsuario.all.paginate(page: params[:page], per_page: 5)\n @action = { title: \"Novo\", button: \"Salvar\"}\n\n respond_to do |format|\n if @tipo_usuario.save\n format.html { redirect_to action: \"new\", notice: 'TIpo Usuário criada com sucesso.' }\n format.json { render :show, status: :created, location: @tipo_usuario }\n else\n format.html { render :new, location: @tipo_usuario}\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @filterrific = initialize_filterrific(\n CambioDirectorTesisRegistro,\n params[:filterrific],\n select_options:{\n sorted_by: CambioDirectorTesisRegistro.options_for_sorted_by\n },\n ) or return\n @cambio_director_tesis_registros = @filterrific.find.where(revisado: false).order(\"created_at DESC\").page(params[:pagina])\n\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n # There is an issue with the persisted param_set. Reset it.\n puts \"Se tuvieron que restablecer los valores: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n end", "def ofrendatri_params\n params.require(:ofrendatri).permit(:valor, :trimestre)\n end", "def index\n @descriptor_genericos = DescriptorGenerico.paginate(:per_page => 20, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @descriptor_genericos }\n end\n end", "def index\n @tipo_fornecedors = TipoFornecedor.all\n end", "def index\n #@unitarios = Unitario.all\n #@grupos_unitarios = GruposUnitario.all\n @filterrific = initialize_filterrific(\n InscripcionDiplomado,\n params[:filterrific],\n select_options: {\n with_grupos_unitario_id: GruposDiplomado.seleccion_curso_nombre,\n with_documentos_validados: InscripcionDiplomado.options_for_documentos_validados\n },\n ) or return\n @inscripcion_diplomados = @filterrific.find.page(params[:pagina])\n\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n # There is an issue with the persisted param_set. Reset it.\n puts \"Se restablecieron los parámetros: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n end", "def sorteio_params\n params.require(:sorteio).permit(:descricao, :regras, :data,\n amigos_attributes: [:id, :nome, :email, :_destroy]\n )\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @filter_param }\n end\n end", "def new\n @tipo_pago = TipoPago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_pago }\n end\n end", "def tipo_unidad_params\n params.require(:tipo_unidad).permit(:nombre)\n end", "def create\n @resultadoconsultum = Resultadoconsultum.new(resultadoconsultum_params)\n\t\n\n\trequire 'nokogiri'\n\t\n\t@doc = Nokogiri::XML(File.open(\"exemplos/emplo.xml\"))\n\n\tcar_tires = @doc.xpath(\"//firstname\")\n\t\n\tdoc = Nokogiri::XML(File.open(\"emplo.xml\"))\n\tdoc.xpath('firstname').each do\n\t\tcar_tires\n\tend\n\n\t \n respond_to do |format|\n if @resultadoconsultum.save\n format.html { redirect_to @resultadoconsultum, notice: car_tires }\n format.json { render :show, status: :created, location: @resultadoconsultum }\n else\n format.html { render :new }\n format.json { render json: @resultadoconsultum.errors, status: :unprocessable_entity }\n end\n end\n end", "def asiento_de_servicio_params\n params.require(:asiento_de_servicio).permit(:nro, :estado)\n end", "def create\n @tipo_vinculo = TipoVinculo.new(params[:tipo_vinculo])\n\n respond_to do |format|\n if @tipo_vinculo.save\n flash[:notice] = 'TipoVinculo was successfully created.'\n format.html { redirect_to(@tipo_vinculo) }\n format.xml { render :xml => @tipo_vinculo, :status => :created, :location => @tipo_vinculo }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_vinculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def aluno_params\n params.require(:aluno).permit(:nome, :ra, :email, :curso_id, :search)\n end", "def index\n @cantores = Cantor.paginate :page => params[:page], :order => 'nome ASC', :per_page => 20\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cantores }\n end\n end", "def estaciones\n\n param_estacion = params[:estacion]\n param_fecha = params[:fecha].to_i\n @info_polens = InfoPolen.where({\"ESTACIONES\" => param_estacion, \"FECHA\" => param_fecha}).order_by(:TIPOS_POLINICOS.asc)\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end", "def objeto_params\n params.require(:objeto).permit(:categoria_objeto_id, :nome, :unidade_medida, :meta, :observacoes)\n end", "def objeto_params\n params.require(:objeto).permit(:categoria_objeto_id, :nome, :unidade_medida, :meta, :observacoes)\n end" ]
[ "0.6420355", "0.5801892", "0.5782677", "0.5694712", "0.55748594", "0.5571271", "0.5567292", "0.551429", "0.54913956", "0.54646015", "0.5461918", "0.54501", "0.5439359", "0.5402195", "0.5397931", "0.5374148", "0.5367078", "0.53659004", "0.53622544", "0.5349792", "0.5334668", "0.5318265", "0.5317491", "0.52984834", "0.52915436", "0.528338", "0.5278184", "0.5274763", "0.5264029", "0.5263771", "0.5263771", "0.52625227", "0.52621704", "0.5260867", "0.52607334", "0.5252863", "0.524908", "0.5247232", "0.52434534", "0.5239884", "0.5236549", "0.5226456", "0.5223273", "0.5214298", "0.52124035", "0.5208425", "0.5206315", "0.5198949", "0.51974124", "0.519575", "0.51894826", "0.5187589", "0.51871496", "0.5186716", "0.51838326", "0.51835954", "0.5180889", "0.5180113", "0.5179488", "0.5179398", "0.51603514", "0.51550967", "0.51515174", "0.5151047", "0.51485574", "0.5148218", "0.51479423", "0.51445794", "0.51354367", "0.5135381", "0.51337224", "0.5132821", "0.512291", "0.51197195", "0.5119718", "0.51179796", "0.51170963", "0.510563", "0.5103495", "0.5102116", "0.509205", "0.5091793", "0.508926", "0.50891095", "0.50834787", "0.5081903", "0.5077601", "0.5076608", "0.5072902", "0.5070839", "0.50679845", "0.50676394", "0.5065137", "0.5065061", "0.5061726", "0.5058685", "0.5056264", "0.5054165", "0.50527656", "0.50527656" ]
0.6709314
0
PUT /tipo_filtros/1 PUT /tipo_filtros/1.xml
def update @tipo_filtro = TipoFiltro.find(params[:id]) respond_to do |format| if @tipo_filtro.update_attributes(params[:tipo_filtro]) format.html { redirect_to(@tipo_filtro, :notice => 'TipoFiltro was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @tipo_filtro.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end", "def update\n @tipo_vinculo = TipoVinculo.find(params[:id])\n\n respond_to do |format|\n if @tipo_vinculo.update_attributes(params[:tipo_vinculo])\n flash[:notice] = 'TipoVinculo was successfully updated.'\n format.html { redirect_to(@tipo_vinculo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_vinculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n format.html { redirect_to tipos_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end", "def update\n @tipo_iva = TipoIva.find(params[:id])\n\n respond_to do |format|\n if @tipo_iva.update_attributes(params[:tipo_iva])\n flash[:notice] = 'TipoIva was successfully updated.'\n format.html { redirect_to(@tipo_iva) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_iva.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_contrato = TipoContrato.find(params[:id])\n respond_to do |format|\n if @tipo_contrato.update_attributes(params[:tipo_contrato])\n flash[:notice] = 'TiposContratos actualizado correctamente.'\n format.html { redirect_to(@tipo_contrato) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_contrato.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_tipo_de_servicio\n @tipo_de_servicio = TipoDeServicio.find(params[:id])\n end", "def update\n @tipo_fuente = TipoFuente.find(params[:id])\n\n respond_to do |format|\n if @tipo_fuente.update_attributes(params[:tipo_fuente])\n format.html { redirect_to(@tipo_fuente, :notice => 'TipoFuente was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_fuente.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_de_documento.update_attributes(params[:tipo_de_documento])\n format.html { redirect_to(@tipo_de_documento, :notice => 'Tipo de documento atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_de_documento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @filtro_vehiculo = FiltroVehiculo.find(params[:id])\n\n respond_to do |format|\n if @filtro_vehiculo.update_attributes(params[:filtro_vehiculo])\n format.html { redirect_to(@filtro_vehiculo, :notice => 'FiltroVehiculo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @filtro_vehiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_articulo = TipoArticulo.find(params[:id])\n\n respond_to do |format|\n if @tipo_articulo.update_attributes(params[:tipo_articulo])\n flash[:notice] = 'TipoArticulo was successfully updated.'\n format.html { redirect_to(@tipo_articulo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_articulo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @tipo_recibo.update_attributes(params[:tipo_recibo])\n format.html { redirect_to(@tipo_recibo, :notice => 'Tipo recibo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_recibo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @orgao = Orgao.find(params[:id])\n\n params[:orgao][:tipo_atendimento_ids] ||= []\n respond_to do |format|\n if @orgao.update_attributes(params[:orgao])\n\t\tformat.html { redirect_to @orgao, notice: \"Local de atendimento: #{@orgao.nome}, foi atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orgao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_pago = TipoPago.find(params[:id])\n\n respond_to do |format|\n if @tipo_pago.update_attributes(params[:tipo_pago])\n format.html { redirect_to(@tipo_pago, :notice => 'TipoPago was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_pago.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @tipo_filtro = TipoFiltro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_filtro }\n end\n end", "def new\n @tipo_filtro = TipoFiltro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_filtro }\n end\n end", "def update\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n if @tipo_usuario.update_attributes(params[:tipo_usuario])\n format.html { redirect_to(@tipo_usuario, :notice => ' - Dados atualizados com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n\n respond_to do |format|\n if @tipo_restaurante.update_attributes(params[:tipo_restaurante])\n format.html { redirect_to(@tipo_restaurante, :notice => 'Tipo restaurante was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_restaurante.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_filtro = TipoFiltro.new(params[:tipo_filtro])\n\n respond_to do |format|\n if @tipo_filtro.save\n format.html { redirect_to(@tipo_filtro, :notice => 'TipoFiltro was successfully created.') }\n format.xml { render :xml => @tipo_filtro, :status => :created, :location => @tipo_filtro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_filtro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @tiposproceso = Tiposproceso.find(params[:id])\n\n respond_to do |format|\n if @tiposproceso.update_attributes(params[:tiposproceso])\n format.html { redirect_to(@tiposproceso, :notice => 'Tiposproceso was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tiposproceso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_lista = TipoLista.find(params[:id])\n\n respond_to do |format|\n if @tipo_lista.update_attributes(params[:tipo_lista])\n format.html { redirect_to(tipo_lista_url(@tipo_lista), :notice => 'Tipo lista atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_lista.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_tipo_movimentacao\n @tipo_movimentacao = TipoMovimentacao.find(params[:id])\n end", "def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @tipo_filtro = TipoFiltro.find(params[:id])\n @tipo_filtro.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_filtros_url) }\n format.xml { head :ok }\n end\n end", "def update\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n if @tipo_vehiculo.update_attributes(params[:tipo_vehiculo])\n format.html { redirect_to(@tipo_vehiculo, :notice => 'TipoVehiculo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_vehiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_conta = TipoConta.find(params[:id])\n\n respond_to do |format|\n if @tipo_conta.update_attributes(params[:tipo_conta])\n flash[:notice] = 'TipoConta was successfully updated.'\n format.html { redirect_to(tipo_contas_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_conta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n if @tipo_contrato.update_attributes(params[:tipo_contrato])\n format.html { redirect_to tipo_contratos_path, notice: 'Tipo de contrato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_contrato.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n if @tipo_nota.update_attributes(params[:tipo_nota])\n format.html { redirect_to(@tipo_nota, :notice => 'TipoNota was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_nota.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_lancamento = TipoLancamento.find(params[:id])\n\n respond_to do |format|\n if @tipo_lancamento.update_attributes(params[:tipo_lancamento])\n flash[:notice] = 'TipoLancamento was successfully updated.'\n format.html { redirect_to(@tipo_lancamento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_lancamento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tipo_veiculo\n @tipo_veiculo = TipoVeiculo.find(params[:id])\n end", "def update\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_documento.update_attributes(params[:tipo_documento])\n format.html { redirect_to @tipo_documento, notice: 'Tipo documento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_proy = TipoProy.find(params[:id])\n\n respond_to do |format|\n if @tipo_proy.update_attributes(params[:tipo_proy])\n flash[:notice] = 'TipoProy was successfully updated.'\n format.html { redirect_to(@tipo_proy) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_proy.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_controles = TipoControle.find(params[:id])\n\n respond_to do |format|\n if @tipo_controles.update_attributes(params[:tipo_controle])\n flash[:notice] = 'CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@tipo_controles) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_controles.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_de_imposto.update(tipo_de_imposto_params)\n format.html { redirect_to @empresa, notice: 'Tipo de imposto actualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @tipo_de_imposto }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_imposto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_de_exercicio = TipoDeExercicio.find(params[:id])\n\n respond_to do |format|\n if @tipo_de_exercicio.update_attributes(params[:tipo_de_exercicio])\n flash[:notice] = 'TipoDeExercicio was successfully updated.'\n format.html { redirect_to(@tipo_de_exercicio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_de_exercicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_curso = TipoCurso.find(params[:id])\n\n respond_to do |format|\n if @tipo_curso.update_attributes(params[:tipo_curso])\n flash[:notice] = 'TipoCurso actualizado correctamente.'\n format.html { redirect_to(@tipo_curso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_curso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tarifas = Tarifas.find(params[:id])\n\n respond_to do |format|\n if @tarifas.update_attributes(params[:tarifas])\n flash[:notice] = 'Tarifas was successfully updated.'\n format.html { redirect_to(@tarifas) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tarifas.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n if @tipo_usuario.update_attributes(params[:tipo_usuario])\n format.html { redirect_to @tipo_usuario, notice: 'Tipo usuario fue actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tarifas_servicio\n @tarifas_servicio = TarifasServicio.find(params[:id])\n end", "def update\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n if @tservicio.update_attributes(params[:tservicio])\n format.html { redirect_to(@tservicio, :notice => 'Tservicio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tservicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @voluntario = Voluntario.find(params[:id])\n params[:voluntario].delete :inclusoes\n\n respond_to do |format|\n if @voluntario.update_attributes(params[:voluntario])\n format.html { redirect_to(@voluntario, :notice => 'Voluntário atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @voluntario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_tipo\n @tipo = Tipo.find(params[:id])\n end", "def update\n respond_to do |format|\n if @tipo_documento.update(tipo_documento_params)\n format.html { redirect_to @tipo_documento, notice: 'Se ha actualizado el Tipo de documento.' }\n format.json { render :show, status: :ok, location: @tipo_documento }\n else\n format.html { render :edit }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n if @tipo_atendimento.update_attributes(params[:tipo_atendimento])\n format.html { redirect_to @tipo_atendimento, notice: \"Tipo de atendimento: #{@tipo_atendimento.descricao}, foi atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_atendimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @titulacionesdoctipo = Titulacionesdoctipo.find(params[:id])\n\n respond_to do |format|\n if @titulacionesdoctipo.update_attributes(params[:titulacionesdoctipo])\n format.html { redirect_to(@titulacionesdoctipo, :notice => 'Titulacionesdoctipo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @titulacionesdoctipo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @evolucao_tipo.update(evolucao_tipo_params)\n format.html { redirect_to @evolucao_tipo, notice: 'Evolucao tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @evolucao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @documentotipo = Documentotipo.find(params[:id])\n\n respond_to do |format|\n if @documentotipo.update_attributes(params[:documentotipo])\n format.html { redirect_to @documentotipo, notice: 'Documentotipo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @documentotipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def resource_params\n params.require(:tratamiento).permit(:tipo)\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def evolucao_tipo_params\n params.require(:evolucao_tipo).permit(:nome, :inativo, campos_attributes: [ :id, :nome, :titulo, :requerido, :tipo_campo, :_destroy ])\n end", "def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n \n\n respond_to do |format|\n\n \n if @solicitudrecurso.update_attributes(:motivos => params[:motivos])\n \n @solicitudrecursos = Solicitudrecurso.find_all_by_usuario_id(@usuario_actual.id)\n format.html { redirect_to :action => \"index\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @solicitudrecurso.errors, :status => :unprocessable_entity }\n end\n \n end\n end", "def destroy\n @oferta = Oferta.find(params[:id])\n @oferta.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_ofertas_path }\n format.json { head :ok }\n end\n end", "def update\n respond_to do |format|\n if @tipo_de_imovel.update(tipo_de_imovel_params)\n format.html { redirect_to @tipo_de_imovel, notice: 'Tipo de imovel was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_imovel }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_imovel.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tipo_documento\n @tipo_documento = TipoDocumento.find(params[:id])\n end", "def update\n respond_to do |format|\n if @tipo_ventum.update(tipo_ventum_params)\n format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_ventum }\n else\n format.html { render :edit }\n format.json { render json: @tipo_ventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tipo_ventum\n @tipo_ventum = TipoVentum.find(params[:id])\n end", "def update\n respond_to do |format|\n if @topico.update(topico_params)\n format.html { redirect_to set_path, notice: 'Tópico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @operation = Operation.find(params[:id])\n cita = Cita.find(@operation.cita_id)\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n if cita.status == 'estudio_en_proceso'\n cita.concluir_estudio!\n elsif cita.status ==\"estudio_exitoso\"\n cita.interpretar!\n end\n flash[:notice] = 'El estudio ha sido actualizado'\n format.html { redirect_to :controller => 'pacientes',:action => 'show',:id => cita.paciente_id }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @solicitacao_tipo.update(solicitacao_tipo_params)\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(etiqueta_params)\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @regiaos = Regiao.find(params[:id])\n\n respond_to do |format|\n if @regiaos.update_attributes(params[:regiao])\n flash[:notice] = 'REGIÃO SALVA COM SUCESSO'\n format.html { redirect_to(@regiaos) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @regiaos.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @orc_ficha = OrcFicha.find(params[:id])\n\n respond_to do |format|\n if @orc_ficha.update_attributes(params[:orc_ficha])\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_ficha) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_ficha.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_veiculo.update(tipo_veiculo_params)\n format.html { redirect_to @tipo_veiculo, notice: 'Tipo veiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_veiculo }\n else\n format.html { render :edit }\n format.json { render json: @tipo_veiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n if @tipo_actividad.update_attributes(params[:tipo_actividad])\n format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n if @tipo_convenio.update_attributes(params[:tipo_convenio])\n format.html { redirect_to @tipo_convenio, notice: 'Tipo convenio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_convenio.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @itemtipo = Itemtipo.find(params[:id])\n\n if @itemtipo.update(itemtipo_params)\n head :no_content\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end", "def update\n @estagiarios = Estagiario.find(params[:id])\n\n respond_to do |format|\n if @estagiarios.update_attributes(params[:estagiario])\n flash[:notice] = 'ESTAGIÁRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n if @tipo_vehiculo.update_attributes(params[:tipo_vehiculo])\n format.html { redirect_to @tipo_vehiculo, notice: 'Tipo vehiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @imovel = Imovel.find(params[:id])\n \n if [email protected]?\n @imovel.attributes = {:vendedor_id => '0'}\n end\n \n # arranjo temporario porque não tá cadastrando com nome quando é terreno\n if @imovel.imovel_tipo_id==4\n @imovel.attributes = {:nome => \"TERRENO LOCALIZADO: \"[email protected]}\n end\n \n respond_to do |format|\n if @imovel.update_attributes(params[:imovel])\n format.html { redirect_to @imovel, notice: 'Imovel atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imovel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @doctipo = Doctipo.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @doctipo.update_attributes(params[:doctipo])\r\n flash[:notice] = 'Doctipo was successfully updated.'\r\n format.html { redirect_to(@doctipo) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @doctipo.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @lotto_type = LottoType.find(params[:id])\n\n respond_to do |format|\n if @lotto_type.update_attributes(params[:lotto_type])\n format.html { redirect_to(@lotto_type, :notice => 'Lotto type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lotto_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n if @tipo_item.update_attributes(params[:tipo_item])\n format.html { redirect_to @tipo_item, notice: 'Tipo item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_orden.update(tipo_orden_params)\n format.html { redirect_to @tipo_orden, notice: 'Tipo orden was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_orden }\n else\n format.html { render :edit }\n format.json { render json: @tipo_orden.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n if @relatorios.update_attributes(params[:relatorio])\n flash[:notice] = 'RELATORIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatorios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relatorios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_telefone = TipoTelefone.find(params[:id])\n\n respond_to do |format|\n if @tipo_telefone.update_attributes(params[:tipo_telefone])\n flash[:notice] = 'TipoTelefone was successfully updated.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_telefone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @descriptor_generico = DescriptorGenerico.find(params[:id])\n\n respond_to do |format|\n if @descriptor_generico.update_attributes(params[:descriptor_generico])\n flash[:notice] = 'Descriptor Generico se ha actualizado con exito.'\n format.html { redirect_to(admin_descriptor_genericos_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @descriptor_generico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @poi_type = PoiType.find(params[:id])\n\n respond_to do |format|\n if @poi_type.update_attributes(params[:poi_type])\n format.html { redirect_to [:admin, @poi_type], notice: 'Tipo de punto de interés actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poi_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoenvolvido.update(tipoenvolvido_params)\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @title_view = 'Tipo de Denuncias'\n @request_and_complaint_complaint_type = RequestAndComplaint::ComplaintType.find(params[:id])\n\n respond_to do |format|\n if @request_and_complaint_complaint_type.update_attributes(params[:request_and_complaint_complaint_type])\n format.html { redirect_to(@request_and_complaint_complaint_type, :notice => 'Complaint type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @request_and_complaint_complaint_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ativo.update(ativo_params)\n format.html { redirect_to @ativo, notice: \"#{type} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ativo }\n else\n format.html { render :edit }\n format.json { render json: @ativo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipos = Tipo.all\n if @ingrediente.update(ingrediente_params)\n flash[:success] = \"Ingrediente editado exitosamente\"\n redirect_to ingrediente_path(@ingrediente)\n else\n render 'ingredientes/edit'\n end\n end", "def set_situacao\n logger.debug \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n\n id_busca = params[:id]\n @os_id = params[:os_id]\n @os_tarefa = OsTarefa.find(id_busca)\n @os_tarefa.situacao=params[:situacao]\n @ordem_servico = OrdemServico.find(@os_id)\n logger.debug \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n\n if @os_tarefa.situacao=='REJEITADA'\n @os_tarefa.ordem_servico_pagamento= nil\n @os_tarefa.situacao=OsTarefa.situacoes[2]\n else\n @os_tarefa.ordem_servico_pagamento= @ordem_servico\n @os_tarefa.situacao=OsTarefa.situacoes[0]\n end\n @os_tarefa.save\n respond_to do |format|\n\n format.json { head :no_content }\n format.js { render :layout => false }\n\n end\n end", "def set_tipo_de_imovel\n @tipo_de_imovel = TipoDeImovel.find(params[:id])\n end", "def update\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n if @categorias_tipo.update_attributes(params[:cat_tipo])\n \t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n format.html { redirect_to cat_tipos_path, notice: 'Categorias tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_recursoshumanos_tipo_vinculo\n @recursoshumanos_tipo_vinculo = Recursoshumanos::TipoVinculo.find(params[:id])\n end", "def set_tipo_de_imposto\n @tipo_de_imposto = TipoDeImposto.find(params[:id])\n end", "def update\n @vicariato = Vicariato.find(params[:id])\n\n respond_to do |format|\n if @vicariato.update_attributes(params[:vicariato])\n flash[:notice] = 'Vicariato was successfully updated.'\n format.html { redirect_to(@vicariato) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vicariato.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n if @patrocinio.update_attributes(params[:patrocinio])\n @@filter_id = @patrocinio.id\n format.html { redirect_to @patrocinio, notice: 'Patrocinio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patrocinio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_de_pago.update(tipo_de_pago_params)\n format.html { redirect_to @tipo_de_pago, notice: 'Tipo de pago fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @tipo_de_pago }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_pago.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sotto_categoria = SottoCategoria.find(params[:id])\n\n respond_to do |format|\n if @sotto_categoria.update_attributes(params[:sotto_categoria])\n format.html { redirect_to(@sotto_categoria, :notice => 'Sotto categoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sotto_categoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n if @ativo_outro.update_attributes(params[:ativo_outro])\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.61366814", "0.60394704", "0.58904153", "0.5867853", "0.5830976", "0.5829597", "0.58077526", "0.5791402", "0.57527536", "0.57435465", "0.572947", "0.57198524", "0.5707464", "0.5693535", "0.5682523", "0.5680805", "0.56547993", "0.5631448", "0.5630538", "0.5624189", "0.5616587", "0.5605318", "0.5594945", "0.5594242", "0.5593289", "0.55874026", "0.55862415", "0.5581232", "0.558082", "0.55661094", "0.5560112", "0.5557165", "0.55371195", "0.55286413", "0.55267686", "0.5524327", "0.55157393", "0.55002", "0.5496344", "0.54848766", "0.54807234", "0.54797095", "0.54658747", "0.5459902", "0.54580885", "0.5448052", "0.5446851", "0.54454195", "0.54444426", "0.5443878", "0.54401433", "0.54187435", "0.54165256", "0.5413054", "0.54122025", "0.5398505", "0.5384044", "0.5382963", "0.5382393", "0.5381894", "0.53529054", "0.53519744", "0.5351711", "0.53506714", "0.53452086", "0.5344241", "0.5344124", "0.5342112", "0.5341858", "0.53417665", "0.5340955", "0.53355986", "0.5334333", "0.53299665", "0.5316192", "0.5315564", "0.53140455", "0.531384", "0.53119355", "0.5308187", "0.5298285", "0.5293024", "0.52879393", "0.52869743", "0.528527", "0.5283766", "0.5279438", "0.527441", "0.5271123", "0.5270575", "0.52682996", "0.52679014", "0.52671427", "0.5264248", "0.5257416", "0.52565444", "0.5254078", "0.5248071", "0.52279174", "0.52255964" ]
0.6699857
0
DELETE /tipo_filtros/1 DELETE /tipo_filtros/1.xml
def destroy @tipo_filtro = TipoFiltro.find(params[:id]) @tipo_filtro.destroy respond_to do |format| format.html { redirect_to(tipo_filtros_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n @tipo_de_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_de_documento_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_contratos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @filtro_vehiculo = FiltroVehiculo.find(params[:id])\n @filtro_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(filtro_vehiculos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_vinculo = TipoVinculo.find(params[:id])\n @tipo_vinculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_vinculos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n @tipo_restaurante.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_restaurantes_url) }\n format.xml { head :ok }\n end\n end", "def delete_type_paiement\n data = params[:type_id]\n\n #recherche et suppression\n query = Modepaiement.find(data)\n query.status = 0\n if query.save\n redirect_to parametre_type_paiement_path\n end\n end", "def destroy\n @tipo_pago = TipoPago.find(params[:id])\n @tipo_pago.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_pagos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_conta = TipoConta.find(params[:id])\n @tipo_conta.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_contas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @tipo_fuente = TipoFuente.find(params[:id])\n @tipo_fuente.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_fuentes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tiposproceso = Tiposproceso.find(params[:id])\n @tiposproceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposprocesos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_lancamento = TipoLancamento.find(params[:id])\n @tipo_lancamento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_lancamentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_iva = TipoIva.find(params[:id])\n @tipo_iva.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_ivas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_articulo = TipoArticulo.find(params[:id])\n @tipo_articulo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_articulos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @tipo_proy = TipoProy.find(params[:id])\n @tipo_proy.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_proys_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_vehiculos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @doctipo = Doctipo.find(params[:id])\r\n @doctipo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(doctipos_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @titulacionesdoctipo = Titulacionesdoctipo.find(params[:id])\n @titulacionesdoctipo.destroy\n\n respond_to do |format|\n format.html { redirect_to(titulacionesdoctipos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to(recursos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @data_file_filter = DataFileFilter.find(params[:id])\n @data_file_filter.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_file_filters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_nota = TipoNota.find(params[:id])\n @tipo_nota.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_notas_url) }\n format.xml { head :ok }\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_de_exercicio = TipoDeExercicio.find(params[:id])\n @tipo_de_exercicio.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_de_exercicios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @coleccionista = Coleccionista.find(params[:id])\n @coleccionista.destroy\n\n respond_to do |format|\n format.html { redirect_to(coleccionistas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_controles = TipoControle.find(params[:id])\n @tipo_controles.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_controles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contrato = Contrato.find(params[:id])\n @contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(contratos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vicariato = Vicariato.find(params[:id])\n @vicariato.destroy\n\n respond_to do |format|\n format.html { redirect_to(vicariatos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_usuario = TipoUsuario.find(params[:id])\n @tipo_usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @descriptor_generico = DescriptorGenerico.find(params[:id])\n @descriptor_generico.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_descriptor_genericos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @domicile_type = DomicileType.find(params[:id])\n @domicile_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @receita = Receita.find(params[:id])\n @receita.destroy\n\n respond_to do |format|\n format.html { redirect_to(receitas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @itemtipo.destroy\n\n head :no_content\n end", "def destroy\n @tarifas = Tarifas.find(params[:id])\n @tarifas.destroy\n\n respond_to do |format|\n format.html { redirect_to(tarifas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n @reputacao_veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_veiculos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @suministro = Suministro.find(params[:id])\n @suministro.destroy\n\n respond_to do |format|\n format.html { redirect_to(suministros_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reclamacao = Reclamacao.find(params[:id])\n @reclamacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(reclamacaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n @solicitudrecurso.destroy\n @tramos=Peticion.find_all_by_solicitudrecurso_id(@solicitudrecurso.id) # busco todos los tramos que tenian el id\n @tramos.each {|tramo| tramo.destroy} # los elimino en cascada\n\n respond_to do |format|\n format.html { redirect_to(solicitudrecursos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @arquivo = Arquivo.find(params[:id])\n\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id)\n\n if @comentarios\n @comentarios.delete_all\n end\n\n @arquivo.destroy\n\n respond_to do |format|\n format.html { redirect_to arquivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asistencia = Asistencia.find(params[:id])\n @asistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(asistencias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n @tramos=Peticion.where(\"solicitudrecurso_id = ?\",@solicitudrecurso.id).to_a # busco todos los tramos que tenian el id\n @tramos.each {|tramo| tramo.destroy} # los elimino en cascada\n @solicitudrecurso.destroy\n \n respond_to do |format|\n format.html { redirect_to(solicitudrecursos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sotto_categoria = SottoCategoria.find(params[:id])\n @sotto_categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(sotto_categorie_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nostro = Nostro.find(params[:id])\n @nostro.destroy\n\n respond_to do |format|\n format.html { redirect_to(nostros_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @precio = Precio.find(params[:id])\n @precio.destroy\n\n respond_to do |format|\n format.html { redirect_to(precios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_curso = TipoCurso.find(params[:id])\n @tipo_curso.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_cursos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @documento = Documento.find(params[:id])\n # Eliminar los registros asociativos de las tablas JOIN \n # para las asociaciones HBTM (has_and_belongs_to_many)\n #\n @documento.reconocimientos.destroy_all\n @documento.areas.destroy_all\n\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to documentos_url, :notice => \"#{@documento.titulo} eliminado\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conteudo = Conteudo.find(params[:id])\n @conteudo.destroy\nt=0\n respond_to do |format|\n format.html { redirect_to(exclusao_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @valor_sistema = ValorSistema.find(params[:id])\n @valor_sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to(valores_sistema_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @protocolo = Protocolo.find(params[:id])\n @protocolo.destroy\n\n respond_to do |format|\n format.html { redirect_to(protocolos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documentotipo = Documentotipo.find(params[:id])\n @documentotipo.destroy\n\n respond_to do |format|\n format.html { redirect_to documentotipos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @unidad = Unidad.find(params[:id])\n @unidad.destroy\n\n respond_to do |format|\n format.html { redirect_to(unidades_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @asociacion_perfil = AsociacionPerfil.find(params[:id])\n @asociacion_perfil.destroy\n\n respond_to do |format|\n format.html { redirect_to(asociacion_perfils_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contratosinterventoria = Contratosinterventoria.find(params[:id])\n @contratosinterventoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(contratosinterventorias_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @categoria_do_recebimento = CategoriaDoRecebimento.find(params[:id])\n @categoria_do_recebimento.destroy\n\n respond_to do |format|\n format.html { redirect_to(categoria_do_recebimentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @viviendastipostramite = Viviendastipostramite.find(params[:id])\n @viviendastipostramite.destroy\n\n respond_to do |format|\n format.html { redirect_to(viviendastipostramites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_documento.destroy\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url, notice: 'Se ha eliminado el Tipo de documento.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_status_selo_fiscal_tipo = Core::StatusSeloFiscalTipo.find(params[:id])\n @core_status_selo_fiscal_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to core_status_selo_fiscal_tipos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipos_pagamento = TiposPagamento.find(params[:id])\n @tipos_pagamento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_pagamentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pagos_detalhe = PagosDetalhe.find(params[:id])\n @pagos_detalhe.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/pagos/#{@pagos_detalhe.pago_id}\" }\n format.xml { head :ok }\n end\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def destroy\n @catastrosdato = Catastrosdato.find(params[:id])\n @catastrosdato.destroy\n\n respond_to do |format|\n format.html { redirect_to(catastrosdatos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vigencia = Vigencia.find(params[:id])\n @vigencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(vigencias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pagamento = Pagamento.find(params[:id])\n @pagamento.destroy\n\n respond_to do |format|\n format.html { redirect_to(pagamentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @requisicao = Requisicao.find(params[:id])\n @requisicao.destroy\n\n respond_to do |format|\n format.html { redirect_to(requisicoes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tservicio = Tservicio.find(params[:id])\n @tservicio.destroy\n\n respond_to do |format|\n format.html { redirect_to(tservicios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @barrio = Barrio.find(params[:id])\n @barrio.destroy\n\n respond_to do |format|\n format.html { redirect_to(barrios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to(avisos_url) }\n format.xml { head :ok }\n end\n end", "def delete_all(xpath); end", "def destroy\n @administrativo = Administrativo.find(params[:id])\n @administrativo.destroy\n\n respond_to do |format|\n format.html { redirect_to(administrativos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @repasse_fabrica = RepasseFabrica.find(params[:id])\n @repasse_fabrica.destroy\n\n respond_to do |format|\n format.html { redirect_to(repasses_fabrica_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @peso = Peso.find(params[:id])\n @peso.destroy\n\n respond_to do |format|\n format.html { redirect_to(pesos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n @solicitudrecurso.destroy\n \n respond_to do |format|\n @solicitudrecursos= Solicitudrecurso.find_all_by_usuario_id(@usuario_actual.id)\n format.html { render :action => \"index\" }\n format.xml { head :ok }\n end\n end", "def destroy\n @tcliente = Tcliente.find(params[:id])\n @tcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(tclientes_url) }\n format.xml { head :ok }\n end\n end", "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_convenio = TipoConvenio.find(params[:id])\n @tipo_convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_convenios_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.6612702", "0.65706843", "0.65391517", "0.65311044", "0.6518119", "0.650598", "0.6465929", "0.6457107", "0.6448614", "0.6426289", "0.64213353", "0.6415037", "0.6414201", "0.6405483", "0.6399571", "0.6369957", "0.63579535", "0.63555914", "0.6340907", "0.63392705", "0.63125205", "0.62887883", "0.62887883", "0.6278649", "0.62533677", "0.6250253", "0.623985", "0.6237831", "0.62364644", "0.62278646", "0.6225505", "0.6224253", "0.6221633", "0.6217371", "0.6207906", "0.62009025", "0.6197841", "0.6197817", "0.6190329", "0.618349", "0.618124", "0.617679", "0.6162807", "0.61613303", "0.6158629", "0.6157491", "0.6152769", "0.61486495", "0.6140756", "0.61392164", "0.61370254", "0.6124276", "0.61237144", "0.612306", "0.6121133", "0.6118344", "0.6112722", "0.6112529", "0.61115295", "0.61098456", "0.61047345", "0.6104147", "0.6103285", "0.608386", "0.6082623", "0.60822356", "0.60815597", "0.6081021", "0.60780597", "0.60721946", "0.6069104", "0.6067889", "0.6064865", "0.60647833", "0.6061607", "0.6055435", "0.60520667", "0.6048994", "0.6048863", "0.60463226", "0.6043229", "0.603891", "0.6034986", "0.6033311", "0.60307574", "0.6025671", "0.6021734", "0.602137", "0.601911", "0.6015639", "0.60133475", "0.60125494", "0.60098", "0.60086757", "0.6007598", "0.60072774", "0.60050184", "0.60020006", "0.59917796", "0.59905684" ]
0.7250184
0
Poorlynamed Campaign class resolver
def to_dripper ::Caffeinate.dripper_collection.resolve(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def campaign; Campaign.get(self.campaign_id); end", "def campaign; Campaign.get(self.campaign_id); end", "def campaign\n self.class.caffeinate_campaign\n end", "def campaign\n company.campaign\n end", "def get_instance(payload)\n CampaignInstance.new(@version, payload, )\n end", "def caffeinate_campaign\n return @caffeinate_campaign if @caffeinate_campaign.present?\n\n if ::Caffeinate.config.implicit_campaigns?\n @caffeinate_campaign = ::Caffeinate::Campaign.find_or_initialize_by(slug: campaign_slug)\n if @caffeinate_campaign.new_record?\n @caffeinate_campaign.name = \"#{name.delete_suffix('Dripper').titleize} Campaign\"\n @caffeinate_campaign.save!\n end\n else\n @caffeinate_campaign = ::Caffeinate::Campaign[campaign_slug]\n end\n\n @caffeinate_campaign\n end", "def campaign_for_contact entity\n entity.ensure_salesforce_id\n return if entity.salesforce_id.nil?\n \n campaign_member = campaign_member_for_contact(entity)\n return nil if campaign_member.nil?\n \n client.materialize('Campaign')\n SFDC_Models::Campaign.find(campaign_member.CampaignId)\n end", "def find\n Campaign.find(:first, :id => @id)\n end", "def get_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end", "def associated_class\n if options[:class_name]\n options[:class_name].constantize\n else\n klass.relative_const_get(attribute.to_s.camelize)\n end\n end", "def find_contactable contact\n contactable_type = contact.contactable_type\n id_param = contactable_type.classify.constantize.find(contact.contactable_id)\n return contactable = id_param\n end", "def campaign_slug\n @_campaign_slug || inferred_campaign_slug\n end", "def associated_class\n self[:class] ||= self[:class_name].constantize\n end", "def associated_class\n self[:class] ||= self[:class_name].constantize\n end", "def campaigns\r\n CampaignsController.instance\r\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def resolver; end", "def get_campaign\n if params[:campaign_path].nil?\n return nil\n end\n\n path = params[:campaign_path]\n\n @campaign = Rails.cache.fetch \"#{path}-campaign-info\" do\n Campaign.where(path: path).first\n end\n end", "def set_campaign\r\n\t\t@campaign = Campaign.find(params[:id])\r\n\tend", "def map_current_campaign\n\t\tobj = Campaign.all\n\t\tobj.map { |i| {i.id => i.name} }\n\tend", "def destination_class\n @destination_class ||= dummy_class_for(dest_table)\n end", "def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end", "def set_campaign\n\t\t@campaign = Campaign.find(params[:id])\n\tend", "def affiliate_class\n self.class.affiliate_class\n end", "def associated_class\n cached_fetch(:class) do\n begin\n constantize(self[:class_name])\n rescue NameError => e\n raise NameError, \"#{e.message} (this happened when attempting to find the associated class for #{inspect})\", e.backtrace\n end\n end\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def campaigns(options={})\n Resources::Campaigns.new(self, options)\n end", "def campaigns(id = nil, opts = {})\n load_resource(Campaign, id, opts)\n end", "def setup_aux_objs\n @campaign = Campaign.find(params[:campaign_id])\n @ads = @campaign.ads\n end", "def class_for_json_class(json_class)\n case json_class\n when MEGAM_ERROR\n Megam::Error\n when MEGAM_ACCOUNT\n Megam::Account\n when MEGAM_ACCOUNTCOLLECTION\n Megam::AccountCollection\n when MEGAM_ASSEMBLIES\n Megam::Assemblies\n when MEGAM_ASSEMBLIESCOLLECTION\n Megam::AssembliesCollection\n when MEGAM_ASSEMBLY\n Megam::Assembly\n when MEGAM_ASSEMBLYCOLLECTION\n Megam::AssemblyCollection\n when MEGAM_COMPONENTS\n Megam::Components\n when MEGAM_COMPONENTSCOLLECTION\n Megam::ComponentsCollection\n when MEGAM_REQUEST\n Megam::Request\n when MEGAM_REQUESTCOLLECTION\n Megam::RequestCollection\n when MEGAM_SSHKEY\n Megam::SshKey\n when MEGAM_SSHKEYCOLLECTION\n Megam::SshKeyCollection\n when MEGAM_EVENTSVM\n Megam::EventsVm\n when MEGAM_EVENTSVMCOLLECTION\n Megam::EventsVmCollection\n when MEGAM_EVENTSMARKETPLACE\n Megam::EventsMarketplace\n when MEGAM_EventsMarketplaceCollection\n Megam::EventsMarketplaceCollection\n when MEGAM_LICENSE\n Megam::License\n when MEGAM_LICENSECOLLECTION\n Megam::LicenseCollection\n when MEGAM_FLAVORS\n Megam::Flavors\n when MEGAM_FLAVORSCOLLECTION\n Megam::FlavorsCollection\n when MEGAM_EVENTSALL\n Megam::EventsAll\n when MEGAM_EVENTSALLCOLLECTION\n Megam::EventsAllCollection\n when MEGAM_EVENTSCONTAINER\n Megam::EventsContainer\n when MEGAM_EVENTSCONTAINERCOLLECTION\n Megam::EventsContainerCollection\n when MEGAM_EVENTSBILLING\n Megam::EventsBilling\n when MEGAM_EVENTSBILLINGCOLLECTION\n Megam::EventsBillingCollection\n when MEGAM_EVENTSSTORAGE\n Megam::EventsStorage\n when MEGAM_EVENTSSTORAGECOLLECTION\n Megam::EventsStorageCollection\n when MEGAM_MARKETPLACE\n Megam::MarketPlace\n when MEGAM_MARKETPLACECOLLECTION\n Megam::MarketPlaceCollection\n when MEGAM_ORGANIZATION\n Megam::Organizations\n when MEGAM_ORGANIZATIONSCOLLECTION\n Megam::OrganizationsCollection\n when MEGAM_DOMAIN\n Megam::Domains\n when MEGAM_DOMAINCOLLECTION\n Megam::DomainsCollection\n when MEGAM_SENSORS\n Megam::Sensors\n when MEGAM_SENSORSCOLLECTION\n Megam::SensorsCollection\n when MEGAM_SNAPSHOTS\n Megam::Snapshots\n when MEGAM_SNAPSHOTSCOLLECTION\n Megam::SnapshotsCollection\n when MEGAM_BACKUPS\n Megam::Backups\n when MEGAM_BACKUPSCOLLECTION\n Megam::BackupsCollection\n when MEGAM_BALANCES\n Megam::Balances\n when MEGAM_BALANCESCOLLECTION\n Megam::BalancesCollection\n when MEGAM_CREDITS\n Megam::Credits\n when MEGAM_CREDITSCOLLECTION\n Megam::CreditsCollection\n when MEGAM_BILLEDHISTORIES\n Megam::Billedhistories\n when MEGAM_BILLEDHISTORIESCOLLECTION\n Megam::BilledhistoriesCollection\n when MEGAM_BILLINGTRANSACTIONS\n Megam::Billingtransactions\n when MEGAM_BILLINGTRANSACTIONSCOLLECTION\n Megam::BillingtransactionsCollection\n when MEGAM_SUBSCRIPTIONS\n Megam::Subscriptions\n when MEGAM_SUBSCRIPTIONSCOLLECTION\n Megam::SubscriptionsCollection\n when MEGAM_DISKS\n Megam::Disks\n when MEGAM_DISKSCOLLECTION\n Megam::DisksCollection\n when MEGAM_ADDONS\n Megam::Addons\n when MEGAM_ADDONSCOLLECTION\n Megam::AddonsCollection\n when MEGAM_REPORTS\n Megam::Reports\n when MEGAM_REPORTSCOLLECTION\n Megam::ReportsCollection\n when MEGAM_QUOTAS\n Megam::Quotas\n when MEGAM_QUOTASCOLLECTION\n Megam::QuotasCollection\n when MEGAM_RAWIMAGES\n Megam::Rawimages\n when MEGAM_RAWIMAGESCOLLECTION\n Megam::RawimagesCollection\n when MEGAM_PROMOS\n Megam::Promos\n else\n fail JSON::ParserError, \"Unsupported `json_class` type '#{json_class}'\"\n end\n end", "def set_campaign\n @campaign = Campaign.find params[:campaign_id]\n end", "def mcget_campaign(campaign_id)\n # campaigns_res = setup_mcapi.campaigns.list( {campaign_id: \"f5666d1862\"} )\n campaigns_res = setup_mcapi.campaigns.list( {campaign_id: campaign_id} )\n search_campaign(campaigns_res)\n end", "def initialize\n @local_campaigns = Campaign.all\n @remote_campaigns = Campaign.get_remote_campaigns\n @missing_remote_campaigns = []\n @changed_campaigns = []\n end", "def entity_class\n self.class.name.sub(/Mapper$/, '').constantize\n end", "def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end", "def get_campaign(access_token, campaign_id)\n url = Util::Config.get('endpoints.base_url') +\n sprintf(Util::Config.get('endpoints.campaign'), campaign_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::Campaign.create(JSON.parse(response.body))\n end", "def asset_class_lookup\n return ASSET_CLASS_LOOKUP\n end", "def advertiser\n self.campaign.advertiser\n end", "def show\n @campaign = Campaign.find(params[:id])\n end", "def get_campaign(campaign_id)\n request(:get, \"api/1/campaigns/#{campaign_id}\").campaign\n end", "def new\n @campaign = Campaign.new\n end", "def new\n @campaign = Campaign.new\n end", "def new\n @campaign = Campaign.new\n end", "def api_class(options={})\n @api_class ||= {}\n return @api_class[options[:api] || self.api] if @api_class[options[:api] || self.api]\n\n @api_class[options[:api] || self.api] = ExternalAPI.const_get((options[:api] || self.api).to_s.gsub(/(?:^|_)(.)/) { $1.upcase })\n end", "def to_class\n Kernel.const_get(self.camelcase)\n end", "def set_campaign_target\n @campaign_target = CampaignTarget.find(params[:id])\n end", "def class_of(short_name)\n fqn(short_name).constantize\n end", "def get_class(cname, mdl = Processor)\n mdl.const_get(cname.split(/[\\,\\_]/).map { |p| p.capitalize }.join)\n rescue NameError\n return nil\n end", "def campaigns(client_id)\n response = Client_GetCampaigns(\"ClientID\" => client_id)\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"Campaign\"].collect{|c| Campaign.new(c[\"CampaignID\"].to_i, c[\"Subject\"], c[\"SentDate\"], c[\"TotalRecipients\"].to_i)}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end", "def find_globalized_column_class_for(record, attribute)\n if record.respond_to?(:translation_class) && record.translated_attribute_names.include?(attribute)\n record.translation_class\n else\n nil\n end\n end", "def find_converter_instance(klass); end", "def campaign\n\t\tif current_user.company\n\t\t\tcompany = current_user.company\n\t\t\tcampaign = company.campaign\n\t\t\tif campaign.submitted?\n\t\t\t\tredirect_to(:controller => 'companies', :action => :show, id: company.slug)\n\t\t\telse\n\t\t\t\tcampaign_step = find_campaign_step(campaign.current_state, campaign.id)\n\t\t\t\tredirect_to campaign_step\n\t\t\tend\n\t\telse\n\t\t\tredirect_to funding_goal_path\n\t\tend\n\tend", "def type_name_resolver; end", "def resolve(namespace, name, inheritance = T.unsafe(nil), proxy_fallback = T.unsafe(nil), type = T.unsafe(nil)); end", "def entityResolver; @entityResolver; end", "def set_campaign\n @campaign = authorize Campaign.find(params[:id])\n end", "def resource_class\n case @options[:class]\n when false\n name.to_sym\n when nil\n namespaced_name.to_s.camelize.constantize\n when String\n @options[:class].constantize\n else\n @options[:class]\n end\n end", "def campaign_url(id = nil)\n \"#{@mailgun.base_url}/#{@domain}/campaigns#{'/' + id.to_s if id}\"\n end", "def translation_class\n const_get translation_class_name\n end", "def get_class(dns_query, parsed_dns)\n RECORD_CLASS[get_rdata_value(dns_query, parsed_dns, SHORT_LENGTH).to_i]\n end", "def deco_class; end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n # @user_roles = UserRole.where(role_id: 2)\n #@specialists = User.joins(:user_roles)\n end", "def resource_to_class(resource)\n BlockScore::Util.to_constant(\"BlockScore::#{BlockScore::Util.to_camelcase(resource.to_s)}\")\nend", "def search_builder_class\n Cul::Ac3::SearchBuilder\n end", "def entity_class\n @entity_class ||= (\"::\" + self.class.name.split('::').last.gsub(/Mapper/, '')).constantize\n @entity_class\n end", "def resource_class\n\n ActiveSupport::Dependencies.constantize(resource_class_name)\n\n end", "def campaigns\n response = get 'campaigns'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def model_class\n @model_class ||= mapping.to\n end", "def class_for assoc_name\n raise NotImplementedError\n end", "def class_for assoc_name\n raise NotImplementedError\n end", "def set_contact\n # debugger\n klass = Contact.create_model_class(Contact.find(params[:id]).klaas, params[:contact])\n\n @contact = klass.find(params[:id])\n # instance_variable_set(\"@\"+klass.to_s,klass.find(params[:id]))\n end", "def to_class(model_name)\r\n Kernel.const_get(model_name.to_s.camelize)\r\n end", "def sponsoring_agency\n return OrderedStringHelper.deserialize(super )\n end", "def sponsoring_agency\n return OrderedStringHelper.deserialize(super )\n end", "def cast\n Kernel.const_get(objeto_classe).find(objeto_id)\n end", "def show\n # 対応するネットワーク独自キャンペーン\n @source = @campaign.get_ns_campaign\n end", "def show\n @campaign = campaign_prefix.friendly.find(params[:id])\n\n # get the percentage for total collected / campaign goal\n # used for progress bar width\n @campaign_percentage = @campaign.campaign_math\n end", "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @campaign }\n format.json { render :json => @campaign }\n end\n end", "def get_instance(payload)\n LinkshorteningMessagingServiceDomainAssociationInstance.new(@version, payload)\n end", "def resolve_class object\n ::Class === object ? object : (::String === object ? (class_for_name object) : nil)\n end", "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @campaign }\n end\n end", "def convert_class(klass)\n ::ActiveSupport::Inflector.underscore(klass.name).gsub(\"/\", \"_\")\n end", "def get_contact_campaigns(id)\n return make_request(\"#{self.endpoint}/#{id}/campaigns\")\n end", "def target_class\n # Need to do a little bit of work here as Module.const_get doesn't work\n # with nested class names, i.e. JIRA::Resource::Foo.\n #\n # So create a method chain from the class components. This code will\n # unroll to:\n # Module.const_get('JIRA').const_get('Resource').const_get('Foo')\n #\n target_class_name = self.class.name.sub(/Factory$/, '')\n class_components = target_class_name.split('::')\n\n class_components.inject(Module) do |mod, const_name|\n mod.const_get(const_name)\n end\n end" ]
[ "0.6217579", "0.6217579", "0.6168188", "0.59303385", "0.5925029", "0.58026165", "0.578407", "0.57034653", "0.5524107", "0.5405422", "0.5388858", "0.5387513", "0.5356889", "0.5327237", "0.5300465", "0.5260212", "0.52580214", "0.525724", "0.5195405", "0.5191416", "0.5183479", "0.51834244", "0.51834244", "0.5165317", "0.51331246", "0.50664", "0.5062859", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.50606585", "0.5058813", "0.5034181", "0.5018488", "0.5012789", "0.5009809", "0.49929217", "0.4991595", "0.49879616", "0.49791437", "0.4976267", "0.4972507", "0.49685186", "0.49652565", "0.49616235", "0.49217302", "0.49197173", "0.49197173", "0.49197173", "0.49029866", "0.48895636", "0.4875541", "0.48594314", "0.48511764", "0.484285", "0.4838763", "0.48339993", "0.48157015", "0.47986498", "0.4780157", "0.47799125", "0.4779582", "0.47757322", "0.47740135", "0.47717026", "0.47574052", "0.47443563", "0.47329375", "0.47201714", "0.47155866", "0.4712566", "0.46935534", "0.4692093", "0.46917188", "0.46901658", "0.46901658", "0.46846262", "0.4678305", "0.46754745", "0.46754745", "0.46743032", "0.46740153", "0.46662143", "0.46507108", "0.46503532", "0.46489552", "0.4637982", "0.46360588", "0.46292832", "0.46286106" ]
0.477122
75
Checks to see if the subscriber exists.
def subscriber(record, **args) caffeinate_campaign_subscriptions.find_by(subscriber: record, **args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscriber?(dbname = nil)\n subscriptions(dbname).any?\n end", "def subscribes?(record, **args)\n subscriber(record, **args).present?\n end", "def subscriber?(email_address)\n !subscriber(email_address).nil?\n end", "def has_subscriber?(user_id)\r\n self.subscribers.include?(user_id.to_i)\r\n end", "def subscribe(subscriber)\n if @id != subscriber.getId\n @subscriptions[subscriber.getId] = subscriber\n return true\n end\n return false\n end", "def has_subscribed?( publication )\n subscriptions.by_publication(publication).exists?\n end", "def has_subscriber?(participant)\n !opt_outs.unsubscriber(participant).any?\n end", "def check_subscription\n !subscribed || subscription_present?\n end", "def subscription_to?(subscriber, subscription_level = nil)\n !subscription_to(subscriber, subscription_level).nil?\n end", "def subscribed?(subscribable, subscription_level = nil)\n subscribed(subscribable, subscription_level) != nil\n end", "def subscribed?\n self.subscription == :subscribed\n end", "def subscribed_to?(chapter)\n subscriptions.where(chapter: chapter).exists?\n end", "def subscriber?\n self.subscription.plan_id != nil && self.subscription.plan_id >= 1\n end", "def subscribe?\n self.type == :subscribe\n end", "def subscribed?\n !ended? && !unsubscribed?\n end", "def unsubscribed?\n @subscription.nil?\n end", "def subscribed?\n self.type == :subscribed\n end", "def subscriber?(email)\n store[name].any? { |r| r.contents == email }\n end", "def subscribed?\n [email protected]? && @attributes.include?(:Subscribed)\n end", "def subscribed?(object)\n subscriptions.include?(remote_object(object))\n rescue RemotePeerMismatch\n false\n end", "def subscribed?\n ( @subscription_id.nil? or @watermark.nil? )? false : true\n end", "def has_subscriber?(user_id)\n # In the case of an Indivual tournament\n if is_individual?\n users.exists?(user_id)\n else\n # If we are in a team kind of tournament\n memberships.exists?(:user_id => user_id)\n end\n end", "def can_subscribe?()\n \treturn !(self.phoneNumber.nil?)\n\tend", "def subscribed?(event)\n subscriptions.include?(event)\n end", "def subscribed?(email)\n %w[pending subscribed].include?(fetch_subscriber(email)['status'])\n rescue Faraday::ResourceNotFound\n false\n end", "def subscribed?(u)\n @clients.has_key?(u.signature)\n end", "def is_subscribed_to?(channel)\n Subscription.where(:subscriber_id => self.id, :channel_id => channel.id).exists?\n end", "def subscribed?(domain, node, jid)\n jid = JID.new(jid)\n @cluster.query(:sismember, \"pubsub:#{domain}:subscribers_#{node}\", jid.to_s) == 1\n end", "def has_subscription?\n hash.key?('subscription_url')\n end", "def valid?\n subscriber && data&.any?\n end", "def request?\n self.type == :subscribe\n end", "def copy_sender?(subscriber)\n false\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def testGetSubscribers_NotExistingTopic()\n topic = \"_GetSubscribers_NotExistingTopic\"\n conn = Scalaris::PubSub.new()\n subscribers = conn.get_subscribers(@testTime.to_s + topic)\n assert_equal([], subscribers)\n conn.close_connection()\n end", "def subscribed?\n status == 1 || status == 2\n end", "def subscribed?\n\t\t\t!!@update_timer\n\t\tend", "def noop\n subscribers.length == 0\n end", "def has_subscriber?(user)\n has_text? user.email\n end", "def subscribed?(user)\n user.subscription.subscribed==true\n end", "def suscription_on?\n is_subscribed == true\n end", "def unsubscribed?\n unsubscribed_at.present?\n end", "def no_subscriptions?\n subscribables.empty? && !toc\n end", "def IsSubscribed=(arg0)", "def IsSubscribed=(arg0)", "def subscription_enabled?\n _notification_subscription_allowed ? true : false\n end", "def subscribe( publication )\n subscriptions.create(publication: publication) unless has_subscribed?(publication)\n rescue ActiveRecord::RecordNotUnique\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def subscribed?\n managers.map(&:subscribed?).include?(true) ? true : false\n end", "def is_subscribed?(user)\n fan_channel_id_youtube = self.channel_id_youtube\n subscriber = user.subscribers.find_by(channel_id_youtube: fan_channel_id_youtube)\n sub_status = subscriber.nil? ? false : subscriber.is_subscribed # if subscriber exists in db, we show his status, else it's false anyway\n return sub_status\n end", "def has_no_registered_receiver?\n !self.has_registered_receiver?\n end", "def unsubscribed?\n @gate.synchronize do\n return @unsubscribed\n end\n end", "def unsubscribed?\n self.type == :unsubscribed\n end", "def exists?\n system = Sonos::System.new\n speaker = system.speakers.select { |s| s.name.downcase == @resource[:name].downcase }\n present = false\n if speaker.size < 1\n fail(\"Speaker #{resource[:name]} not associated to network?\")\n else\n if speaker[0].get_player_state[:state] == 'PLAYING'\n present = true\n end\n end\n\n present\n end", "def pubsub_subscribed?(domain, node, jid)\n @pubsub.subscribed?(domain, node, jid)\n end", "def has_registered_receiver?\n self.receiver && self.receiver.activated?\n end", "def registered?\n !push_id.nil?\n end", "def subscribed?\n if root_object?\n plan&.subscribed? ||\n (!self_owned? && owners.any?(&:subscribed_plan?)) ||\n super\n else\n root_object.subscribed?\n end\n end", "def exists!\n @exists = true\n end", "def is_paid_subscriber?\n has_role? :paid_subscription\n end", "def exists?\n !!async\n end", "def podcast_already_subscribed(itunes_id, user_id)\n @podcast = Podcast.where('itunes_id = ' + itunes_id.to_s)[0]\n if @podcast.blank?\n return false\n else\n userpod = UserPodcast.where('podcast_id = ' + @podcast.id.to_s + ' AND user_id = ' + user_id.to_s)[0]\n return !userpod.blank?\n end\n end", "def unsubscribe?\n self.type == :unsubscribe\n end", "def subscribed?; owners.any? { |peer| peer.subscribed?(self) if peer != Distributed } end", "def verify(subscriber)\n subscriber.is_a?(Class) && subscriber.respond_to?(:perform_async)\n end", "def subscribed?(email)\n list.include? email\n end", "def create\n @subscriber = Subscriber.new(subscriber_params)\n begin\n if valid_number?(@subscriber.phone) && @subscriber.save\n Rails.logger.info \"Validations complete\"\n new_subscriber_responder\n else\n Rails.logger.error \"Validations failed\"\n bad_phone_responder\n end\n rescue ActiveRecord::RecordNotUnique\n @subscriber = Subscriber.find_by_phone(@subscriber.phone)\n if @subscriber.verified?\n Rails.logger.info \"Subscriber already exists\"\n subscriber_exists_responder\n else\n Rails.logger.info \"Subscriber isn't verified\"\n resend_pin_responder\n end\n end\n end", "def wants_to_subscribe?\n source_is_ffcrm? && has_list?\n end", "def exists?\n uid && ABAddressBook.sharedAddressBook.recordForUniqueId(uid)\n end", "def exists?\n [email protected]? && @exists\n end", "def exists?\n [email protected]? && @exists\n end", "def exists?\n [email protected]? && @exists\n end", "def exists?\n redis.exists(name)\n end", "def ensure_subscribed_by(user)\n ActiveRecord::Base.transaction(requires_new: true) do\n subscribed_by?(user) || subscriptions.create!(user: user)\n end\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique => e\n errors = e.record.errors\n return true if e.is_a?(ActiveRecord::RecordInvalid) &&\n !errors[:topic_id].empty? && !errors[:user_id].empty?\n raise e\n end", "def exists?\n [email protected]? && @exists\n end", "def exists?\n [email protected]? && @exists\n end", "def exists?\n ! Tainers::API.get_by_name(name).nil?\n end", "def blocked?(subscriber)\n false\n end", "def subscribing?(other_user)\n subscribing.include?(other_user)\n end", "def subscribe(email)\n return false if subscriber?(email)\n\n store[name].create(email)\n\n true\n end", "def unsubscribed?\n preminum? ? false : true\n #subscribed? ? false : true\n end", "def is_subscribed_to\n scope[:current_veteran].is_subscribed_to?(object)\n end", "def is_subscribed\n if initted?\n @@dll_SteamAPI_ISteamApps_BIsSubscribed.call(@i_apps) % 256 != 0\n else\n nil\n end\n end", "def check_subscription(user, device_id, sub)\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n return \"{\\\"subscribed\\\": \\\"#{device.hasSubscription?(sub)}\\\"}\"\n else\n return \"{\\\"subscribed\\\": \\\"false\\\"}\"\n end\n end", "def subscribes_to_notification?(key, subscribe_as_default = ActivityNotification.config.subscribe_as_default)\n !subscription_allowed?(key) || _subscribes_to_notification?(key, subscribe_as_default)\n end", "def sub?\n @badges.key? 'subscriber'\n end", "def subscriber( name )\n raise NotImplementedError, \"please implement 'subscriber'\"\n end", "def subscriber(email_address)\n subscribers.detect {|s| s.rfc5322_email == email_address}\n end", "def ensure_has_subscription\n if !has_valid_subscription?\n raise ApiErrors::StandardError.new(\n message: 'Sorry, you must have a valid subscription to perform this action',\n status: 403,\n )\n end\n end", "def has_topic\n [email protected]?\n end", "def has_topic\n [email protected]?\n end", "def is_any_subscription_active?\n is_subscription_active?\n end", "def subscribe\n if User.exists?(email: params[:user][:email])\n render json: { status: 'The email is already taken' }, status: :bad_request\n else\n subscribed_user = SubscribedUser.create!(user_params)\n render json: { status: 'Created' }, status: :created if subscribed_user\n render json: { status: 'Something wrong happened' }, status: :bad_request unless subscribed_user\n end\n rescue\n render json: { status: 'Something wrong happened' }, status: :bad_request\n end", "def subscription_active\n active_subscription.present?\n end", "def exists?\n !@not_found\n end", "def exists?\n @exists == true\n end", "def exists?\n @exists\n end", "def primary_subscriber\n return if enrollees.blank?\n\n enrollees.detect do |enrollee|\n enrollee.is_subscriber == true\n end\n end" ]
[ "0.752799", "0.7265319", "0.7247807", "0.72218466", "0.7192678", "0.717307", "0.71017206", "0.70467633", "0.69650894", "0.69126356", "0.6858322", "0.68511486", "0.68400955", "0.6779897", "0.67339826", "0.6685595", "0.6673168", "0.6670017", "0.6616324", "0.6607828", "0.657627", "0.65534467", "0.65390134", "0.65347856", "0.6523081", "0.6515473", "0.6462701", "0.6456774", "0.6398877", "0.63505816", "0.6328554", "0.6298747", "0.6288301", "0.6288301", "0.62764746", "0.6239353", "0.6226251", "0.61945724", "0.61416554", "0.6131046", "0.6124805", "0.6115581", "0.61147356", "0.6052466", "0.6052466", "0.60381716", "0.60354453", "0.60298294", "0.60298294", "0.60298294", "0.60298294", "0.6028268", "0.6003147", "0.59408647", "0.593968", "0.593832", "0.5932426", "0.59305406", "0.5922001", "0.59219295", "0.59098315", "0.5884853", "0.58831525", "0.5873247", "0.5868959", "0.5865205", "0.5849865", "0.5840591", "0.5834755", "0.58129776", "0.5804021", "0.579744", "0.5796325", "0.5796325", "0.5796325", "0.57939684", "0.57896537", "0.5783654", "0.5783654", "0.57792294", "0.5775338", "0.5772227", "0.5769303", "0.5765472", "0.5763632", "0.57559836", "0.5753946", "0.57504207", "0.5747389", "0.5726558", "0.5713112", "0.57108426", "0.5702135", "0.5702135", "0.5701084", "0.5698755", "0.5698258", "0.5688867", "0.5685438", "0.56840026", "0.5666752" ]
0.0
-1
Check if the subscriber exists
def subscribes?(record, **args) subscriber(record, **args).present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscriber?(dbname = nil)\n subscriptions(dbname).any?\n end", "def subscribe(subscriber)\n if @id != subscriber.getId\n @subscriptions[subscriber.getId] = subscriber\n return true\n end\n return false\n end", "def has_subscriber?(user_id)\r\n self.subscribers.include?(user_id.to_i)\r\n end", "def has_subscribed?( publication )\n subscriptions.by_publication(publication).exists?\n end", "def has_subscriber?(participant)\n !opt_outs.unsubscriber(participant).any?\n end", "def subscriber?(email_address)\n !subscriber(email_address).nil?\n end", "def check_subscription\n !subscribed || subscription_present?\n end", "def subscriber?\n self.subscription.plan_id != nil && self.subscription.plan_id >= 1\n end", "def subscribe?\n self.type == :subscribe\n end", "def subscribed?\n self.subscription == :subscribed\n end", "def subscription_to?(subscriber, subscription_level = nil)\n !subscription_to(subscriber, subscription_level).nil?\n end", "def subscribed?(subscribable, subscription_level = nil)\n subscribed(subscribable, subscription_level) != nil\n end", "def subscribed?\n self.type == :subscribed\n end", "def subscribed?\n !ended? && !unsubscribed?\n end", "def subscribed_to?(chapter)\n subscriptions.where(chapter: chapter).exists?\n end", "def subscribed?(event)\n subscriptions.include?(event)\n end", "def subscribed?(u)\n @clients.has_key?(u.signature)\n end", "def unsubscribed?\n @subscription.nil?\n end", "def subscribed?\n ( @subscription_id.nil? or @watermark.nil? )? false : true\n end", "def can_subscribe?()\n \treturn !(self.phoneNumber.nil?)\n\tend", "def subscriber?(email)\n store[name].any? { |r| r.contents == email }\n end", "def subscribed?(object)\n subscriptions.include?(remote_object(object))\n rescue RemotePeerMismatch\n false\n end", "def subscribed?\n status == 1 || status == 2\n end", "def has_subscriber?(user_id)\n # In the case of an Indivual tournament\n if is_individual?\n users.exists?(user_id)\n else\n # If we are in a team kind of tournament\n memberships.exists?(:user_id => user_id)\n end\n end", "def subscribed?(domain, node, jid)\n jid = JID.new(jid)\n @cluster.query(:sismember, \"pubsub:#{domain}:subscribers_#{node}\", jid.to_s) == 1\n end", "def testGetSubscribers_NotExistingTopic()\n topic = \"_GetSubscribers_NotExistingTopic\"\n conn = Scalaris::PubSub.new()\n subscribers = conn.get_subscribers(@testTime.to_s + topic)\n assert_equal([], subscribers)\n conn.close_connection()\n end", "def copy_sender?(subscriber)\n false\n end", "def IsSubscribed=(arg0)", "def IsSubscribed=(arg0)", "def subscribed?\n [email protected]? && @attributes.include?(:Subscribed)\n end", "def suscription_on?\n is_subscribed == true\n end", "def request?\n self.type == :subscribe\n end", "def has_subscription?\n hash.key?('subscription_url')\n end", "def is_subscribed_to?(channel)\n Subscription.where(:subscriber_id => self.id, :channel_id => channel.id).exists?\n end", "def subscribed?(user)\n user.subscription.subscribed==true\n end", "def subscribed?\n\t\t\t!!@update_timer\n\t\tend", "def noop\n subscribers.length == 0\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def subscribed?(email)\n %w[pending subscribed].include?(fetch_subscriber(email)['status'])\n rescue Faraday::ResourceNotFound\n false\n end", "def valid?\n subscriber && data&.any?\n end", "def subscribe( publication )\n subscriptions.create(publication: publication) unless has_subscribed?(publication)\n rescue ActiveRecord::RecordNotUnique\n end", "def has_subscriber?(user)\n has_text? user.email\n end", "def subscribed?\n managers.map(&:subscribed?).include?(true) ? true : false\n end", "def is_subscribed?(user)\n fan_channel_id_youtube = self.channel_id_youtube\n subscriber = user.subscribers.find_by(channel_id_youtube: fan_channel_id_youtube)\n sub_status = subscriber.nil? ? false : subscriber.is_subscribed # if subscriber exists in db, we show his status, else it's false anyway\n return sub_status\n end", "def unsubscribed?\n unsubscribed_at.present?\n end", "def no_subscriptions?\n subscribables.empty? && !toc\n end", "def registered?\n !push_id.nil?\n end", "def wants_to_subscribe?\n source_is_ffcrm? && has_list?\n end", "def subscribing?(other_user)\n subscribing.include?(other_user)\n end", "def subscription_enabled?\n _notification_subscription_allowed ? true : false\n end", "def unsubscribed?\n self.type == :unsubscribed\n end", "def subscribed?(email)\n list.include? email\n end", "def is_subscribed_to\n scope[:current_veteran].is_subscribed_to?(object)\n end", "def subscriber( name )\n raise NotImplementedError, \"please implement 'subscriber'\"\n end", "def primary_subscriber\n return if enrollees.blank?\n\n enrollees.detect do |enrollee|\n enrollee.is_subscriber == true\n end\n end", "def check_subscription(user, device_id, sub)\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n return \"{\\\"subscribed\\\": \\\"#{device.hasSubscription?(sub)}\\\"}\"\n else\n return \"{\\\"subscribed\\\": \\\"false\\\"}\"\n end\n end", "def subscribed?; owners.any? { |peer| peer.subscribed?(self) if peer != Distributed } end", "def sub?\n @badges.key? 'subscriber'\n end", "def podcast_already_subscribed(itunes_id, user_id)\n @podcast = Podcast.where('itunes_id = ' + itunes_id.to_s)[0]\n if @podcast.blank?\n return false\n else\n userpod = UserPodcast.where('podcast_id = ' + @podcast.id.to_s + ' AND user_id = ' + user_id.to_s)[0]\n return !userpod.blank?\n end\n end", "def subscription_active\n active_subscription.present?\n end", "def unsubscribed?\n preminum? ? false : true\n #subscribed? ? false : true\n end", "def subscribe(email)\n return false if subscriber?(email)\n\n store[name].create(email)\n\n true\n end", "def subscribed?\n self.friendship_status > 0\n end", "def subscribed; end", "def checkSubscription\n @check_sub= Subscription.where(user_id:@current_user.id , channel_id:@channel.id )\n if @check_sub.length>0\n render :json=>{subscribed:true, message:@check_sub[0]}, status: :ok\n else\n render :json=>{subscribed:false, message:@check_sub[0]}, status: :ok\n end\n end", "def pubsub_subscribed?(domain, node, jid)\n @pubsub.subscribed?(domain, node, jid)\n end", "def has_registered_receiver?\n self.receiver && self.receiver.activated?\n end", "def subscribe(event)\n has_subscriptions.create(subscribed_id: event.id)\n end", "def unsubscribe?\n self.type == :unsubscribe\n end", "def subscribes_to_notification?(key, subscribe_as_default = ActivityNotification.config.subscribe_as_default)\n !subscription_allowed?(key) || _subscribes_to_notification?(key, subscribe_as_default)\n end", "def verify(subscriber)\n subscriber.is_a?(Class) && subscriber.respond_to?(:perform_async)\n end", "def unsubscribed?\n @gate.synchronize do\n return @unsubscribed\n end\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "def is_any_subscription_active?\n is_subscription_active?\n end", "def create\n @subscriber = Subscriber.new(subscriber_params)\n begin\n if valid_number?(@subscriber.phone) && @subscriber.save\n Rails.logger.info \"Validations complete\"\n new_subscriber_responder\n else\n Rails.logger.error \"Validations failed\"\n bad_phone_responder\n end\n rescue ActiveRecord::RecordNotUnique\n @subscriber = Subscriber.find_by_phone(@subscriber.phone)\n if @subscriber.verified?\n Rails.logger.info \"Subscriber already exists\"\n subscriber_exists_responder\n else\n Rails.logger.info \"Subscriber isn't verified\"\n resend_pin_responder\n end\n end\n end", "def subscriber_count\n subscribers.size\n end", "def blocked?(subscriber)\n false\n end", "def exists?\n !!async\n end", "def subscribe\n if User.exists?(email: params[:user][:email])\n render json: { status: 'The email is already taken' }, status: :bad_request\n else\n subscribed_user = SubscribedUser.create!(user_params)\n render json: { status: 'Created' }, status: :created if subscribed_user\n render json: { status: 'Something wrong happened' }, status: :bad_request unless subscribed_user\n end\n rescue\n render json: { status: 'Something wrong happened' }, status: :bad_request\n end", "def is_paid_subscriber?\n has_role? :paid_subscription\n end", "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "def subscribed # :doc:\n # Override in subclasses\n end", "def subscribe_notifications\n @subscribe_notifications ||= true\n end", "def ensure_subscribed_by(user)\n ActiveRecord::Base.transaction(requires_new: true) do\n subscribed_by?(user) || subscriptions.create!(user: user)\n end\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique => e\n errors = e.record.errors\n return true if e.is_a?(ActiveRecord::RecordInvalid) &&\n !errors[:topic_id].empty? && !errors[:user_id].empty?\n raise e\n end", "def subscribed_newsletter(user)\n NewsletterEmail.all.each do |newsletter|\n if newsletter.email == user.email\n return true\n end\n end\n return false\n end", "def has_no_registered_receiver?\n !self.has_registered_receiver?\n end", "def is_subscribed\n if initted?\n @@dll_SteamAPI_ISteamApps_BIsSubscribed.call(@i_apps) % 256 != 0\n else\n nil\n end\n end", "def subscriber(email_address)\n subscribers.detect {|s| s.rfc5322_email == email_address}\n end", "def has_topic\n [email protected]?\n end", "def has_topic\n [email protected]?\n end" ]
[ "0.76956147", "0.75955653", "0.738231", "0.7326496", "0.7294988", "0.72285485", "0.7193556", "0.7128194", "0.71240765", "0.7092888", "0.7079508", "0.7030331", "0.6951858", "0.6916984", "0.6901865", "0.68792534", "0.68007535", "0.676771", "0.6763353", "0.6757027", "0.6744197", "0.67283475", "0.6723028", "0.67074007", "0.6687621", "0.6676421", "0.66663104", "0.6666063", "0.6666063", "0.66564864", "0.66124266", "0.65812975", "0.6576367", "0.6572038", "0.65543854", "0.6549793", "0.6521037", "0.6518369", "0.6518369", "0.6504857", "0.6433681", "0.6411924", "0.63843274", "0.6293778", "0.629264", "0.6271757", "0.625363", "0.6230469", "0.6207932", "0.6207765", "0.6170388", "0.61540973", "0.6149908", "0.6140098", "0.61375827", "0.61118954", "0.61118335", "0.6106132", "0.60994864", "0.609246", "0.6077884", "0.6067014", "0.605526", "0.6051856", "0.6050702", "0.6049992", "0.604986", "0.6047455", "0.6046317", "0.6045603", "0.60358226", "0.6032693", "0.6029155", "0.6014842", "0.6014842", "0.6014842", "0.6014842", "0.6004832", "0.59992796", "0.59966135", "0.5995029", "0.59923536", "0.5987394", "0.5977245", "0.5976422", "0.59734726", "0.59734726", "0.59734726", "0.59734726", "0.59734726", "0.59734726", "0.59686434", "0.59602684", "0.5953861", "0.5952512", "0.59465414", "0.59435564", "0.5926134", "0.59012103", "0.59012103" ]
0.74806
2
Unsubscribes an object from a campaign. Campaign[:onboarding].unsubscribe(Company.first, user: Company.first.admin, reason: "Because I said so") is the same as Campaign.find_by(slug: "onboarding").caffeinate_campaign_subscriptions.find_by(subscriber: Company.first, user: Company.first.admin).unsubscribe!("Because I said so") Just... mintier.
def unsubscribe(subscriber, **args) reason = args.delete(:reason) subscription = subscriber(subscriber, **args) return false if subscription.nil? subscription.unsubscribe(reason) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end", "def unsubscribe!(reason = nil)\n update!(unsubscribed_at: ::Caffeinate.config.time_now, unsubscribe_reason: reason)\n\n caffeinate_campaign.to_dripper.run_callbacks(:on_unsubscribe, self)\n end", "def unsubscribe(email)\n\t # Logic for mailchimp unsubscription.\n\t api.unsubscribe({\n\t \t:id => @campaignable_list_id,\n\t :email => {\n\t :email => email\n\t }, \n\t :send_goodbye => false, # Don't send a goodbye email.\n\t :send_notify => false # Don't notify the user of the unsubscription.\n\t })\n end", "def unsubscribe(object)\n subscriptions.delete(remote_object(object))\n end", "def unsubscribe(course)\n subscribeds.delete(course)\n end", "def unsubscribe_from_channel; end", "def unsubscribe(id_or_email, options = {})\n url = \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/remove\"\n url += options[:campaign_id] ? \"?campaign_id=#{options[:campaign_id]}\" : \"\"\n make_json_api_request :post, url\n end", "def unsubscribe\n @entry.subscribers.delete(current_user)\n end", "def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end", "def unsubscribe2\n if Spree::Chimpy::Subscriber.where(email:self.email).first\n self.unsubscribe\n end\n end", "def unsubscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.unsubscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :delete_member => true, # this is NOT the default value\n :send_notify => true,\n :send_goodbye => true\n })\n Rails.logger.info(\"Unsubscribed #{self.email} from MailChimp\") if result\n end", "def unsubscribe(email)\n\t # Logic for mailchimp unsubscription.\n\t api.lists(@campaignable_list_id).members(subscriber_hash(email)).update(body: { status: \"unsubscribed\" })\n rescue Gibbon::MailChimpError => e\n # Reraise any non 404 errors.\n raise unless e.status_code == 404\n # Log rails errors into the rails logger.\n Rails.logger.warn \"unsubscribe: User #{email} not found!\"\n end", "def unsubscribe(user, target)\n user.personal_subscriptions.where(target_id: target.id, target_type: target.class).destroy_all\n end", "def unsubscribe(event)\n has_subscriptions.find_by(subscribed_id: event.id).destroy\n end", "def unsubscribe; end", "def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end", "def unsubscribe\n @subscriber = MailchimpSubscriber.new params[:mailchimp_subscriber]\n\n if @subscriber.valid?\n GoGoGibbon::Commands.unsubscribe @subscriber, GoGoGibbon::Config.subscribed\n end\n\n respond_to do |format|\n format.html { redirect_to(mailchimp_subscribers_url, :notice => 'User was successfully unsubscribed.') }\n end\n end", "def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end", "def unsubscribe()\n \n end", "def unsubscribe()\n end", "def unsubscribe\n end", "def unsubscribe_from_channel # :nodoc:\n run_callbacks :unsubscribe do\n unsubscribed\n end\n end", "def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end", "def unsubscribe\n @subscription_reference.unsubscribe\n end", "def unsubscribed\n # This will broadcast that user unsubscribed but the frontend will not receive the final broadcast\n p '**** ChatChannel unsubscribed'\n notification = {notification: 'User X has dropped off'}\n # ActionCable.server.broadcast(params[:room], notification)\n send_broadcast(params[:room], notification)\n end", "def unsubscribe(ident)\n @subscribers.delete(ident)\n end", "def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end", "def marketing_tool_sync_unsubscription(with_delay = true)\n case(club.marketing_tool_client)\n when 'exact_target'\n if defined?(SacExactTarget::MemberModel)\n with_delay ? exact_target_unsubscribe : exact_target_unsubscribe_without_delay \n end\n when 'mailchimp_mandrill'\n if defined?(SacMailchimp::MemberModel)\n with_delay ? Mailchimp::UserUnsubscribeJob.perform_later(self.id) : Mailchimp::UserUnsubscribeJob.perform_now(self.id)\n end\n end\n rescue Exception => e\n logger.error \"* * * * * #{e}\"\n Auditory.report_issue(\"User::unsubscribe\", e, { user: self.id })\n end", "def unsubscribe\n email = Base64.decode64(params[:token])\n Subscription.where(email: email).destroy_all\n end", "def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end", "def unsubscrible\n NewsletterMailer.unsubscrible\n end", "def unsubscribe_from_comments user\n subscription = find_or_build_comment_subscription user\n subscription.subscribed = false\n subscription.save!\n end", "def unsubscribe!\n message_class = whoami\n\n debug_me{[ :message_class ]}\n\n broker.unsubscribe!(message_class) if broker_configured?\n end", "def unsubscribed\n end", "def unsubscribed\n end", "def unsubscribe\n raise UnsubscribedError\n end", "def unsubscribe(cls)\n @subscribers.delete(name)\n end", "def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end", "def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end", "def unsubscribe\n\t@sub = Subscription.find_by_id(params[:c][:sub_id])\n\[email protected]_attributes(:explanation => params[:c][:explanation], :active => false, :canceled_at => Time.now)\n\t#current_user.update_attributes(:customer => false) #taken out now because a user might remain a customer if he has purchased pages\n\t@cust = Stripe::Customer.retrieve(current_user.customer_id)\n\[email protected]_subscription\n\tredirect_to current_user, notice: \"Thank you for trying our service!\"\nend", "def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end", "def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end", "def unsubscribe_from_notifications(client, collection)\n mirror = client.discovered_api('mirror', 'v1')\n result = client.execute(\n :api_method => mirror.subscriptions.delete,\n :parameters => { 'id' => collection })\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end", "def unsubscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'unsubscribe')\n connection.send_stanza pres, &blk\n end", "def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end", "def unsubscribe\n\t\t@subject = Subject.find(params[:id])\n\t\t@customer = current_user.customer\n\t\[email protected](@subject)\n\t\tflash[:success] = \"You have unsubscribed from #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend", "def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end", "def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end", "def punsubscribe(*channels); end", "def unsubscribed\n User.find(current_user.id).update(online: false)\n ActionCable.server.broadcast(\n 'appearance_channel',\n user_id: current_user.id,\n is_online: false\n )\n end", "def unsubscribe\n redis.unsubscribe\n end", "def unsubscribed\n\tend", "def unsubscribe(email)\n if email.present?\n FfcrmMailchimp.logger.info(\"#{Time.now.to_s(:db)} FfcrmMailchimp::OutboundSync: unsubscribing #{email} from all mailchimp lists.\")\n ffcrm_list_ids.each do |list_id|\n FfcrmMailchimp::Api.unsubscribe(list_id, email)\n end\n end\n end", "def unsubscribe(name)\n id = @subs[name]\n\n self.send(msg: 'unsub', id: id)\n end", "def unsubscribe(subscriber)\n @subscriber = subscriber\n mail to: subscriber.email, subject: \"Unsubscribed from ML@B\"\n end", "def unsubscribe_from(topic)\n subscriptions.find_by_topic_id(topic.id).try(:destroy)\n end", "def unsubscribe(params)\n web_id = params[\"web_id\"]\n\n subscriber = nil\n enabled_models.each { |model| subscriber ||= model.constantize.find_by_mail_chimp_id(web_id) }\n\n subscriber.subscribed_to_list = false\n subscriber.save_without_update_list_member(:validate => false)\n end", "def unsubscribed\n @attributes[:unsubscribed]\n end", "def unlink_campaign(campaign)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Campaign must be saved\")if campaign.new_record?\n\n session = Base.connection\n server = XMLRPC::Client.new2(\"#{session.url}#{self.class.endpoint}\")\n server.call(\"unlinkCampaign\", session.id, self.id, campaign.id)\n end", "def unsubscribe_all\n # Get an array of all the email addresses accociated with this devise class.\n emails = all.map(&:email).select {|e| Devise::Models::Campaignable.valid_campaign_email? e}\n\n # Ask the list managed to subscibe all of these emails.\n list_manager.batch_unsubscribe(emails) \n end", "def unsubscribe(*channels); end", "def unsubscribe_all\n send_action('unsubscribe_all')\n end", "def batch_unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end", "def unlink_campaign(campaign)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Campaign must be saved\")if campaign.new_record?\n\n session = self.class.connection\n server = XmlrpcClient.new2(\"#{session.url}\")\n server.call(\"ox.unlinkCampaign\", session, self.id, campaign.id)\n end", "def unsubscribe(channel)\n send_action('unsubscribe', channel)\n end", "def unsubscribe!\n @consumer.try(:cancel)\n @consumer = nil\n end", "def unsubscribe\n logger.info \"Loading MemberSubscriber unsubscribe action - remote\"\n @subscriber = @current_resource\n logger.debug \"Subscriber attributes hash: #{@subscriber.attributes.inspect}\" if @subscriber\n @merchant_store = MerchantStore.find(@subscriber.merchant_store.id)\n logger.debug \"Merchant-store attributes hash: #{@merchant_store.attributes.inspect}\" if @merchant_store\n if @subscriber.present? && @merchant_store.present?\n logger.debug \"Subscriber found in database. Starting unsubscribe process: #{@subscriber.attributes}\"\n if @subscriber.destroy\n logger.debug \"Unsubscribe completed successfully: #{@subscriber.attributes}\"\n #Send opt-out e-mail to member\n MemberMailer.delay.web_opt_out(@subscriber.member.id, @merchant_store.id)\n logger.debug \"Sending delayed unsubscribe email to member\"\n else\n logger.debug \"Error unsubscribing via Google Maps\" \n logger.fatal \"Error unsubscribing via Google Maps\" \n end\n end\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js \n end\n end", "def unsubscribe(channel, connection)\n if sid = subscriptions.delete(channel => connection.signature)\n Channel[app_id => channel].unsubscribe(sid)\n end\n end", "def unsubscribe\n if request.post?\n @recipient = Recipient.find_by_email( params[:recipient][:email] )\n if (! @recipient)\n flash.now[:error] = _(\"Email address not found in the database!\")\n elsif Subscription.unsubscribe( @recipient, @project )\n render :text => @project.templets.find_by_name('PAGE_UNSUBSCRIBE_OK').render( @project ), :layout => true\n return\n end\n end\n render :text => @project.templets.find_by_name('PAGE_UNSUBSCRIBE').render( @project ), :layout => true\n end", "def unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end", "def remove_user_from_mailchimp\n unless self.email.include?('@example.com')\n mailchimp = Hominid::API.new(AppConstants.mailchimp_key)\n list_id = mailchimp.find_list_id_by_name AppConstants.mailchimp_list\n result = mailchimp.list_unsubscribe(list_id, self.email, true, false, true) \n Rails.logger.info(\"Mailchimp unsubscribed for email id #{self.email}\")\n end\n end", "def send_unsubscribe(contact)\n presence = [%w[to unsubscribe], %w[from unsubscribed]].map do |meth, type|\n presence(contact.jid, type) if contact.send(\"subscribed_#{meth}?\")\n end.compact\n broadcast_to_interested_resources(presence, contact.jid)\n end", "def unsubscribed # :doc:\n # Override in subclasses\n end", "def batch_unsubscribe(emails=[])\n # Do this using a batch call to the MailChimp API for performance rather than lots of single API calls.\n api.batch_unsubscribe({\n \t:id => @campaignable_list_id,\n :batch => emails.map {|email| {:email => { :email => email }} }, # Map all users in the system into a mailchimp collcation.\n :send_goodbye => false, # Don't send a goodbye email.\n :send_notify => false # Don't notify the user of the unsubscription. \n })\n end", "def unsubscribe!\n self.unsubscribed = true\n save\n end", "def unsubscribe(source)\n #TODO\n end", "def unsubscribeack(channel, ack)\n @ws.send(get_unsubscribe_object(channel, increment_cnt).to_json)\n @channels.delete(channel)\n @acks[@cnt] = [channel, ack]\n end", "def unsubscribe(device_id, subscription)\n #puts \"\\n\\n------------------------------\\nUnsubscribe from: #{subscription}\\n--------------------------------------\"\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n device.removeSubscription(subscription)\n @subscriptionLists.commitObject(device_id, device, false)\n end\n if @subscriptionLists.hasKey(\"subscriptions\")\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n if(subscriptions.key? subscription)\n subs = subscriptions[subscription]\n subs.removeDevice(device_id)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false)\n return \"{\\\"unsubscribe\\\": \\\"Device unsubscribed from #{subscription}\\\"}\"\n end\n else\n return '{\"unsubscribe\": \"No subscriptions available\"}'\n end\n end", "def unsubscribed; end", "def unsubscribe_clients(channel)\n send_action('unsubscribe_clients', channel)\n end", "def successful_unsubscribe\n end", "def remove_subscription\n buyer = @current_user\n customer_id = buyer.stripe_customer_id\n customer = Stripe::Customer.retrieve(customer_id)\n subscription.delete\n render json: { message: 'Unsubscribed succesfully' }, status: 200\n end", "def unsubscribe_to_email\n @subscription.unsubscribe_to_email\n return_back_or_ajax\n end", "def unsubscribe(opt_max=nil)\n @nc.send(:unsubscribe, self, opt_max)\n end", "def destroy\n event = Subscription.find(params[:id]).event\n current_user.unsubscribe(event)\n redirect_to event\n end", "def unsubscribe(channel)\n @ws.send(get_unsubscribe_object(channel, increment_cnt).to_json)\n @channels.delete(channel)\n end", "def remove(address_or_id)\n delete(\"#{domain}/unsubscribes/#{address_or_id}\")\n end", "def unsubscribe(*channels)\n _subscription(:unsubscribe, 0, channels, nil)\n end", "def unsubscribe(feed)\n SubscriptionsManager.remove_subscription feed, self\n end", "def unsubscribeTo (event)\r\n @subscribedEvents.delete?(event)\r\n end", "def cancel_subscription(magazine)\n self.subscriptions.find {|subscription| subscription.magazine === magazine}.delete\n end", "def unsubscribe\n \n @conversation.subscriptions.delete(@user) if @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now no longer receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n \n end", "def unsubscribe_member_table\n logger.info \"Loading MemberSubscriber unsubscribe_member_table action\"\n @subscriber = @current_resource\n logger.debug \"Subscriber attributes hash: #{@subscriber.attributes.inspect}\" if @subscriber\n @merchant_store = MerchantStore.find(@subscriber.merchant_store.id)\n logger.debug \"Merchant-store attributes hash: #{@merchant_store.attributes.inspect}\" if @merchant_store\n error = false\n if @subscriber.present? && @merchant_store.present?\n logger.debug \"Subscriber found in database. Starting unsubscribe process: #{@subscriber.attributes}\"\n if @subscriber.destroy\n logger.debug \"Unsubscribe completed successfully\"\n \n #Send opt-out e-mail to member\n MemberMailer.delay.web_opt_out(@subscriber.member.id, @merchant_store.id)\n logger.debug \"Sending delayed unsubscribe email to member\"\n flash[:success] = t( :unsubscribe_confirmation, store_name: @merchant_store.store_name, :scope => [:business_messages, :subscriber])\n redirect_to favorites_path(current_member_user)\n return\n else\n error = true\n logger.debug \"Error when deleting subscriber record\"\n end\n else\n error = true\n logger.debug \"Error: Invalid unsubscribe request. Missing attributes\"\n logger.fatal \"Error: Invalid unsubscribe request. Missing attributes\"\n end\n if error\n flash[:error] = t( :unsubscribe_error, store_name: @merchant_store.store_name, :scope => [:business_messages, :subscriber])\n redirect_to favorites_path(current_member_user)\n end\n end", "def unsubscribe( publication )\n subscriptions.by_publication( publication ).delete_all\n end", "def unsubscribe(destination, headers = {})\n headers[:id] = sha1(destination) unless headers[:id]\n @connection.unsubscribe(destination, headers)\n end", "def unsubscribe\n unregister\n end", "def delete_subscriptions\n end", "def delete_observer o\n @sub_lock.synchronize do\n subscribers.fetch(channel, {}).delete o\n end\n end", "def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n end", "def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n end" ]
[ "0.74581206", "0.72047496", "0.6987216", "0.6811801", "0.67727804", "0.67360365", "0.67302924", "0.67221355", "0.66860914", "0.665698", "0.66358405", "0.6624739", "0.6591913", "0.6588627", "0.65824723", "0.65746903", "0.6573805", "0.6522745", "0.6502448", "0.6489009", "0.6464107", "0.6456475", "0.64498115", "0.64459234", "0.64211667", "0.6413021", "0.6410858", "0.63975734", "0.6388695", "0.6385582", "0.63853663", "0.6351913", "0.63515115", "0.63452595", "0.63452595", "0.63404375", "0.63381505", "0.63366294", "0.6329666", "0.6326099", "0.63003033", "0.6296963", "0.62924206", "0.6289185", "0.6277881", "0.6273148", "0.6258073", "0.6258073", "0.6251783", "0.6248688", "0.6228778", "0.62147534", "0.6199562", "0.618747", "0.6182503", "0.6172816", "0.61701083", "0.6167142", "0.6157801", "0.6152997", "0.61499393", "0.61468947", "0.6141095", "0.6128999", "0.6124507", "0.6115626", "0.6110654", "0.61044806", "0.6102289", "0.6088787", "0.60865813", "0.6083685", "0.60727596", "0.60708183", "0.60661227", "0.606425", "0.6061217", "0.6054829", "0.60528475", "0.60498065", "0.6038792", "0.60356134", "0.6013479", "0.6010301", "0.5980288", "0.5971592", "0.5950495", "0.5947723", "0.5940054", "0.5924995", "0.59215397", "0.5918369", "0.59062064", "0.5906082", "0.5901421", "0.58984596", "0.5893789", "0.58781683", "0.58766747", "0.58766747" ]
0.61395293
63
Creates a `CampaignSubscription` object for the present Campaign. Allows passing `args` to delegate additional arguments to the record. Uses `find_or_create_by`.
def subscribe(subscriber, **args) caffeinate_campaign_subscriptions.find_or_create_by(subscriber: subscriber, **args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe!(subscriber, **args)\n caffeinate_campaign_subscriptions.find_or_create_by!(subscriber: subscriber, **args)\n end", "def create_subscription!(plan, coupon, params)\n subscription = find_or_build_subscription(plan, coupon, params)\n subscription.save_with_payment!\n return subscription\n end", "def create_or_update_subscriber(*args)\n data = {}\n data[:email] = args[0] if args[0].is_a? String\n data.merge!(args.last) if args.last.is_a? Hash\n raise ArgumentError, 'email: or id: or bigcommerce_subscriber_id: parameter required' if missing_subscriber_identifier(data)\n make_json_api_request :post, \"v2/#{account_id}/subscribers\", private_generate_resource(\"subscribers\", data)\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to campaign_subscription_path(@campaign, @subscription), :notice => 'Subscription was successfully created.' }\n format.json { render :json => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_subscription(sender)\n PsegRecurring::Subscription.new(@credentials).send_subscription(sender)\n end", "def create_subscription(options)\n stripe_service.create_subscription(options)\n end", "def subscribe(recipient)\n subscription = subscriptions.find_or_initialize_by(recipient: recipient)\n return unless subscription.new_record?\n subscription.save\n subscription\n end", "def create_subscription\n subscription = nil\n stripe_call do\n local_plan = Plan.active.find(@params[:user][:plan_id])\n return false if local_plan.nil?\n stripe_plan = Stripe::Plan.retrieve(local_plan.stripe_id)\n # If the plan has a trial time, it does not need a stripe token to create a subscription\n # We assume you have a trial time > 0. Otherwise there will be 2 customers created for\n # each subscribed customer. One at registration and another when subscribing.\n subscription = customer.subscriptions.create(\n source: @params[:stripeToken],\n plan: stripe_plan.id\n )\n end\n return false if subscription.nil?\n\n user_attributes_to_update = {\n stripe_id: customer.id,\n stripe_subscription_id: subscription.id\n }\n assign_card_details(user_attributes_to_update, @params)\n @user.update(user_attributes_to_update)\n end", "def create_subscription topic, subscription_name, options = {}\n updated_option = construct_create_subscription_options topic, subscription_name, options\n subscriber.create_subscription(**updated_option)\n end", "def create\n @subscription = @target.create_subscription(subscription_params)\n return_back_or_ajax\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n respond_to do |format|\n if @subscription.save\n record_activity :create, @subscription\n format.html { redirect_to edit_subscription_path(@subscription),\n notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_subscriptions\n Subscription.create_subscriptions(self.id, self.hashtag)\n end", "def create_initial_subscription\n return unless self.subscription_plan_id.to_i > 0\n\n @subscription_plan = SubscriptionPlan.find(self.subscription_plan_id)\n if @subscription_plan.user?\n self.subscribe_to_plan(@subscription_plan)\n else\n create_organization_and_subscription_plan\n end\n end", "def create_subscription(options)\n # Get the plan.\n plan = Stripe::Plan.retrieve(options[:plan])\n\n # Charge VAT in advance because subscription call will create and pay an invoice.\n # TK actually we need to apply VAT for invoiceitems that are pending and scheduled\n # for the next invoice.\n # Do not charge VAT if the plan or the subscription is still in trial (invoice will come later).\n vat, invoice_item = charge_vat_of_plan(plan) unless \\\n plan.trial_period_days || (options[:trial_end] && options[:trial_end] != 'now')\n\n # Start subscription.\n # This call automatically creates an invoice, always.\n subscription = customer.subscriptions.create(options)\n\n [subscription, last_invoice]\n rescue Stripe::StripeError, Stripe::CardError => e\n # Something failed in Stripe, if we already charged for VAT,\n # we need to rollback this. As we may charge twice later otherwise.\n invoice_item.delete if invoice_item\n raise e\n end", "def subscriber(record, **args)\n caffeinate_campaign_subscriptions.find_by(subscriber: record, **args)\n end", "def create(params)\n params.merge!(\n :order_no => (Time.now.to_f * 10000).to_i.to_s, # Produce a unique order_no - it's not used anywhere, but ePay needs this\n :amount => 0\n )\n \n post = Api.default_post_for_params(params).merge({\n :subscription => 1,\n :subscriptionname => params[:description]\n })\n \n query = Api.authorize(post)\n \n if query['accept']\n # Return the new subscriber\n subscription = new(query[\"subscriptionid\"].to_i).reload\n \n # Set (obfuscated) card number:\n subscription.card_no = query[\"tcardno\"]\n \n subscription\n else\n new(nil, 'error' => query[\"error\"])\n end\n end", "def create\n s_params = params[:subscription]\n s_params.delete(:id)\n @subscription = Subscription.new(s_params)\n @subscription.save\n respond_with(@subscription)\n end", "def subscribe!(params)\n raise Errors::AlreadySubscribedError if subscribed?\n raise Errors::StripeCustomerExistsError if stripe_customer_id\n\n customer = ::Stripe::Customer.create(\n source: params[:stripe_token],\n plan: params[:subscription_plan_id] || SlackRubyBotServer::Stripe.config.subscription_plan_id,\n email: params[:stripe_email],\n metadata: {\n id: id,\n team_id: team_id,\n name: name,\n domain: domain\n }\n )\n\n update_attributes!(\n subscribed: true,\n subscribed_at: Time.now.utc,\n stripe_customer_id: customer['id'],\n subscription_expired_at: nil,\n subscription_past_due_at: nil,\n subscription_past_due_informed_at: nil\n )\n\n customer\n end", "def create\n\t\t@subscription = Subscription.new(params[:subscription])\n\t\trespond_to do |format|\n\t\t\tif fonct_new_dup?\n\t\t\t\tobject_orig=Subscription.find(params[:object_orig_id])\n\t\t\tst = @subscription.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @subscription.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\t#format.html { redirect_to(@subscription, :notice => 'Subscription was successfully created.') }\n\t\t\t\tflash[:notice] = 'Subscription was successfully created.'\n\t\t\t\tparams[:id]= @subscription.id\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n\t\t\telse\n\t\t\t\t@ingroups = Group.all\n\t\t\t\t@inprojects = Project.all\n\t\t\t\t@fortypesobjects=Typesobject.get_from_observer\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create!(*args)\n instance = self.new(*args)\n instance.save!\n return instance\n end", "def create\n @subscription = Subscription.create(params[:subscription])\n gb = Gibbon::API.new(\"6f8672a5c2393d1441c54d3be3fb79a1-us1\")\n gb.lists.subscribe({:id => \"c0ca5b3d41\", :email => {:email => params[:subscription][:email]}, :merge_vars => {:FNAME => '', :LNAME => ''}, :double_optin => false})\n end", "def subscription_created(user_id, discount_code:, products:, subscription_id:, subscription_mrr:, subscription_time_interval:, subscription_value:)\n track(user_id, SubscriptionCreated.new(\n discount_code: discount_code,\n products: products,\n subscription_id: subscription_id,\n subscription_mrr: subscription_mrr,\n subscription_time_interval: subscription_time_interval,\n subscription_value: subscription_value \n ))\n end", "def create\n @subscription = Subscription.new(subscription_params)\n @subscription.activity :params => {:composite_key => \"#{@subscription.game_id},#{@subscription.player_id}\"}\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription.game, notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n current_subscriber.update_company_subscription_by_token(params[:recurly_token])\n\n # TODO hide advisor plan when the company is advised\n if current_subscriber.subscription.plan_code == 'advisor_annual'\n current_company.upgrade_to_advisor!\n end\n\n flash[:notice] = 'Subscription was successfully created!'\n redirect_to app_url(subdomain: current_company.subdomain)\n end", "def create_subscription(subscription_info, opts = {})\n data, _status_code, _headers = create_subscription_with_http_info(subscription_info, opts)\n return data\n end", "def create(*args)\n instance = self.new(*args)\n instance.save\n return instance\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n @subscription.sub_create(current_user,subscription_params[:stripe_plan_id],subscription_params[:coupon_code])\n\n # Create a subscription with the following information:\n #\n # 1) Customer Account\n # 2) Subscription Type (GOLD, Silver, etc.)\n # 3) Discount Coupom (if applicable)\n\n if @subscription.save\n redirect_to @subscription, notice: 'Subscription was successfully created.'\n else\n @verrors = @subscription.errors.full_messages\n render 'new'\n end\n end", "def create_stripe_subscription!\n Stripe::Subscription.create(\n customer: create_stripe_customer!,\n tax_percent: Price::DEFAULT_TAX_RATE,\n trial_from_plan: store.eligible_for_trial_subscription?,\n items: [\n {plan: stripe_plan_id},\n ],\n metadata: {store: store.name}\n )\n end", "def subscribe!\n Subscription.transaction do\n subscription = create_stripe_subscription!\n store.subscriptions.create!(\n customer: user,\n stripe_plan_id: stripe_plan_id,\n stripe_id: subscription.id,\n first_date: Date.today,\n status: :active\n )\n end\n end", "def create_subscription(credit_card, options = {})\n\n u = self.user\n options[:order_id] = number # currently just loading a date\n options[:email] = u.email\n options[:address] = {\n :first_name => u.first_name,\n :last_name => u.last_name,\n :address1 => u.street_address1,\n :address2 => (u.street_address2 || \"\"),\n :company => (u.company || \"\"),\n :city => u.city,\n :state => u.us_state,\n :zip => u.zip,\n :country => 'United States',\n :phone => u.primary_phone\n }\n\n subscription = OrderTransaction.generate_yearly_subscription(credit_card, options)\n self.save!\n order_transactions << subscription\n\n if subscription.success?\n self.payment_captured!\n else\n self.transaction_declined!\n end\n\n subscription\n end", "def create_auto_subscription(user, target, namespace = nil)\n if namespace\n if user.can?(:\"read_#{namespace.class.name.underscore}\", namespace)\n user.auto_subscriptions.create(target: target, namespace_id: namespace.id, namespace_type: namespace.class.name)\n end\n else\n user.auto_subscriptions.create(target: target)\n end\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n @subscription.owner = Company.find(params[:company_id]) if params[:company_id]\n @subscription.owner = Person.find(params[:person_id]) if params[:person_id]\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription.owner, notice: 'Subscription was successfully created.' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(options)\n API::request(:post, 'subscription_agreements', options)\n end", "def create_single!(attributes, relation, options)\n attributes[:subscriber] = relation\n create!(attributes) unless options[:avoid_duplicates] && by_parents(relation, attributes[:publisher]).exists?\n end", "def create\n @product_subscription = ProductSubscription.new(params[:product_subscription])\n\n respond_to do |format|\n if @product_subscription.save\n format.html { redirect_to campaign_subscription_path(@product_subscription.subscription.campaign, @product_subscription.subscription), :notice => 'Product subscription was successfully created.' }\n format.json { render :json => @product_subscription, :status => :created, :location => @product_subscription }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product_subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def subscribe( publication )\n subscriptions.create(publication: publication) unless has_subscribed?(publication)\n rescue ActiveRecord::RecordNotUnique\n end", "def create\n @subscription = current_user.subscriptions.create(subscription_params)\n redirect_to @playlist\n end", "def create_subscription(options)\n # This call automatically creates an invoice, always.\n Stripe::Subscription.create({\n customer: customer.id,\n tax_percent: calculate_vat_rate\n }.merge(options))\n end", "def subscribe\n @podcast = Podcast.where(:id => params[:id]).first\n unless Subscription.where(:user_id => current_user.id, :podcast_id => params[:id]).size > 0\n @subscription = Subscription.new(:user_id => current_user.id, :podcast_id => params[:id])\n if @subscription.save\n puts \"Subscription successfully created!\"\n redirect_to @podcast, :notice => \"successfully subscribed!\"\n # render :layout => false\n else\n puts \"Subscription failed to be created!\"\n render :layout => false\n end\n end\n end", "def create\n # TODO:\n # * guard based on \"state\" param:\n # if `session['omniauth.state]`, `params[:state]` must match.\n\n authorization = Corkboard::Authorization.create!(auth_attrs)\n subscription = Corkboard::Subscription.create!(provider, authorization)\n\n Corkboard.publish!(subscription.backlog)\n redirect_to(authorizations_path)\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n if @subscription.save\n render json: @subscription, status: :created, location: @subscription\n else\n render json: @subscription.errors, status: :unprocessable_entity\n end\n end", "def create\n @subscriber = MailchimpSubscriber.new params[:mailchimp_subscriber]\n\n respond_to do |format|\n if @subscriber.valid? && GoGoGibbon::Commands.subscribe(@subscriber)\n format.html { redirect_to(mailchimp_subscribers_path, :notice => 'User was successfully subscribed.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::POST_SUBSCRIPTION\n\n args.req_body = ZAPIArgs.new\n args.req_body.accountKey = SAMPLE_ACCOUNT_KEY\n args.req_body.contractEffectiveDate = '2013-02-1'\n args.req_body.termType = 'TERMED'\n args.req_body.initialTerm = '12'\n args.req_body.autoRenew = true\n args.req_body.renewalTerm = \"3\"\n args.req_body.notes = 'Test POST subscription from z-ruby-sdk'\n args.req_body.subscribeToRatePlans = []\n args.req_body.subscribeToRatePlans[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].productRatePlanId = 'ff8080811ca15d19011cdda9b0ad3b51'\n args.req_body.subscribeToRatePlans[0].chargeOverrides = []\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].productRatePlanChargeId =\n 'ff8080811ca15d19011cddad8c953b53'\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].quantity = 10\n args.req_body.invoiceTargetDate = '2013-12-31'\n args.req_body.invoiceCollect = false\n\n puts \"========== CREATE A SUBSCRIPTION ============\"\n\n begin\n @z_client.post(args) do |resp|\n ap resp\n return resp.subscriptionNumber if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end", "def create\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: (I18n.t :subscription_created) }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @campaign = Campaign.new(campaign_params)\n @campaign.users << current_user\n\n respond_to do |format|\n if @campaign.save\n format.html { redirect_to tenant_campaign_path(@campaign, tenant_id: @tenant.id), notice: 'Campaign was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n if session[:user_id] \n user = User.find(session[:user_id])\n s = Subscription.new\n s.url = params[:subscription][:url]\n s.title = params[:subscription][:title]\n s.user = user\n @subscription = s\n \n respond_to do |format|\n if @subscription.save\n format.html { redirect_to(@subscription, :notice => 'Subscription was successfully created.') }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create!(*args)\n props = args[0] || {}\n association_props = extract_association_attributes!(props) || {}\n\n new(*args).tap do |o|\n yield o if block_given?\n o.save!\n association_props.each do |prop, value|\n o.send(\"#{prop}=\", value)\n end\n end\n end", "def create!(*args)\n props = args[0] || {}\n association_props = extract_association_attributes!(props)\n\n new(*args).tap do |o|\n yield o if block_given?\n o.save!\n association_props.each do |prop, value|\n o.send(\"#{prop}=\", value)\n end\n end\n end", "def subscription_service_create(space_id, create_request, opts = {})\n data, _status_code, _headers = subscription_service_create_with_http_info(space_id, create_request, opts)\n return data\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n @subscription.screen = @screen\n @subscription.field = @field\n auth!\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to(manage_screen_field_subscriptions_path(@screen, @field), :notice => t(:subscription_created)) }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def subscription_created(resource, opts = {})\n raise('expected an Effective::Customer') unless resource.kind_of?(Effective::Customer)\n\n @customer = resource\n subject = subject_for(__method__, 'New Subscription', resource, opts)\n headers = headers_for(resource, opts)\n\n mail(to: @customer.user.email, subject: subject, **headers)\n end", "def find_or_build_comment_subscription user\n unless subscription = subscription_on_comments(user) \n subscription = commentable_subscriptions.where{user_id == user.id}.build\n end\n subscription\n end", "def create(name, id=nil)\n campaign_opts = {name: name}\n campaign_opts = campaign_opts.merge({id: id}) unless id.nil?\n Mailgun.submit(:post, campaign_url, campaign_opts)\n end", "def create_gocardless_subscription\n GO_CARDLESS_CLIENT.subscriptions.create(\n params: {\n amount: User::PLAN_AMOUNT.to_i,\n currency: User::GO_CARDLESS_CURRENCY,\n name: User::GO_CARDLESS_NAME,\n interval_unit: User::INTERVAL_UNIT,\n interval: 1,\n start_date: Date.current + 2.month,\n day_of_month: 1,\n links: {\n mandate: current_user.go_cardless_mandate\n }\n }\n )\n end", "def create\n @subscription = Subscription.new(subscription_params)\n @subscription.user = current_user\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: t('controller.successfully_created', model: t('activerecord.models.subscription')) }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authenticate_user!\n authorize! :index, @user, :message => 'Not authorized as an administrator.'\n \n @campaign = Campaign.new(params[:campaign])\n\n respond_to do |format|\n if @campaign.save\n format.html { redirect_to @campaign, notice: 'Campaign was successfully created.' }\n format.json { render json: @campaign, status: :created, location: @campaign }\n else\n format.html { render action: \"new\" }\n format.json { render json: @campaign.errors, status: :unprocessable_entity }\n end\n end\n end", "def create / update_subscriptions\n end", "def create\n tournament = Tournament.find(params[:tournament_id])\n s = Subscription.new\n s.tournament_id = tournament.id\n if tournament.is_individual?\n s.participant_id = params[:participant_id] || session[:user_id]\n \n flash[:valid] = I18n.t('subscription.ok') if s.save\n else\n if params[:membership_id]\n s.participant_id = params[:membership_id]\n\n flash[:valid] = I18n.t('subscription.ok') if s.save\n end\n end\n redirect_to :back\n end", "def create\n @subscription = Subscription.create(params[:subscription])\n groups = params[:subscription][:group_name].split(\",\").collect(&:strip)\n email = params[:subscription][:email]\n begin\n gb = Gibbon::API.new(\"f24fdd53217fab0b0698fdaba15c0c6f-us7\")\n subscribe = gb.lists.subscribe({\n :id => \"caa152eac4\",\n :email => {:email => email},\n :merge_vars => {\n :FNAME => \"\",\n :LNAME => \"\",\n :groupings => {\n 0 => {\n :id => 4457,\n :groups => groups\n }\n }\n },\n :update_existing => true,\n :double_optin => false\n })\n #logger.debug subscribe\n rescue Gibbon::MailChimpError\n \n end\n redirect_to \"/contact\"\n end", "def create\n # params[:id] is the knowmadics id\n\n @api_subscription = Api::Subscription.new(api_subscription_params)\n\n respond_to do |format|\n if @api_subscription.save\n format.html { redirect_to @api_subscription, notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @api_subscription }\n else\n format.html { render :new }\n format.json { render json: @api_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_if_necessary!\n if topic.blank?\n @topic = pubsub.create_topic(topic_name).tap do |topic|\n raise error, \"Unable to create topic #{topic_name}\" if topic.nil?\n end\n end\n\n @subscription = @topic.find_subscription(subscription_name) || @topic.create_subscription(subscription_name)\n @subscription.tap do |subscription|\n raise Error, \"Unable to create subscription #{subscription_name}\" if subscription.nil?\n\n # Default subscription expiry is 31 days. We want none of that.\n subscription.expires_in = nil unless pubsub.project_id == EMULATOR.fetch(:project_id)\n end\n end", "def create_organization_and_subscription_plan\n organization = Organization.create(\n name: \"My Organization\",\n subscription_plan_id: self.subscription_plan_id,\n time_zone: self.time_zone\n )\n\n organization_membership = organization.add_user(self)\n organization_membership.role = :owner\n organization_membership.save\n end", "def call(_obj, args, _ctx)\n Customer.create!(\n name: args[:name],\n email: args[:email],\n )\n end", "def create\n return false unless self.valid? \n \n # set defaults for budget for campaign.create only\n self.budget = budget.reverse_merge( period: 'DAILY', delivery_method: 'STANDARD' )\n\n # create basic campaign attributes\n operand = Hash[\n [ :name, :status, :start_date, :end_date,\n :budget, :bidding_strategy, :network_setting, :settings ].map do |k|\n [ k.to_sym, self.send(k) ] if self.send(k)\n end.compact\n ]\n\n # set default values for settings (for create only - should we set it also for update?)\n # PS: KeywordMatchSetting is required since 201206\n operand[:settings] ||= []\n unless operand[:settings].map { |s| s[:xsi_type] }.include?('KeywordMatchSetting')\n operand[:settings] << { :xsi_type => 'KeywordMatchSetting', :opt_in => false }\n end\n\n response = self.mutate( \n operator: 'ADD', \n operand: operand\n )\n\n check_for_errors(self)\n\n self.id = response[:value].first[:id] rescue nil\n \n if criteria && criteria.size > 0\n new_criteria = Adapi::CampaignCriterion.create(\n campaign_id: @id,\n criteria: criteria\n )\n\n check_for_errors(new_criteria)\n end\n\n ad_groups.each do |ad_group_data|\n ad_group = Adapi::AdGroup.create(\n ad_group_data.merge( campaign_id: @id )\n )\n\n check_for_errors(ad_group, :prefix => \"AdGroup \\\"#{ad_group[:id] || ad_group[:name]}\\\"\")\n end\n\n self.errors.empty?\n\n rescue CampaignError => e\n false\n end", "def upsert_subscription(entity, subscription_params)\n raise \"'#{entity.name}' has no Stripe Account\" if entity.stripe_customer_id.blank?\n\n customer = get_stripe_customer(entity.try(:stripe_customer_id))\n raise \"'#{entity.name}' has no Stripe Account\" if customer.nil?\n raise \"Stripe account for '#{entity.name}' is deleted\" if customer.try(:deleted) == true\n raise \"'#{entity.name}' has no default payment method in Stripe\" if customer.try(:default_source).blank? && subscription_params[:source].blank?\n\n # Initialize 'subscription not found' state\n subscription = nil\n\n # Gather data\n submission_data = {\n plan: subscription_params[:plan],\n metadata: {\n \"lo_entity_id\" => entity.id,\n \"lo_entity_type\" => entity.class.name.underscore,\n \"lo_entity_name\" => entity.name\n }\n }\n # Stripe uses the default card if one exists, making this value optional\n submission_data[:source] = subscription_params[:source] if subscription_params[:source].present?\n\n # Stripe complains if you pass an empty coupon. Only add it if it exists\n submission_data[:coupon] = subscription_params[:coupon] if subscription_params[:coupon].present?\n\n customer.subscriptions.data.each do |sub|\n # If an existing subscription matches the current data...\n if sub.plan.id == subscription_params[:plan]\n # ...then update the subscription:\n subscription = customer.subscriptions.retrieve(sub.id)\n subscription.plan = submission_data[:plan]\n subscription.source = submission_data[:source] if submission_data[:source].present?\n subscription.coupon = submission_data[:coupon] if submission_data[:coupon].present?\n subscription.save\n\n else\n # Otherwise delete it:\n customer.subscriptions.retrieve(sub.id).delete\n end\n end\n\n # If no matching subscription was found...\n if subscription.nil?\n # ...just create one\n subscription = customer.subscriptions.create(submission_data)\n end\n\n subscription\n end", "def create\n @campaign = current_user.campaigns.new(params[:campaign])\n\n respond_to do |format|\n if @campaign.save\n format.html { redirect_to(@campaign, :notice => 'Campaign was successfully created.') }\n format.xml { render :xml => @campaign, :status => :created, :location => @campaign }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @campaign.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @campaign = Campaign.new(campaign_params)\n @campaign.user_id = current_user[:id]\n\n respond_to do |format|\n if @campaign.save\n puts \"New campaign created: #{@campaign.inspect}\" \n\n if Rails.env.production?\n tracker = Mixpanel::Tracker.new(Generic.get_mixpanel_key)\n tracker.track(@campaign.user_id, 'Campaign Created')\n end \n\n format.html {\n redirect_to new_campaign_message_path(@campaign)\n }\n format.json { render :show, status: :created, location: @campaign }\n else\n format.html { render :new }\n format.json { render json: @campaign.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe(options, &block)\n subscriptions.create(options, &block)\n end", "def findOrCreate(args, options = {})\n # attempt to find the record\n res = get_cached(args)\n\n # on failure, do\n unless res\n args.merge!(options)\n res = self.new(args).save!\n\n # Update cache\n cache_key = gen_cache_key(args)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, Octo::Utils.serialize(res))\n end\n res\n end", "def create \n @subscription = Subscription.new(params[:subscription])\n \n uri = URI.parse(request.env[\"HTTP_REFERER\"])\n unless %w{ app.atra.obra.org localhost app.americantrackracing.com raceatra.com www.raceatra.com}.include?(uri.host)\n flash[:notice] = \"Cannot send request from '#{uri.host}'\"\n return render(:action => \"new\")\n end\n\n if @subscription.valid?\n email = SubscriptionMailer.create_subscription_request(@subscription)\n SubscriptionMailer.deliver(email)\n redirect_to(:action => \"subscribed\")\n else\n render(:action => \"new\")\n end\n end", "def create!(*args)\n new(*args).tap do |o|\n yield o if block_given?\n o.save!\n end\n end", "def create\n @subscriber = Subscriber.new(params[:subscriber])\n\n @subscriber.account = @account\n\n respond_to do |format|\n if @subscriber.save\n format.html { redirect_to account_subscriber_path(@account, @subscriber), notice: 'Subscriber was successfully created.' }\n format.json { render json: @subscriber, status: :created, location: @subscriber }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @panel_subscription = Panel::Subscription.new(params[:panel_subscription])\n\n respond_to do |format|\n if @panel_subscription.save\n format.html { redirect_to(@panel_subscription, :notice => 'Subscription was successfully created.') }\n format.json { render :json => @panel_subscription, :status => :created, :location => @panel_subscription }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def find_or_create(*args)\n result = find(*args)\n result.empty? ? create!(*args) : result.first\n end", "def create\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to root_url, notice: 'Subscription was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subscription }\n else\n format.html { render action: 'new' }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def find_or_create(*args, &block)\n find_or_initialize_and_do :save, *args, &block\n end", "def create_campaign(opts = {})\n data, _status_code, _headers = create_campaign_with_http_info(opts)\n return data\n end", "def create\n @campaign = Campaign.new(campaign_params)\n\n begin\n ActiveRecord::Base.transaction do\n # 両方の Validation を実行しておく\n campaign_invalid = @campaign.invalid?\n\n if campaign_invalid\n render :new\n return\n end\n\n @campaign.save!\n\n # 対応するオファーを作成\n @campaign.update_related_offers\n\n redirect_to :action => 'index', notice: 'Campaign was successfully created.'\n end\n rescue => e\n logger.error e\n render :new\n end\n end", "def create\n @user_to_channel_subscription = UserToChannelSubscription.new(user_to_channel_subscription_params)\n\n respond_to do |format|\n if @user_to_channel_subscription.save\n format.html { redirect_to @user_to_channel_subscription, notice: 'User to channel subscription was successfully created.' }\n format.json { render :show, status: :created, location: @user_to_channel_subscription }\n else\n format.html { render :new }\n format.json { render json: @user_to_channel_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe(options = {})\n subscribed_at = options[:subscribed_at] || Time.current\n with_email_subscription = options.has_key?(:with_email_subscription) ? options[:with_email_subscription] : ActivityNotification.config.subscribe_to_email_as_default\n with_optional_targets = options.has_key?(:with_optional_targets) ? options[:with_optional_targets] : ActivityNotification.config.subscribe_to_optional_targets_as_default\n new_attributes = { subscribing: true, subscribed_at: subscribed_at, optional_targets: optional_targets }\n new_attributes = new_attributes.merge(subscribing_to_email: true, subscribed_to_email_at: subscribed_at) if with_email_subscription\n if with_optional_targets\n optional_target_names.each do |optional_target_name|\n new_attributes[:optional_targets] = new_attributes[:optional_targets].merge(\n Subscription.to_optional_target_key(optional_target_name) => true,\n Subscription.to_optional_target_subscribed_at_key(optional_target_name) => Subscription.convert_time_as_hash(subscribed_at))\n end\n end\n update(new_attributes)\n end", "def build_create_subscription_request(xml, options)\n # Subscription\n add_subscription(xml, options)\n\n xml.target!\n end", "def create_new_subscription\n @subscription_offers = Subscription.get_subscription_list\n end", "def create\n @report_subscription = ReportSubscription.new(report_subscription_params)\n\n respond_to do |format|\n if @report_subscription.save\n format.html { redirect_to @report_subscription, notice: 'Report subscription was successfully created.' }\n format.json { render :show, status: :created, location: @report_subscription }\n else\n format.html { render :new }\n format.json { render json: @report_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create!(*args, &block)\n instance = new(*args, &block)\n instance.create!\n instance\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to Binder.find(@subscription.binder_id), notice: 'Subscription was successfully created.' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n@subscription = current_user.subscriptions.build(subscription_params)\n\nrespond_to do |format|\n if @subscription.save\n\n format.html { redirect_to user_profile_url(current_user.id), notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\nend\nend", "def createDiarySubject _obj, _args\n \"_obj createDiarySubject _args;\" \n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n if params.has_key?(:new_service_id)\n service = Service.find(params[:new_service_id])\n unless service.nil?\n @subscription.service_id = service.id\n @subscription.costs = service.costs\n @subscription.user_id = current_user.id\n end\n end\n\n respond_to do |format|\n if @subscription.save\n flash[:success] = \"Subscription was successfully created.\"\n format.html { redirect_to @subscription }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n unless service.nil?\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n else\n flash[:error] = \"Subscription was not successful.\"\n format.html redirect_to services_path\n end\n end\n end\n end", "def create\n @vendor_subscription = VendorSubscription.new(vendor_subscription_params)\n\n respond_to do |format|\n if @vendor_subscription.save\n format.html { redirect_to @vendor_subscription, notice: 'Vendor subscription was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_subscription }\n else\n format.html { render :new }\n format.json { render json: @vendor_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\t\tif !current_user\r\n\t\t\tredirect_to '/'\r\n\t\t\treturn\r\n\t\tend\r\n\t\tif current_user.additionsThisRound >= Round.first.maxAdditionsPerUser + current_user.abilities.find_by(ability_id: 4).charges\r\n\t\t\trespond_to do |format|\r\n\t\t\t\tmsg = \"<span class=\\\"alert alert-warning\\\">You have exceeded your submission limit for this round.</span>\"\r\n\t\t\t\tformat.html { redirect_to current_user, notice: msg }\r\n\t\t\t\tformat.json { render :show, location: current_user }\r\n\t\t\tend\r\n\t\t\treturn\r\n\t\tend\r\n\r\n\t\t@campaign = Campaign.new(campaign_params)\r\n\r\n\t\tlink = campaign_params[:link]\r\n\t\tprovider = link.sub(\"https://\", \"\").sub(\"http://\", \"\").split(\"/\")[0]\r\n\r\n\t\tcase provider\r\n\t\twhen *Crowdfunding_site.pluck(:domain)\r\n\t\t\tif Campaign.exists?(link: link)\r\n\t\t\t\tnominate(link, provider)\r\n\t\t\telse\r\n\t\t\t\tadd(provider)\r\n\t\t\tend\r\n\t\telse\r\n\t\t\trepond_to do |format|\r\n\t\t\t\tmsg = \"<span class=\\\"alert alert-warning\\\">The site this URL is pointing at is not supported.</span>\"\r\n\t\t\t\tformat.html { redirect_to current_user, notice: msg }\r\n\t\t\t\tformat.json { render :show, location: current_user }\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def create\n \n @subscription = Subscription.new(params[:subscription])\n @subscription.quantity = @subscription.subscription_type.number_of_issues\n @subscription.unit_cost = @subscription.subscription_type.unit_cost\n \n respond_to do |format|\n if @subscription.save\n flash[:notice] = 'Subscription was successfully created.'\n format.html { redirect_to(@subscription) }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n requestor = User.where(email: @requestor)\n target = User.where(email: @target)\n\n if requestor.exists? && !target.exists?\n render json: { success: false, message: \"Target Email not found\" }\n\n elsif !requestor.exists? && target.exists?\n render json: { success: false, message: \"Requestor Email not found\" }\n\n elsif !requestor.exists? && !target.exists?\n render json: { success: false, message: \"Both Email not found\" }\n\n else\n if @requestor != @target || @target != @requestor\n user = User.find_by_email @requestor\n aim = User.find_by_email @target\n user.subscribes.create target_id: aim.id\n render json: { success: true }\n else\n render json: { success: false, message: \"You can't subscribe yourself\" }\n end\n\n end\n end", "def create\n @subscription = Subscription.new(subscription_params)\n @subscription.screen = @screen\n @subscription.field = @field\n auth!\n\n # Verify the screen can read the feed\n ability = Ability.new(@screen)\n @subscription.feed = nil if ability.cannot?(:read, @subscription.feed)\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to(screen_field_subscriptions_path(@screen, @field), notice: t(:subscription_created)) }\n format.xml { render xml: @subscription, status: :created, location: @subscription }\n format.js\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @subscription.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create!(params = {})\n association.build(model, params).tap(&:save!)\n end", "def create\n plan = Billingly::Plan.find(params[:plan_id])\n unless current_customer.can_subscribe_to?(plan)\n return redirect_to subscriptions_path, notice: 'Cannot subscribe to that plan'\n end\n current_customer.subscribe_to_plan(plan)\n on_subscription_success\n end", "def create\n plan = Billingly::Plan.find(params[:plan_id])\n unless current_customer.can_subscribe_to?(plan)\n return redirect_to subscriptions_path, notice: 'Cannot subscribe to that plan'\n end\n current_customer.subscribe_to_plan(plan)\n on_subscription_success\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n \n @subscription = Subscription.new()\n @subscription.luser_id = current_user.luser.id\n \n @subscription.project_id = params[:project_id]\n \n current = Subscription.find(:first, :conditions => {:luser_id => current_user.luser.id, \n :project_id => params[:project_id] })\n \n respond_to do |format|\n if current != nil\n current.destroy\n format.json { head :no_content }\n elsif @subscription.save\n recieving_user = Luser.find(:first, :conditions => {:name => @subscription.project.created_by })\n Notification.add(@subscription.project, nil,\"project_subscription\", recieving_user, current_user.luser)\n LuserMailer.new_subscriber(current_user.luser, @subscription.project,).deliver\n format.html { redirect_to @subscription, notice: 'Subscription was successfully created.' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe_author\n self.subscriptions.create user_id: self.user.id\n end", "def create!(*args)\n session = new(*args)\n session.save!\n end", "def create!(*args)\n session = new(*args)\n session.save!\n end" ]
[ "0.75296235", "0.64149314", "0.63212955", "0.60824597", "0.6034721", "0.5917424", "0.58482075", "0.5841959", "0.57585114", "0.5746375", "0.5724394", "0.57079816", "0.5707246", "0.56818575", "0.56723", "0.56309414", "0.5626865", "0.55641526", "0.556065", "0.5556583", "0.55479836", "0.554601", "0.5536344", "0.55281305", "0.5527648", "0.5523008", "0.5502966", "0.54928035", "0.5492749", "0.5485606", "0.5475438", "0.5465396", "0.54458135", "0.54370064", "0.54304934", "0.54222095", "0.5414101", "0.54005414", "0.5399949", "0.5394543", "0.5377695", "0.53660333", "0.5363833", "0.53569835", "0.53432906", "0.53286564", "0.53278625", "0.5324897", "0.53235406", "0.5302875", "0.5292527", "0.5283858", "0.5282688", "0.5261031", "0.52565074", "0.525299", "0.52457696", "0.5214255", "0.52126026", "0.5200473", "0.5187543", "0.51523215", "0.5148392", "0.514598", "0.51445454", "0.5123651", "0.51090074", "0.51084626", "0.5094523", "0.5092974", "0.50904024", "0.507684", "0.5069592", "0.50627536", "0.50598574", "0.5058625", "0.50573546", "0.50503206", "0.5040135", "0.5038411", "0.5038337", "0.5028363", "0.50151634", "0.5014047", "0.501228", "0.5004874", "0.50041664", "0.49995342", "0.49985662", "0.49906588", "0.49803936", "0.49796933", "0.49779978", "0.49722794", "0.49703708", "0.49703708", "0.49485615", "0.49454698", "0.49453485", "0.49453485" ]
0.75935745
0
Subscribes an object to a campaign. Raises `ActiveRecord::RecordInvalid` if the record was invalid.
def subscribe!(subscriber, **args) caffeinate_campaign_subscriptions.find_or_create_by!(subscriber: subscriber, **args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe(subscriber, **args)\n caffeinate_campaign_subscriptions.find_or_create_by(subscriber: subscriber, **args)\n end", "def subscribe\n CampaignMonitorWrapper.subscribe(id: user.id, email: user.email, name: user.name, beta: user.beta?.to_s, billable: user.billable?.to_s)\n end", "def subscribe!(params)\n raise Errors::AlreadySubscribedError if subscribed?\n raise Errors::StripeCustomerExistsError if stripe_customer_id\n\n customer = ::Stripe::Customer.create(\n source: params[:stripe_token],\n plan: params[:subscription_plan_id] || SlackRubyBotServer::Stripe.config.subscription_plan_id,\n email: params[:stripe_email],\n metadata: {\n id: id,\n team_id: team_id,\n name: name,\n domain: domain\n }\n )\n\n update_attributes!(\n subscribed: true,\n subscribed_at: Time.now.utc,\n stripe_customer_id: customer['id'],\n subscription_expired_at: nil,\n subscription_past_due_at: nil,\n subscription_past_due_informed_at: nil\n )\n\n customer\n end", "def subscriber(record, **args)\n caffeinate_campaign_subscriptions.find_by(subscriber: record, **args)\n end", "def subscribe(object)\n while object.respond_to?(:__getobj__)\n object = object.__getobj__\n end\n\n if remote_object = (remote_object(object) rescue nil)\n if !subscriptions.include?(remote_object)\n remote_object = nil\n end\n end\n\n unless remote_object\n remote_sibling = object.sibling_on(self)\n remote_object = call(:subscribe, remote_sibling)\n synchro_point\n end\n local_object = local_object(remote_object)\n end", "def subscribe!\n Subscription.transaction do\n subscription = create_stripe_subscription!\n store.subscriptions.create!(\n customer: user,\n stripe_plan_id: stripe_plan_id,\n stripe_id: subscription.id,\n first_date: Date.today,\n status: :active\n )\n end\n end", "def subscribe(email, campaign_id, options = {})\n data = options.merge(\"email\" => email)\n url = \"v2/#{account_id}/campaigns/#{campaign_id}/subscribers\"\n make_json_api_request :post, url, private_generate_resource(\"subscribers\", data)\n end", "def subscribes?(record, **args)\n subscriber(record, **args).present?\n end", "def subscribe(event)\n has_subscriptions.create(subscribed_id: event.id)\n end", "def subscribe\n @podcast = Podcast.where(:id => params[:id]).first\n unless Subscription.where(:user_id => current_user.id, :podcast_id => params[:id]).size > 0\n @subscription = Subscription.new(:user_id => current_user.id, :podcast_id => params[:id])\n if @subscription.save\n puts \"Subscription successfully created!\"\n redirect_to @podcast, :notice => \"successfully subscribed!\"\n # render :layout => false\n else\n puts \"Subscription failed to be created!\"\n render :layout => false\n end\n end\n end", "def push_subscription(object)\n local_server.subscribe(object)\n synchro_point\n end", "def subscribe_to_channel\n run_callbacks :subscribe do\n subscribed\n end\n\n reject_subscription if subscription_rejected?\n ensure_confirmation_sent\n end", "def subscribe\n # Ask the list manager to subscribe this devise models email.\n self.class.list_manager.subscribe(self.email, campaignable_additional_fields)\n end", "def perform(campaign)\n campaign.apply_premailer\n campaign.list.subscriptions.availables.each do |s|\n campaign.push_notification(s)\n end\n end", "def subscribe(agent, type, collective)\n source = make_target(agent, type, collective)\n unless @subscriptions.include?(source)\n Log.debug(\"Subscribing to #{source}\")\n @connection.subscribe(source)\n @subscriptions << source\n end\n rescue\n Log.error(\"Received subscription request for #{source.inspect.chomp} but already had a matching subscription, ignoring\")\n end", "def subscribe\n @broker.subscribe(*self.class.subscriptions) do |channel, data|\n begin\n perform(channel, data)\n rescue => e\n puts \"Exception #{e}\"\n end\n end\n end", "def subscribe(recipient)\n subscription = subscriptions.find_or_initialize_by(recipient: recipient)\n return unless subscription.new_record?\n subscription.save\n subscription\n end", "def subscribe(course)\n subscribeds << course\n end", "def resubscribe!\n update!(unsubscribed_at: nil, resubscribed_at: ::Caffeinate.config.time_now)\n\n caffeinate_campaign.to_dripper.run_callbacks(:on_resubscribe, self)\n end", "def subscribe(contact)\n c = ActsAsIcontact::Contact.find(contact)\n s = ActsAsIcontact::Subscription.new(:contactId => c.id, :listId => id)\n s.save\n end", "def subscribe(user)\n return false if user == self\n if subscription = find_any_subscription_with(user)\n subscription.update_attributes(status: Subscription.statuses[:allowed])\n else\n Subscription.new(subscriber_id: user.id, user_id: self.id).save\n end\n end", "def subscribe(params)\n web_id = params[\"web_id\"]\n email = params[\"merges\"][\"EMAIL\"]\n\n subscriber = nil\n enabled_models.each { |model| subscriber ||= model.constantize.find_by_email(email) }\n\n subscriber.subscribed_to_list = true\n subscriber.mail_chimp_id = web_id.to_i\n subscriber.save_without_update_list_member(:validate => false)\n end", "def subscribe_owner\n\t subscription = owner.subscribe_to(activity_feed)\n\t subscription.save\n\t end", "def link_campaign(campaign)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Campaign must be saved\")if campaign.new_record?\n\n session = self.class.connection\n server = XmlrpcClient.new2(\"#{session.url}\")\n server.call(\"ox.linkCampaign\", session, self.id, campaign.id)\n end", "def trigger(event_name, args, object, scope: nil)\n field = @schema.get_field(\"Subscription\", event_name)\n if !field\n raise \"No subscription matching trigger: #{event_name}\"\n end\n\n event = Subscriptions::Event.new(\n name: event_name,\n arguments: args,\n field: field,\n scope: scope,\n )\n execute_all(event, object)\n end", "def subscribe\n @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default),\n with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default))\n return_back_or_ajax\n end", "def link_campaign(campaign)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Campaign must be saved\")if campaign.new_record?\n\n session = Base.connection\n server = XMLRPC::Client.new2(\"#{session.url}#{self.class.endpoint}\")\n server.call(\"linkCampaign\", session.id, self.id, campaign.id)\n end", "def subscribe\n Case_Watcher.create_subscription!(current_contact.synced_record, set_options )\n if request.xhr?\n render :update do |page|\n page.alert \"Case Watcher Created.\"\n page.replace_html \"subscribe_container\", set_subscribe_link\n end\n else\n flash[:notice] = \"Case Watcher Created.\"\n redirect_to(:back)\n end\n \n end", "def pub_sub_record(record)\n subscribe_record(record)\n publish_record(record)\n end", "def subscription_created(resource, opts = {})\n raise('expected an Effective::Customer') unless resource.kind_of?(Effective::Customer)\n\n @customer = resource\n subject = subject_for(__method__, 'New Subscription', resource, opts)\n headers = headers_for(resource, opts)\n\n mail(to: @customer.user.email, subject: subject, **headers)\n end", "def stripe_customer_subscription_updated(event, req)\n subscription = event['data']['object']\n subs = Lynr::Model::Subscription.new({\n canceled_at: subscription['canceled_at'],\n plan: subscription['plan']['id'],\n status: subscription['status'],\n })\n dealership = dealer_dao.get_by_customer_id(subscription['customer']).set('subscription' => subs)\n dealer_dao.save(dealership)\n end", "def subscribe(options, &block)\n subscriptions.create(options, &block)\n end", "def create\n plan = Billingly::Plan.find(params[:plan_id])\n unless current_customer.can_subscribe_to?(plan)\n return redirect_to subscriptions_path, notice: 'Cannot subscribe to that plan'\n end\n current_customer.subscribe_to_plan(plan)\n on_subscription_success\n end", "def create\n plan = Billingly::Plan.find(params[:plan_id])\n unless current_customer.can_subscribe_to?(plan)\n return redirect_to subscriptions_path, notice: 'Cannot subscribe to that plan'\n end\n current_customer.subscribe_to_plan(plan)\n on_subscription_success\n end", "def create\n @subscriber = MailchimpSubscriber.new params[:mailchimp_subscriber]\n\n respond_to do |format|\n if @subscriber.valid? && GoGoGibbon::Commands.subscribe(@subscriber)\n format.html { redirect_to(mailchimp_subscribers_path, :notice => 'User was successfully subscribed.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def campaign; Campaign.get(self.campaign_id); end", "def campaign; Campaign.get(self.campaign_id); end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to campaign_subscription_path(@campaign, @subscription), :notice => 'Subscription was successfully created.' }\n format.json { render :json => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def call(obj, args, ctx)\n @inner_proc.call(obj, args, ctx) if @inner_proc && !@inner_proc.is_a?(GraphQL::Field::Resolve::BuiltInResolve)\n\n events = ctx.namespace(:subscriptions)[:events]\n\n if events\n # This is the first execution, so gather an Event\n # for the backend to register:\n events << Subscriptions::Event.new(\n name: ctx.field.name,\n arguments: args,\n context: ctx,\n )\n ctx.skip\n elsif ctx.irep_node.subscription_topic == ctx.query.subscription_topic\n # The root object is _already_ the subscription update:\n if obj.is_a?(GraphQL::Schema::Object)\n obj.object\n else\n obj\n end\n else\n # This is a subscription update, but this event wasn't triggered.\n ctx.skip\n end\n end", "def update_campaign(access_token, campaign)\n url = Util::Config.get('endpoints.base_url') +\n sprintf(Util::Config.get('endpoints.campaign'), campaign.id)\n url = build_url(url)\n payload = campaign.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::Campaign.create(JSON.parse(response.body))\n end", "def subscribe(object_to_time)\r\n fail \"Should have method #timed_out implemented\" unless object_to_time.respond_to?(:timed_out)\r\n\r\n @subscribers.push(object_to_time)\r\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def subscribe( publication )\n subscriptions.create(publication: publication) unless has_subscribed?(publication)\n rescue ActiveRecord::RecordNotUnique\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def create\n event = Event.find(params[:event_id])\n current_user.subscribe(event)\n redirect_to event\n end", "def subscribe\n @recipient = Recipient.new(params[:recipient])\n\n if request.post?\n s = Subscription.subscribe( @recipient, @project )\n if s\n render :text => @project.templets.find_by_name('PAGE_SUBSCRIBE_OK').render( @project ), :layout => true\n return\n end\n flash.now[:error] = _(\"Unable to accept your request!\")\n end\n \n render :text => @project.templets.find_by_name('PAGE_SUBSCRIBE').render( @project, :recipient => @recipient ), :layout => true\n end", "def stripe_customer_subscription_created(event, req)\n stripe_customer_subscription_updated(event, req)\n end", "def subscribe\n\t\t@subject = Subject.find_by_name(params[:name])\n\t\t@customer = current_user.customer\n\t\[email protected] << @subject\n\t\tflash[:success] = \"You have subscribed to #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend", "def subscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.subscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :merge_vars => {\n :FNAME => self.fname,\n :LNAME => self.lname,\n :COHORT_ID => self.cohort_id,\n :SCHOOL => self.school.name,\n :CITY => self.cohort.city.name,\n :SDATE => self.cohort.start_date,\n :EDATE => self.cohort.end_date,\n :ENV => Rails.env\n },\n :double_optin => false,\n :update_existing => true,\n :send_welcome => false\n })\n Rails.logger.info(\"Subscribed #{self.email} to MailChimp\") if result\n\n end", "def set_campaign\n @campaign = Campaign.find(params[:id])\n end", "def subscribe(magazine, price)\n Subscription.create(price: price, magazine_id: magazine.id, reader_id: self.id)\n end", "def run_subscribe(conn, dest)\n return if not @need_subscribe\n @log.debug \"run_subscribe starts\"\n conn.subscribe(dest) # call hook\n @log.debug \"run_subscribe done\"\n @need_subscribe = false\n @need_gets = true\nend", "def apply_mailchimp_subscription(subscription, list_id)\n email = @record.email\n return if email.blank?\n merge_fields = { FIRST_NAME: @record.first_name, LAST_NAME: @record.last_name }.merge(extra_merge_vars)\n body = { email_address: email, merge_fields: merge_fields }\n FfcrmMailchimp::Api.subscribe(list_id, subscribed_email, body, subscription.groupings)\n end", "def subscribe!\n # TODO: Implement\n end", "def ensure_subscribed_by(user)\n return true if self.subscribed_by?(user)\n subscriptions.build(user: user).save!\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique => e\n return true if e.is_a?(ActiveRecord::RecordInvalid) &&\n e.record.errors[:topic_id].any? && e.record.errors[:user_id].any?\n raise e\n end", "def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end", "def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end", "def subscribe\n begin\n gibbon.lists(mc_list_id).members.create(\n body: {\n email_address: params[:email][:address],\n status: \"subscribed\",\n marketing_permissions: [{\n marketing_permission_id: mc_mp_id_one,\n enabled: true\n }]\n }\n )\n flash[:success] = @settings.newsletter_success\n rescue Gibbon::MailChimpError => event\n message = \"Houston, we have a problem: #{event.message} - #{event.raw_body}\"\n Rails.logger.debug message\n flash[:failure] = @settings.newsletter_failure\n end\n redirect_to newsletter_path\n end", "def set_customer_campaign\n @customer_campaign = CustomerCampaign.find(params[:id])\n end", "def subscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribe')\n connection.send_stanza pres, &blk\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n respond_to do |format|\n if @subscription.save\n record_activity :create, @subscription\n format.html { redirect_to edit_subscription_path(@subscription),\n notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe_owned_organization_to_plan\n organization = self.owned_organizations.first\n\n if organization.current_subscription.nil? && self.plan_id\n plan = Saaso::Plan.find(self.plan_id)\n organization.subscribe_to_plan(plan)\n end\n end", "def create\n if params[:type] == StripePaymentGatewayProfile::Events::SUBSCRIPTION_UPDATED\n\n # hackity mchacks a lot. use a singleton? hmm.\n event = StripePaymentGatewayProfile.new.webhook_event_with_stripe_key(AppConfiguration.get('stripe.secret_key'), params[:id])\n\n if event\n\n subscription = event.data.values[0]\n previous_values = event.data.values[1]\n if event.type == StripePaymentGatewayProfile::Events::SUBSCRIPTION_UPDATED\n profile = StripePaymentGatewayProfile.by_vendor_id(subscription['customer']).first\n if profile && profile.subscribable?\n profile.reload_remote\n if !previous_values['status'].blank? && previous_values['status'] != subscription['status'] && !profile.active_plan?\n profile.payment_gateway_profilable.notify_inactive!\n end\n else\n # Found event, but not the customer record. dismiss the event,\n # but remember in our system that we messed up.\n DetectedError.create(\"Received webhook for customer that we didn't handle: #{subscription.customer}\")\n end\n end\n\n head :ok\n else\n # not existent event\n head :not_found\n end\n else\n\n # this is a trade off. on the one hand, lets attackers identify this end and DOS us. on the other hand,\n # we don't recognize this hook...we don't care.\n # todo: build this stripe key retrieval into the mfe.\n head :ok\n\n end\n end", "def subscribe(agent, type, collective)\n source = make_target(agent, type, collective)\n unless @subscriptions.include?(source)\n Log.debug(\"Subscribing to #{source}\")\n queue = @channel.queue(source)\n queue.subscribe(:block => false) do |delivery_info, properties, payload|\n msg = { :delivery_info => delivery_info, :properties => properties, :payload => payload }\n @buf.synchronize do\n @buf.push(msg)\n @empty_cond.signal\n end\n end\n @subscriptions << source\n end\n end", "def subscribe(list)\n l = ActsAsIcontact::List.find(list)\n s = ActsAsIcontact::Subscription.new(:contactId => id, :listId => l.id)\n s.save\n end", "def set_campaign\n @campaign = authorize Campaign.find(params[:id])\n end", "def subscribe(subscriber, subscription_level = Subscription::Levels[:reader])\n\n if sub = subscription_to(subscriber)\n # no need for equine abuse post-mortem\n return if sub.level == subscription_level\n else\n # Build a subscription\n sub = self.subscriptions_to.build(Sable.subscriber_relation_name.to_sym => subscriber)\n\n # Manually assigning +subscribable+ ensures the current instance will\n # carry forward (useful in combination with +suppress_notifiables+)\n sub.subscribable = self\n end\n\n sub.level = subscription_level\n sub.save! unless new_record?\n end", "def subscribe_to_comments user\n subscription = find_or_build_comment_subscription user\n subscription.subscribed = true\n subscription.save!\n end", "def set_campaign\r\n\t\t@campaign = Campaign.find(params[:id])\r\n\tend", "def subscribe(subscriber)\n if @id != subscriber.getId\n @subscriptions[subscriber.getId] = subscriber\n return true\n end\n return false\n end", "def set_campaign\n @campaign = Campaign.find params[:campaign_id]\n end", "def transcribe(id, optional_params = {})\n response = Network.post(['Recordings', id, 'Transcriptions'], optional_params)\n Transcription.new(response)\n end", "def set_campaign\n\t\t@campaign = Campaign.find(params[:id])\n\tend", "def subscribe_to_newsletter\n SubscribeToNewsletterService.new(self).call\n end", "def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end", "def publish(object)\n @channel << object\n end", "def create\n @campaign = Campaign.new(campaign_params)\n\n begin\n ActiveRecord::Base.transaction do\n # 両方の Validation を実行しておく\n campaign_invalid = @campaign.invalid?\n\n if campaign_invalid\n render :new\n return\n end\n\n @campaign.save!\n\n # 対応するオファーを作成\n @campaign.update_related_offers\n\n redirect_to :action => 'index', notice: 'Campaign was successfully created.'\n end\n rescue => e\n logger.error e\n render :new\n end\n end", "def subscribe(event, *args, &block)\n event(event).subscribe(*args, &block)\n end", "def subscribe\n begin\n gibbon.lists(mc_list_id).members.create(\n body: {\n email_address: params[:email][:address],\n status: \"subscribed\",\n marketing_permissions: [{\n marketing_permission_id: mc_mp_id_one,\n enabled: true\n }]\n }\n )\n flash[:notice] = \"Thank you for subscribing\"\n rescue Gibbon::MailChimpError => event\n message = \"Houston, we have a problem: #{event.message} - #{event.raw_body}\"\n Rails.logger.debug message\n flash[:notice] = \"Ops. Something went wrong!\"\n end\n redirect_to root_path\n end", "def create\n @campaign = Campaign.new(campaign_params)\n @campaign.user_id = current_user[:id]\n\n respond_to do |format|\n if @campaign.save\n puts \"New campaign created: #{@campaign.inspect}\" \n\n if Rails.env.production?\n tracker = Mixpanel::Tracker.new(Generic.get_mixpanel_key)\n tracker.track(@campaign.user_id, 'Campaign Created')\n end \n\n format.html {\n redirect_to new_campaign_message_path(@campaign)\n }\n format.json { render :show, status: :created, location: @campaign }\n else\n format.html { render :new }\n format.json { render json: @campaign.errors, status: :unprocessable_entity }\n end\n end\n end", "def audience\n @campaign = Campaign.find(params[:id])\n end", "def subscribe_author\n self.subscriptions.create user_id: self.user.id\n end", "def subscribed?(object)\n subscriptions.include?(remote_object(object))\n rescue RemotePeerMismatch\n false\n end", "def subscribe_to_magazine(magazine)\n Subscription.new(self, magazine)\n end", "def subscription_created(customer_param, atts = {})\n around_mail_action(:subscription_created, customer_param, atts) do\n return true unless EffectiveOrders.mailer[:send_subscription_created]\n\n @customer = (customer_param.kind_of?(Effective::Customer) ? customer_param : Effective::Customer.find(customer_param))\n @subscriptions = @customer.subscriptions\n @user = @customer.user\n\n @subject = subject_for(@customer, :subscription_created, 'New Subscription')\n\n mail(to: @customer.user.email, subject: @subject)\n end\n end" ]
[ "0.64265466", "0.6350889", "0.59259635", "0.58669853", "0.57175565", "0.56955796", "0.55729085", "0.55360806", "0.55061877", "0.5476807", "0.54680187", "0.5466731", "0.5453503", "0.5406475", "0.53934467", "0.53436077", "0.5328871", "0.5306146", "0.5300841", "0.5298906", "0.5296287", "0.5243041", "0.5220409", "0.5218811", "0.5214691", "0.5207121", "0.5187885", "0.51653886", "0.5144744", "0.5138716", "0.51222146", "0.5100938", "0.5089867", "0.5089867", "0.508326", "0.50808394", "0.50808394", "0.50764", "0.504432", "0.50285", "0.5023327", "0.50176007", "0.5012379", "0.5003593", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.5001737", "0.4996199", "0.49924254", "0.4991955", "0.49721232", "0.49710506", "0.4967526", "0.49615803", "0.49542212", "0.49447975", "0.49446508", "0.49422196", "0.49388564", "0.49371946", "0.49371946", "0.49354327", "0.49281392", "0.49266773", "0.49174666", "0.4916048", "0.4897158", "0.48959488", "0.48933443", "0.4883572", "0.48833227", "0.48781738", "0.4876935", "0.48593736", "0.48569134", "0.4853252", "0.4848712", "0.48323455", "0.48313683", "0.4825203", "0.481818", "0.48148498", "0.4804216", "0.4797823", "0.47913006", "0.4789927", "0.4788958", "0.47880924", "0.4785852" ]
0.6347455
2