query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
sequencelengths
30
30
negative_scores
sequencelengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Query the context for the most recent copy of a message by type
def find_by_type( type ) return @messages[ type ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cached_message type_name\n cached_obj @prior_messages, type_name\n end", "def get_specific_conversations usr, c_type \n conv_ids = Array.new\n convos = Conversation.get_conversations(usr)\n convos.find_each do |convo|\n convo.posts.find_each do |post|\n if (c_type == \"received\" && post.recipient_id == usr.id && post.recipient_status == 'active') ||\n (c_type == \"sent\" && post.user_id == usr.id && post.status == 'active')\n conv_ids << convo.id if usr_msg?(convo, usr); break\n end\n end\n end\n return convos.where([\"id in (?)\", conv_ids]).sort_by {|x| x.posts.last.created_at }.reverse \n end", "def original_message\n @original_message ||= messages.order(:created_at).first\n end", "def last_zenodo_resource(copy_type:)\n resources.joins(:zenodo_copies).where('stash_engine_zenodo_copies.deposition_id IS NOT NULL')\n .where(\"stash_engine_zenodo_copies.state = 'finished'\")\n .where('stash_engine_zenodo_copies.copy_type = ?', copy_type)\n .order(id: :desc).limit(1).first\n end", "def receipts_to_type(type)\n receipts_to_or_from_type(type).sent_messages_receipts\n end", "def last_message\n @last_message ||= messages.order(:created_at => :desc, :id => :desc).first\n end", "def fetch_last_snapshot(type_identifier, aggregate_id)\n filter = {\n aggregate_id: aggregate_id,\n aggregate_type: type_identifier\n }\n\n sort = {\n sequence_number: DESCENDING\n }\n\n @template.snapshot_collection.find(filter).sort(sort).limit(1)\n end", "def original_message\n @original_message = self.messages.find(:first, :order => 'created_at') if @original_message.nil?\n return @original_message\n end", "def get_messages\n @messages = Message.order(:created_at).last(50)\n @message = current_user.messages.new\n end", "def caseworker_search_latest_by_reference(reference, case_type_id:)\n caseworker_search_by_reference(reference, case_type_id: case_type_id, page: 1, sort_direction: 'desc').first\n end", "def receipts_to_or_from_type(type)\n receipts.includes(:message).to_or_from_type(type)\n end", "def new_content_for(user,type=nil)\n user_id = User.normalize_to_id(user)\n case type\n when :comment\n comments.created_since(last_viewed_by(user))\n when :photo\n photos.created_since(last_viewed_by(user))\n when :like\n likes.created_since(last_viewed_by(user))\n else\n Participation.content_creation.in(self).map(&:indication)\n end.select{ |c| c.user_id != user_id }\n\n end", "def newest\n @messages.last\n end", "def time_last_received\n a = emails_received.order(\"created_at DESC\").first\n a.created_at if a\n end", "def message_type(project, message_type_id)\n get(\"/buckets/#{project.id}/categories/#{message_type_id}\")\n end", "def subtypes_of(message_type)\n unless @listeners[message_type].nil?\n @listeners[message_type].keys.clone.freeze\n else\n []\n end\n end", "def get_last_message\r\n @messages.fetch(self.count_messages - 1)\r\n end", "def get_message_types; end", "def get_message_types; end", "def index\n type = params[:message_type]\n @sysnews = Message.sysnews.joins(:user).first if type.eql?('news')\n @messages = messages(type)\n @messages = @messages.joins(:user)\n @messages = @messages.page(params[:page]).per(5)\n end", "def get_thread_by_context_last_posts(username, job_key, application_id, context = 'Interviews')\n $LOG.i \"running \" + __method__.to_s\n @client.get '/mc/v1/contexts/' + username + '/' + context + ':' + job_key + ':' + application_id + '/last_posts'\n end", "def caseworker_search_latest_by_ethos_case_reference(reference, case_type_id:)\n caseworker_search_by_ethos_case_reference(reference, case_type_id: case_type_id, page: 1, sort_direction: 'desc').first\n end", "def show\n if params[:type].present?\n if params[:type] == 'inbox'\n @message = PrivateMessage.where(id: params[:id], deleted_by_to_user: false).limit(1)[0]\n else\n @message = PrivateMessage.where(id: params[:id], deleted_by_from_user: false).limit(1)[0]\n end\n @message = nil if params[:type].nil?\n if @message.present?\n if params[:type] == 'inbox'\n can_read = @message.user_to_id == current_user.id\n else\n can_read = @message.user_from_id == current_user.id\n end\n @message = nil unless can_read\n end\n @message.present? and params[:type] == 'inbox' and @message.update(read: true)\n end\n end", "def index\n @messages = type_class.all\n end", "def get_new_messages\n get_messages_link_and_content\n end", "def latest_mail(options = {})\n return only_latest(mail(options))\n end", "def has_pushed_since_last_respin?(type)\n jobs = push_jobs_since_last_state(type, 'NEW_FILES').where('pub_task_id is not null')\n jobs.reject(&:is_nochannel?).any?(&:is_committed?)\n end", "def last_message\n @last_message = self.messages.find(:first, :order => 'created_at DESC') if @last_message.nil?\n return @last_message\n end", "def get_last_message\n Message.showing.last\n end", "def content_type; @message_impl.getContentType; end" ]
[ "0.64233696", "0.5479395", "0.5441389", "0.533675", "0.5155024", "0.5115295", "0.5067762", "0.5043197", "0.5040463", "0.49355263", "0.49256632", "0.49063772", "0.48996243", "0.4846096", "0.4845721", "0.48181874", "0.4815648", "0.478703", "0.478703", "0.4758576", "0.47325197", "0.47319856", "0.4728513", "0.47267765", "0.47141603", "0.47106236", "0.47079125", "0.46858138", "0.4683117", "0.46825397" ]
0.5580696
1
Set the most recent copy of a message by type. Any existing message is overwritten.
def set( message ) @messages[ message.descriptor.type ] = message.dup end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_type=(type)\n self.message_type_id = MESSAGE_TYPES.invert[type]\n end", "def cached_message type_name\n cached_obj @prior_messages, type_name\n end", "def set_message_type\n @message_type = MessageType.find(params[:id])\n end", "def content_type=(content_type); @message_impl.setContentType content_type; end", "def set_last_message_read(group, time)\n cookies.permanent[create_last_message_key(current_user, group)] = time\n end", "def set(type, content)\n grit.git.put_raw_object(content, type.to_s)\n end", "def handle_message\n self[:type] = HandledMessage.name\n self.save!\n self.reload\n end", "def mutate!(type)\n set_type(type)\n end", "def set_position\n if last_recipient = message.recipients.find(:first, :conditions => {:kind => kind}, :order => 'position DESC')\n self.position = last_recipient.position + 1\n else\n self.position = 1\n end\n end", "def original_message\n @original_message ||= messages.order(:created_at).first\n end", "def keep message\n @messages << message\n end", "def set_saved_message\n @saved_message = SavedMessage.find(params[:id])\n end", "def __setobj__(mail_message) # :nodoc:\n @mail_message = mail_message\n end", "def actual_message=(msg)\n write_attribute(:actual_message, msg) unless substituted_draft_message == draft_message\n end", "def type= (type)\n self.tweet_type = type\n end", "def set_replied_to\n if reply?\n parent.replied_at = Time.now\n parent.save!\n end\n end", "def update_received_modified\n self.received_at = Time.now if received_changed?\n end", "def chat_type=(value)\n @chat_type = value\n end", "def net_message(message)\n @messages << message\n # Remove last element from messages history\n if messages.length > @history_length\n messages.shift\n messages.pop\n end\n end", "def set_user_message\n @user_message = UserMessage.unscoped.find(params[:id])\n end", "def move_to_sentbox\n update_attributes(:mailbox_type => :sentbox, :trashed => false)\n end", "def update!(**args)\n @subject = args[:subject] if args.key?(:subject)\n @type = args[:type] if args.key?(:type)\n end", "def set_cache(email, type, body)\n @members[type] ||= {}\n @members[type][email] = body\n end", "def set_message\n # TBD: verify that either user is admin or the message is from/to the current user\n MessagesController.current_message = @message = Message.find(params[:id])\n end", "def type=(type); end", "def [](mailbox_type)\n self.type = mailbox_type\n return self\n end", "def move_to_inbox\n update_attributes(:mailbox_type => :inbox, :trashed => false)\n end", "def message_type\n @message_type ||= \"message\"\n end", "def initialize(message, type = nil)\n @type = type\n super(message)\n end", "def move_to_sentbox\n update_attributes(mailbox_type: :sentbox, trashed: false)\n end" ]
[ "0.6280736", "0.60991395", "0.6008557", "0.54666257", "0.54044837", "0.53255373", "0.5277625", "0.5165847", "0.51412004", "0.51318544", "0.51207036", "0.51109344", "0.50967246", "0.5078213", "0.5043629", "0.50348383", "0.5029947", "0.5012565", "0.49909952", "0.49907452", "0.49767545", "0.4955052", "0.49504328", "0.49405378", "0.49209595", "0.49206278", "0.492059", "0.48983777", "0.48927888", "0.4891156" ]
0.71746457
0
Get the list of descriptors associated with the open PX4 log file. If a valid descriptor cache was specified at startup, the descriptors are loaded from the cache. Otherwise, the descriptors are parsed from the open log.
def descriptors( &block ) if @log_file && @message_descriptors.empty? if @descriptor_cache && @descriptor_cache.exist? @message_descriptors = @descriptor_cache.read_descriptors else @message_descriptors = LogFile::read_descriptors( @log_file, @descriptor_cache, &block ) end @message_descriptors[ FORMAT_MESSAGE.type ] = FORMAT_MESSAGE end return @message_descriptors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_firmware_iom_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_iom_descriptor_list_with_http_info(opts)\n data\n end", "def descriptors(arg = nil)\n if arg.nil?\n storage.map { |_, (descriptor, _)| descriptor }\n else\n with_interest(arg).map { |_, descriptor, _| descriptor }\n end\n end", "def described_datafiles\n if sip_descriptor\n sip_paths = sip_descriptor_datafile_info.keys\n\n cached_datafiles.inject([]) do |acc, df|\n sp = df['sip-path']\n acc << df if sip_descriptor_datafile_info.has_key? sp\n acc\n end\n\n else\n []\n end\n end", "def get_firmware_cimc_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_cimc_descriptor_list_with_http_info(opts)\n data\n end", "def _get_descriptor\n _get_file(descriptor_filename)\n end", "def descriptors\n @descriptors ||= (attributes + parameters)\n end", "def get_capability_cimc_firmware_descriptor_list(opts = {})\n data, _status_code, _headers = get_capability_cimc_firmware_descriptor_list_with_http_info(opts)\n data\n end", "def get_firmware_pcie_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_pcie_descriptor_list_with_http_info(opts)\n data\n end", "def file_references\n return unless @command == :download_file_list\n\n @file_references ||= begin\n xml = xml_doc content\n descriptors = xml.css('FileDescriptor')\n descriptors.map { |descriptor| descriptor.at('FileReference').content }\n end\n end", "def buildAnalyzedFCList()\n logFile = @instrDir + \"/\" + @completedFCLog\n puts logFile\n @fcList = nil\n @fcList = Hash.new()\n \n if File::exist?(logFile)\n lines = IO.readlines(logFile)\n\n if lines != nil && lines.length > 0\n lines.each do |line|\n @fcList[line.strip] = \"1\"\n end \n end\n else\n # If this directory is newly created and it does not have the log of\n # completed flowcells, create this file.\n cmd = \"touch \" + logFile\n `#{cmd}`\n end\n end", "def buildAnalyzedFCList()\n logFile = @instrDir + \"/\" + @completedFCLog\n puts logFile\n @fcList = nil\n @fcList = Hash.new()\n \n if File::exist?(logFile)\n lines = IO.readlines(logFile)\n\n if lines != nil && lines.length > 0\n lines.each do |line|\n @fcList[line.strip] = \"1\"\n end \n end\n else\n # If this directory is newly created and it does not have the log of\n # completed flowcells, create this file.\n cmd = \"touch \" + logFile\n `#{cmd}`\n end\n end", "def get_firmware_dimm_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_dimm_descriptor_list_with_http_info(opts)\n data\n end", "def content_files\n @cache_content_files ||= cached_datafiles.reject { |df| sip_descriptor == df }\n end", "def all(options = {})\n data = service.list_monitored_resource_descriptors(options).body[\"resourceDescriptors\"] || []\n load(data)\n end", "def get_firmware_drive_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_drive_descriptor_list_with_http_info(opts)\n data\n end", "def get_firmware_mswitch_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_mswitch_descriptor_list_with_http_info(opts)\n data\n end", "def get_entries(date = nil)\r\n if date.nil?\r\n list = []\r\n for i in @log\r\n list.push(i)\r\n end\r\n elsif @log[date].nil?\r\n list = nil\r\n else\r\n list = @log[date]\r\n end\r\n list\r\n end", "def get_firmware_hba_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_hba_descriptor_list_with_http_info(opts)\n data\n end", "def get_firmware_bios_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_bios_descriptor_list_with_http_info(opts)\n data\n end", "def get_firmware_sas_expander_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_sas_expander_descriptor_list_with_http_info(opts)\n data\n end", "def get_capability_io_card_descriptor_list(opts = {})\n data, _status_code, _headers = get_capability_io_card_descriptor_list_with_http_info(opts)\n data\n end", "def sip_descriptor\n @cache_sip_descriptor ||= cached_datafiles.find { |df| df['sip-path'] == sip_descriptor_name }\n end", "def get_firmware_nxos_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_nxos_descriptor_list_with_http_info(opts)\n data\n end", "def read_logs\n @@logs\n end", "def getEventSourceMessageFiles(log)\n return getSourcesFromMiqFS(log) if Object.const_defined?(:MiqFS) && @fs.kind_of?(MiqFS)\n getSourcesFromWin32(log)\n end", "def execute\n LOGGERS.map do |logger|\n { file_name: logger.file_name, logs: logger.read_latest }\n end\n end", "def readLog()\n\tpkgs,tl = {},[]\n\topen(\"/var/log/zypp/history\") do |f|\n\t\tf.each_line do |line|\n\t\t\tif line.index(/install\\||remove\\s\\|/) && ! line.index(\"|_\")\n\t\t\t\tarr = line.split(\"|\")\n\t\t\t\t# \"2016-12-23 00:01:31\" \"install\" \"vlc\" \"0.1.0-1.1\" \"x86_64\" \"packman\"\n\t\t\t\tdate = arr[0].gsub(/\\s.*$/,'')\n\t\t\t\ttime = arr[0].gsub(/^.*\\s/,'')\n\t\t\t\trepo = \"\"\n\t\t\t\tif arr[1] != \"install\"\n\t\t\t\t\tarr[1] = \"remove\"\n\t\t\t\t\trepo = \"none\"\n\t\t\t\telse\n\t\t\t\t\trepo = arr[6]\n\t\t\t\tend\n\t\t\t\tif pkgs.has_key?(date)\n\t\t\t\t\t#\"2016-12-23\"=>{\"vlc\"=>[\"00:01:31\",\"install\",\"0.1.0-1.1.x86_64\",\"packman\"]}\n\t\t\t\t\tpkgs[date][arr[2]] = [time,arr[1],arr[3] + \".\" + arr[4],repo]\n\t\t\t\telse\n\t\t\t\t\tpkgs[date] = {arr[2]=>[time,arr[1],arr[3] + \".\" + arr[4],repo]}\n\t\t\t\tend\n\t\t\t\ttl << date \n\t\t\tend\t\n\t\tend\n\tend\n\n\ttl = tl.uniq.sort\n\n\treturn pkgs,tl\nend", "def index\n @descriptors = Descriptor.all\n end", "def index\n @descriptors = Descriptor.all\n end", "def all(options = {})\n data = service.list_metric_descriptors(options).body[\"metricDescriptors\"] || []\n load(data)\n end" ]
[ "0.55762297", "0.5383673", "0.5364133", "0.52710927", "0.52452326", "0.51260567", "0.5087144", "0.5005252", "0.490131", "0.49000594", "0.49000594", "0.4873191", "0.480384", "0.47972667", "0.47545296", "0.4745057", "0.4739712", "0.47161612", "0.47117537", "0.47113132", "0.47045583", "0.46902812", "0.46528757", "0.4611745", "0.45972237", "0.45776615", "0.45704767", "0.45631352", "0.45631352", "0.45508027" ]
0.68161917
0
Iterate over all log messages. Embedded message descriptors are skipped. If a "with" list is supplied, only messages in the list are passed to the callersupplied block. If a "without" list supplied, all messages except those in the list are passed to the callersupplied block. The caller must supply a block.
def each_message( options = {}, &block ) opts ={ with: [], # white list - empty means all minus those in without list without: ['FMT'] # black list - includes types or names }.merge( options || {} ) opts[:with].map! do |val| if val.class == String descriptor = descriptors.values.find { |desc| desc.name == val } if descriptor val = descriptor.type else puts "Failed to find descriptor with name '#{val}'" end end end opts[:without].map! do |val| if val.class == String descriptor = descriptors.values.find { |desc| desc.name == val } if descriptor val = descriptor.type else raise "Failed to find descriptor with name '#{val}'" end end end if block_given? loop do message, offset = LogFile::read_message( @log_file, @message_descriptors ) break if message.nil? # Add message to the set of latest messages. @context.set( message ) if opts[:with].empty? if !opts[:without].include?( message.descriptor.type ) yield message end else if opts[:with].include?( message.descriptor.type ) yield message end end end else raise BlockRequiredError.new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_block(&block)\n return enum_for(:each_block) unless block_given?\n\n each_log do |log|\n log.each_block(&block)\n end\n end", "def each(&block)\n @messages.each(&block)\n end", "def each_block\n unless block_given?\n return enum_for(:each_block)\n end\n\n each_log do |log|\n log.each_block do |block_index, block|\n yield block_index, block\n end\n end\n end", "def do_for_all_messages(&block) \n raise ArgumentError, \"FileHandler#do_for_all_messages expects a code block\" unless block_given? \n @messages_as_text.shuffle!\n @messages_as_text.each_slice(@limit) do |set|\n messages = get_messages(set)\n messages.each { |message| yield(message) }\n end\n end", "def each_log(&block)\n return enum_for(:each_log) unless block_given?\n\n @logs.each(&block)\n end", "def each(&block)\n @log.each(&block)\n end", "def messages(&block)\n @messages.each { |m| proc_with_message(m, &block) } if block\n return @messages\n end", "def each_log\n unless block_given?\n return enum_for(:each_log)\n end\n\n @logs.each do |log|\n yield log\n end\n end", "def each (order=[:debug, :error, :warning, :notice, :notify], &block)\n order.each {|o| m = @messages[o] and m.each(&block)}\n end", "def each\n while message = read_message\n yield message\n end\n end", "def each_notice(&block)\n while true\n string, structure = next_notice(&block)\n break unless string\n end\n end", "def block_eg\n puts \"this is the first message\"\n yield\n puts \"this is the middle message\"\n yield\n puts \"this is the last\\n\\n\"\nend", "def descriptors( &block )\n\t\t\tif @log_file && @message_descriptors.empty?\n\t\t\t\tif @descriptor_cache && @descriptor_cache.exist?\n\t\t\t\t\t@message_descriptors = @descriptor_cache.read_descriptors\n\t\t\t\telse\n\t\t\t\t\t@message_descriptors = LogFile::read_descriptors( @log_file, @descriptor_cache, &block )\n\t\t\t\tend\n\n\t\t\t\t@message_descriptors[ FORMAT_MESSAGE.type ] = FORMAT_MESSAGE\n\t\t\tend\n\n\t\t\treturn @message_descriptors\n\t\tend", "def collect! &block\n collect(&block)\n ok!\n @messages\n end", "def each(&block)\n @ledger.each(&block)\n end", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n yield\n end\n puts \"But in this function/method message is :: #{message}\"\nend", "def each\n messages.each_key do |attribute|\n self[attribute].each { |hint| yield attribute, hint }\n end\n end", "def each(&block)\n decorators.each(&block)\n end", "def info(message = nil)\n message = yield if message.nil? && block_given?\n @logs << message\n end", "def each(&block)\n @flash.each(&block)\n end", "def each\n messages.each_key do |attribute|\n messages[attribute].each { |error| yield attribute, error }\n end\n end", "def each(&block)\n\n all.each { |wi| block.call(wi) }\n end", "def consume_each_message\n kafka_consumer.each_message(\n ConfigAdapter.consuming(consumer_group)\n ) do |message|\n # always yield an array of messages, so we have consistent API (always a batch)\n yield([message])\n end\n end", "def each(&block)\n\t\t\t\t@receivers.each(&block)\n\t\t\tend", "def each\n @block_args.each do |arg|\n yield arg\n end\n end", "def each(&block)\n return to_enum(__method__) unless block\n\n @receivers << block\n block.call io.string.dup unless io.string.empty?\n sync\n\n self\n end", "def each(*args, &block)\n @body.each(*args, &block)\n ensure\n unless @closed\n @closed = true\n @block.call\n end\n end", "def find_each(options = {})\n find_in_batches(options) do |messages|\n messages.each { |messages| yield messages }\n end\n end", "def each(&block)\n @batch_queue.each(&block)\n end", "def attach_for(block, msg_stack)\n messages = Docker::Messages.new\n lambda do |c,r,t|\n messages = messages.decipher_messages(c)\n msg_stack.append(messages)\n\n unless block.nil?\n messages.stdout_messages.each do |msg|\n block.call(:stdout, msg)\n end\n messages.stderr_messages.each do |msg|\n block.call(:stderr, msg)\n end\n end\n end\n end" ]
[ "0.68506944", "0.679366", "0.6641456", "0.6488992", "0.64099014", "0.6264239", "0.6257899", "0.62248707", "0.6157667", "0.6114694", "0.59598035", "0.5895701", "0.57562315", "0.56654865", "0.5584014", "0.5580064", "0.5518322", "0.5468103", "0.53865594", "0.5383677", "0.5376745", "0.5368721", "0.5347077", "0.53398", "0.5318748", "0.53169304", "0.52899694", "0.5288393", "0.5244771", "0.52387667" ]
0.7694941
0
GET /linkers GET /linkers.json
def index @linkers = Linker.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def links\n json_hyperschema[\"links\"] || []\n end", "def links\n response = Clever.request :get, url\n response[:links]\n end", "def links\n data['links']\n end", "def index\n render json: @links\n end", "def index\n links = all_links\n render json: { success: true, links: links }\n end", "def links\n @data[\"_links\"]\n end", "def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @links }\n end\n end", "def links()\n return @links\n end", "def links\n @user = User.find(params[:id])\n render json: {status: 'SUCCESS', message: 'List all Links in User', data: @user.links},status: :ok\n end", "def get_links_changes(params)\n get_json(links_changes_url(params))\n end", "def links\n @links.values\n end", "def show\n @link = Link.find(params[:id])\n paginate_all_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end", "def index\n @links = current_user.links.desc :created_at\n @title = 'Shared By You'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "def all_links\n Link.all\n end", "def all_links\n Link.all\n end", "def all_links\n Link.all\n end", "def linked\n request('linked')\n end", "def links\n return @links\n end", "def links\n return @links\n end", "def links\n return @links\n end", "def links\n self[\"link\"].map { |l| l.href }\n end", "def links\n self[\"link\"].map { |l| l.href }\n end", "def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end", "def links; end", "def links; end", "def links\n @source._links\n end", "def handle_links(json) end", "def links\n @links ||= []\n @links\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end" ]
[ "0.7031974", "0.696591", "0.69285816", "0.66210544", "0.65901345", "0.65591985", "0.6403536", "0.63891697", "0.6349022", "0.62791204", "0.6223168", "0.62085176", "0.6207957", "0.61892486", "0.61892486", "0.61892486", "0.6174676", "0.61660075", "0.61660075", "0.61660075", "0.60804904", "0.60804904", "0.6075389", "0.60471106", "0.60471106", "0.60320735", "0.6013141", "0.6010271", "0.59983313", "0.59983313" ]
0.7481699
0
POST /linkers POST /linkers.json
def create @linker = Linker.new(linker_params) respond_to do |format| if @linker.save format.html { redirect_to @linker, notice: 'Linker was successfully created.' } format.json { render :show, status: :created, location: @linker } else format.html { render :new } format.json { render json: @linker.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @link_request = LinkRequest.new(link_request_params)\n\n respond_to do |format|\n if @link_request.save\n @link_request.sterrenlinks.create!\n format.html { redirect_to @link_request, notice: 'Link request was successfully created.' }\n format.json { render :show, status: :created, location: @link_request }\n else\n format.html { render :new }\n format.json { render json: @link_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @link.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end", "def create\n @link_builder = LinkBuilder.new(link_builder_params)\n\n respond_to do |format|\n if @link_builder.save\n format.html { redirect_to @link_builder, notice: \"Link builder was successfully created.\" }\n format.json { render :show, status: :created, location: @link_builder }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @link_builder.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if @link.save\n @response = { url: \"#{request.protocol}#{request.host_with_port}/#{Link.encode(@link.id)}\" }\n format.json { render json: @response, status: :created, location: @link }\n else\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end", "def create\n @link = current_user.links.build(link_params) # using devise helper \"current_user\"\n logger.debug \" DEBUG :::::::: #{link_params.to_json}\"\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @linkers = Linker.all\n end", "def create\n @link = @campaign.links.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to campaign_links_path, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: campaign_links_path }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_links\n return if @links.nil?\n\n if @links.empty?\n Rentlinx.client.unpost_links_for(self)\n else\n Rentlinx.client.post_links(@links)\n end\n end", "def create_links\n end", "def create_links\n end", "def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = current_user.links.build(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = current_user.links.build(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def handle_links(json) end", "def create\n @link = Link.new(params[:link])\n puts @link\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = current_user.links.new link_params\n create_and_respond(@link)\n end", "def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if (@entity.links << @link)\n flash[:notice] = 'Link was successfully created.'\n furl = link_url(@entity,@link)\n format.html { redirect_to furl}\n format.xml { head :created, :location => furl }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @link.errors.to_xml }\n end\n end\n end", "def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to edit_link_url(@link), notice: 'Link was successfully created.' }\n format.json { render :edit, status: :created, location: edit_link_url(@link) }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @linkpost = Linkpost.new(linkpost_params)\n\n respond_to do |format|\n if @linkpost.save\n format.html { redirect_to @linkpost, notice: 'Linkpost was successfully created.' }\n format.json { render action: 'show', status: :created, location: @linkpost }\n else\n format.html { render action: 'new' }\n format.json { render json: @linkpost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_link = TestLink.new(test_link_params)\n\n if @test_link.save\n render :show, status: :created, location: @test_link\n else\n render json: @test_link.errors, status: :unprocessable_entity\n end\n end", "def create\n @link = current_user.links.new( link_params )\n # @link = Link.new( link_params )\n # @link.user = current_user\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_link(links)\n links = [links] if links.is_a?(String)\n self.class.get(\"/action/add/links/grabber0/start1/\"+links.join(\" \"))\n end", "def create\n @link_resource = LinkResource.new(link_resource_params)\n\n respond_to do |format|\n if @link_resource.save\n format.html { redirect_to @lab, notice: 'Link resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @link_resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @link_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = Link.new(link_params)\n @link.active = true # make link active by default\n @link.admin_id = SecureRandom.uuid\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to link_admin_path(@link.admin_id), notice: \"Link was successfully created.\" }\n # format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new, status: :unprocessable_entity }\n # format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = Link.new(params[:link])\n @link.user = current_user\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = Link.new(link_params)\n @link.user = current_user\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to info_path(@link.slug), notice: \"Link was successfully created.\" }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { redirect_to new_link_path, alert: @link.errors.full_messages.join(\", \") }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = Link.new(params[:link])\n puts \"////////////////////////////\"\n puts params\n respond_to do |format|\n if @link.save\n format.html { redirect_to links_url, notice: t('links.create.notice') }\n format.json { render json: @link, status: :created, location: @link }\n else\n @links_a=ManRsc.all\n @links_b=linksb(params[:link][:link_a])\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.65013206", "0.6474064", "0.6377264", "0.6311157", "0.62924874", "0.62617254", "0.6194391", "0.6134379", "0.61183584", "0.607425", "0.6063035", "0.6063035", "0.60541934", "0.6035315", "0.60277706", "0.6000556", "0.59999204", "0.59947354", "0.59783554", "0.5970733", "0.59449106", "0.5925986", "0.5863391", "0.58610886", "0.58574927", "0.5842891", "0.58340764", "0.5825901", "0.5823518", "0.58201754" ]
0.659273
0
DELETE /linkers/1 DELETE /linkers/1.json
def destroy @linker.destroy respond_to do |format| format.html { redirect_to linkers_url, notice: 'Linker was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end", "def destroy\n destroy_and_respond(@link)\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to campaign_links_path, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: '투표안건이 성공적으로 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @referer = Referer.find(params[:id])\n @referer.destroy\n\n respond_to do |format|\n format.html { redirect_to referers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url, notice: \"Link was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jakeslink = Jakeslink.find(params[:id])\n @jakeslink.destroy\n\n respond_to do |format|\n format.html { redirect_to jakeslinks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url+\"#show-links\", notice: 'Link was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html do\n redirect_to root_path,\n notice: \"Link was successfully deleted\"\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: \"Link was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\n format.json { head :no_content }\n end\n end", "def destroy\n @linkctr.destroy\n respond_to do |format|\n format.html { redirect_to linkctrs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = @entity.links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to new_link_url, notice: \"Link was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end" ]
[ "0.6946011", "0.6946011", "0.69355476", "0.6929076", "0.68720865", "0.6852387", "0.6852387", "0.6852387", "0.6812328", "0.6797859", "0.67786455", "0.6767648", "0.6754019", "0.67517275", "0.6750615", "0.6732307", "0.6732307", "0.6732307", "0.6732307", "0.6732307", "0.6732307", "0.6732307", "0.6732307", "0.6731326", "0.6730037", "0.672297", "0.6718098", "0.6713625", "0.6700052", "0.6618673" ]
0.7224523
0
GET /fg_bookings GET /fg_bookings.json
def index @fg_bookings = FgBooking.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = @user.bookings\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def index\n @fbookings = Fbooking.all\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def all_bookings\n Booking.none\n end" ]
[ "0.7622552", "0.74592304", "0.740094", "0.740094", "0.740094", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.7149267", "0.71383554", "0.70608073", "0.70577234", "0.70049477", "0.69933945", "0.6990921", "0.69697994", "0.69487363", "0.6924526", "0.6890816", "0.6821555", "0.680244" ]
0.747126
1
PATCH/PUT /fg_bookings/1 PATCH/PUT /fg_bookings/1.json
def update respond_to do |format| if @fg_booking.update(fg_booking_params) format.html { redirect_to getting_started_welcome_path, notice: 'Booking was successfully updated.' } format.json { render :show, status: :ok, location: @fg_booking } else format.html { render :edit } format.json { render json: @fg_booking.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end", "def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booking])\n respond_with(@booking)\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to bookings_path, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n booking = Booking.find(params[:id])\n \n # Check if user is the owner of the booking\n if current_user[:id] == booking[:user_id]\n if booking.update_attributes(booking_params) \n render json: { status: 'SUCCESS', message: 'Updated booking', data: booking }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Booking not updated', data: booking.errors }, status: :unprocessable_entity\n end\n end\n end", "def update\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n flash[:notice] = 'Booking was successfully updated.'\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to bookings_url, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er blevet opdateret.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to profile_bookings_url(@profile), notice: 'Booking was successfully updated.' }\n format.json { render :index, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @bookkeeping.update(bookkeeping_params)\n head :no_content\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params_update)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params.except(:mode_of_booking))\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: \"Booking was successfully updated.\" }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6860899", "0.6778849", "0.6667386", "0.6667386", "0.6667386", "0.66633373", "0.66064864", "0.6552615", "0.6544953", "0.6543623", "0.65305024", "0.652486", "0.652486", "0.652486", "0.652354", "0.6519628", "0.64751965", "0.64693725", "0.6463658", "0.6460832", "0.6457936", "0.64569163", "0.6448083", "0.6447953", "0.6447953", "0.6447953", "0.6447953", "0.6447953", "0.6447953", "0.6447953" ]
0.6841598
1
DELETE /fg_bookings/1 DELETE /fg_bookings/1.json
def destroy @fg_booking.destroy respond_to do |format| format.html { redirect_to fg_bookings_url, notice: 'Booking was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to '/bookings' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er nu slettet.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_book.destroy\n\n head :no_content\n end", "def delete_bookings()\n sql = \"DELETE FROM bookings\n WHERE bookings.member_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "def destroy\n @book_shelf = BookShelf.find(params[:id])\n @book_shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to book_shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gbook.destroy\n respond_to do |format|\n format.html { redirect_to gbooks_url, notice: 'Gbook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bookalawn.destroy\n respond_to do |format|\n format.html { redirect_to bookalawns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to static_pages_new_booking_enquiry_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_index_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @booking.destroy\n\n head :no_content\n end", "def delete\n api_delete(\"/listings/#{@listing_id}\")\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to options_path, notice: 'Booking was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = @room.bookings.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7108041", "0.7108041", "0.7108041", "0.7108041", "0.709098", "0.707182", "0.707182", "0.7065558", "0.6917805", "0.6913106", "0.6906084", "0.68992096", "0.68696755", "0.6830031", "0.68269175", "0.67883563", "0.6781664", "0.6775332", "0.6775332", "0.6772609", "0.6772175", "0.6768438", "0.6766565", "0.6766292", "0.6766292", "0.6766292", "0.6766292", "0.6766292", "0.6766292", "0.6766292" ]
0.7153057
0
Returns a new instance for +time+ (a Time object). ===== Options :validity Integer, duration in seconds during which a timestamp is valid. :reference_time Time, the time that is the point of reference for expiration (default: the current UTC time). :formatter String, the format string used by Time.strftime create a formatted timestamp.
def initialize(time, validity: 60, reference_time: Time.now.utc, formatter: '%Y-%m-%d %H:%M:%S.%6L %Z') @reference_time = reference_time @time = time @validity = validity @formatter = formatter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_time(time)\n unless time['duration'].is_a? Integer\n duration = duration_to_seconds(time['duration'])\n time['duration'] = duration\n\n # Duration at this point contains an error_msg if it's not an int\n return duration unless time['duration'].is_a? Integer\n end\n\n if time['duration'] < 0\n return Hash[@error => 'time object: duration cannot be negative']\n end\n\n create_or_update(time, nil, 'time', 'times')\n end", "def initialize( time, make_copy = true )\n \n not_nil( time, \"time\" )\n @time = ( make_copy ? Time.iso8601( time.iso8601( 9 ) ) : time ).utc\n end", "def set_time(time)\n @time = time.getutc\n return self\n end", "def time name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :time, description: description, mode: mode, policy_tags: policy_tags\n end", "def time(options = {})\n if @time.is_a?(Time)\n @time.strftime(\"%l#{@time.min > 0 ? \":%M\" : ''}%P\").strip\n else\n nil\n end\n end", "def from_time(time, options = nil)\n unique = (options || {})[:unique]\n from_data(unique ? @@generator.next(time.to_i) : [ time.to_i ].pack(\"Nx8\"))\n end", "def initialize time: nil\n @time = time || ::Time.now.utc\n end", "def from_time(options = {})\n t = range(options).first.strftime(\"%T\")\n return nil if t == \"00:00:00\"\t\n t\n end", "def time(limit = nil)\n Validation.new { |d| d.is_a?(Time) && in_range?(d, limit) }\n end", "def create(time)\n TZTime::LocalTime.new(time, @time_zone)\n end", "def time\n return Time.new(@t_year, @t_month, @t_day, @t_hour, @t_min, @t_sec)\n end", "def to_time\n t = ::Time.at utc_reference\n Time.new t.utc\n end", "def initialize(time, in_ms = false)\n @t = time\n @ms = in_ms\n end", "def with_time(time)\n time_travel_lock.synchronize do\n Timecop.freeze(time) do\n yield\n end\n end\n end", "def validate_time(time)\n\t\tif time.is_a? Time\n\t\t\treturn time\n\t\telse\n\t\t\treturn Time.parse(time)\n\t\tend\n\tend", "def initialize(timeOrDateTime)\n @time = nil\n @datetime = nil\n @timestamp = nil\n \n if timeOrDateTime.is_a?(Time)\n @time = timeOrDateTime\n \n # Avoid using the slower Rational class unless necessary.\n nsec = RubyCoreSupport.time_nsec(@time)\n usec = nsec % 1000 == 0 ? nsec / 1000 : Rational(nsec, 1000)\n \n @time = Time.utc(@time.year, @time.mon, @time.mday, @time.hour, @time.min, @time.sec, usec) unless @time.utc? \n @orig = @time\n elsif timeOrDateTime.is_a?(DateTime)\n @datetime = timeOrDateTime\n @datetime = @datetime.new_offset(0) unless @datetime.offset == 0\n @orig = @datetime\n else\n @timestamp = timeOrDateTime.to_i\n \n if !RubyCoreSupport.time_supports_64bit && (@timestamp > 2147483647 || @timestamp < -2147483648 || (@timestamp < 0 && !RubyCoreSupport.time_supports_negative))\n raise RangeError, 'Timestamp is outside the supported range of Time on this platform'\n end\n \n @orig = @timestamp\n end\n end", "def initialize(options)\n set_attributes_with_time(options)\n save if valid?\n end", "def at(time)\n new(time, zone)\n end", "def semantic_time_tag(time, options = {})\n SemanticDateTimeTags::Tag::Time.new(time, options).to_html\n end", "def time_query(match, time, options = {})\n options[:on] ||= :validity\n super\n end", "def create_time=(time)\n @create_time = time\n update_times\n end", "def time=(value)\n @time = value\n end", "def set_time_as_datetime(options)\n options[:type] = DateTime if options[:type] == Time\n end", "def time(value)\n _parse_time(value)\n end", "def time_field(field, options={})\n options.reverse_merge!(:value => field_value(field) ? field_value(field).to_time.strftime(\"%H:%M\") : nil, :id => field_id(field))\n options[:class] = 'time_field'\n options.merge!(:class => field_error(field, options))\n @template.time_field_tag field_name(field), options\n end", "def change(options) #:nodoc:\n TzTime.new(time.change(options), @zone)\n end", "def expiration_time\n Time.at(0, expiration_date, :millisecond)\n end", "def time=(new_time)\n @time = new_time\n end", "def initialize(*args)\n # date must be last argument (NLTime::Entity::Date)\n date = args.pop\n \n if args.size == 1 and args.first.kind_of?(NLTime::Duration::Time)\n time = args.first\n elsif args.size > 0\n time = NLTime::Duration::Time.new(*args)\n else\n raise ArgumentError\n end\n \n raise ArgumentError unless time.kind_of?(NLTime::Duration::Time)\n raise ArgumentError unless date.kind_of?(NLTime::Entity::Date)\n \n @time, @date = time, date\n #super(self, self)\n end", "def time_query(match, time, options = {})\n options[:on] ||= :validity\n super\n end" ]
[ "0.6103263", "0.60612404", "0.6045295", "0.59468853", "0.5930667", "0.5703511", "0.5644326", "0.558651", "0.5582991", "0.55599105", "0.5509744", "0.54468316", "0.539078", "0.53828514", "0.53767985", "0.53712237", "0.536504", "0.53626084", "0.53348637", "0.5324465", "0.5314597", "0.5313082", "0.5306909", "0.53039616", "0.5286396", "0.527703", "0.5276212", "0.5230665", "0.5227495", "0.5222365" ]
0.8090588
0
Returns +true+ if the delta between time and reference_time exceeds the allowed validity span.
def expired? return if missing? validity < (reference_time - time) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def later?(target_time, ref_time)\n target_time.to_f - ref_time.to_f > 0.01\n end", "def more_than_a_day_passed?(start_time, end_time)\n end_time - start_time > 60 * 60 * 24\n end", "def valid?(time=Time.now.utc)\n time>not_before && time<self.not_after\n end", "def _timeout? changed_time, timeout\n\t\t@current_time ||= Time.now\n\t\t(@current_time - changed_time - timeout) > 0 ? true : false\n\tend", "def time_allow(get_time, min_period_time, max_period_time)\n to_time = Time.parse(get_time)\n now_time = Time.now\n return to_time - now_time < max_period_time - min_period_time && to_time - now_time > min_period_time\n end", "def future?\n return if missing?\n\n reference_time < time\n end", "def time_cannot_be_in_the_past\n time1 = DateTime.now - 300.minutes\n time2 = self.time \n if time1 > time2 \n errors.add(:time, \"can't be in the past \")\n end\n end", "def past_time_threshold?\n return true if @past_time_threshold # no need to check again once past\n @past_time_threshold = (Time.now-@start_time) >= N_PLUS_ONE_TIME_THRESHOLD\n end", "def after?(time)\n start_time > time\n end", "def after?(time)\n start_time > time\n end", "def is_after?(other_time, leeway = 5)\n other_time -= leeway\n self >= other_time\n end", "def validate_temporal_sanity\n errors.add(:end_time, \"Must be after Start Time.\") unless self.start_time < self.end_time\n end", "def ensure_on_time!\n time_diff_sec = timestamp.to_i - Time.now.to_i\n\n unless DEADLINE_RANGE.cover?(time_diff_sec)\n if time_diff_sec < 0\n fail(TransactionTimestampTooOld, REPORT_DEADLINE_PAST)\n else\n fail(TransactionTimestampTooNew, REPORT_DEADLINE_FUTURE)\n end\n end\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def check?\n @last_time < @check_time - 100\n end", "def time_expired?\n (Time.now - @duration) > @start_time\n end", "def valid_at?(time)\n if time.is_a?(Integer)\n time = Time.at(time)\n end\n\n if (self.not_after < time) || (self.not_before > time)\n false\n else\n true\n end\n end", "def less_than_2_hours\n two_hours_later = start_time + 2.hours\n errors.add(:end_time, 'should be at most 2 hours after start time (interviews must be shorter than 2 hours in duration)') if end_time > two_hours_later\n end", "def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end", "def is_within?(other_time, leeway = 5)\n is_before?(other_time, leeway) && is_after?(other_time, leeway)\n end", "def meets_temporal_constraints?(time, &block)\n !find_failed_temporal_constraint(time, &block) &&\n !find_failed_occurence_constraint(true, &block)\n end", "def end_time_must_be_after_start_time\n if self.start_time > self.end_time\n errors.add(:end_time, 'must be after start time')\n end\n end", "def valid_duration?(cert_obj)\n cert_obj.not_before < Time.now.utc && cert_obj.not_after > Time.now.utc\n end", "def is_before?(other_time, leeway = 5)\n other_time += leeway\n self <= other_time\n end", "def end_time_cannot_be_earlier_than_start_time\n\t\tif end_time && start_time \n\t\t\tif end_time < start_time\n\t\t\t\terrors.add(:end_time, \"End time should not be earlier than start time.\")\n\t\t\tend\n\t\tend\n\tend", "def valid?\n (start_at - CLOCK_SKEW_TOLERANCE).past? && (end_at + CLOCK_SKEW_TOLERANCE).future?\n end", "def crossed_day_change_boundary?(start_time, end_time)\n start_time.hour < 4 && end_time.hour >= 4\n end", "def time_must_be_in_the_future\n if !time.present? || DateTime.current > time\n errors.add(:time, \"cant be in the past\")\n end\n end", "def end_time_after_start_time\n if self.end_time && self.end_time < self.start_time\n self.errors.add(:end_time, \"The end time must be after the start time\")\n end\n end" ]
[ "0.7064664", "0.6690272", "0.64969385", "0.631873", "0.6232966", "0.61365294", "0.60901314", "0.6082805", "0.6048665", "0.6048665", "0.6037859", "0.5998494", "0.5988431", "0.5987782", "0.5987782", "0.59778655", "0.59689885", "0.58981496", "0.5886937", "0.5882449", "0.58381796", "0.58355016", "0.5799876", "0.5793283", "0.5790731", "0.5785214", "0.57846975", "0.57765985", "0.57741535", "0.5751299" ]
0.6742259
1
Returns +true+ if the time attribute of +self+ is a a time in the future relative to the reference_time.
def future? return if missing? reference_time < time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def later?(target_time, ref_time)\n target_time.to_f - ref_time.to_f > 0.01\n end", "def future?\r\n @at > DateTime.now\r\n end", "def future?\n start_date.future?\n end", "def historical?\n self.as_of_time.present?\n end", "def in_the_future(now=Time.now)\n trip_time > now\n end", "def in_the_future(now=Time.now)\n trip_datetime > now\n end", "def future?\n utc.future?\n end", "def in_past?\n elapsed.positive?\n end", "def past?\n begins.to_time < Time.now\n end", "def upcoming?\n begins.to_time > Time.now\n end", "def is_happening_now?\n if start_on.past? && end_on.future?\n true\n else\n false\n end\n end", "def in_future?\n elapsed.negative?\n end", "def time_after_now? time\n time_now_with_resetted_date = reset_date_for_time_now\n time_with_resetted_date = reset_date_for_time time\n (time_now_with_resetted_date <=> time_with_resetted_date) == Timeable::TIME_COMPARE_RESULTS[:left_side_later]\n end", "def after?(time)\n start_time > time\n end", "def after?(time)\n start_time > time\n end", "def time_over?\r\n return self.due_date <= Time.now\r\n end", "def time_before_now? time\n time_now_with_resetted_date = reset_date_for_time_now\n time_with_resetted_date = reset_date_for_time time\n (time_now_with_resetted_date <=> time_with_resetted_date) == Timeable::TIME_COMPARE_RESULTS[:right_side_later]\n end", "def past_time_threshold?\n return true if @past_time_threshold # no need to check again once past\n @past_time_threshold = (Time.now-@start_time) >= N_PLUS_ONE_TIME_THRESHOLD\n end", "def has_time_to_solve?\n self.expires_at ? Time.now.utc + self.time_to_solve < self.expires_at : true\n end", "def has_time_to_solve?\n self.expires_at ? Time.now.utc + self.time_to_solve < self.expires_at : true\n end", "def past?\n\n @next_time &&\n @next_time < Time.now - @scheduler.frequency\n end", "def expired?\n return if missing?\n\n validity < (reference_time - time)\n end", "def is_late\n Time.current > object.deadline if object.deadline.present?\n end", "def future?\n self > self.class.current\n end", "def relevant_time?\n\t\tself.start < Time.now && self.end >Time.now \n\tend", "def time_is_up(end_time)\n DateTime.now >= end_time\nend", "def past_deadline?\n self.deadline < Time.now\n end", "def old() @time < Time.now.to_f end", "def time_must_be_in_the_future\n if !time.present? || DateTime.current > time\n errors.add(:time, \"cant be in the past\")\n end\n end", "def _timeout? changed_time, timeout\n\t\t@current_time ||= Time.now\n\t\t(@current_time - changed_time - timeout) > 0 ? true : false\n\tend" ]
[ "0.7500459", "0.7132985", "0.7019621", "0.6968327", "0.6962669", "0.6937079", "0.67950094", "0.6608741", "0.65910304", "0.65903187", "0.65612936", "0.65450805", "0.6543769", "0.6485338", "0.6485338", "0.6484777", "0.6479321", "0.6470232", "0.6453995", "0.6453995", "0.64508694", "0.64195496", "0.6415711", "0.64124054", "0.63920766", "0.6387575", "0.63495463", "0.63377327", "0.6334428", "0.6322659" ]
0.83900136
0
Returns a timestamp (String representation) for the reference_time.
def reference_timestamp reference_time.strftime formatter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp\n _timestamp.as_time\n end", "def timestamp\n _timestamp.as_time\n end", "def timestamp\n time.strftime formatter\n end", "def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend", "def get_formatted_timestamp()\n return Time.now.iso8601.to_s\n end", "def timestamp\n @now = Vedeu.clock_time\n @time ||= 0.0\n @last ||= @now\n\n unless @last == @time\n @time += (@now - @last).round(4)\n @last = @now\n end\n\n \"[#{format('%7.4f', @time.to_s)}] \".rjust(7)\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end", "def timestamp(now)\n (now - @start_time) * 1000\n end", "def time_s\n time_to_s(time)\n end", "def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%S\")\n end", "def timestamp\n Time.now.to_i.to_s\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end", "def timestamp\n Time.now.to_s\n end", "def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend", "def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end", "def timestamp\n current_time = DateTime.now\n \"#{current_time.strftime(\"%d/%m/%y %H:%M:%S\")} -\"\n end", "def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def precision_timestamp\n Time.now.strftime(\"%Y%m%d%H%M%S%L\")\n end", "def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end", "def timestamp\n Time.at((self[:tsh].to_i << 32 | self[:tsl].to_i) * ts_resol)\n end", "def get_timestamp(time)\n time.to_i.to_s.ljust 13, '0'\n end", "def timestamp\n ((Time.now.to_f - StartTime)*1000).round\n end", "def to_time()\n #This is a stub, used for indexing\n end", "def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end", "def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end", "def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end", "def get_time\n\t\t@time.inspect\n\tend", "def datetime_stamp\n Time.now.utc.iso8601\n end" ]
[ "0.6908702", "0.6863267", "0.68387777", "0.6686364", "0.662848", "0.6606359", "0.6582293", "0.64391303", "0.6406028", "0.6390529", "0.638036", "0.63692075", "0.6345251", "0.6339497", "0.63311124", "0.63137734", "0.6290373", "0.62851137", "0.6279971", "0.62626296", "0.62075627", "0.6197336", "0.6193683", "0.61695755", "0.6166896", "0.6165162", "0.61638856", "0.615537", "0.6155346", "0.6038849" ]
0.87412626
0
Returns a timestamp as a String for +self+.
def timestamp time.strftime formatter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_formatted_timestamp()\n return Time.now.iso8601.to_s\n end", "def timestamp\n current_time = DateTime.now\n \"#{current_time.strftime(\"%d/%m/%y %H:%M:%S\")} -\"\n end", "def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%S\")\n end", "def timestamp\n Time.now.to_s\n end", "def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend", "def timestamp\n Time.now.to_i.to_s\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end", "def to_s\n @date_time\n end", "def to_s\n \"#{time.strftime(\"%Y-%m-%d %H:%M:%S\")} #{formatted_offset(false, 'UTC')}\" # mimicking Ruby Time#to_s format\n end", "def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end", "def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end", "def timestamp\n _timestamp.as_time\n end", "def time_s\n time_to_s(time)\n end", "def timestamp\n @now = Vedeu.clock_time\n @time ||= 0.0\n @last ||= @now\n\n unless @last == @time\n @time += (@now - @last).round(4)\n @last = @now\n end\n\n \"[#{format('%7.4f', @time.to_s)}] \".rjust(7)\n end", "def timestamp\n _timestamp.as_time\n end", "def to_s\n if @orig.is_a?(Time)\n \"Time: #{@orig.to_s}\"\n elsif @orig.is_a?(DateTime)\n \"DateTime: #{@orig.to_s}\"\n else\n \"Timestamp: #{@orig.to_s}\"\n end\n end", "def to_s\n if @orig.is_a?(Time)\n \"Time: #{@orig.to_s}\"\n elsif @orig.is_a?(DateTime)\n \"DateTime: #{@orig.to_s}\"\n else\n \"Timestamp: #{@orig.to_s}\"\n end\n end", "def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end", "def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def to_s()\n\t\tself.to_chrono()\n\tend", "def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end", "def to_s\n return \"#{\"%04d\" % @t_year}-#{\"%02d\" % @t_month}-#{\"%02d\" % @t_day} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec}\"\n end", "def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end", "def timestamp\n self.created_at.to_s(:db)\n end", "def to_s\n sprintf '#<%s:%#0x @timestamp: %s @changes: {%d}>',\n self.class.to_s,\n self.object_id,\n @timestamp.strftime('%d/%b/%Y:%H:%M:%S %z'),\n length\n end", "def to_s()\n \"#{@location}-#{@op}@#{@time.iso8601(9)}\"\n end", "def to_label\n \"#{time}\"\n end", "def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend" ]
[ "0.8017756", "0.759984", "0.74723697", "0.7466139", "0.7463398", "0.74336416", "0.73540777", "0.73522544", "0.7275035", "0.72639924", "0.7237221", "0.71552444", "0.71462554", "0.7117651", "0.7054738", "0.70543885", "0.7037421", "0.7037421", "0.69866526", "0.6935484", "0.6928359", "0.69175255", "0.6909533", "0.68826944", "0.6860542", "0.68434936", "0.6816452", "0.6810362", "0.6773147", "0.6769612" ]
0.78723156
1
Returns message (String) when the timestamp is expired.
def expired_msg return unless expired? delta = reference_time - time - validity "Expired timestamp: #{timestamp};"\ " #{delta.to_i} seconds past expiration." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expired?\n timestamp.nil? || (Time.now.to_i - timestamp.to_i).abs > 300\n end", "def expired(payload)\n Time.zone.at(payload['exp']) < Time.zone.now\n end", "def expired?(payload)\n Time.at(payload['exp']) < Time.now\n end", "def missing_msg\n return unless missing?\n\n 'Missing timestamp.'\n end", "def expired?; end", "def expired(an_issue, a_person, sent_at = Time.now.utc)\n if an_issue.owner==a_person\n subject \"Your case has expired, '{subject}'\".t.gsub(/\\{subject\\}/, an_issue.subject)\n else\n subject \"Case expired, '{subject}'\".t.gsub(/\\{subject\\}/, an_issue.subject)\n end\n recipients a_person.email\n from Notifier.noreply_email\n sent_on sent_at\n body( :issue => an_issue, :person => a_person )\n end", "def expired?\n Time.now > self.to_be_expired_at\n end", "def dead_lettering_on_message_expiration\n to_bool description['DeadLetteringOnMessageExpiration']\n end", "def to_s\n missing_msg || future_msg || expired_msg || timestamp\n end", "def future_msg\n return unless future?\n\n delta = time - reference_time\n \"Invalid timestamp: #{timestamp};\"\\\n \" #{delta.to_i} seconds ahead of time.\"\n end", "def expired_for(time = delete_expired_after)\n where('expired_at < ?', time.seconds.ago)\n end", "def expired?\n @expiry_time < Time.now\n end", "def expired?\n Time.now - @created_time > @ttl\n end", "def request_expired?\n parsed_timestamp < request_expires_at\n end", "def expired_time? time\n time + self.class.ttl_in_seconds.to_i < Time.now\n end", "def expired?\n Time.now > expiration if expiration\n end", "def expired? time\n time ||= Timers.now\n time >= @fire_time\n end", "def expired?\n Time.current >= expires_at\n end", "def expire_time\n Convert.timestamp_to_time @grpc.expire_time\n end", "def expire_time\n e_time = @token_manager.token_info[\"expiration\"]\n raise 'CloudTools::IAMAuth Unable to extract the retrieved expiration time.' if e_time.nil?\n raise \"CloudTools::IAMAuth Extracted expiry time #{e_time} is not an expected integer.\" unless e_time.kind_of?(Integer)\n\n e_time\n end", "def max_time_ms_expired?\n code == 50 # MaxTimeMSExpired\n end", "def expired?\n expires_at.to_time <= Time.now.utc\n end", "def expired?\n expires_at.to_time <= Time.now.utc\n end", "def expiry_time\n response_hash[:hard_expiration_time]\n end", "def signature_expired?(timestamp)\n\t\t\ttimestamp < ((Time.now.to_f - config[:signature_expiration])*1000).round if config[:signature_expiration]\n\t\tend", "def expired?\n expiration_date <= Time.now\n end", "def is_token_expired?\n (Time.now - self.updated_at) > 3300\n end", "def expired?\n @expired\n end", "def expired?(time = Timers.now)\n time >= @fire_time\n end", "def expiry_time_millis\n @subscription_purchase.expiry_time_millis\n end" ]
[ "0.6565335", "0.6516956", "0.63292474", "0.62557805", "0.6246613", "0.62417513", "0.620384", "0.6169135", "0.6118661", "0.6113683", "0.60188353", "0.5982069", "0.59450924", "0.59263057", "0.5923897", "0.59107625", "0.5908549", "0.5905709", "0.5900538", "0.5893792", "0.5873543", "0.58693206", "0.58693206", "0.5863122", "0.58607525", "0.58600336", "0.58568895", "0.5856472", "0.5855879", "0.5855247" ]
0.8503037
0
Returns message (String) when the timestamp is in the future.
def future_msg return unless future? delta = time - reference_time "Invalid timestamp: #{timestamp};"\ " #{delta.to_i} seconds ahead of time." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def since t\n t.to_now\n end", "def datetimeperformed_cannot_be_in_the_future\n if datetimeperformed.present? && datetimeperformed > Time.now \n errors.add(:datetimeperformed, \"cannot be in the future\")\n end\n end", "def expired_msg\n return unless expired?\n\n delta = reference_time - time - validity\n \"Expired timestamp: #{timestamp};\"\\\n \" #{delta.to_i} seconds past expiration.\"\n end", "def to_s\n missing_msg || future_msg || expired_msg || timestamp\n end", "def since(prev)\n prev = prev.to_datetime unless prev.is_a?(DateTime)\n b = @current - prev # how many days in between\n if b.round(4) < 0\n \"ERROR. Time given is in the future!\"\n \n else\n in_words(b)\n \n end\n end", "def missing_msg\n return unless missing?\n\n 'Missing timestamp.'\n end", "def future?\r\n @at > DateTime.now\r\n end", "def in_the_future(now=Time.now)\n trip_datetime > now\n end", "def later?(timestamp)\n ends_at && timestamp > ends_at\n end", "def future?\n utc.future?\n end", "def time_must_be_in_the_future\n if !time.present? || DateTime.current > time\n errors.add(:time, \"cant be in the past\")\n end\n end", "def in_the_future(now=Time.now)\n trip_time > now\n end", "def old() @time < Time.now.to_f end", "def with_past\n without_temporal_condition\n end", "def future(time = Time.zone.now, options = {}, &block)\n time = parse(time)\n by_direction(\">\", time, options, &block)\n end", "def future?\n return if missing?\n\n reference_time < time\n end", "def earliest_incomplete_timestamp\n res = incomplete_recipients.first\n\n return unless res\n\n res.created_at\n end", "def future(time = Time.now, options = {})\n by_direction(\">\", time, options)\n end", "def force_message m; send_message format_message(nil, Time.now, m) end", "def get_time_message()\n\t\tt = Time.now\n\t\t#string_date = t.strftime(\"%A %B %d, %Y\")\n\n\t\tif t.hour < 12\n\t\t\ttime_message =\t\"Good Morning\"\n\t\telsif t.hour > 12 && t.hour < 17 \n\t\t\ttime_message =\t\"Good Afternoon\"\n\t\telse\n\t\t\ttime_message =\t\"Good Evening\"\n\t\tend\n \tend", "def upcoming?\n begins.to_time > Time.now\n end", "def get_waiting_time_str\n get_time_diff_string(self.requested_at, self.started_at)\n end", "def future?\n start_date.future?\n end", "def is_later?(time)\n time.to_date > Date.today + 1\n end", "def past?\n begins.to_time < Time.now\n end", "def is_future?\n is_event_future = false\n is_event_future = true if !is_past?\n return is_event_future\n end", "def meeting_time_later_than_now?\n\t\tif self.meeting_time < DateTime.now\n errors.add(:meeting_time, \"Meeting time must be later than now!\")\n\t\tend\n\tend", "def remaining_time\n # calculate how old is the feedback\n created_at = self.created_at.to_time\n diff_seconds = (Time.now - created_at).round\n remaining = TEN_MINUTES - diff_seconds\n\n remaining.to_s\n end", "def timestamp\n Time.parse(message.date.to_s).utc\n end", "def ensure_on_time!\n time_diff_sec = timestamp.to_i - Time.now.to_i\n\n unless DEADLINE_RANGE.cover?(time_diff_sec)\n if time_diff_sec < 0\n fail(TransactionTimestampTooOld, REPORT_DEADLINE_PAST)\n else\n fail(TransactionTimestampTooNew, REPORT_DEADLINE_FUTURE)\n end\n end\n end" ]
[ "0.6312165", "0.6273602", "0.6238385", "0.61125535", "0.6108313", "0.6032549", "0.5928881", "0.5891012", "0.58671224", "0.5821111", "0.5795002", "0.5773816", "0.57709605", "0.57209814", "0.57078725", "0.56932527", "0.56586856", "0.5635252", "0.56317157", "0.56259984", "0.56223416", "0.5577025", "0.5567442", "0.5565289", "0.5556861", "0.5549262", "0.55398536", "0.55324304", "0.5501075", "0.5500798" ]
0.80855185
0
Returns message (String) when the timestamp is missing.
def missing_msg return unless missing? 'Missing timestamp.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n missing_msg || future_msg || expired_msg || timestamp\n end", "def timestamp\n nil\n end", "def future_msg\n return unless future?\n\n delta = time - reference_time\n \"Invalid timestamp: #{timestamp};\"\\\n \" #{delta.to_i} seconds ahead of time.\"\n end", "def earliest_incomplete_timestamp\n res = incomplete_recipients.first\n\n return unless res\n\n res.created_at\n end", "def timestamp_parse(_timestamp)\n _undefined\n end", "def missing?\n time.nil?\n end", "def require_timestamp(command_in_context) # :nodoc:\n return if cartage.config.timestamp\n fail GLI::MissingRequiredArgumentsException.new(\n 'Timestamp required', command_in_context\n )\n end", "def timestamp_for_day\n if timestamp > Time.zone.now.at_beginning_of_day\n self.errors.add(:timestamp, 'should be not earlier then the beginning of this day.')\n end\n end", "def log_error_with_timestamp(message)\n Rails.logger.error (\"#{get_timestamp} #{message}\")\nend", "def display_time(timestamp)\n return nil if timestamp.blank?\n timestamp.to_s(:date_time_long)\n end", "def timestamp\n timestamp = self.doc.search(\"td.AQDataSectionTitle\").css(\"small\").text.split(\" \")\n if timestamp != []\n timestamp[0].capitalize!\n timestamp = timestamp.join(\" \")\n else\n timestamp = 'Time Captured Unavailable'\n end\n timestamp\n end", "def check_timestamp!(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end", "def expired_msg\n return unless expired?\n\n delta = reference_time - time - validity\n \"Expired timestamp: #{timestamp};\"\\\n \" #{delta.to_i} seconds past expiration.\"\n end", "def timestamp\n Time.parse(message.date.to_s).utc\n end", "def should_print_message(timestamp, message)\n \n end", "def check_timestamp(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def log_info_with_timestamp(message)\n Rails.logger.info (\"#{get_timestamp} #{message}\")\nend", "def should_print_message(timestamp, message)\n if @log_hash[message].nil?\n @log_hash[message] = timestamp\n true\n elsif (timestamp - @log_hash[message]) < 10\n false\n else\n @log_hash[message] = timestamp\n true\n end\n end", "def timestamp_received(notification)\n return unless notification.userInfo[:sender] == self\n @timestamp = notification.userInfo[:date]\n end", "def not_valid_message; nil; end", "def not_valid_message; nil; end", "def should_print_message(timestamp, message)\n if log[message].nil? || timestamp - log[message] >= 10\n log.store(message, timestamp)\n return true\n end\n \n return false\n end", "def test_timestamp_invalid_format\n parser = Parser::new\n timestamp = \"15188.93687-562508000\"\n assert_raises SystemExit do\n parser.parse_timestamp timestamp\n end\n end", "def timestamp_ok?(timestamp)\n return unless (Time.now - Time.at(timestamp.to_i)).abs / 1.second > 5.minute\n\n raise Unauthorized \"ERROR: you're not Slack!\"\n end", "def default_timestamp_format\n \"{ts '%Y-%m-%d %H:%M:%S%N'}\"\n end", "def formatted_message(message)\n \"#{timestamp}#{message}\\n\".freeze if message\n end", "def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end", "def locate_timestamp\n return nil unless headers\n\n header = HEADERS.find { |candidate| headers[candidate] }\n if header\n data = headers[header]\n data.to_s.gsub(/(t=|\\.)/, '')\n else\n nil\n end\n end", "def should_print_message(timestamp, message)\n @map[message] ||= []\n should_drop_msg = !@map[message].empty? && timestamp - @map[message].last < 10\n return false if should_drop_msg\n\n @map[message] << timestamp\n true\n end" ]
[ "0.6593171", "0.63649756", "0.6245806", "0.6097163", "0.6082293", "0.6050867", "0.60149086", "0.5981572", "0.59410876", "0.58738667", "0.5847053", "0.5846065", "0.5791138", "0.57727146", "0.56976694", "0.5695673", "0.5617357", "0.55909777", "0.5589414", "0.5561384", "0.5521183", "0.5521183", "0.5520732", "0.5513687", "0.5498389", "0.54880315", "0.547786", "0.5467247", "0.544947", "0.5438072" ]
0.88346106
0
Returns the versions, bypassing the project_statement method patched above
def versions(options = {}) Version.visible. where(project_statement(false)).# bypass overridden method where(options[:conditions]). includes(:project). references(:project). to_a rescue ::ActiveRecord::StatementInvalid => e raise StatementInvalid.new(e.message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def versions\n versions = Backlogjp.base._command \"getVersions\", self.id\n versions.map {|hash| Version.new(hash)}\n end", "def versions\n Version.all\n end", "def versions\n self.apar_defect_version_maps.map { |m| m.version }\n end", "def getVersions\r\n\t\t\t\t\treturn @versions\r\n\t\t\t\tend", "def versions\n return @_versions ||= Regulate::Git::Interface.commits(id)\n end", "def get_all_versions\n []\n end", "def listversions(project=self.project)\n get('listversions.json', project: project)['versions']\n end", "def get_all_versions()\n return []\n end", "def versions\n @versions ||= Versions.new(self)\n end", "def versions\n @versions ||= Versions.new(self)\n end", "def versions\n self.class.where(id: self._id)\n end", "def versions\n @versions ||= run( :versions, '--bare' ).lines.map( &:chomp )\n end", "def bt_versions\n self.class.where(bt_scope_conditions)\n end", "def get_versions(project_id_or_key)\n get(\"projects/#{project_id_or_key}/versions\")\n end", "def build_current_versions\n version_list = []\n new_resource.package_name.each_with_index do |name, index|\n version = if new_resource.version && !new_resource.version[index].nil?\n powershell_exec(build_powershell_package_command(\"Get-Package '#{name}'\", new_resource.version[index]), timeout: new_resource.timeout).result\n else\n powershell_exec(build_powershell_package_command(\"Get-Package '#{name}'\"), timeout: new_resource.timeout).result\n end\n if version.empty?\n version = nil\n end\n version = version.strip if version.respond_to?(:strip)\n version_list.push(version)\n end\n version_list\n end", "def versions\n Code.where(parent_id: parent_id, parent_class: parent_class, name: name)\n end", "def all_versions\n [document.version, *all_preceding_versions]\n end", "def versions_for_select(unit_member)\n static_options = [['Most Recent','']]\n dynamic_options = package_branch.packages.map {|p| [p.version, p.id]}\n static_options + dynamic_options\n end", "def versions\n info[:versions]\n end", "def versions\n\t\tObjectVersion.where(\n\t\t\t:format => 1,\n\t\t\t:model_id => self.id, \n\t\t\t:inki_model_name => self.class.to_s, \n\t\t).order(\"created_at DESC\")\n\tend", "def versions_for_select(unit_member)\n static_options = [['Most Recent','']]\n pb = package_branch\n pb.bind_to_scope(unit_member)\n dynamic_options = pb.packages.map {|p| [p.version, p.id]}\n static_options + dynamic_options\n end", "def versions\n @versions ||= VersionsProxy.new self\n end", "def versions\n self.git.commits\n end", "def versions\n # TODO make this a collection proxy, only loading the first, then the\n # rest as needed during iteration (possibly in chunks)\n return nil if @archived\n @versions ||= [self].concat(CloudKit.storage_adapter.query { |q|\n q.add_condition('resource_reference', :eql, @resource_reference)\n q.add_condition('archived', :eql, 'true')\n }.reverse.map { |hash| self.class.build_from_hash(hash) })\n end", "def versions\n JSON.parse(RestClient.get(\"#{VERSION_URL}/.json\", self.default_headers))[\"versions\"].collect { |v| v[\"id\"] }.uniq\n end", "def versions_dataset\n if versionable?\n internal_versions_dataset\n else\n self.class.where(:version_id => self.version_id).order(:version_number).reverse\n end\n end", "def project_versions(project,issues)\n issues.collect(&:fixed_version).compact.uniq\n end", "def versions\n registered_versions.keys\n end", "def get_versions(versions)\n versions.map {|v| [v,get_version(v)] }\n end", "def all_versions\n r = []\n raw['update'].each do |h|\n r << h['version']\n end\n AssUpdater::AssVersion.convert_array r\n end" ]
[ "0.74128276", "0.72224337", "0.72117674", "0.7195049", "0.69509834", "0.6926755", "0.69138205", "0.6896606", "0.6884435", "0.6884435", "0.6861387", "0.6860854", "0.680563", "0.6709103", "0.6686741", "0.6678842", "0.66582763", "0.65091753", "0.6490963", "0.6474872", "0.6464375", "0.6432684", "0.64204377", "0.63758224", "0.6375306", "0.6329751", "0.6323142", "0.63151395", "0.62857014", "0.6283314" ]
0.8174002
0
POST /cambio_comision_registros POST /cambio_comision_registros.json
def create @cambio_comision_registro = current_user.cambio_comision_registros.build(cambio_comision_registro_params) if @cambio_comision_registro.save flash[:success] = "Su solicitud para registrar el cambio comisión revisora de tesis fue creada!" if current_user.tipos_usuario.tipo == "Alumno" redirect_to alumnos_path else redirect_to root_path end else flash[:alert] = "Su solicitud para el cambio comisión revisora de tesis no puede ser creada! Revise el formulario." render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\r\n @comite_registro = current_user.comite_registros.build(comite_registro_params)\r\n\r\n if @comite_registro.save\r\n flash[:success] = \"Su petición para registrar su comité tutorial fue creada!\"\r\n if current_user.tipos_usuario.tipo == \"Alumno\"\r\n redirect_to alumnos_path\r\n else\r\n redirect_to root_path\r\n end\r\n else\r\n flash[:alert] = \"Su petición para registrar su comité tutorial no pudo ser creada! Revise el formulario.\"\r\n render :new\r\n end\r\n end", "def cambio_comision_registro_params\n params.require(:cambio_comision_registro).permit(:presidente, :secretario, :primer_vocal, :segundo_vocal, :tercer_vocal, :suplente, :valida_consejero, :valida_coordinador, :estado, :revisado, :user_id)\n end", "def create\n @giro_comercial = GiroComercial.new(giro_comercial_params)\n\n respond_to do |format|\n if @giro_comercial.save\n format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente creado.' }\n format.json { render :show, status: :created, location: @giro_comercial }\n else\n format.html { render :new }\n format.json { render json: @giro_comercial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\n @it_inscripcion_registro = current_user.it_inscripcion_registros.build(it_inscripcion_registro_params)\n\n #Se cuenta cuantas personas se han preinscrito a un grupo. Se cuenta con todos los registros no\n #importando que éstos no hayan sido validados. El dato se obtiene a través de todos los registros\n #de preinscripción, el id para el grupo actual se obtiene con @it_inscripcion_registro.grupo_id\n cupos = ItInscripcionRegistro.where(grupo_id: @it_inscripcion_registro.grupo_id).count\n\n #Se localiza si el usuatio tiene un id previo con ese mismo grupo. Si existe se le envia un mensaje\n # y no se permite guardar el registro por segunda ocasión.\n usuario = User.find(current_user.id)\n registro = ItInscripcionRegistro.find_by(user_id: usuario, grupo_id: @it_inscripcion_registro.grupo_id)\n\n #Si el cupo del grupo excede los 25 alunos se le muestra un mensaje al usuario donde se le indica\n #que deberá elegir un grupo distinto, el registro de inscripción no se guardará en la base dde datos_bancos\n #hay que agregar este metodo a las rb de el modelo correspondiente.\n if cupos > 40\n redirect_to new_it_inscripcion_registro_path, notice: \"El grupo ha alcanzado su ocupación máxima. Por favor elija otro grupo\"\n elsif registro.present? && registro.grupo_id == @it_inscripcion_registro.grupo_id\n redirect_to panel_alumnos_path, notice: \"Usted ya tiene registrada una solicitud con este grupo.\"\n else\n\n respond_to do |format|\n if @it_inscripcion_registro.save\n format.html { redirect_to @it_inscripcion_registro, notice: 'El registro de inscripción se creó correctamente.' }\n format.json { render :show, status: :created, location: @it_inscripcion_registro }\n else\n format.html { render :new }\n format.json { render json: @it_inscripcion_registro.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @comite_registro.update(comite_registro_params)\r\n format.html { redirect_to @comite_registro, notice: 'Su petición para registrar su comité tutorial fue actualizada.' }\r\n format.json { render :show, status: :ok, location: @comite_registro }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @comite_registro.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @registro = Registro.new(registro_params)\n\n respond_to do |format|\n if @registro.save\n format.html { redirect_to '/' }\n format.json { render :show, status: :created, location: @registro }\n else\n format.html { render :new }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registro = Registro.new(registro_params)\n\n respond_to do |format|\n if @registro.save\n format.html { redirect_to @registro, notice: \"Registro was successfully created.\" }\n format.json { render :show, status: :created, location: @registro }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registro = Registro.new(registro_params)\n\n respond_to do |format|\n if @registro.save\n format.html { redirect_to @registro, notice: 'Registro was successfully created.' }\n format.json { render :show, status: :created, location: @registro }\n else\n format.html { render :new }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registration = Registration.new(registration_params)\n @registration.group_id = sortear_grupo(@registration.colonist_age, @registration.colonist_gender)\n \n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: \"Bienvenido a la familia Buena Onda. Ya estás pre-inscripto. No olvides pasar por el club [dirección] de (9) a (18) dentro de las próximas 72 hs para confirmar la inscripción de #{@registration.colonist_name} y abonar la inscripción.\" }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html { render :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registro_guardium = RegistroGuardium.new(registro_guardium_params)\n\n respond_to do |format|\n if @registro_guardium.save\n format.html { redirect_to @registro_guardium, notice: 'Registro guardium was successfully created.' }\n format.json { render :show, status: :created, location: @registro_guardium }\n else\n format.html { render :new }\n format.json { render json: @registro_guardium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cambio_director_tesis_registro = current_user.cambio_director_tesis_registros.build(cambio_director_tesis_registro_params)\n if @cambio_director_tesis_registro.save\n flash[:success] = \"Su petición para cambiar director(es) de tesis ha sido creada!\"\n if current_user.tipos_usuario.tipo == \"Alumno\"\n redirect_to alumnos_path\n else\n redirect_to root_path\n end\n else\n flash[:alert] = \"Su petición para cambiar director(es) de tesis no pudo crearse! Revise el formulario.\"\n render :new\n end\n end", "def create\n @gommi = Gommi.new(gommi_params)\n\n respond_to do |format|\n if @gommi.save\n format.html { redirect_to gommis_complete_path, notice: 'Gommi was successfully created.' }\n format.json { render :show, status: :created, location: @gommi }\n else\n format.html { render :new }\n format.json { render json: @gommi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registro_curso = RegistroCurso.new(registro_curso_params)\n\n respond_to do |format|\n if @registro_curso.save\n format.html { redirect_to @registro_curso, notice: 'El registro del curso fue creado correctamente.' }\n format.json { render :show, status: :created, location: @registro_curso }\n else\n format.html { render :new }\n format.json { render json: @registro_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registo = Registo.new(registo_params)\n\n respond_to do |format|\n if @registo.save\n if (usuario_signed_in?)\n format.html { redirect_to @registo, notice: 'Registo criado com sucesso.' }\n else\n format.html { redirect_to root_url, notice: 'Registo enviado com sucesso.' }\n end\n format.json { render :show, status: :created, location: @registo }\n\n # unless Rails.env.development? || Rails.env.test?\n RegistoMailer.novo_registo(@registo).deliver\n RegistoMailer.novo_registo_para_equipa(@registo).deliver\n # end\n else\n format.html { render :new }\n format.json { render json: @registo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rego = Rego.new(rego_params)\n\n respond_to do |format|\n if @rego.save\n format.html { redirect_to @rego, notice: 'Rego was successfully created.' }\n format.json { render :show, status: :created, location: @rego }\n else\n format.html { render :new }\n format.json { render json: @rego.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registro_servicio = Registro::Servicio.new(registro_servicio_params)\n\n respond_to do |format|\n if @registro_servicio.save\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully created.' }\n format.json { render :show, status: :created, location: @registro_servicio }\n else\n format.html { render :new }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @congreso = Congreso.new(params[:congreso])\n @congreso.user_id = current_user.id\n \n respond_to do |format|\n if @congreso.save\n crear_campos_congreso(params, @congreso.id)\n CongresosUser.create(:user_id => current_user.id, :congreso_id => @congreso.id)\n format.html { redirect_to @congreso, notice: 'Congreso registrado correctamente.' }\n format.json { render json: @congreso, status: :created, location: @congreso }\n else\n @campos = Campo.all\n format.html { render action: \"new\" }\n format.json { render json: @congreso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cotiz_mes_cam = CotizMesCam.new(cotiz_mes_cam_params)\n\n respond_to do |format|\n if @cotiz_mes_cam.save\n format.html { redirect_to @cotiz_mes_cam, notice: 'Cotiz mes cam was successfully created.' }\n format.json { render :show, status: :created, location: @cotiz_mes_cam }\n else\n format.html { render :new }\n format.json { render json: @cotiz_mes_cam.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registro = Registro.new(registro_params)\n\n respond_to do |format|\n if @registro.save\n format.html { redirect_to registros_path, notice: 'Codigo: CRE004 - El usuario ha sido creado' }\n format.json { render :show, status: :created, location: @registro }\n format.js\n else\n format.html { redirect_to registros_path, notice: 'Codigo: ERR006 - Email esta vacio. Por favor comprueba los campos del formulario.' }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @regiaos = Regiao.new(params[:regiao])\n\n respond_to do |format|\n if @regiaos.save\n flash[:notice] = 'REGIÃO SALVA COM SUCESSO'\n format.html { redirect_to(new_regiao_path)}\n format.xml { render :xml => @regiaos, :status => :created, :location => @regiaos }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @regiaos.errors, :status => :unprocessable_entity }\n end\n end\n end", "def registo_params\n params.require(:registo).permit(:nome_user, :nome_empresa, :telemovel, :email, :cidade, :estado)\n end", "def create\n\n @respuestum = Respuestum.new(respuestum_params)\n # @comentario = Comentario.find(params[:id])\n #nombre = params[:nombre]\n #correo = params[:correo]\n #comentario = params[:comentario]\n\n #@respuestum = Respuestum.create(:nombre => string, :correo => string, :descripcion => text,:comentario_id => @comentario.id)\n\n respond_to do |format|\n if @respuestum.save\n format.html { redirect_to comentarios_url}\n format.json { render :show, status: :created, location: @respuestum }\n else\n format.html { render :new }\n format.json { render json: @respuestum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enregistrement = Enregistrement.new(params[:enregistrement])\n\n respond_to do |format|\n if @enregistrement.save\n format.html { redirect_to @enregistrement, notice: 'Enregistrement was successfully created.' }\n format.json { render json: @enregistrement, status: :created, location: @enregistrement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enregistrement.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_registration(params)\r\n random_pass = 4.times.map { (0..9).to_a.sample }.join\r\n stgu = Hash.new\r\n stgu['__c'] = 'stgu'\r\n stgu['__p'] = [\r\n nil,\r\n nil,\r\n nil, \r\n 1,\r\n params[:email],\r\n random_pass,\r\n nil,\r\n params[:first_name],\r\n params[:middle_name],\r\n params[:last_name],\r\n params[:phone],\r\n nil,\r\n Settings.register_location,\r\n params[:birth_date]\r\n ]\r\n\r\n address = [\r\n nil,\r\n nil,\r\n nil,\r\n params[:street_address],\r\n nil,\r\n params[:city],\r\n nil,\r\n params[:state],\r\n 'US',\r\n params[:zip_code]\r\n ]\r\n\r\n stgma = Hash.new\r\n stgma['__c'] = 'stgma'\r\n stgma['__p'] = address\r\n\r\n stgba = Hash.new\r\n stgba['__c'] = 'stgba'\r\n stgba['__p'] = address\r\n\r\n stgu_json = stgu.to_json\r\n stgma_json = stgma.to_json\r\n stgba_json = stgba.to_json\r\n\r\n register_path = 'https://catalog.tadl.org/osrf-gateway-v1?service=open-ils.actor&method=open-ils.actor.user.stage.create&param='\r\n register_path << stgu_json.to_s\r\n register_path << '&param=' + stgma_json.to_s\r\n register_path << '&param=' + stgba_json.to_s\r\n\r\n if Settings.register_newsletter == true && params[:enews] == 'true'\r\n uri = URI(Settings.register_listapi_url)\r\n\r\n params = {\r\n 'check' => ENV[\"LISTAPI_KEY\"],\r\n 'email' => params[:email],\r\n 'firstname' => params[:first_name],\r\n 'lastname' => params[:last_name],\r\n 'city' => params[:city],\r\n 'state' => params[:state],\r\n 'zip' => params[:zip_code],\r\n }\r\n\r\n res = Net::HTTP.post_form(uri, params);\r\n # puts res.body if res.is_a?(Net::HTTPSuccess) # Uncomment for DEBUG\r\n\r\n end\r\n\r\n uri = URI.parse(register_path)\r\n response = Net::HTTP.get_response(uri)\r\n if response.code == '200'\r\n return JSON.parse(response.body)\r\n else\r\n return 'error'\r\n end\r\n\r\n end", "def create\n @registro_bovino = RegistroBovino.new(params[:registro_bovino])\n\n respond_to do |format|\n if @registro_bovino.save\n #format.html { redirect_to @registro_bovino, notice: 'Registro bovino was successfully created.' }\n format.html { redirect_to action: \"index\" }\n format.json { render json: @registro_bovino, status: :created, location: @registro_bovino }\n else\n format.html { render action: \"new\" }\n format.json { render json: @registro_bovino.errors, status: :unprocessable_entity }\n end \n end\n end", "def create\n @central_correio = CentralCorreio.new(params[:central_correio])\n\n respond_to do |format|\n if @central_correio.save\n format.html { redirect_to @central_correio, notice: 'Central correio was successfully created.' }\n format.json { render json: @central_correio, status: :created, location: @central_correio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @central_correio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @registro_medicion = Api::RegistroMedicion.new(registro_medicion_params)\r\n @registro_medicion.microcontrolador = Api::Microcontrolador.find_or_create_by(nivel: params[:nivel], area: params[:area])\r\n #TODO Mande que tipo de variable ambiental es\r\n\r\n @registro_medicion.variable_ambiental = Api::VariableAmbiental.where(tipo: params[:tipo]).first\r\n\r\n if @registro_medicion.save && Api::RegistroMedicionesHelper.verify(@registro_medicion, params[:promedio])\r\n render json: @registro_medicion.to_json, status: :ok\r\n else\r\n render :json => { :mssg => 'Hubo un error creando el registro medicion.' }, status: :unprocessable_entity\r\n end\r\n end", "def create\n @reg = Reg.new(reg_params)\n\n respond_to do |format|\n if @reg.save\n format.html { redirect_to @reg, notice: 'Reg was successfully created.' }\n format.json { render :show, status: :created, location: @reg }\n else\n format.html { render :new }\n format.json { render json: @reg.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Caracteristica.new(caracteristica_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end" ]
[ "0.7112228", "0.6465226", "0.64506114", "0.63754755", "0.6348455", "0.6344423", "0.63419175", "0.63370794", "0.633042", "0.62951434", "0.6282906", "0.62643063", "0.62295175", "0.6225241", "0.621955", "0.6204152", "0.62034416", "0.62016106", "0.6198143", "0.6185357", "0.6098667", "0.6093246", "0.60667735", "0.60644925", "0.606063", "0.60490066", "0.6023926", "0.6020666", "0.6017284", "0.6012886" ]
0.7532299
0
PATCH/PUT /cambio_comision_registros/1 PATCH/PUT /cambio_comision_registros/1.json
def update respond_to do |format| if @cambio_comision_registro.update(cambio_comision_registro_params) format.html { redirect_to @cambio_comision_registro, notice: 'Cambio comision registro was successfully updated.' } format.json { render :show, status: :ok, location: @cambio_comision_registro } else format.html { render :edit } format.json { render json: @cambio_comision_registro.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n respond_to do |format|\r\n if @comite_registro.update(comite_registro_params)\r\n format.html { redirect_to @comite_registro, notice: 'Su petición para registrar su comité tutorial fue actualizada.' }\r\n format.json { render :show, status: :ok, location: @comite_registro }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @comite_registro.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @giro_comercial.update(giro_comercial_params)\n format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente editado.' }\n format.json { render :show, status: :ok, location: @giro_comercial }\n else\n format.html { render :edit }\n format.json { render json: @giro_comercial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registo.update(registo_params)\n format.html { redirect_to @registo, notice: 'Registo actualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @registo }\n else\n format.html { render :edit }\n format.json { render json: @registo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registro.update(registro_params)\n format.html { redirect_to @registro, notice: \"Registro was successfully updated.\" }\n format.json { render :show, status: :ok, location: @registro }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registro.update(registro_params)\n format.html { redirect_to @registro, notice: 'Registro was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro }\n else\n format.html { render :edit }\n format.json { render json: @registro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cambio_director_tesis_registro.update(cambio_director_tesis_registro_params)\n format.html { redirect_to @cambio_director_tesis_registro, notice: 'Su petición para cambiar de director(es) de tesis fue actualizada.' }\n format.json { render :show, status: :ok, location: @cambio_director_tesis_registro }\n else\n format.html { render :edit }\n format.json { render json: @cambio_director_tesis_registro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(caracteristica_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica 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 respond_to do |format|\n if @objeto.update(imagen_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Imagen 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_gen\n respond_to do |format|\n # En etiquetas pone usuario actual por omision\n if (!params[:caso][:caso_etiqueta_attributes].nil?)\n params[:caso][:caso_etiqueta_attributes].each do |k,v|\n if (v[:usuario_id].nil? || v[:usuario_id] == \"\")\n v[:usuario_id] = current_usuario.id\n end\n end\n end\n\n # En familiares si falta crear trelacion_persona para personas\n # autocompletadas los crea\n if caso_params[:victima_attributes]\n caso_params[:victima_attributes].each do |iv, v|\n if v[:persona_attributes] &&\n v[:persona_attributes][:persona_trelacion1_attributes]\n v[:persona_attributes][:persona_trelacion1_attributes].each do |it, t|\n if t && (!t[:id] || t[:id] == '') &&\n t[:personados_attributes] &&\n t[:personados_attributes][:id] &&\n t[:personados_attributes][:id].to_i > 0 &&\n Msip::Persona.where(\n id: t[:personados_attributes][:id].to_i).count == 1\n pt_e = Msip::PersonaTrelacion.where(\n persona1: v[:persona_attributes][:id],\n persona2: t[:personados_attributes][:id]\n )\n if !pt_e\n pt = Msip::PersonaTrelacion.create({\n persona1: v[:persona_attributes][:id],\n persona2: t[:personados_attributes][:id]\n })\n pt.save!(validate: false)\n params[:caso][:victima_attributes][iv][:persona_attributes][:persona_trelacion1_attributes][it][:id] = pt.id\n else\n params[:caso][:victima_attributes][iv][:persona_attributes][:persona_trelacion1_attributes][it][:id] = pt_e[0].id\n end\n end\n end\n end\n end\n end\n\n if params[:_msip_enviarautomatico] == \"1\"\n params_finales = caso_params.except(\n :caso_etiqueta_attributes,\n :caso_anexo_attributes,\n :caso_fuenteprensa_attributes,\n :caso_fotra_attributes,\n :caso_presponsable_attributes\n )\n else\n params_finales = caso_params\n end\n\n if @caso.update(params_finales)\n\n\n if registrar_en_bitacora\n Msip::Bitacora.agregar_actualizar(\n request, :caso, :bitacora_cambio, \n current_usuario.id, params, 'Sivel2Gen::Caso',\n @caso.id\n )\n end\n\n #if request.params[:enviarFichaCaso] == '1'\n # head :no_content\n # return\n #end\n\n notificacion = 'Caso actualizado.'\n if Sivel2Gen::Caso.count > MAX_CASOS_REFRESCA_AUTOMATICO\n notificacion += \" Por la cantidad de casos \"+\n \" debe Refrescar para notar \" +\n \" el cambio en el listado de casos\"\n end\n format.html {\n redirect_to @caso,\n notice: notificacion\n }\n format.json { head :no_content }\n format.js { head :no_content }\n else\n format.html {\n if session[:capturacaso_acordeon]\n render 'editv', layout: 'application'\n else\n render 'edit', layout: 'application'\n end\n }\n format.json { render json: @caso.errors,\n status: :unprocessable_entity }\n format.js { render json: @caso.errors,\n status: :unprocessable_entity }\n end\n end\n begin\n @conscasocount = Conscaso.count\n if @conscasocount <= MAX_CASOS_REFRESCA_AUTOMATICO\n puts Conscaso.refresca_conscaso\n end\n rescue\n puts Conscaso.refresca_conscaso\n @conscasocount = Conscaso.count\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @rego.update(rego_params)\n format.html { redirect_to @rego, notice: 'Rego was successfully updated.' }\n format.json { render :show, status: :ok, location: @rego }\n else\n format.html { render :edit }\n format.json { render json: @rego.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prospecto_telefono.update(prospecto_telefono_params)\n format.html { redirect_to @prospecto_telefono, notice: 'Prospecto telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto_telefono }\n else\n format.html { render :edit }\n format.json { render json: @prospecto_telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.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 @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 respond_to do |format|\n if @registro_curso.update(registro_curso_params)\n format.html { redirect_to @registro_curso, notice: 'El registro del curso fue actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @registro_curso }\n else\n format.html { render :edit }\n format.json { render json: @registro_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n if @registro_bovino.update_attributes(params[:registro_bovino])\n #format.html { redirect_to @registro_bovino, notice: 'Registro bovino was successfully updated.' }\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registro_bovino.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @registro.update(registro_params)\n respond_with @registro\n # respond_to do |format|\n # if @registro.update(registro_params)\n # format.html { redirect_to @registro, notice: 'Registro was successfully updated.' }\n # format.json { render :show, status: :ok, location: @registro }\n # else\n # format.html { render :edit }\n # format.json { render json: @registro.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n if params[:id]==\"edit_familias_propiedades\"\n edit_familias_propiedades\n return\n end\n \n #if params[:familia][\"articulos_grupopropiedades_attributes\"]\n# componer_articulo\n# return\n #end \n \n respond_to do |format|\n if @familia.update(familia_params) \n \n format.html { redirect_to familias_path(:id => @familia.padre_id), notice: 'Familia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @familia.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\r\n respond_to do |format|\r\n if @sivic_contabanco.update(sivic_contabanco_params)\r\n format.html { redirect_to @sivic_contabanco, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_contabanco.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @cotiz_mes_cam.update(cotiz_mes_cam_params)\n format.html { redirect_to @cotiz_mes_cam, notice: 'Cotiz mes cam was successfully updated.' }\n format.json { render :show, status: :ok, location: @cotiz_mes_cam }\n else\n format.html { render :edit }\n format.json { render json: @cotiz_mes_cam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @espacio_comun.update(espacio_comun_params)\n format.html { redirect_to @espacio_comun, notice: 'Espacio comun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @espacio_comun.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(carpeta_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta 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 respond_to do |format|\n if @camino.update(camino_params)\n format.html { redirect_to @camino, notice: 'Camino was successfully updated.' }\n format.json { render :show, status: :ok, location: @camino }\n else\n format.html { render :edit }\n format.json { render json: @camino.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mecanico_especialidad.update(mecanico_especialidad_params)\n format.html { redirect_to @mecanico_especialidad, notice: 'Mecanico especialidad was successfully updated.' }\n format.json { render :show, status: :ok, location: @mecanico_especialidad }\n else\n format.html { render :edit }\n format.json { render json: @mecanico_especialidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @telefono.update(telefono_params)\n format.html { redirect_to @telefono, notice: 'Telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefono }\n else\n format.html { render :edit }\n format.json { render json: @telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @campeonato.update(campeonato_params)\n format.html { redirect_to @campeonato, notice: 'Campeonato was successfully updated.' }\n format.json { render :show, status: :ok, location: @campeonato }\n else\n format.html { render :edit }\n format.json { render json: @campeonato.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6834587", "0.6483392", "0.62798417", "0.62583333", "0.6249241", "0.6228642", "0.6154822", "0.6148632", "0.6144729", "0.6122083", "0.6104952", "0.6070255", "0.6067732", "0.6052843", "0.6044723", "0.60371983", "0.60259426", "0.601404", "0.6003383", "0.6003267", "0.5995533", "0.5994497", "0.59934115", "0.59849584", "0.5974905", "0.59700537", "0.594885", "0.5938772", "0.59316814", "0.59274316" ]
0.6931963
0
DELETE /cambio_comision_registros/1 DELETE /cambio_comision_registros/1.json
def destroy @cambio_comision_registro.destroy respond_to do |format| format.html { redirect_to cambio_comision_registros_url, notice: 'Cambio comision registro was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\r\n @comite_registro.destroy\r\n respond_to do |format|\r\n format.html { redirect_to comite_registros_url, notice: 'Su petición para registrar su comité tutorial fue eliminada.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @cambio_director_tesis_registro.destroy\n respond_to do |format|\n format.html { redirect_to cambio_director_tesis_registros_url, notice: 'Su petición para cambiar de director(es) de tesis fue eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @registro_guardium.destroy\n respond_to do |format|\n format.html { redirect_to registro_guardia_url, notice: 'Registro guardium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @registro.destroy\n respond_to do |format|\n format.html { redirect_to registros_url, notice: \"Registro was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @registro.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 @giro_comercial.destroy\n respond_to do |format|\n format.html { redirect_to giro_comercials_url, notice: 'Giro comercial fue exitosamente destruido.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @registro.destroy\n respond_to do |format|\n format.html { redirect_to registros_url, notice: 'Registro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @central_correio = CentralCorreio.find(params[:id])\n @central_correio.destroy\n\n respond_to do |format|\n format.html { redirect_to central_correios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @registo.destroy\n respond_to do |format|\n format.html { redirect_to registos_url, notice: 'Registo eliminado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocorrencium.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencia_url, notice: 'Registro excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @registro.destroy\n respond_to do |format|\n format.html { redirect_to registros_url, notice: 'El usuario ha sido eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @registro_servicio.destroy\n respond_to do |format|\n format.html { redirect_to registro_servicios_url, notice: 'Servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @registro_bovino = RegistroBovino.find(params[:id])\n @registro_bovino.destroy\n\n respond_to do |format|\n format.html { redirect_to registro_bovinos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @personaje_mision = PersonajeMision.find(params[:id])\n @personaje_mision.destroy\n\n respond_to do |format|\n format.html { redirect_to personaje_misions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @director_tesis_registro.destroy\n respond_to do |format|\n format.html { redirect_to director_tesis_registros_url, notice: 'Su petición de registro de director de tesis fue eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuestum.destroy\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @empresa_registrada = EmpresaRegistrada.find(params[:id])\n @empresa_registrada.destroy\n\n respond_to do |format|\n format.html { redirect_to empresa_registradas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @analisisregistro.destroy\n respond_to do |format|\n format.html { redirect_to analisisregistros_url, alert: 'Análisis eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @camino.destroy\n respond_to do |format|\n format.html { redirect_to caminos_url, notice: 'Camino was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @it_inscripcion_registro.destroy\n respond_to do |format|\n format.html { redirect_to it_inscripcion_registros_url, notice: 'El registro de inscripción se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.74563485", "0.732304", "0.7243939", "0.709651", "0.7040907", "0.7035399", "0.7031135", "0.70310986", "0.7029875", "0.70093375", "0.70037496", "0.6964801", "0.6960962", "0.69432026", "0.692193", "0.69188553", "0.6906292", "0.69049776", "0.6902614", "0.68997616", "0.68959224", "0.68783855", "0.6876379", "0.6876379", "0.68758565", "0.6873596", "0.68668866", "0.6849031", "0.6845854", "0.6845549" ]
0.76422995
0
TODO add authentication as a option for go live as Github Rate Limit is 60 hits per hour when unauthenticated by 5000 per hour when authenticated. TODO PRIORITY username and password variables are not using "gets" correctly when used in terminal. When in terminal after typing in credentials github api returns a bad credentials alert. But when you type the credentials in directly in the code there is no issues.
def ghAuthenticate (username, password) # puts "Enter GitHub Username:" # username = "" # puts "Enter GitHub Password:" # password = "" # Octokit.auto_paginate = true @ghClient = Octokit::Client.new(:login => username.to_s, :password => password.to_s, :per_page =>100) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_credentials\n self.username = cli.prompt \"Your GitHub username: \"\n self.password = cli.prompt_secret \"Your GitHub password (never stored): \"\n end", "def ask_token\n self.username = cli.prompt \"Your GitHub username: \"\n self.user_defined_token = cli.prompt_secret \"Your GitHub API token: \"\n end", "def request_token\n json = cli.perform_quietly %Q(curl -u '#{username}:#{password}' -d '{\"scopes\": [\"repo\"], \"notes\": \"Octopolo\"}' https://api.github.com/authorizations)\n self.auth_response = JSON.parse json\n end", "def ask_github_password(username = nil)\n username ||= github_username\n print \"Github password for #{username} (never stored): \"\n if $stdin.tty?\n password = askpass\n puts ''\n password\n else\n # in testing\n $stdin.gets.chomp\n end\n rescue Interrupt\n abort\n end", "def initialize(user = nil, api_token = nil, repo_name = \"cookie_monster\") \n if user.nil?\n puts \"No user provided, getting from git config\"\n user = `git config --get github.user`.chomp\n end\n\n if api_token.nil?\n puts \"No API token provided, getting from git config\"\n api_token = `git config --get github.token`.chomp\n end\n\n\n @user = user.chomp # chomp in case user passes in bad data\n @api_token = api_token.chomp # chomp in case user passes in bad data\n @repo_name = repo_name\n\n # Authenticated client\n #@client = Octopussy::Client.new({:login => @user, :token => @api_token})\n\n # Location of local git repository. Necessary for pushing to Github.\n # Put it in .cloud_path so it doesn't conflict with anything\n @git_dir_path = File.expand_path(\"~/.cloud_path/\" + @repo_name)\n\n create_repo\n create_git_dir\n \n # For whatever reason, Repository.find raises Octopi::NotFound when\n # we've just created the repository in this run of the script.\n # Possibly a caching error.\n begin\n repo = Repository.find(:user => @user, :repo => @repo_name)\n rescue Octopi::NotFound\n puts \"Repository not found. Probably just created repository, please\"\n puts \"run this script again.\"\n exit 0\n end\n end", "def ask_credentials\n self.email = cli.prompt \"Your Pivotal Tracker email: \"\n self.password = cli.prompt_secret \"Your Pivotal Tracker password (never stored): \"\n end", "def retrieve_options_from_user\n opts = {}\n\n puts \"We need your Github user id and token. Please use the following steps\\n\"\n puts ' 1. Go to Github'\n puts ' 2. Click on your user name or icon in the upper right hand corner'\n puts ' 3. Click on *Developer Settings*'\n puts ' 3. Click on *Personal Access Tokens*'\n puts ' 4. Click on *Generate new token*'\n puts ' 5. Fill out your Github password'\n puts ' 6. Fill out token description'\n puts ' 7. Select *repos*'\n puts ' 8. Click on *Generate token*'\n puts ' 9. Copy your token from the resulting page'\n puts 'This information will be saved in github.yml'\n $stdout.print 'What\\'s your github user name (e.g. willosser)? '\n opts[:user_id] = $stdin.gets.rstrip\n Breadcrumbs.drop \"user_id set to '#{opts[:user_id]}'\"\n $stdout.print 'What\\'s your github user token? '\n opts[:user_token] = $stdin.gets.rstrip\n Breadcrumbs.drop \"user_token set to '#{opts[:user_token]}'\"\n\n write_github_info(opts)\n opts\n end", "def configure_github_access\n settings = ::GitReview::Settings.instance\n if settings.oauth_token && settings.username\n @github = Octokit::Client.new(\n :login => settings.username,\n :access_token => settings.oauth_token,\n :auto_traversal => true\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def run\n puts @usage if failed?\n puts @help if @opts[:help]\n exit if failed?\n increment\n @opts[:get] = @ghuls.get_random_user if @opts[:get].nil?\n\n user = @ghuls.get_user_and_check(@opts[:get])\n if !user\n puts 'Sorry, something wen\\'t wrong.'\n puts \"We could not find any user named #{@opts[:get]}.\"\n puts 'If you believe this is an error, please report it as a bug.'\n else\n @repos = @ghuls.get_user_repos(@opts[:get])\n @org_repos = @ghuls.get_org_repos(@opts[:get])\n language_data(user[:username])\n puts 'Getting forks, stars, and watchers of user repositories...'\n fork_data(@repos)\n puts 'Getting forks, stars, and watchers of organization repositories...'\n fork_data(@org_repos)\n follower_data(user[:username])\n issue_data(@repos)\n issue_data(@org_repos)\n calendar_data(user[:username])\n end\n exit\n end", "def test_input_username_retrieves_info_from_github\n skip\n # get \"/\"\n # post \"/profile\"\n assert_equal \"https://api.github.com/users/stevefake/repos\", \"\"\n end", "def create\n\t\t# we're sent here by the GET '/auth' => 'sessions#create' route\n\t\t# response = Faraday.post(\"https://github.com/login/oauth/access_token\") do |request|\n\t\t# \trequest.headers['Accept'] = 'application/json'\n\t\t# \trequest.body = JSON.generate({\n\t\t# \t\t\t'client_id': ENV[\"GITHUB_CLIENT_ID\"],\n\t\t# \t\t\t'client_secret': ENV[\"GITHUB_CLIENT_SECRET\"],\n\t\t# \t\t\t'code': params[:code]\n\t\t# \t\t})\n\t\t# end\n\t\t# could also be written \n\t\tresponse = Faraday.post \"https://github.com/login/oauth/access_token\", {client_id: ENV[\"GITHUB_CLIENT_ID\"], client_secret: ENV[\"GITHUB_CLIENT_SECRET\"],code: params[:code]}, {'Accept' => 'application/json'}\n\n\t\t# this is sent back by github under the following form by default\n\t\t# access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&scope=user%2Cgist&token_type=bearer\n\t\t# and since we asked for headers \"Accept: application/json\"\n\t\t# {\"access_token\":\"e72e16c7e42f292c6912e7710c838347ae178b4a\", \"scope\":\"repo,gist\", \"token_type\":\"bearer\"}\n\t\taccess_hash = JSON.parse(response.body)\n\t\tsession[:token] = access_hash[\"access_token\"]\n\n\t\t##### Now we have the token and we can use it to access the API\n\n\t\t# we make a call to get the username\n\t\tuser_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization' => \"token #{session[:token]}\", 'Accept' => 'application/json'}\n\t\t# parse the response body\n\t\tuser_json = JSON.parse(user_response.body)\n\t\t# set the username into the session\n\t\tsession[:username] = user_json[\"login\"]\n\t\tbinding.pry\n\t\t# next step happens in the root path (repositories#index)\n\t\tredirect_to root_path\n\tend", "def index\n\n\n# # Exchange your oauth_token and oauth_token_secret for an AccessToken instance.\n# def prepare_access_token(oauth_token, oauth_token_secret)\n# consumer = OAuth::Consumer.new(\"e24305f14f7f9a67c465\", \"604015f905f6207ec29f3661b952397663d58347\",\n# { :site => \"https://api.github.com/\",\n# :scheme => :header\n# })\n# # now create the access token object from passed values\n# token_hash = { :oauth_token => oauth_token,\n# :oauth_token_secret => oauth_token_secret\n# }\n# access_token = OAuth::AccessToken.from_hash(consumer, token_hash )\n# return access_token\n# end\n\n# # Exchange our oauth_token and oauth_token secret for the AccessToken instance.\n# access_token = prepare_access_token(\"abcdefg\", \"hijklmnop\")\n# # use the access token as an agent to get the home timeline\n# @response = access_token.request(:get, \"https://api.github.com/repos/rails/rails/collaborators\")\n\n\n# curl https://api.github.com/repos/rails/rails/collaborators?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\n\n\n # url = \"https://github.com/login/oauth/authorize\"\n\n # @token = JSON.parse(open(url).read)\n\n @repo = Repo.new\n end", "def get_token_for(username, password)\n\t\t\t\turl = GITHUB_API_AUTH_LINK \n\t\t\t\tscopes = %w[repo gist]\n\t\t\t\tcontent = generate_scope \"Gistto\", scopes\n\t\t\t\thttps_open_for ({url: url, mthd: \"post\", content: content, username: username, password: password})\n\t\t\tend", "def credentials\n @credentials ||= Rugged::Credentials::UserPassword.new({\n :username => \"x-oauth-basic\",\n :password => ENV[\"GITHUB_TOKEN\"]\n })\n end", "def github\n @github ||= begin\n if username.present? && github_access_token.present?\n Octokit::Client.new(login: username, oauth_token: github_access_token, auto_traversal: true)\n else\n nil\n end\n end\n end", "def configure_github_access\n if Settings.instance.oauth_token\n @github = Octokit::Client.new(\n :login => Settings.instance.username,\n :oauth_token => Settings.instance.oauth_token\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def github_check\n begin\n unless github.blank?\n RestClient.get \"https://github.com/#{github}\"\n end\n rescue\n errors.add :base, \"Invalid Github account.\"\n end\n end", "def fetch_json\n # Get raw JSON of GitHub API\n api_page = open(@api_url, http_basic_authentication: @login)\n # Parse the JSON into a hash\n @api_hash = JSON.parse(api_page.read)\n end", "def authorize(auth = {})\n @authentication ||= TaskMapper::Authenticator.new(auth)\n auth = @authentication\n login = auth.login || auth.username\n if auth.login.blank? and auth.username.blank?\n raise TaskMapper::Exception.new('Please provide at least a username')\n elsif auth.token\n TaskMapper::Provider::Github.login = login\n TaskMapper::Provider::Github.user_token = auth.token\n TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :token => auth.token)\n elsif auth.password\n TaskMapper::Provider::Github.login = login\n TaskMapper::Provider::Github.user_token = auth.token\n TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :password => auth.password)\n else \n TaskMapper::Provider::Github.login = login\n TaskMapper::Provider::Github.user_token = nil\n TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login)\n end\n end", "def github_commit(owner, repo, sha)\n parent_dir = File.join('commits', \"#{owner}@#{repo}\")\n commit_json = File.join(parent_dir, \"#{sha}.json\")\n FileUtils::mkdir_p(parent_dir)\n\n r = nil\n if File.exists? commit_json\n r = begin\n JSON.parse File.open(commit_json).read\n rescue\n # This means that the retrieval operation resulted in no commit being retrieved\n {}\n end\n return r\n end\n\n url = \"https://api.github.com/repos/#{owner}/#{repo}/commits/#{sha}\"\n log(\"Requesting #{url} (#{@remaining} remaining)\")\n\n contents = nil\n begin\n r = open(url, 'User-Agent' => 'ghtorrent', 'Authorization' => \"token #{token}\")\n @remaining = r.meta['x-ratelimit-remaining'].to_i\n @reset = r.meta['x-ratelimit-reset'].to_i\n contents = r.read\n JSON.parse contents\n rescue OpenURI::HTTPError => e\n @remaining = e.io.meta['x-ratelimit-remaining'].to_i\n @reset = e.io.meta['x-ratelimit-reset'].to_i\n log \"Cannot get #{url}. Error #{e.io.status[0].to_i}\"\n {}\n rescue StandardError => e\n log \"Cannot get #{url}. General error: #{e.message}\"\n {}\n ensure\n File.open(commit_json, 'w') do |f|\n f.write contents unless r.nil?\n f.write '' if r.nil?\n end\n\n if 5000 - @remaining >= REQ_LIMIT\n to_sleep = @reset - Time.now.to_i + 2\n log \"Request limit reached, sleeping for #{to_sleep} secs\"\n sleep(to_sleep)\n end\n end\n end", "def fetch_github_information\n self.associated_commit_shas = []\n self.branch_name = nil\n self.username = nil\n\n return if self.dev_build\n\n GithubService.run(self.project.github_root_url, self.project.github_repo) do |service|\n if self.is_branch_build\n self.associated_commit_shas = service.github_commits(10, self.commit_sha)\n self.branch_name = nil\n self.username = nil\n else\n self.associated_commit_shas = []\n info = service.user_and_branch_for_pull_request(self.pull_request_number)\n self.username = info[:user]\n self.branch_name = info[:branch]\n end\n end\n end", "def request_repo_data\n self.class.get(\"/#{@repo}\", headers: {\n 'Authorization' => \"token #{@token}\",\n 'User-Agent' => 'stefanrush/weightof.it'\n })\n end", "def api_call(path)\n url = \"https://api.github.com#{path}\"\n url << \"?access_token=#{ENV['GITHUB_API_TOKEN']}\" if ENV['GITHUB_API_TOKEN']\n resp = get(url)\n if resp.code.to_i != 200\n nil\n else\n data = resp.body\n JSON.parse(data)\n end\nend", "def resolve\n if (login = env['GITHUB_LOGIN']) && (password = env['GITHUB_PASSWORD'])\n { login: login, password: password }\n elsif access_token = env['GITHUB_ACCESS_TOKEN']\n { access_token: access_token }\n elsif (client_id = env['GITHUB_CLIENT_ID']) && (client_secret = env['GITHUB_CLIENT_SECRET'])\n { client_id: client_id, client_secret: client_secret }\n elsif netrc_file = env['NETRC_FILE']\n raise MissingCredentials.new(netrc_file) unless Netrc.read(netrc_file)['api.github.com']\n { netrc: true, netrc_file: netrc_file }\n elsif Netrc.read['api.github.com']\n { netrc: true }\n else\n raise MissingCredentials\n end\n end", "def get_url( url, &block )\n open( url, { http_basic_authentication: [ ENV[ 'GITHUB_USERNAME' ], ENV[ 'GITHUB_ACCESS_TOKEN' ] ] } ) do |response|\n yield response if block_given?\n end\nend", "def ask_for_creds(user=nil)\n if user\n @username = user\n else\n print \"Enter your GApps email address: \"\n @username = gets.chomp.strip.downcase \n # using highline for input on more than one run of a loop causes intermittent errors\n # in Ruby 1.8.7 on Mac OS X 10.8 for some reason. Changed from the highline 'ask' below\n # to the 'print/gets' above.\n #@username = ask(\"Enter your GApps email address: \").strip.downcase if @username == nil\n end\n @password = ask(\"Enter your password: \") { |q| q.echo = \"x\" }\n end", "def authentication\n auth = \"\"\n auth << \"--username #{variable(:scm_username)} \" if variable(:scm_username)\n auth << \"--password #{variable(:scm_password)} \" if variable(:scm_password)\n auth << \"--no-auth-cache\" if !auth.empty?\n auth\n end", "def authorize(auth = {})\n auth[:login] = auth[:login] || auth[:username]\n raise TaskMapper::Exception.new('Please provide at least a username') if auth[:login].blank?\n provider.login = auth[:login]\n provider.user_token = auth[:password] || auth[:oauth_token]\n provider.api = new_github_client auth\n end", "def get_my_pull_requests\n repos_to_get = GITHUB_REPOS.kind_of?( Array ) ? GITHUB_REPOS : get_my_repos\n\n repos_to_get.each do |repo|\n status = []\n pulls_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/pulls?state=open\"\n\n get_json( pulls_url ).each_with_index do |item, index|\n sha = item[ 'head' ][ 'sha' ]\n status_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/commits/#{ sha }/status\"\n\n status << get_json( status_url )\n\n unless item[ 'assignee' ].nil?\n if item[ 'assignee' ][ 'login' ] == ENV[ 'GITHUB_USERNAME' ]\n color = ''\n state = status[ index ][ 'state' ]\n\n unless status[ index ][ 'statuses' ].empty?\n color = \"| color=#{ determine_status_color( state )}\"\n end\n\n puts \"#{ repo }: ##{ item[ 'number' ] } #{ item[ 'title' ] } #{ color } | href=#{ item[ 'html_url' ] }\"\n end\n end\n end\n end\nend", "def grantAccess()\n\t\t\tif File.zero?('lib/data.txt') #if files doesn't exist it then gets the access_tokens\n\t\t\t\t@request_token = @consumer.get_request_token\n\t\t\t\tLaunchy.open(\"#{@request_token.authorize_url}\")\n\t\t\t\tprint \"Enter pin that the page gave you:\" \n\t\t\t\t@pin = STDIN.readline.chomp\n\t\t\t\t@access_token = @request_token.get_access_token(:oauth_verifier => @pin)\n\t\t\t\tputs @access_token.token\n\t\t\t\tFile.open('lib/data.txt','w') do |f|\n\t\t\t\t\tf.puts @access_token.token\n\t\t\t\t\tf.puts @access_token.secret\n\t\t\t\tend\n\t\t\telse #if they exist it simple reads them into token_hash\n\t\t\t\tFile.open('lib/data.txt','r') do |f|\n\t\t\t\t\t@token_hash = { :oauth_token => f.readline.chomp,\n\t\t\t\t\t\t\t\t\t\t\t :oauth_token_secret => f.readline.chomp\n\t\t\t\t\t\t\t\t\t\t \t\t}\n\t\t\t\t\tend\n\t\t\tend\n\t\tend" ]
[ "0.6802039", "0.6618084", "0.6450719", "0.6350213", "0.62897384", "0.61337006", "0.6120754", "0.6043551", "0.60281485", "0.5969612", "0.59672064", "0.5965212", "0.5959407", "0.594398", "0.58749336", "0.5866352", "0.586415", "0.5846172", "0.58066285", "0.5778766", "0.5735763", "0.5709427", "0.56882185", "0.56851804", "0.5684859", "0.56834215", "0.5660027", "0.56418455", "0.56188345", "0.5615162" ]
0.6795407
1
find records in Mongodb that have a comments field value of 1 or higher returns only the number field TODO rebuild in option to not have to call MongoDB and add option to pull issues to get comments from directly from getIssues method
def getIssueComments(issueNumber) # issuesWithComments = @coll.find({"comments" => {"$gt" => 0}}, # {:fields => {"_id" => 0, "number" => 1}} # ).to_a issueComments = @ghClient.issue_comments(@repository.to_s, issueNumber.to_s) issueCommentsRaw = JSON.parse(@ghClient.last_response.body) ghLastReponse = @ghClient.last_response while ghLastReponse.rels.include?(:next) do ghLastReponse = ghLastReponse.rels[:next].get issueCommentsRaw.concat(JSON.parse(ghLastReponse.body)) end issueCommentsRaw.each do |x| x["organizaion"] = @organization x["repo"] = @repository x["downloaded_at"] = Time.now x["issue_number"] = issueNumber self.convertIssueCommentDatesInMongo(x) end return issueCommentsRaw # @coll.update( # { "number" => x["number"]}, # { "$push" => {"comments_Text" => self.convertIssueCommentDatesInMongo(commentDetails)}} # ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end", "def comments\n if has_comments?\n @repository.load(:comments, number).map do |item|\n Github::Issue::Comment.new(item)\n end\n else \n []\n end\n end", "def issue_comments(owner, repo, pr_id)\n Thread.current[:issue_id] ||= pr_id\n\n if pr_id != Thread.current[:issue_id]\n Thread.current[:issue_id] = pr_id\n Thread.current[:issue_cmnt] = nil\n end\n\n Thread.current[:issue_cmnt] ||= Proc.new {\n issue_comments = mongo['issue_comments']\n ic = issue_comments.find(\n {'owner' => owner, 'repo' => repo, 'issue_id' => pr_id.to_i},\n {:fields => {'body' => 1, 'created_at' => 1, '_id' => 0},\n :sort => {'created_at' => :asc}}\n ).map {|x| x}\n\n }.call\n Thread.current[:issue_cmnt]\n end", "def issue_comments(owner, repo, pr_id)\n Thread.current[:issue_id] ||= pr_id\n\n if pr_id != Thread.current[:issue_id]\n Thread.current[:issue_id] = pr_id\n Thread.current[:issue_cmnt] = nil\n end\n\n Thread.current[:issue_cmnt] ||= Proc.new {\n issue_comments = mongo.get_underlying_connection['issue_comments']\n ic = issue_comments.find(\n {'owner' => owner, 'repo' => repo, 'issue_id' => pr_id.to_i},\n {:fields => {'body' => 1, 'created_at' => 1, '_id' => 0},\n :sort => {'created_at' => :asc}}\n ).map {|x| x}\n\n }.call\n Thread.current[:issue_cmnt]\n end", "def processing_comments(opts = {})\n find_collection(\"processingComments\", opts)\n end", "def comments\n Comment.query({item_id: _id}, {sort: [[:created_at, -1]]})\n end", "def list_comments(content,num)\n @comments = Comment.find(:all, :limit => num, :order=> 'created_at asc', :conditions => { :content_id => content} )\n end", "def issue_comments(repo, issue_number, options = {})\n paginate \"#{Repository.path repo}/issues/#{issue_number}/comments\", options\n end", "def _get_comments_from_gh()\n comments = []\n page = 1\n done = false\n until done\n puts \"Comment Page #{page}\"\n newcomments = self.client.issues_comments( REPO, { :page => page} )\n comments += newcomments\n done = newcomments == []\n page = page + 1\n end\n return comments\n end", "def pull_request_comments(repo, number, options = {})\n # return the comments for a pull request\n paginate(\"#{Repository.path repo}/pulls/#{number}/comments\", options)\n end", "def test_ListBugComments\n\t\tcolName = 'comments'\n\t\tretClass = LeanTesting::BugComment\n\t\tresp = rcol(colName, ['_id', 'text', '_owner_id', 'created_at'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = LeanTesting::Bug.new(@client, {'id'=> 0}).comments.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend", "def ensure_issue_comments(owner, repo, issue_id, pull_req_id = nil)\n currepo = ensure_repo(owner, repo)\n\n if currepo.nil?\n warn \"Could not find repository #{owner}/#{repo} for retrieving issue comments for issue #{issue_id}\"\n return\n end\n\n issue = if pull_req_id.nil?\n ensure_issue(owner, repo, issue_id, false, false, false)\n else\n db[:issues].first(:pull_request_id => pull_req_id)\n end\n\n if issue.nil?\n warn \"Could not find issue #{owner}/#{repo} -> #{issue_id} for retrieving issue comments\"\n return\n end\n\n retrieve_issue_comments(owner, repo, issue_id).reduce([]) do |acc, x|\n\n if db[:issue_comments].first(:issue_id => issue[:id],\n :comment_id => x['id']).nil?\n acc << x\n else\n acc\n end\n end.map { |x|\n save{ensure_issue_comment(owner, repo, issue_id, x['id'], pull_req_id)}\n }.select{|x| !x.nil?}\n end", "def limited_bugs offset, number = 10\n if !offset\n offset = 1\n end\n is_successful = search_bugzilla [\"id\",\"assigned_to\",\"component\",\"last_change_time\",\"status\",\"summary\"],number,(offset.to_i-1)*10\n return is_successful if is_successful\n return []\n end", "def get_comments\n return Comment.where(design_problem_id: self.id).sort_by! { |x| x.created_at }.sort! { |a,b| b.created_at <=> a.created_at }\n end", "def comments\n pull_comments\n @comments_list\n end", "def comments\r\n @comments = Comment.active.belonging_to(@entry).paginate(:all,\r\n :order => \"#{Comment.right_column_name} DESC\", \r\n :page => params[:page], :per_page => setpagesize)\r\n end", "def recent_comments\n get_or_make_references('Comment', @data, 'recent_comment_ids')\n end", "def recent_comments\n get_or_make_references('Comment', @data, 'recent_comment_ids')\n end", "def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end", "def num_issue_comments(pr_id)\n q = <<-QUERY\n select count(*) as issue_comment_count\n from pull_requests pr, issue_comments ic, issues i\n where ic.issue_id=i.id\n and i.issue_id=pr.pullreq_id\n and pr.base_repo_id = i.repo_id\n and pr.id = ?\n and ic.created_at < (\n select max(created_at)\n from pull_request_history\n where action = 'closed' and pull_request_id = ?)\n QUERY\n if_empty(db.fetch(q, pr_id, pr_id).all, :issue_comment_count)\n end", "def comments\n Comment.where(:article => @id)\n end", "def comments\n posts.where(:floor.gt => 0)\n end", "def comments\n @mapped_comments ||= Basecamp3::Comment.all(bucket.id, id)\n end", "def num_issue_comments(pr)\n q = <<-QUERY\n select count(*) as issue_comment_count\n from pull_requests pr, issue_comments ic, issues i\n where ic.issue_id=i.id\n and i.issue_id=pr.pullreq_id\n and pr.base_repo_id = i.repo_id\n and pr.id = ?\n and ic.created_at < (\n select max(created_at)\n from pull_request_history\n where action = 'closed' and pull_request_id = ?)\n QUERY\n db.fetch(q, pr[:id], pr[:id]).first[:issue_comment_count]\n end", "def comments\n @uni_module = UniModule.find(params[:id])\n @comments = @uni_module.comments\n \n if params[:per_page].present? && params[:per_page].to_i > 0\n @per_page = params[:per_page].to_i\n else\n @per_page = 20\n end\n\n if params[:sortby].present? && params[:order].present? \n @sort_by = params[:sortby]\n @order = params[:order]\n @comments = sort(Comment, @comments, @sort_by, @order, @per_page, \"created_at\")\n @comments = Kaminari.paginate_array(@comments).page(params[:page]).per(@per_page)\n\n\n else\n @comments = @comments.order('created_at ASC').page(params[:page]).per(@per_page)\n end\n\n\n end", "def regular_comments\n Comment.find(:all, :order => \"created_at DESC\", :conditions => [\"commentable_id = ? AND commentable_type = ? AND comment_type < ?\", id, 'Screen', 5])\n end", "def comments\n client.get(\"/#{id}/comments\")\n end", "def num_comments(pr_id)\n q = <<-QUERY\n select count(*) as comment_count\n from pull_request_comments prc\n where prc.pull_request_id = ?\n and prc.created_at < (\n select max(created_at)\n from pull_request_history\n where action = 'closed' and pull_request_id = ?)\n QUERY\n if_empty(db.fetch(q, pr_id, pr_id).all, :comment_count)\n end", "def review_comments(repo, pull_number, options = {})\n paginate \"#{Repository.path repo}/pulls/#{pull_number}/comments\", options\n end", "def test_getting_collection_numbers\n params = { method: :get, action: :collection_number }\n\n nums = CollectionNumber.where(CollectionNumber[:created_at].year == 2006)\n assert_not_empty(nums)\n assert_api_pass(params.merge(created_at: \"2006\"))\n assert_api_results(nums)\n\n nums = CollectionNumber.where(CollectionNumber[:updated_at].year == 2005)\n assert_not_empty(nums)\n assert_api_pass(params.merge(updated_at: \"2005\"))\n assert_api_results(nums)\n\n nums = CollectionNumber.where(user: mary)\n assert_not_empty(nums)\n assert_api_pass(params.merge(user: \"mary\"))\n assert_api_results(nums)\n\n obs = observations(:detailed_unknown_obs)\n nums = obs.collection_numbers\n assert_not_empty(nums)\n assert_api_pass(params.merge(observation: obs.id))\n assert_api_results(nums)\n\n nums = CollectionNumber.where(name: \"Mary Newbie\")\n assert_not_empty(nums)\n assert_api_pass(params.merge(collector: \"Mary Newbie\"))\n assert_api_results(nums)\n\n nums = CollectionNumber.where(CollectionNumber[:name].matches(\"%mary%\"))\n assert_not_empty(nums)\n assert_api_pass(params.merge(collector_has: \"Mary\"))\n assert_api_results(nums)\n\n nums = CollectionNumber.where(number: \"174\")\n assert_not_empty(nums)\n assert_api_pass(params.merge(number: \"174\"))\n assert_api_results(nums)\n\n # nums = CollectionNumber.where(\"number LIKE '%17%'\")\n nums = CollectionNumber.where(CollectionNumber[:number].matches(\"%17%\"))\n assert_not_empty(nums)\n assert_api_pass(params.merge(number_has: \"17\"))\n assert_api_results(nums)\n end" ]
[ "0.6537961", "0.64506286", "0.6416352", "0.63914245", "0.6138587", "0.61315155", "0.5979445", "0.59729105", "0.58830315", "0.5882186", "0.5844262", "0.57901627", "0.5784754", "0.5707286", "0.56933165", "0.5681097", "0.5642766", "0.5642766", "0.56352895", "0.5628732", "0.5627467", "0.5609276", "0.56064546", "0.56031406", "0.5589327", "0.55861825", "0.558155", "0.5570534", "0.5547107", "0.55317837" ]
0.7093299
0
TODO Setup so it will get all repo events since the last time a request was made
def getRepositoryEvents respositoryEvents = @ghClient.repository_events(@repository.to_s) respositoryEventsRaw = JSON.parse(@ghClient.last_response.body) ghLastReponse = @ghClient.last_response while ghLastReponse.rels.include?(:next) do ghLastReponse = ghLastReponse.rels[:next].get respositoryEventsRaw.concat(JSON.parse(ghLastReponse.body)) end # Debug Code # puts "Got Repository Events, GitHub rate limit remaining: " + @ghClient.rate_limit.remaining.to_s if respositoryEventsRaw.empty? == false respositoryEventsRaw.each do |y| y["organization"] = @organization y["repo"] = @repository y["downloaded_at"] = Time.now yDatesFixed = self.convertRepoEventsDates(y) self.putIntoMongoCollRepoEvents(yDatesFixed) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repository_events(repo, options={})\n get(\"/repos/#{Repository.new(repo)}/events\", options, 3)\n end", "def watched_repos\n super\n end", "def recent_commits\n public_events = @client.user_public_events @user[:login]\n public_events.select! { |e| e[:type] == \"PushEvent\" }\n commits = []\n public_events.each do |e|\n e[:payload][:commits].each do |c|\n c[:html_url] = \"https://github.com/#{e[:repo][:name]}/commit/#{c[:sha]}\"\n c[:shortcut] = \"#{e[:repo][:name]}@#{c[:sha][0..7]}\"\n end\n commits.concat e[:payload][:commits]\n end\n commits.take 15\nend", "def getIssueEvents (issueNumber)\n\n\t\t# issueNumbers = @coll.aggregate([\n\t\t# \t\t\t\t\t\t\t\t{ \"$project\" => {number: 1}},\n\t\t# \t\t\t\t\t\t\t\t{ \"$group\" => {_id: {number: \"$number\"}}},\n\t\t# \t\t\t\t\t\t\t\t{ \"$sort\" => {\"_id.number\" => 1}}\n\t\t# \t\t\t\t\t\t\t\t])\n\t\tissueEvents = @ghClient.issue_events(@repository, issueNumber)\n\t\tissueEventsRaw = JSON.parse(@ghClient.last_response.body)\n\n\t\tghLastReponse = @ghClient.last_response\n\n\t\twhile ghLastReponse.rels.include?(:next) do\n\t\t\tghLastReponse = ghLastReponse.rels[:next].get\n\t\t\tissueEventsRaw.concat(JSON.parse(ghLastReponse.body))\n\t\tend\n\n\t\tif issueEventsRaw.empty? == false\n\t\t\t# Adds Repo and Issue number information into the hash of each event so multiple Repos can be stored in the same DB.\n\t\t\t# This was done becauase Issue Events do not have Issue number and Repo information.\n\t\t\tissueEventsRaw.each do |y|\n\t\t\t\ty[\"organization\"] = @organization\n\t\t\t\ty[\"repo\"] = @repository\n\t\t\t\ty[\"issue_number\"] = issueNumber\n\t\t\t\ty[\"downloaded_at\"] = Time.now\n\t\t\t\tyCorrectedDates = self.convertIssueEventsDates(y)\n\t\t\t\tself.putIntoMongoCollRepoIssuesEvents(yCorrectedDates)\n\t\t\tend\n\t\tend\n\n\t\t# Debug Code\n\t\t# puts \"Got Repository Issue Events, GitHub rate limit remaining: \" + @ghClient.rate_limit.remaining.to_s\n\tend", "def get_watched_repos\n @repos.each do |r|\n if r.name.downcase == 'txtout'\n @watched.store('txtout', r.id)\n end\n if r.name.downcase == 'resumemonster'\n @watched.store('resumemonster', r.id)\n end\n end\n end", "def retrieve(exchange)\n begin\n new = dupl = 0\n events = api_request \"https://api.github.com/events?per_page=100\"\n (new, dupl, stored) = store_count events\n\n # This means that the first page does not contain all new events. Do\n # a paged request and get everything on the queue\n if dupl == 0\n events = paged_api_request \"https://api.github.com/events?per_page=100\"\n (new1, dupl1, stored1) = store_count events\n stored = stored | stored1\n new = new + new1\n end\n\n stored.each do |e|\n repo = e['repo']['name'].gsub('/',' ')\n key = \"evt.#{e['type']}\"\n if @options[:projects_given]\n exchange.publish repo, :persistent => true, :routing_key => GHTorrent::ROUTEKEY_PROJECTS\n debug \"Published update to project #{repo}\"\n if @events_requeue.include? e['type']\n exchange.publish e['id'], :persistent => true, :routing_key => key\n end\n else\n exchange.publish e['id'], :persistent => true, :routing_key => key\n end\n end\n\n return new, dupl\n rescue StandardError => e\n STDERR.puts e.message\n STDERR.puts e.backtrace\n end\n end", "def 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 event_processing\n Github::Client.initialize(request)\n end", "def audit_repo(name)\n git = Git.open('.')\n\n @listener.repo_fetching_latest_changes\n git.fetch\n\n ranges = repo_agent.repo_pull_request_ranges(name)\n\n commits_with_pr = ranges.inject(Set.new) do |set, range|\n set.merge(commits_in_range(git, range))\n end\n\n # Passing `nil` to `log` to ensure all commits are returned.\n commits_without_pr = git.log(nil)\n .select {|commit| commit.parents.size == 1 && !commits_with_pr.include?(commit.sha) }\n .map {|commit| commit.sha }\n\n if commits_without_pr.empty?\n @listener.repo_audit_passed(name)\n else\n @listener.commits_without_pull_requests(name, commits_without_pr)\n end\n end", "def event\n request.env[\"HTTP_X_GITHUB_EVENT\"]\n end", "def index\n @github_events_by_date ||= begin\n if user_signed_in?\n Github::Event.user_events_by_day current_user_github_access_token,\n current_user_github_username\n else\n []\n end\n end\n end", "def commits\n event_hash = GithubService.new(self).event_info\n event_hash.each_with_object(Hash.new(0)) do |event, hash|\n if event[:type] == \"PushEvent\" || event[:type] == \"CreateEvent\"\n hash[event[:repo][:name]] += 1\n end\n end\n end", "def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end", "def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end", "def events\r\n load_private_events\r\n load_completed_private_events\r\n end", "def org_events\n @org_events ||= orgs.map { |o| o.events }.flatten\n end", "def repository_events(repo, options = {})\n paginate \"#{Repository.path repo}/events\", options\n end", "def recent_commits\n\n return \"\" if !installation_selected?\n\n installation_id = session[:selected_installation]\n # installation_token = get_app_token(installation_id)\n\n @client = Octokit::Client.new(:access_token => session[:access_token])\n response = @client.find_installation_repositories_for_user(installation_id)\n\n commits = response[:repositories]\n commits.take 15\nend", "def log_event( repo_object )\n repo_object.log_event( event ) if repo_object.respond_to? :log_event\n end", "def events\n event_lookup()\n end", "def events\n event_lookup()\n end", "def find_commits(repos=@repo_array)\n repos.each do |repo|\n commit_list = @github.repos.commits.list user: @user_name, repo: repo\n @repos_and_commits[repo] = commit_list.body.to_s.scan(/message=\"([^\"]*)\"/)\n sleep @delay\n end\n end", "def watched_repos\n @repos ||= get(\"/repos/watched/#{login}\")['repositories'].map { |r| Repo.new(connection, r) }\n end", "def check_new_noti\n Settings.Repos.each do |repo|\n notis = @git_client.repository_events(repo.url)\n next if notis.empty?\n\n puts \"New Notification in #{repo.display_name}\"\n\n notis.each do |noti|\n event = launcher.git_client.get(noti.subject.latest_comment_url)\n next unless noti.subject.type == \"PullRequest\"\n message = @message_generator.noti2message repo, noti, event\n ChatWork::Message.create(room_id: repo.chatwork_box, body: message)\n end\n\n launcher.git_client.mark_repo_notifications_as_read(repo.url) if repo.auto_read\n end\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def events_for target, event_types\n url = GITHUB_EVENT_API_END_POINT % target\n etag = @etag_hash[target]\n last_event = @last_event_hash[target]\n\n events_to_send = []\n page = 1\n while page <= 10\n result = @clnt.get(url, {client_id: @client_id, client_secret: @client_secret}, {\"If-None-Match\" => etag})\n break unless result.status_code == 200\n events = JSON.load result.body\n if page == 1 # etag and last event should be set when querying the very first page\n @etag_hash[target] = result.header[\"etag\"]\n @last_event_hash[target] = events[0]\n end\n\n events.each do |event|\n return events_to_send if last_event == event # no need to proceed\n events_to_send << event if event_types.accept? event\n end\n\n page += 1\n end\n\n events_to_send\n end", "def get_commits\n raise \"can't get a repo without the repo's full_name (eg. 'fubar/ofxTrickyTrick')\" unless full_name\n\n begin\n response = GithubApi::repository_commits(full_name: full_name)\n rescue => ex\n Rails.logger.debug \"Failed to get recent commit: #{ex.message} (#{ex.class})\"\n return\n end\n\n unless response.success?\n Rails.logger.debug response.inspect.to_s.red\n return\n\tend\n\n @repo_commits_json = response.parsed_response\n end", "def get_my_pull_requests\n repos_to_get = GITHUB_REPOS.kind_of?( Array ) ? GITHUB_REPOS : get_my_repos\n\n repos_to_get.each do |repo|\n status = []\n pulls_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/pulls?state=open\"\n\n get_json( pulls_url ).each_with_index do |item, index|\n sha = item[ 'head' ][ 'sha' ]\n status_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/commits/#{ sha }/status\"\n\n status << get_json( status_url )\n\n unless item[ 'assignee' ].nil?\n if item[ 'assignee' ][ 'login' ] == ENV[ 'GITHUB_USERNAME' ]\n color = ''\n state = status[ index ][ 'state' ]\n\n unless status[ index ][ 'statuses' ].empty?\n color = \"| color=#{ determine_status_color( state )}\"\n end\n\n puts \"#{ repo }: ##{ item[ 'number' ] } #{ item[ 'title' ] } #{ color } | href=#{ item[ 'html_url' ] }\"\n end\n end\n end\n end\nend", "def parse_repo\n if raw_event.has_key?('repository')\n @repo = parse_field('repository', %w{id url name})\n else\n @repo = parse_field('repo', %w{id url name})\n end\n end", "def current_requests_full(repo=source_repo)\n @github.pull_requests(repo).collect { |request|\n @github.pull_request(repo, request.number)\n }\n end" ]
[ "0.6865734", "0.65944004", "0.65899485", "0.6390656", "0.6313105", "0.6294419", "0.6155147", "0.6131523", "0.6127501", "0.60734886", "0.6064072", "0.60636777", "0.6037365", "0.5976474", "0.59476423", "0.59083146", "0.57867354", "0.5784179", "0.5758835", "0.56995386", "0.56995386", "0.5683973", "0.56828535", "0.5677853", "0.5667578", "0.56493986", "0.5647935", "0.56459326", "0.56260365", "0.559825" ]
0.7631854
0
TODO Setup so will get issues events since the last time they were downloaded TODO Consider adding Issue Events directly into the Issue Object in Mongo
def getIssueEvents (issueNumber) # issueNumbers = @coll.aggregate([ # { "$project" => {number: 1}}, # { "$group" => {_id: {number: "$number"}}}, # { "$sort" => {"_id.number" => 1}} # ]) issueEvents = @ghClient.issue_events(@repository, issueNumber) issueEventsRaw = JSON.parse(@ghClient.last_response.body) ghLastReponse = @ghClient.last_response while ghLastReponse.rels.include?(:next) do ghLastReponse = ghLastReponse.rels[:next].get issueEventsRaw.concat(JSON.parse(ghLastReponse.body)) end if issueEventsRaw.empty? == false # Adds Repo and Issue number information into the hash of each event so multiple Repos can be stored in the same DB. # This was done becauase Issue Events do not have Issue number and Repo information. issueEventsRaw.each do |y| y["organization"] = @organization y["repo"] = @repository y["issue_number"] = issueNumber y["downloaded_at"] = Time.now yCorrectedDates = self.convertIssueEventsDates(y) self.putIntoMongoCollRepoIssuesEvents(yCorrectedDates) end end # Debug Code # puts "Got Repository Issue Events, GitHub rate limit remaining: " + @ghClient.rate_limit.remaining.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_issue_events(owner, repo, issue_id)\n currepo = ensure_repo(owner, repo)\n\n if currepo.nil?\n warn \"Could not find repository #{owner}/#{repo} for retrieving events for issue #{issue_id}\"\n return\n end\n\n issue = ensure_issue(owner, repo, issue_id, false, false, false)\n if issue.nil?\n warn \"Could not find issue #{owner}/#{repo} -> #{issue_id} for retrieving events\"\n return\n end\n\n retrieve_issue_events(owner, repo, issue_id).reduce([]) do |acc, x|\n\n if db[:issue_events].first(:issue_id => issue[:id],\n :event_id => x['id']).nil?\n acc << x\n else\n acc\n end\n end.map { |x|\n save{ensure_issue_event(owner, repo, issue_id, x['id'])}\n }.select{|x| !x.nil?}\n end", "def getRepositoryEvents\n\t\trespositoryEvents = @ghClient.repository_events(@repository.to_s)\n\t\trespositoryEventsRaw = JSON.parse(@ghClient.last_response.body)\n\n\t\tghLastReponse = @ghClient.last_response\n\n\t\twhile ghLastReponse.rels.include?(:next) do\n\t\t\tghLastReponse = ghLastReponse.rels[:next].get\n\t\t\trespositoryEventsRaw.concat(JSON.parse(ghLastReponse.body))\n\t\tend\n\n\t\t# Debug Code\n\t\t# puts \"Got Repository Events, GitHub rate limit remaining: \" + @ghClient.rate_limit.remaining.to_s\n\n\t\tif respositoryEventsRaw.empty? == false\n\t\t\trespositoryEventsRaw.each do |y|\n\t\t\t\ty[\"organization\"] = @organization\n\t\t\t\ty[\"repo\"] = @repository\n\t\t\t\ty[\"downloaded_at\"] = Time.now\n\t\t\t\tyDatesFixed = self.convertRepoEventsDates(y)\n\t\t\t\tself.putIntoMongoCollRepoEvents(yDatesFixed)\n\t\t\tend\n\t\tend\n\tend", "def fetch_issues()\n\n # fetch last created date\n last_creation = @kv.get(@last_creation_k) # || \"2015-05-11T16:37:21Z\"\n\n # request Redmine issues\n issues = @redmine_api.issues(created_on: \">=#{last_creation}\", limit:200, sort:\"created_on\")['issues']\n puts issues if self.verbose\n \n # filter issues to include only certain projects, avoid certain users, avoid self tickets\n issues = issues.select do |issue|\n Utils.project_whitelisted? issue and Utils.user_not_blacklisted? issue and not Utils.ticket_to_self? issue\n end\n\n # no issues\n if issues.empty?\n puts \"#{Utils.human_timestamp} No new issues since #{last_creation}.\"\n return\n end\n\n # post issues\n issues.each do |issue|\n post_issue(issue)\n end\n\n # store the created data of the last ticket + 1 second\n last_creation = issues.last[\"created_on\"]\n last_creation_plus = (Time.parse(last_creation)+1).iso8601\n @kv.put(@last_creation_k, last_creation_plus)\n \n puts \"#{Utils.human_timestamp}: Posted #{issues.length} issues. Last created #{@kv.get(@last_creation_k)}\"\n\n end", "def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end", "def repository_issue_events(repo, options = {})\n paginate \"#{Repository.path repo}/issues/events\", options\n end", "def issues\n if @issues.nil?\n @issues = {}\n max_result = 3\n jql = \"/rest/api/2/search?jql=project=\\\"#{name}\\\" AND issuetype NOT IN (Epic, Sub-task)&expand=changelog&maxResults=#{max_result}\"\n #r = nil\n #without_cache{ r = self.class.get(\"#{jql}&startAt=0\") }\n r = self.class.get(\"#{jql}&startAt=0\")\n pages = (r['total'] / max_result)\n (0..pages).each do |current_page|\n begin\n # If you can get the latest version of the last page, do so, otherwise load the cached version\n query = \"#{jql}&startAt=#{(current_page * max_result)}\"\n if current_page == pages\n #without_cache{ r = self.class.get(query) }\n # else\n r = self.class.get(query)\n end\n r['issues'].each do |issue|\n # Cast raw response to Issue(), passing project reference into constructor\n issue['project'] = self\n @issues[issue['key']] = Issue.new(issue)\n end\n # rescue => exception\n # puts \"#{exception.message} (#{exception.class})\"\n # pp exception.backtrace\n end\n end\n end\n @issues\n end", "def latest_event(&blk)\n latest_event = nil\n page = 1\n count = 100\n loop do\n events = @client.issue_events(@issue.number, per_page: count, page: page)\n matching_events = events.select(&blk)\n latest_event = matching_events.last unless matching_events.empty?\n page += 1\n break if events.length < count\n end\n latest_event\n end", "def fetch\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_time, \"tags\" => \"miq.event_type|*\", \"thin\" => true)\n @start_time = new_events.max_by(&:ctime).ctime + 1 unless new_events.empty? # add 1 ms to avoid dups with GTE filter\n new_events\n rescue => err\n $mw_log.info \"Error capturing events #{err}\"\n []\n end", "def prior_interaction_issue_events(pr, months_back)\n q = <<-QUERY\n select count(distinct(i.id)) as num_issue_events\n from issue_events ie, pull_request_history prh, pull_requests pr, issues i\n where ie.actor_id = prh.actor_id\n and i.repo_id = pr.base_repo_id\n and i.id = ie.issue_id\n and prh.pull_request_id = pr.id\n and prh.action = 'opened'\n and ie.created_at > DATE_SUB(prh.created_at, INTERVAL #{months_back} MONTH)\n and ie.created_at < prh.created_at\n and prh.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:num_issue_events]\n end", "def run_events_for_issue_changelog\n webhook.parsed_body[\"changelog\"][\"items\"].each do |item|\n run_event_for_issue_changelog_item(item)\n end\n end", "def fetch_events_async(issues)\n i = 0\n threads = []\n\n issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice|\n issues_slice.each do |issue|\n threads << Thread.new do\n issue[\"events\"] = []\n iterate_pages(@client, \"issue_events\", issue[\"number\"]) do |new_event|\n issue[\"events\"].concat(new_event)\n end\n issue[\"events\"] = issue[\"events\"].map { |event| stringify_keys_deep(event.to_hash) }\n print_in_same_line(\"Fetching events for issues and PR: #{i + 1}/#{issues.count}\")\n i += 1\n end\n end\n threads.each(&:join)\n threads = []\n end\n\n # to clear line from prev print\n print_empty_line\n\n Helper.log.info \"Fetching events for issues and PR: #{i}\"\n end", "def repository_events(repo, options={})\n get(\"/repos/#{Repository.new(repo)}/events\", options, 3)\n end", "def issue_events(repo, number, options = {})\n options = ensure_api_media_type(:project_card_events, options)\n paginate \"#{Repository.path repo}/issues/#{number}/events\", options\n end", "def ensure_issue_event(owner, repo, issue_id, event_id)\n issue = ensure_issue(owner, repo, issue_id, false, false, false)\n\n if issue.nil?\n warn \"Could not find issue #{owner}/#{repo} -> #{issue_id} for retrieving event #{event_id}\"\n return\n end\n\n issue_event_str = \"#{owner}/#{repo} -> #{issue_id}/#{event_id}\"\n\n curevent = db[:issue_events].first(:issue_id => issue[:id],\n :event_id => event_id)\n if curevent.nil?\n\n retrieved = retrieve_issue_event(owner, repo, issue_id, event_id)\n\n if retrieved.nil?\n warn \"Could not retrieve issue_event #{owner}/#{repo} -> #{issue_id}/#{issue_event_str}\"\n return\n elsif retrieved['actor'].nil?\n warn \"Could not find issue_event_actor #{owner}/#{repo} -> #{issue_id}/#{issue_event_str}\"\n return\n end\n\n actor = ensure_user(retrieved['actor']['login'], false, false)\n\n action_specific = case retrieved['event']\n when \"referenced\" then retrieved['commit_id']\n when \"merged\" then retrieved['commit_id']\n when \"closed\" then retrieved['commit_id']\n else nil\n end\n\n if retrieved['event'] == 'assigned'\n\n def update_assignee(owner, repo, issue, actor)\n db[:issues].first(:id => issue[:id]).update(:assignee_id => actor[:id])\n info \"Updated #{owner}/#{repo} -> #{issue[:id]}, assignee -> #{actor[:id]}\"\n end\n\n if issue[:assignee_id].nil? then\n update_assignee(owner, repo, issue, actor)\n else\n existing = db[:issue_events].\\\n filter(:issue_id => issue[:id],:action => 'assigned').\\\n order(Sequel.desc(:created_at)).first\n if existing.nil?\n update_assignee(owner, repo, issue, actor)\n elsif date(existing[:created_at]) < date(retrieved['created_at'])\n update_assignee(owner, repo, issue, actor)\n end\n end\n end\n\n db[:issue_events].insert(\n :event_id => event_id,\n :issue_id => issue[:id],\n :actor_id => unless actor.nil? then actor[:id] end,\n :action => retrieved['event'],\n :action_specific => action_specific,\n :created_at => date(retrieved['created_at']))\n\n info \"Added issue_event #{owner}/#{repo} -> #{issue_id}/#{issue_event_str}\"\n db[:issue_events].first(:issue_id => issue[:id],\n :event_id => event_id)\n else\n debug \"Issue event #{owner}/#{repo} -> #{issue_id}/#{issue_event_str} exists\"\n curevent\n end\n end", "def issues\n Sifter.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Sifter::Issue.new(i) }\n end", "def events\n collection(\"events\")\n end", "def fetch_events(type_identifier, aggregate_id, first_sequence_number)\n filter = {\n aggregate_id: aggregate_id,\n aggregate_type: type_identifier,\n sequence_number: {\n '$gte' => first_sequence_number\n }\n }\n\n sort = {\n sequence_number: ASCENDING\n }\n\n @template.event_collection.find(filter).sort(sort)\n end", "def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end", "def issues\n return @issues\n end", "def actual_issues\n @actual_issues ||= issues.select { |i| i[:pull_request].nil? }\n end", "def get_file_events(gf_pid, obj_identifier)\n query = \"select intellectual_object_id, institution_id, \" +\n \"identifier, event_type, date_time, detail, \" +\n \"outcome, outcome_detail, outcome_information, \" +\n \"object, agent, generic_file_id, generic_file_identifier \" +\n \"from premis_events_solr where generic_file_id = ?\"\n if @file_events_query.nil?\n @file_events_query = @db.prepare(query)\n end\n result_set = @file_events_query.execute(gf_pid)\n events = []\n result_set.each_hash do |row|\n events.push(get_event(row, obj_identifier))\n end\n events\n end", "def prev\n Issue.find(:first, :conditions => ['date < ?', date], :order => 'date DESC')\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def issues\n @_issues ||= item.active_issues.includes(translation: { key: [{ section: { article: :project } }, :project] }).order_default\n end", "def events\n @events ||= event_finder\n end", "def issues\n dashboard = fetch_email_dashboard\n respond_with Emails.new(dashboard.issues, issues_emails_url)\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end", "def issues\n @issues ||= @commit.issues.includes(translation: { key: :project }).order_default\n end", "def org_events\n @org_events ||= orgs.map { |o| o.events }.flatten\n end" ]
[ "0.6661183", "0.6364875", "0.62115735", "0.60032505", "0.59893435", "0.59884876", "0.58697295", "0.5862619", "0.5765426", "0.57641536", "0.5713394", "0.56885344", "0.5673847", "0.56736976", "0.56702024", "0.5660209", "0.5640432", "0.5630753", "0.5573927", "0.5508966", "0.5505734", "0.54733396", "0.54552525", "0.5453612", "0.5445663", "0.54253536", "0.54136413", "0.5411987", "0.54101825", "0.540879" ]
0.76675373
0
Get list of time logs for the project. ==== Parameters projectId:: ID 0f the project. queryMap:: This queryMap contains the filters in the form of keyvalue pair. ==== Returns TimelogList object.
def getTimeLogs(projectId, queryMap) url = getBaseURL+"projects/"+String(projectId)+"/logs/" response = ZohoHTTPClient.get(url, getQueryMap(queryMap)) return $timesheetParser.getTimeLogs(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_logs(user_id:, queries: nil)\n path = '/users/{userId}/logs'\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 queries: queries,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::LogList\n )\n end", "def time_log_entries(user_id, started_at, stopped_at, project_id)\n result = TimeLogEntry::Flex.by_user(user_id)\n if started_at.present? && stopped_at.present?\n result = result.after_stopped_at(started_at.sub(' ', 'T'))\n result = result.before_started_at(stopped_at.sub(' ', 'T'))\n end\n result = result.by_project(project_id) if project_id.present?\n result.map{ |found_element| found_element['_source'] }\n end", "def get_time_entries(xero_tenant_id, project_id, opts = {})\n data, _status_code, _headers = get_time_entries_with_http_info(xero_tenant_id, project_id, opts)\n data\n end", "def get_time_entries_with_http_info(xero_tenant_id, project_id, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.get_time_entries ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling ProjectApi.get_time_entries\"\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ProjectApi.get_time_entries\"\n end\n # resource path\n local_var_path = '/Projects/{projectId}/Time'.sub('{' + 'projectId' + '}', project_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'taskId'] = opts[:'task_id'] if !opts[:'task_id'].nil?\n query_params[:'invoiceId'] = opts[:'invoice_id'] if !opts[:'invoice_id'].nil?\n query_params[:'contactId'] = opts[:'contact_id'] if !opts[:'contact_id'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'states'] = @api_client.build_collection_param(opts[:'states'], :multi) if !opts[:'states'].nil?\n query_params[:'isChargeable'] = opts[:'is_chargeable'] if !opts[:'is_chargeable'].nil?\n query_params[:'dateAfterUtc'] = opts[:'date_after_utc'] if !opts[:'date_after_utc'].nil?\n query_params[:'dateBeforeUtc'] = opts[:'date_before_utc'] if !opts[:'date_before_utc'].nil?\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TimeEntries' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, \"ProjectApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#get_time_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @timelogs = Timelog.all\n end", "def getTimeLogs(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\ttimeLogs_array = timeLogs_json[\"timelogs\"]\r\n\t\t\t\treturn jsonToTimelogList(timeLogs_array)\r\n\t\t\tend", "def add(task_id, params = {})\n wrike.execute(:get, api_url(\"tasks/#{task_id}/timelogs\"), params)\n end", "def list(options={})\n Mailgun.submit(:get, log_url, options)\n end", "def workLogs(username=@username, dateFrom=nil, dateTo=nil, project=nil)\n q = {:username => username}\n q[:dateFrom] = DateTime.parse(dateFrom).to_date.iso8601 unless dateFrom.nil?\n q[:dateTo] = DateTime.parse(dateTo).to_date.iso8601 unless dateTo.nil?\n q[:projectKey] = project unless project.nil?\n #q[:accountKey]\n #q[:teamId]\n\n verbose \"Fetching worklogs for #{q}\"\n get('worklogs', q)\n end", "def time_entries(options = {})\n entries = []\n time_invested(options).groups.each { |g| entries << g[\"time_entries\"] }\n\n process_list_response( entries.flatten , Unfuddled::TimeEntry )\n end", "def index\n unless logged_in?\n require_user\n return\n end\n\n @duration = @project.duration\n @times = @project.project_times.order(:date_time)\n end", "def addTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def index\n @logs ||= Log.where(device_id: selected_device).order(created_at: :desc)\n unless params[:start_time].blank?\n start_date = DateTime.parse(\"#{params[:start_time]} 00:00:00\")\n @logs = @logs.where(\"created_at >= :start_time\", {start_time: start_date})\n end\n\n unless params[:end_time].blank?\n end_date = DateTime.parse(\"#{params[:end_time]} 23:59:59\")\n @logs = @logs.where(\"created_at <= :end_time\", {end_time: end_date})\n end\n end", "def logs(options = {})\n request_params = {\n q: options.fetch(:q, nil),\n page: options.fetch(:page, nil),\n per_page: options.fetch(:per_page, nil),\n sort: options.fetch(:sort, nil),\n fields: options.fetch(:fields, nil),\n include_fields: options.fetch(:include_fields, nil),\n include_totals: options.fetch(:include_totals, nil),\n from: options.fetch(:from, nil),\n take: options.fetch(:take, nil)\n }\n if request_params[:take].to_i > 100\n raise Auth0::InvalidParameter, 'The total amount of entries to retrieve should be less than 100'\n end\n if request_params[:per_page].to_i > 100\n raise Auth0::InvalidParameter, 'The total amount of entries per page should be less than 100'\n end\n get(logs_path, request_params)\n end", "def projects_tracked\n timings = Timing.for_period_of_time(self.id, 1.month.ago, Time.now)\n if timings.present?\n timings.map(&:project_id).uniq\n else\n []\n end\n end", "def index\n parse_conditions\n\n @time_records = []\n\n if @user\n @project_time_record_grid = initialize_grid(TimeRecord.where(user_id: @user.id, type: TimeRecord.name).group(:project_id))\n @time_records = TimeRecord.where(@conditions.merge(type: TimeRecord.name))\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_records.to_json }\n end\n end", "def find_log_ids(query=nil, limit=nil)\n log_ids = []\n cursor = nil\n begin\n args = {}\n args[:q] = query if query\n args[:l] = limit if limit\n args[:c] = cursor if cursor\n\n result = service.get \"logs\", args\n cursor = result[:cursor]\n log_ids += result[:ids]\n limit -= log_ids.length if limit\n end while !cursor.nil? and (limit.nil? or limit > 0)\n log_ids\n end", "def list_log_gcp_pubsub(opts = {})\n data, _status_code, _headers = list_log_gcp_pubsub_with_http_info(opts)\n data\n end", "def get_logs(opt={})\n opt[:from] ||= Date.today\n #opt[:to] ||= Date.today - 1\n opt[:parse] = opt[:parse].nil? ? true : opt[:parse]\n \n #raise \":from date must preceed :to date.\" if opt[:to] && opt[:to] < opt[:from]\n \n uri_str = \"#{API_URL}/GetDailyReportLogs/#{options[:site]}?#{self.generate_authorization_token}\"\n uri_str << \"&StartDate=#{opt[:from]}\"\n uri_str << \"&EndDate=#{opt[:to]}\" if opt[:to]\n url = URI.parse uri_str\n \n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n resp = http.start {\n request = Net::HTTP::Get.new(url.to_s)\n response = http.request(request)\n response.body\n }\n if resp =~ /No.*?log data found/\n return opt[:parse] ? [] : resp\n end\n \n return opt[:parse] ? Log.parse(resp) : resp\n end", "def response_time_entries\n response_time_entries_raw = wrapper(@user).time_entries(1, harvest_project_id)\n\n # Getting the number of pages of the paginated response from projects API\n number_of_pages = response_time_entries_raw['total_pages']\n\n response_time_entries_per_project = []\n\n if number_of_pages == 1\n response_time_entries_per_project = response_time_entries_raw.dig('time_entries')\n else\n # for loop to loop through all the pages and fetch all and put into the variable response_time_entries_per_project\n\n (1..number_of_pages).each do |i|\n time_entries_raw = wrapper(@user).time_entries(i, harvest_project_id)\n\n next_array = time_entries_raw['time_entries']\n\n # add projects array to complete array\n response_time_entries_per_project += next_array\n end\n\n end\n response_time_entries_per_project\n end", "def get_all_logs(date_range_start, date_range_end, search = '', log_level = '',\n logger_assembly = '', user_id = 0, message_group_id = 0,\n include_traces = nil, org_unit_id = 0, bookmark = '')\n path = \"/d2l/api/lp/#{$lp_ver}/logging/\"\n path += \"?dateRangeStart=#{date_range_start}\"\n path += \"&dateRangeEnd=#{date_range_end}\"\n path += \"&search=#{search}\" if search != ''\n path += \"&logLevel=#{log_level}\" if log_level != ''\n path += \"&loggerAssembly=#{logger_assembly}\" if logger_assembly != ''\n path += \"&userId=#{user_id}\" if user_id != 0\n path += \"&messageGroupId=#{message_group_id}\" if message_group_id != 0\n path += \"&includeTraces=#{include_traces}\" unless include_traces.nil?\n path += \"&orgUnitId=#{org_unit_id}\" if org_unit_id != 0\n path += \"&bookmark=#{bookmark}\" if bookmark != ''\n ap path\n _get(path)\n # returns paged result set of Message data blocks\nend", "def get_time_entries(start_date=nil, end_date=nil)\n options = Hash.new\n options[\"start_date\"] = iso8601_date(start_date) if start_date\n options[\"end_date\"] = iso8601_date(end_date) if end_date\n get \"/time_entries\", options\n end", "def entries\n settings.time_entries.present? ? settings.time_entries : []\n end", "def all(options={})\n results = []\n current_time = Time.now\n key = \"#{current_time.year}/#{current_time.month}/#{current_time.day}/#{current_time.hour}\"\n case options[:order]\n when \"application\"\n column_family = :logs_by_application\n when \"machine\"\n column_family = :logs_by_machine\n else\n return current_epoch(options)\n end\n options.delete(:order)\n @@data_store.get(column_family, key, options).each do |log_entry|\n uuid = log_entry[1].keys.first.to_guid\n attributes = @@data_store.get(:logs, key, uuid)\n attributes[\"uuid\"] = uuid\n results << new(attributes)\n end\n results\n end", "def where(options={})\n results = []\n current_time = Time.now\n key = \"#{current_time.year}/#{current_time.month}/#{current_time.day}/#{current_time.hour}\"\n\n # Multiple compares\n if options[:machine].is_a?(String) && options[:application].is_a?(String)\n key = key + \"_\" + options[:machine]\n @@data_store.get(:logs_by_machine_and_application, key, options[:application]).each do |attribute_value|\n attribute_value[1].keys.each do |uuid|\n guid = uuid.to_guid\n attributes = @@data_store.get(:logs, key, guid)\n attributes[\"uuid\"] = guid\n results << new(attributes)\n end\n end\n # Compare\n elsif options[:machine].is_a?(String)\n @@data_store.get(:logs_by_machine, key, options[:machine]).each { |log_entry| results << parse_log_entry(log_entry) }\n elsif options[:application].is_a?(String)\n @@data_store.get(:logs_by_application, key, options[:application]).each { |log_entry| results << parse_log_entry(log_entry) }\n # Range\n elsif options[:machine].is_a?(Array)\n results = range(:logs_by_machine, key, :start => options[:machine].first, :end => options[:machine].second)\n elsif options[:application].is_a?(Array)\n results = range(:logs_by_application, key, :start => options[:application].first, :end => options[:application].second)\n elsif options[:date].is_a?(Array)\n results = range(:logs, key, :start => options[:date].first, :end => options[:date].second)\n end\n results\n end", "def retrieve_log(module_id, nr_of_lines)\n logs = Log.find(:all, :conditions => [ \"module_id = (?)\", module_id ], :order => 'created_at asc', :limit => nr_of_lines)\n end", "def list(project_id, options)\n @_client.get(resource_root(project_id), options)\n end", "def getDocuments(projectId, queryMap)\t\t\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/documents/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.get(url, getQueryMap(queryMap))\t\t\r\n\t\t\t\treturn $documentParser.getDocuments(response)\r\n\t\t\tend", "def read_logs_all()\n logs = Log.find(:all, :order => 'created_at asc')\n end", "def project_fields(project_id, query_params = nil)\n get_project_children(project_id, __method__, query_params)\n end" ]
[ "0.5696256", "0.56157535", "0.5509633", "0.53502285", "0.5177358", "0.5157544", "0.5085997", "0.5058653", "0.5019479", "0.50043094", "0.49224234", "0.49016744", "0.4895208", "0.487327", "0.48673984", "0.4806951", "0.47869515", "0.47531185", "0.474953", "0.47337064", "0.4696011", "0.4681524", "0.46715087", "0.46635807", "0.45885703", "0.45855466", "0.4565804", "0.45564786", "0.45485476", "0.4543524" ]
0.8082578
0
Add a new task log for the project. ==== Parameters projectId:: ID of the project. tasklog:: Tasklog object. ==== Returns Tasklog object.
def addTasklog(projectId, tasklog) url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(tasklog.getTaskId)+"/logs/" response = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP) return $timesheetParser.getTasklog(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"+String(tasklog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def create\n @log = @task.logs.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @log }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def addBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend", "def addGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def add(task_id, params = {})\n wrike.execute(:get, api_url(\"tasks/#{task_id}/timelogs\"), params)\n end", "def create\n @tasks_log = TasksLog.new\n @tasks_log.start_date = Time.now\n # @task = Task.find_by(id: params[:task_id])\n @tasks_log.task_id = params[:task_id]\n @tasks_log.user_id = current_user.id\n #! check params for task_id, and find by id\n\n respond_to do |format|\n if @tasks_log.save\n format.html { redirect_to task_path(@tasks_log.task), notice: 'Tasks log was successfully created.' }\n format.json { render :show, status: :created, location: @tasks_log }\n else\n format.html { render :new }\n format.json { render json: @tasks_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_log\n @log = Log.find(params[:id])\n @task = Task.find(params[:task_id]) if params[:task_id].present?\n end", "def set_task_log\n @task_log = TaskLog.find(params[:id])\n end", "def create_log_entry\n Rails.logger.debug(\"@@@ create_log_entry: task = #{@task.inspect} event = #{@event.inspect}\")\n params = Hash.new\n params[:user_id] = current_user.id\n params[:role_id] = current_user.role.id\n params[:ot_id] = @task.ot.id\n params[:task_id] = @task.id\n params[:description] = \"Transicion de #{@task.current_state} a #{@task.current_state.events[@event.to_sym].transitions_to}\"\n log_entry = Audit.new(params)\n log_entry.save\n end", "def set_tasks_log\n @tasks_log = TasksLog.find(params[:id])\n end", "def addTaskToProject(taskid,projectid)\n task = getTaskByID(taskid) \n project = getProjectByID(projectid) \n\n if task != nil and project != nil \n project.addTask(task)\n else\n puts \"Task or project has not been found.\"\n end \n end", "def deleteTasklog(projectId, taskId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(taskId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def log(project, line_item_id, line_item_params, action)\n ProjectLog.create(project_id: project.id, line_item_id: line_item_id, params: line_item_params.to_json, action: action)\n end", "def project_add(project)\n raise Client::FileboundClientException.new('Id is required', 0) if project[:projectId].greater_than_zero?\n put('/projects', nil, project)\n end", "def log(log)\n post(formatter.call(log, self), log.time.strftime(@logging_path))\n end", "def create\n @timelog = Timelog.new(timelog_params)\n\n respond_to do |format|\n if @timelog.save\n format.html { redirect_to @timelog, notice: 'Timelog was successfully created.' }\n format.json { render :show, status: :created, location: @timelog }\n else\n format.html { render :new }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timelog = Timelog.new(timelog_params)\n @timelog.user_id = current_user.id unless @timelog.user_id\n\n respond_to do |format|\n if @timelog.save\n format.html { redirect_to timelogs_url, notice: 'Timelog was successfully created.' }\n format.json { render :show, status: :created, location: @timelog }\n else\n format.html { render :new }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_log\n @log = Log.find(params[:id])\n @log = nil unless current_user.tasks.include?(@log.task)\n end", "def create\n \n @log = Log.new(params[:log])\n @log.tracking = false\n @all_projects = current_user.projects.where([\"active = ?\", true])\n @customers = current_firm.customers\n \n @log.firm = current_firm\n \t @model = \"log\"\n @model_instanse = @log\n if params[:done]\n if !@log.todo.nil?\n @log.todo.completed = true\n @log.todo.save\n end\n end\n \n respond_to do |format|\n if @log.save\n flash[:notice] = flash_helper('Log was successfully created.')\n format.html { redirect_to(home_path(@log)) }\n format.xml { render :xml => @log, :status => :created, :location => @log }\n format.js\n else\n format.js { render \"shared/validate_create\" }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n if @log.save\n render json: @log, status: :created, location: @log\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def create\n @project = Project.find(params[:project_id])\n @user = current_user\n @task = @project.tasks.new(task_params)\n if @task.save\n redirect_to @project, notice: \"Task was successfully added to project.\"\n else\n render :new\n end\n\n end", "def add_task(project, description, deadline)\n project_tasks = @tasks[project]\n if project_tasks.nil?\n @output.printf(\"Could not find a project with the name \\\"%s\\\".\\n\", project)\n return\n end\n t = Task.new(next_id, description, false, deadline)\n project_tasks << t\n #checking if the task newly created already exists in another project and import its properties to the new one 't'\n @tasks.each do |project_name, project_tasks|\n project_tasks.each do |task|\n if task.description == t.description\n t.done= task.done\n t.date = task.date\n end\n end\n end\n end", "def add(task)\n\t\tbegin\n\t\t\t@all_tasks << task\n\t\trescue=>detail\n\t\t\tputs detail.backtrace.join(\"\\n\")\n\t\tend\n\tend", "def create\n @task = Task.new(params[:task])\n @task.project_id = params[:project_id]\n @task.add_collaborator current_user\n\n respond_to do |format|\n if @task.save\n format.html { \n flash[:success] = t(\"flash.msg.task-created\")\n redirect_to(project_tasks_path(params[:project_id])) \n }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n @new_task = Task.new\n\n unless @project.save\n head :unprocessable_entity\n end\n end", "def create\n @task = @project.tasks.build(params[:task])\n if @task.save\n @task.insert_at # The top of the list.\n respond_to do |format|\n format.html do\n flash[:notice] = 'Task was created.'\n flash[:highlight_dom_id] = dom_id(@task)\n redirect_to project_tasks_path(@project)\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'new' }\n end\n end\n end", "def create\n \n @task = @project.tasks.new(params[:task])\n\n if @task.save\n redirect_to(project_tasks_path(@project))\n flash[:notice] = 'Task was successfully created.' \n else\n \t\n render('new')\n end\n end" ]
[ "0.7270358", "0.670275", "0.635152", "0.6237317", "0.61696374", "0.6115398", "0.5977757", "0.59596676", "0.5854124", "0.57529837", "0.57242626", "0.5643681", "0.5534113", "0.55309814", "0.5506589", "0.549159", "0.54759026", "0.54631937", "0.5438807", "0.54115635", "0.54115635", "0.54115635", "0.5403575", "0.53820837", "0.5380202", "0.5371651", "0.5342635", "0.53109187", "0.5308076", "0.5300158" ]
0.8639101
0
Update the details of a task log. ==== Parameters projectId ID of the project. tasklog:: Tasklog object. ==== Returns Tasklog object.
def updateTasklog(projectId, tasklog) url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(tasklog.getTaskId)+"/logs/"+String(tasklog.getId)+"/" response = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP) return $timesheetParser.getTasklog(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def addTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def updateBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"+String(buglog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend", "def update\n @tasks_log = TasksLog.find(params[:id])\n @task = @tasks_log.task\n @tasks_log.end_date = Time.now\n @tasks_log.duration = @tasks_log.end_date - @tasks_log.start_date\n\n respond_to do |format|\n if @tasks_log.save\n format.html { redirect_to task_path(@task), notice: 'Tasks log was successfully updated.' }\n format.json { render :show, status: :ok, location: @tasks_log }\n else\n format.html { render :edit }\n format.json { render json: @tasks_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_task_log\n @task_log = TaskLog.find(params[:id])\n end", "def update\n @log = Log.find(params[:id])\n\n if @log.update(log_params)\n head :no_content\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def update\n @formlog = Formlog.find(params[:id])\n\n respond_to do |format|\n if @formlog.update_attributes(params[:formlog])\n flash[:notice] = 'Formlog was successfully updated.'\n format.html { redirect_to(@formlog) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @formlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_log\n @log = Log.find(params[:id])\n @task = Task.find(params[:task_id]) if params[:task_id].present?\n end", "def update\n @log = Log.find(params[:id])\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @log = Log.find(params[:id])\n @logs = @goal.logs\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to goal_logs_url(@goal), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'index' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(generallog.getId)+\"/\"\t\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t \t@log = Log.find(params[:id])\n @all_projects = current_user.projects.where([\"active = ?\", true]).includes(:customer, {:todos => [:logs]})\n @customers = current_firm.customers\n @projects = current_firm.projects.where([\"active = ?\", true])\n \n @model = \"log\"\n @model_instanse = @log\n # regular update \n if !@log.todo.nil?\n if params[:done] == \"1\" \n \t\n @log.todo.completed = true\n @log.todo.save!\n \n elsif params[:done].nil?\n \t\n @log.todo.completed = false\n @log.todo.save!\n \n end\n end\n \n respond_to do |format|\n if @log.update_attributes!(params[:log])\n flash[:notice] = flash_helper(\"Log was successfully saved.\")\n \n format.js\n else\n format.js { render \"shared/validate_update\" }\n \n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to admin_log_path(@log), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @log }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tasks_log\n @tasks_log = TasksLog.find(params[:id])\n end", "def update\n respond_to do |format|\n if @daily_task_log.update(daily_task_log_params)\n format.html { redirect_to @daily_task_log, notice: 'Daily task log was successfully updated.' }\n format.json { render :show, status: :ok, location: @daily_task_log }\n else\n format.html { render :edit }\n format.json { render json: @daily_task_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @timelog.update(timelog_params)\n format.html { redirect_to @timelog, notice: 'Timelog was successfully updated.' }\n format.json { render :show, status: :ok, location: @timelog }\n else\n format.html { render :edit }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @update_log = UpdateLog.find(params[:id])\n\n respond_to do |format|\n if @update_log.update_attributes(params[:update_log])\n flash[:notice] = 'UpdateLog was successfully updated.'\n format.html { redirect_to(@update_log) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @update_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @effort_log = EffortLog.find(params[:id])\n\n respond_to do |format|\n if @effort_log.update_attributes(params[:effort_log])\n format.html { redirect_to(:controller => \"effort_logs\", :action => \"index_by_project\",\n :id => @effort_log.project_phase_deliverable.project_phase.project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @effort_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trans_log.update(trans_log_params)\n format.html { redirect_to @trans_log, notice: 'Trans log was successfully updated.' }\n format.json { render :show, status: :ok, location: @trans_log }\n else\n format.html { render :edit }\n format.json { render json: @trans_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n if @time_log.update_attributes(params[:time_log])\n format.html { redirect_to @time_log, notice: 'Time log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:user_id])\n @log = @user.logs.find(params[:id])\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to user_logs_url, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def deleteTasklog(projectId, taskId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(taskId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def set_log\n @log = Log.find(params[:id])\n @log = nil unless current_user.tasks.include?(@log.task)\n end", "def update\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to(@log, :notice => 'Log was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_log = ExerciseLog.find(params[:id])\n\n respond_to do |format|\n if @exercise_log.update_attributes(params[:exercise_log])\n format.html { redirect_to @exercise_log, notice: 'Exercise log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @log = Log.find(params[:id])\n end" ]
[ "0.722958", "0.69112635", "0.6649512", "0.6631488", "0.6609345", "0.6573202", "0.6558166", "0.65401715", "0.6524673", "0.6522404", "0.6513108", "0.6458808", "0.6458808", "0.6458808", "0.64417285", "0.6426898", "0.63763165", "0.62982994", "0.62477064", "0.62415165", "0.6227037", "0.6222905", "0.6200487", "0.619319", "0.6185565", "0.6170597", "0.6159178", "0.6156033", "0.6152619", "0.6088248" ]
0.8647746
0
Delete an existing task log for the project. ==== Parameters projectId:: ID of the project. taskId:: ID of the task. logId:: ID of the log. ==== Returns String object.
def deleteTasklog(projectId, taskId, logId) url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/logs/"+String(logId)+"/" response = ZohoHTTPClient.delete(url, getQueryMap) return $timesheetParser.getResult(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteGenerallog(projectId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def deleteBuglog(projectId, bugId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(bugId)+\"/logs/\"+String(logId)+\"/\"\t\t\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def updateTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"+String(tasklog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def destroy\n @task = Task.find(params[:id])\n @client = Client.find(@task.cl_id)\n @task.destroy\n mnglog = MngLog.new(cr_time: Time.now.getlocal, who: @staff_login.fullname+\" (\"+@staff_login.user+\")\", text: task_action_parser(@client,@task))\n mnglog.save\n\n respond_to do |format|\n format.html { redirect_to session[:referer] }\n format.json { head :no_content }\n end\n end", "def destroy\n @tasks_log.destroy\n respond_to do |format|\n format.html { redirect_to tasks_logs_url, notice: 'Tasks log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_log(log_file = '')\n File.delete(log_file) if File.exists?(log_file) && $SYNC_CONFIG[:wipe_log]\n log_file\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_logs_url(@goal) }\n format.json { head :no_content }\n end\n end", "def delete_sleep_log(log_id)\n successful_delete?(delete(path_user_version(\"/sleep/#{log_id}\")))\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n \n respond_to do |format|\n flash[:notice] = flash_helper('Log was deleted.')\n format.html { redirect_to logs_path }\n format.xml { head :ok }\n format.js\n end\n end", "def addTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def delete_log name\n ensure_connection!\n resp = connection.delete_log name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @logtransfer = Logtransfer.find(params[:id])\n @logtransfer.destroy\n\n respond_to do |format|\n format.html { redirect_to logtransfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to admin_logs_url }\n format.json { head :no_content }\n end\n end", "def delete_todo(todo)\n response = Logan::Client.delete \"/projects/#{@project_id}/todos/#{todo.id}.json\"\n end", "def destroy\n @exercise_log = ExerciseLog.find(params[:id])\n @exercise_log.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n\n head :no_content\n end", "def delete\n CONNECTION.execute(\"DELETE FROM logs WHERE id = #{self.id};\")\n end", "def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end", "def delete_log_ftp(opts = {})\n data, _status_code, _headers = delete_log_ftp_with_http_info(opts)\n data\n end", "def destroy\n @formlog = Formlog.find(params[:id])\n @formlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(formlogs_url) }\n format.xml { head :ok }\n end\n end", "def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end", "def destroy\n @steps_log = StepsLog.find(params[:id])\n @steps_log.destroy\n\n respond_to do |format|\n format.html { redirect_to steps_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tap_log_record = current_account.tap_log_records.find(params[:id])\n authorize! :delete, @tap_log_record\n @tap_log_record.destroy\n\n respond_to do |format|\n format.html { redirect_to(tap_log_records_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n respond_to do |format|\n format.html { redirect_to index_logs_path(params[:device_id], :page => 1) }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:project_id])\n @task.destroy\n redirect_to @project, notice: 'You have successfully deleted a task from this project.'\n\n end", "def destroy\n @log_entry = LogEntry.find(params[:id])\n @log_entry.destroy\n\n redirect_to log_entries_path\n end", "def delete_log_loggly(opts = {})\n data, _status_code, _headers = delete_log_loggly_with_http_info(opts)\n data\n end", "def delete_water_log(log_id, opts={})\n delete(\"user/#{user_id}/foods/log/water/#{log_id}.json\", opts)\n end" ]
[ "0.71801114", "0.68418723", "0.60814387", "0.59169453", "0.5891257", "0.587059", "0.585648", "0.5828042", "0.57387763", "0.57286125", "0.56962794", "0.56492037", "0.56492037", "0.54758954", "0.545893", "0.54365385", "0.54251975", "0.539682", "0.5377201", "0.5360542", "0.5354491", "0.5348419", "0.53385144", "0.53331065", "0.5321878", "0.5300453", "0.5298403", "0.5298133", "0.5290055", "0.5284657" ]
0.8557406
0
Add a new bug log for the project. ==== Parameters projectId:: ID of the project. buglog:: Buglog object. ==== Returns Buglog object.
def addBuglog(projectId, buglog) url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(buglog.getBugId)+"/logs/" response = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP) return $timesheetParser.getBuglog(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"+String(buglog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend", "def addTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def addGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def deleteBuglog(projectId, bugId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(bugId)+\"/logs/\"+String(logId)+\"/\"\t\t\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def create\n @bug = Bug.new(bug_params)\n @project = Project.find(params[:project_id])\n @bug.project_id = @project.id\n\n respond_to do |format|\n if @bug.save\n # Notificar a criação do bug no Slack\n message = \"#{current_user.username} adicionou o bug \\\"#{@bug.title}\\\" ao projeto \\\"#{@project.name}\\\"\"\n @notifier.ping message\n\n format.html { redirect_to user_project_url(current_user.id, params[:project_id]), notice: 'Bug was successfully created.' }\n format.json { render :show, status: :created, location: @bug }\n else\n format.html { render :new }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_bug(bug={})\n return call('Bug.create', bug)\n end", "def create\n @bug = Project.find(params[:project_id]).bugs.new(bug_params)\n @bug.user_id = current_user.id\n @bug.status = \"new\"\n authorize @bug\n if @bug.save\n redirect_to project_path(@bug.project.id), notice: I18n.t('flash.actions.bug.create.notice')\n else\n render 'new'\n end\n end", "def create\n @bug = @project.bugs.new(bug_params.merge!(user_status: current_user))\n respond_to do |format|\n if @bug.save\n send_slack_notification ( {create: true} )\n format.html { redirect_to [@project, @bug], notice: 'Bug was successfully created.' }\n format.json { render :show, status: :created, location: @bug }\n else\n format.html { render :new }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bug = Bug.new(bug_params)\n @bug.project_id = session[:project_id]\n @bug.user_id = current_user.id\n @bug.clean_summary\n @bug.clean_description\n @bug.status = 0 #New\n @bug.resolution = 0 #Open\n\n respond_to do |format|\n if @bug.save\n BugHistoric.create(bug_id: @bug.id, ref: BugHistoric.CREATED, user_id: current_user.id)\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render :show, status: :created, location: @bug }\n else\n format.html { render :new }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.find(params[:project_id])\n @project_bug=@project.project_bugs.create(project_bug_params)\n if @project_bug.errors.full_messages[0].present?\n redirect_to request.referer,flash: {error: @project_bug.errors.full_messages[0]}\n else\n redirect_to @project_bug\n end\n # p1=ProjectBug.find_by(id: params[:project_bug_id])\n # @project_bug = current_user.project_bugs.create(p1)\n # respond_to do |format|\n # format.html { redirect_to @project_bug, notice: \"Project bug was successfully created.\" }\n # format.json { render :show, status: :created, location: @project_bug }\n # end\n end", "def jsonToBuglog(jsonObject)\r\n\t\t\t\tbuglog = Buglog.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\tbuglog.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"notes\")\r\n\t\t\t\t\tbuglog.setNotes(jsonObject[\"notes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"log_date\")\r\n\t\t\t\t\tbuglog.setLogDate(jsonObject[\"log_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"log_date_long\")\r\n\t\t\t\t\tbuglog.setLogDateLong(jsonObject[\"log_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"hours\")\r\n\t\t\t\t\tbuglog.setHours(jsonObject[\"hours\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"minutes\")\r\n\t\t\t\t\tbuglog.setMinutes(jsonObject[\"minutes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"hours_display\")\r\n\t\t\t\t\tbuglog.setHoursDisplay(jsonObject[\"hours_display\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"total_minutes\")\r\n\t\t\t\t\tbuglog.setTotalMinutes(jsonObject[\"total_minutes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_id\")\r\n\t\t\t\t\tbuglog.setOwnerId(jsonObject[\"owner_id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_name\")\r\n\t\t\t\t\tbuglog.setOwnerName(jsonObject[\"owner_name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"bill_status\")\r\n\t\t\t\t\tbuglog.setBillStatus(jsonObject[\"bill_status\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"bug\")\r\n\t\t\t\t\tbug = jsonObject[\"bug\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tif bug.has_key?(\"id\")\r\n\t\t\t\t\t\tbuglog.setBugId(bug[\"id\"])\r\n\t\t\t\t\tend\r\n\t\t\t\t\tif bug.has_key?(\"title\")\r\n\t\t\t\t\t\tbuglog.setTitle(bug[\"title\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\tbuglog.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn buglog\r\n\t\t\tend", "def updateTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"+String(tasklog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def create\n\n @backlog = Backlog.new(backlog_params)\n \n # adiciona o backlog no final da lista\n p = Project.find params[:project_id]\n @backlog.position = (p.get_last_backlog_position + 1)\n\n respond_to do |format|\n if @backlog.save\n format.html { redirect_to project_backlogs_path(@backlog.project.id), notice: 'Backlog criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @backlog }\n else\n format.html { render action: 'new' }\n format.json { render json: @backlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_project_bug\n @project_bug = ProjectBug.find(params[:id])\n end", "def set_bug\n @bug = Project.find(params[:project_id]).bugs.find(params[:id])\n end", "def create\n @project = Project.find_by_permalink(params[:project_id])\n @bug = Bug.new(params[:bug])\n @bug.project = @project\n @bug.creator = get_current_user\n\n respond_to do |format|\n if @bug.save\n @bug.generate_state_comment(@bug.creator, nil, @bug.state)\n format.html { redirect_to(project_bug_url(@project, @bug),\n :notice => 'Bug was successfully created.') }\n format.xml { render :xml => @bug, :status => :created, :location => @bug }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bug.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @change_log = ChangeLog.new(change_log_params)\n\n respond_to do |format|\n if @change_log.save\n format.html { redirect_to @change_log, notice: 'Change log was successfully created.' }\n format.json { render :show, status: :created, location: @change_log }\n else\n format.html { render :new }\n format.json { render json: @change_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def file_bug(errata, bug)\n FiledBug.\n new(:errata => errata, :bug => bug, :user => User.current_user).\n save!(:validate => false)\n end", "def create\n @bug = Bug.new(bug_params)\n @bug.user_id = current_user.id\n respond_to do |format|\n if @bug.save\n activity = @bug.create_activity :create, owner: current_user, recipient: Project.find(@bug.story.project_id)\n @notif = Notification.new\n @notif.notifs_create(@bug, activity.id) \n format.html { redirect_to :back, notice: 'Bug was successfully created.' }\n format.json { render :show, status: :created, location: @bug }\n else\n format.html { render :new }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n if params[:bug][:bugtitle].empty? or params[:bug][:bugdescription].empty? or params[:bug][:assignedto_user_id].empty?\n @bug = Bug.new(params[:bug])\n @bug.errors[:base] << \"Please Enter all the mandatory fields \"\n @users = Bug.get_users_project(get_project_id)\n get_count_of_issue\n render :action=>\"new\"\n else\n @bug = Bug.new(params[:bug])\n Bug.save_file(params,@bug) if !params[:fileuploadpath].nil?\n @bug.project_id = get_project_id\n @bug.assignedby_user_id = session[:user_id]\n @bug.status= \"Open\"\n respond_to do |format|\n if @bug.save\n format.html { redirect_to bugs_url , notice: 'Bug was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @bug_list = BugList.new(params[:bug_list])\n\t\t@bug_list.user_id = session[:user_id]\n respond_to do |format|\n if @bug_list.save\n format.html { redirect_to @bug_list.project, notice: 'Bug list was successfully created.' }\n format.json { render json: @bug_list, status: :created, location: @bug_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(generallog.getId)+\"/\"\t\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def create\n \n @log = Log.new(params[:log])\n @log.tracking = false\n @all_projects = current_user.projects.where([\"active = ?\", true])\n @customers = current_firm.customers\n \n @log.firm = current_firm\n \t @model = \"log\"\n @model_instanse = @log\n if params[:done]\n if !@log.todo.nil?\n @log.todo.completed = true\n @log.todo.save\n end\n end\n \n respond_to do |format|\n if @log.save\n flash[:notice] = flash_helper('Log was successfully created.')\n format.html { redirect_to(home_path(@log)) }\n format.xml { render :xml => @log, :status => :created, :location => @log }\n format.js\n else\n format.js { render \"shared/validate_create\" }\n end\n end\n end", "def create_commit_bug(bugs, commit_hash)\n # split the bugs by comma and any space char.\n bugs = bugs.split(%r{,\\s*})\n bugs_set = Set.new\n\n bugs.each do |bug|\n\n # Normalize bug field\n bug.downcase!\n bug.strip!\n\n # Remove the common bad text\n bad_text = [\"chromium:\",\"issue\",\"bug=\",\"=\"]\n bad_text.each do |text|\n bug.slice! text if bug.start_with? text\n end\n\n # If the bug is a number with 6 digits\n if fast_match(bug,/^(\\s*\\d{1,6}\\s*)$/)\n bugs_set << bug.to_i\n # If it is a repetition of 4-6 digits\n elsif fast_match(bug,/([0-9]{4,6})\\1/)\n bug = /([0-9]{4,6})\\1/.match(bug)[1]\n bugs_set << bug.to_i\n end\n end\n\n bugs_set.each do |bug|\n @con.exec_prepared('bugInsert', [commit_hash,bug])\n end\n end", "def create\n @bug = Bug.new(params[:bug])\n\n respond_to do |format|\n if @bug.save\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render json: @bug, status: :created, location: @bug }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bug = Bug.new(params[:bug])\n\n respond_to do |format|\n if @bug.save\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render json: @bug, status: :created, location: @bug }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @portfoliolog = Portfoliolog.new(portfoliolog_params)\n\n respond_to do |format|\n if @portfoliolog.save\n format.html { redirect_to @portfoliolog, notice: 'Portfoliolog was successfully created.' }\n format.json { render :show, status: :created, location: @portfoliolog }\n else\n format.html { render :new }\n format.json { render json: @portfoliolog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bug = Bug.new(params[:bug])\n \n respond_to do |format|\n if @bug.save\n flash[:notice] = 'Bug was successfully created.'\n format.html { redirect_to(bugs_path) }\n format.xml { render :xml => @bug, :status => :created, :location => @bug }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bug.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ticket = Ticket.new(params[:ticket] )\n\n respond_to do |format|\n if @ticket.valid?\n\t\t\t\tif TicketLog.make_log(params[:log], @ticket, current_user)\n\t\t\t\t\t@ticket.save\n\t\t\t\t\tflash[:notice] = 'Ticket was successfully created.'\n\t\t\t\t\tformat.html { redirect_to(@ticket) }\n\t\t\t\t\tformat.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n\t\t\t\telse\n\t\t\t\t\t@ticket.errors.add :log, \"entry cannot be blank\"\n\t\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\t\tformat.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n else\n\t\t\t\t@ticket.save\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bug_params\n params.require(:bug).permit(:name, :bug_type, :description, :project_id)\n end" ]
[ "0.7331927", "0.6420672", "0.60176027", "0.5876627", "0.5761503", "0.5723727", "0.569731", "0.5679494", "0.55371684", "0.55122095", "0.5349955", "0.5329497", "0.5249734", "0.5233404", "0.5215649", "0.52150685", "0.5204753", "0.51925904", "0.518287", "0.5135109", "0.50979376", "0.5081542", "0.5057349", "0.50421417", "0.50276875", "0.50276875", "0.5002929", "0.50000554", "0.4994455", "0.49888274" ]
0.8624892
0
Update the details of a bug log. ==== Parameters projectId:: ID of the project. buglog:: Buglog object. ==== Returns Buglog object.
def updateBuglog(projectId, buglog) url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(buglog.getBugId)+"/logs/"+String(buglog.getId)+"/" response = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP) return $timesheetParser.getBuglog(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend", "def updateTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"+String(tasklog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def updateGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(generallog.getId)+\"/\"\t\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def deleteBuglog(projectId, bugId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(bugId)+\"/logs/\"+String(logId)+\"/\"\t\t\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def update\n if @bug.update(bug_params)\n redirect_to projects_path, notice: I18n.t('flash.actions.bug.update.notice')\n else\n render :edit \n end\n end", "def update\n respond_to do |format|\n if @bug.update(bug_params)\n BugHistoric.create(bug_id: @bug.id, ref: BugHistoric.MODIFIED, user_id: current_user.id)\n format.html { redirect_to @bug, notice: 'Bug was successfully updated.' }\n format.json { render :show, status: :ok, location: @bug }\n else\n format.html { render :edit }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bug = Bug.find(params[:id])\n @project = Project.find(params[:project_id])\n \n old_status = @bug.is_fixed\n\n respond_to do |format|\n if @bug.update(bug_params)\n # Checar se o status do bug mudou\n if @bug.is_fixed != old_status\n status = { true => \"Corrigido\", false => \"Não corrigido\"}\n # Caso tenha mudado, notificar no Slack\n message = \"#{current_user.username} alterou o status do bug \\\"#{@bug.title}\\\" (#{@project.name}) para #{status[@bug.is_fixed]}\"\n @notifier.ping message\n end\n\n format.html { redirect_to user_project_path(current_user.id, params[:project_id]), notice: 'Bug was successfully updated.' }\n format.json { render :show, status: :ok, location: @bug }\n else\n format.html { render :edit }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @formlog = Formlog.find(params[:id])\n\n respond_to do |format|\n if @formlog.update_attributes(params[:formlog])\n flash[:notice] = 'Formlog was successfully updated.'\n format.html { redirect_to(@formlog) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @formlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @log = Log.find(params[:id])\n @logs = @goal.logs\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to goal_logs_url(@goal), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'index' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @change_log.update(change_log_params)\n format.html { redirect_to @change_log, notice: 'Change log was successfully updated.' }\n format.json { render :show, status: :ok, location: @change_log }\n else\n format.html { render :edit }\n format.json { render json: @change_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n\t\t@ticket.attributes = params[:ticket]\n\n respond_to do |format|\n if @ticket.valid?\n\t\t\t\tif TicketLog.make_log(params[:log], @ticket, current_user)\n\t\t\t\t\t@ticket.save\n\t\t\t\t\tflash[:notice] = 'Ticket was successfully updated.'\n\t\t\t\t\tformat.html { redirect_to(@ticket) }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\t@ticket.errors.add :log, \"entry cannot be blank\"\n\t\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\t\tformat.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n else\n\t\t\t\t@ticket.save\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bug_list = BugList.find(params[:id])\n\t\t@bug_list.user_id = session[:user_id]\n respond_to do |format|\n if @bug_list.update_attributes(params[:bug_list])\n format.html { redirect_to @bug_list.project, notice: 'Bug list was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bug_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bug.update(bug_params.merge!(user_status: current_user))\n send_slack_notification ( {update: true} )\n format.html { redirect_to [@project, @bug], notice: 'Bug was successfully updated.' }\n format.json { render :show, status: :ok, location: @bug }\n else\n format.html { render :edit }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_project_bug\n @project_bug = ProjectBug.find(params[:id])\n end", "def update\n @project = Project.find_by_permalink(params[:project_id])\n @bug = Bug.find(params[:id])\n @user = get_current_user\n\n if params[:bug][:watcher_id]\n @watcher = @project.users.find_by_id(params[:bug][:watcher_id])\n params[:bug].delete :watcher_id\n\n if @bug.watchers.include?(@watcher)\n @bug.watchers.delete(@watcher)\n else\n @bug.watchers << @watcher unless @watcher.nil?\n end\n end\n\n if params[:bug][:comment]\n @comment = Comment.new()\n @comment.user = @user\n @comment.content = RedCloth.new(params[:bug][:comment][:content]).to_html\n @bug.comments << @comment\n params[:bug].delete :comment\n end\n\n if params[:bug][:state]\n if @bug.state != params[:bug][:state]\n render :action => \"show\"\n return\n else\n params[:bug].delete :state\n end\n end\n\n if params[:bug][:next_event]\n next_event = @bug.verify_next_event(params[:bug][:next_event], @user)\n if next_event.nil?\n render :action => \"show\"\n return\n end\n params[:bug].delete :next_event\n end\n\n if @bug.update_attributes(params[:bug])\n if next_event\n transition = @bug.state_transitions.find { |t| t if t.event == next_event }\n @bug.fire_events(next_event)\n @bug.generate_state_comment(@user, transition.from, transition.to)\n end\n\n redirect_to(project_bug_url(@project, @bug),\n :notice => 'Bug was successfully updated.')\n else\n render :action => \"edit\"\n end\n end", "def update\n @log = Log.find(params[:id])\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @log = Log.find(params[:id])\n\n if @log.update(log_params)\n head :no_content\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def update_bug(bug_data, bug_task, build_number)\n bug_id = bug_data['id']\n bugproxy = @server.proxy('Bug')\n comments_result = bugproxy.comments({:ids => bug_id})\n #puts comments_result\n comments = comments_result['bugs'][\"#{bug_id}\"]['comments']\n last_comment = comments.last\n\n if last_comment\n if !last_comment['text'].start_with? FIXED_COMMENT_PREFIX\n\n # only add a comment if the state isn't already VERIFIED, REVERIFIED or CLOSED\n status = bug_data['status']\n txt = String.new(FIXED_COMMENT_PREFIX) # comment should always begin with this\n txt << \"Fixed in Git and deployed with build #{build_number}\"\n\n if !(status == 'RESOLVED' || verified_or_closed?(status))\n txt << \"\\n\\nNOTE: it appears that this bug has not been marked resolved yet... please verify and update status if necessary\"\n end\n\n if (!verified_or_closed?(status) && !@dry_run)\n add_comment_response = bugproxy.add_comment({'id' => bug_id, 'comment' => txt})\n\n #puts \"adding comment to bug id #{bug_id}\\n #{txt}\"\n # TODO: add delivered in build field\n # unfortunately it doesn't look like the API gives us a way to update custom fields\n # http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html#fields\n end\n end\n end\n #puts \"Last comment:\\n#{last_comment}\"\n end", "def set_bug\n @bug = Project.find(params[:project_id]).bugs.find(params[:id])\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to admin_log_path(@log), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n if @bug.update_attributes(params[:bug])\n format.html { redirect_to @bug, 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\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n if @bug.update_attributes(params[:bug])\n format.html { redirect_to @bug, 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\n \t \t@log = Log.find(params[:id])\n @all_projects = current_user.projects.where([\"active = ?\", true]).includes(:customer, {:todos => [:logs]})\n @customers = current_firm.customers\n @projects = current_firm.projects.where([\"active = ?\", true])\n \n @model = \"log\"\n @model_instanse = @log\n # regular update \n if !@log.todo.nil?\n if params[:done] == \"1\" \n \t\n @log.todo.completed = true\n @log.todo.save!\n \n elsif params[:done].nil?\n \t\n @log.todo.completed = false\n @log.todo.save!\n \n end\n end\n \n respond_to do |format|\n if @log.update_attributes!(params[:log])\n flash[:notice] = flash_helper(\"Log was successfully saved.\")\n \n format.js\n else\n format.js { render \"shared/validate_update\" }\n \n end\n end\n end", "def update\n @bug_comment = BugComment.find(params[:id])\n\n respond_to do |format|\n if @bug_comment.update_attributes(params[:bug_comment])\n format.html { redirect_to project_bug_list_bug_post_path(params[:project_id], params[:bug_list_id], params[:bug_post_id]), notice: 'Bug comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bug_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if project_bug_params[:status] ==\"started\"\n @project_bug.assigned_id = current_user.id\n\n end\n if @project_bug.update(project_bug_params)\n format.html { redirect_to @project_bug, notice: \"Project bug was successfully updated.\" }\n format.json { render :show, status: :ok, location: @project_bug }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project_bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize Bug\n respond_to do |format|\n if @bug.update(bug_params)\n format.html { redirect_to @bug, notice: 'Bug was successfully updated.' }\n format.json { render :show, status: :ok, location: @bug }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @portfoliolog.update(portfoliolog_params)\n format.html { redirect_to @portfoliolog, notice: 'Portfoliolog was successfully updated.' }\n format.json { render :show, status: :ok, location: @portfoliolog }\n else\n format.html { render :edit }\n format.json { render json: @portfoliolog.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7116334", "0.6524365", "0.6214276", "0.61958617", "0.60275775", "0.59494716", "0.5939012", "0.58407605", "0.5823737", "0.5780291", "0.5755026", "0.574328", "0.57302403", "0.5729758", "0.5726732", "0.5726439", "0.5724277", "0.5686232", "0.5675895", "0.5659279", "0.56356454", "0.56356454", "0.56330335", "0.56294715", "0.5619218", "0.5619218", "0.5619218", "0.5607484", "0.56006056", "0.55994165" ]
0.8651246
0
Delete an existing bug log for the project. ==== Parameters projectId:: ID of the project. bugId:: ID of the bug. logId:: ID of the log. ==== Returns String object.
def deleteBuglog(projectId, bugId, logId) url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bugId)+"/logs/"+String(logId)+"/" response = ZohoHTTPClient.delete(url, getQueryMap) return $timesheetParser.getResult(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteGenerallog(projectId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def deleteTasklog(projectId, taskId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(taskId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def updateBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"+String(buglog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend", "def delete_log name\n ensure_connection!\n resp = connection.delete_log name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_logs_url(@goal) }\n format.json { head :no_content }\n end\n end", "def addBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend", "def delete_log(log_file = '')\n File.delete(log_file) if File.exists?(log_file) && $SYNC_CONFIG[:wipe_log]\n log_file\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to admin_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n \n respond_to do |format|\n flash[:notice] = flash_helper('Log was deleted.')\n format.html { redirect_to logs_path }\n format.xml { head :ok }\n format.js\n end\n end", "def delete_water_log(log_id, opts={})\n delete(\"user/#{user_id}/foods/log/water/#{log_id}.json\", opts)\n end", "def delete_log_loggly(opts = {})\n data, _status_code, _headers = delete_log_loggly_with_http_info(opts)\n data\n end", "def delete_water_log(water_log_id)\n delete(\"/user/-/foods/log/water/#{water_log_id}.json\")\n end", "def destroy\n @log.destroy\n\n head :no_content\n end", "def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end", "def delete_sleep_log(log_id)\n successful_delete?(delete(path_user_version(\"/sleep/#{log_id}\")))\n end", "def delete_log\n unless UserSession.find == nil\n Log.create(user_id: UserSession.find.user.id, message: \n \"#{UserSession.find.user.name} har slettet rollen: #{self.name}\",\n logtype_id: 3)\n end\n end", "def destroy\n @formlog = Formlog.find(params[:id])\n @formlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(formlogs_url) }\n format.xml { head :ok }\n end\n end", "def delete_issue(project, id)\n delete(\"/projects/#{url_encode project}/issues/#{id}\")\n end", "def destroy\n @work_log = WorkLog.find(params[:id])\n @work_log.destroy\n\n respond_to do |format|\n format.html { redirect_to work_logs_url }\n format.json { head :no_content }\n end\n end", "def delete_log_heroku(opts = {})\n data, _status_code, _headers = delete_log_heroku_with_http_info(opts)\n data\n end", "def destroy\n @exercise_log = ExerciseLog.find(params[:id])\n @exercise_log.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bug = Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n \n if @bug.destroy\n render :json => {:status => :ok}\n else\n render :json => {:error => @bug.errors.full_messages, :status => :bad_request}\n end\n end", "def destroy\n @log_entry = LogEntry.find(params[:id])\n @log_entry.destroy\n\n redirect_to log_entries_path\n end", "def delete\n CONNECTION.execute(\"DELETE FROM logs WHERE id = #{self.id};\")\n end", "def delete_log_ftp(opts = {})\n data, _status_code, _headers = delete_log_ftp_with_http_info(opts)\n data\n end", "def command_delete(name, date)\n if @log.contains(name, date)\n @log.remove_logItem(name, date)\n @logChangedDB = true\n else\n puts \"Item not in log\"\n end\n end", "def delete_log_gcp_pubsub(opts = {})\n data, _status_code, _headers = delete_log_gcp_pubsub_with_http_info(opts)\n data\n end", "def destroy\n @bug.destroy\n\n respond_to do |format|\n format.html { redirect_to project_environment_bugs_url(@project, @environment), flash: {success: t('controllers.bugs.destroy.deleted', number: number_with_delimiter(@bug.number))} }\n end\n end" ]
[ "0.7142091", "0.6956854", "0.6182351", "0.59739757", "0.5900415", "0.584281", "0.5813457", "0.57272506", "0.57272506", "0.56348777", "0.5613421", "0.5612092", "0.5606971", "0.5580716", "0.55606985", "0.55378646", "0.5496478", "0.54311246", "0.54148203", "0.5403991", "0.5382803", "0.53505164", "0.53273153", "0.5307121", "0.52666515", "0.5241546", "0.5235539", "0.52311796", "0.520816", "0.5203247" ]
0.848432
0
Add a new general log for the project. ==== Parameters projectId:: ID of the project. generallog:: Generallog object. ==== Returns Generallog object.
def addGenerallog(projectId, generallog) url = getBaseURL+"projects/"+String(projectId)+"/logs/" requestBody = generallog.toParamMAP requestBody["name"] = generallog.getName response = ZohoHTTPClient.post(url, getQueryMap, requestBody) return $timesheetParser.getGenerallog(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(generallog.getId)+\"/\"\t\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def addTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def deleteGenerallog(projectId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def create\n @general = General.new(params[:general])\n\n respond_to do |format|\n if @general.save\n format.html { redirect_to @general, notice: 'General was successfully created.' }\n format.json { render json: @general, status: :created, location: @general }\n else\n format.html { render action: \"new\" }\n format.json { render json: @general.errors, status: :unprocessable_entity }\n end\n end\n end", "def addBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend", "def getGenerallog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\tgenerallogs_array = timeLogs_json[\"timelogs\"][\"generallogs\"]\r\n\t\t\t\treturn jsonToGenerallog(generallogs_array[0])\r\n\t\t\tend", "def jsonToGenerallog(jsonObject)\r\n\t\t\t\tgenerallog = Generallog.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\tgenerallog.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\tgenerallog.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"notes\")\r\n\t\t\t\t\tgenerallog.setNotes(jsonObject[\"notes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"log_date\")\r\n\t\t\t\t\tgenerallog.setLogDate(jsonObject[\"log_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"log_date_format\")\r\n\t\t\t\t\tgenerallog.setLogDateFormat(jsonObject[\"log_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"log_date_long\")\r\n\t\t\t\t\tgenerallog.setLogDateLong(jsonObject[\"log_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"hours\")\r\n\t\t\t\t\tgenerallog.setHours(jsonObject[\"hours\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"minutes\")\r\n\t\t\t\t\tgenerallog.setMinutes(jsonObject[\"minutes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"hours_display\")\r\n\t\t\t\t\tgenerallog.setHoursDisplay(jsonObject[\"hours_display\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"total_minutes\")\r\n\t\t\t\t\tgenerallog.setTotalMinutes(jsonObject[\"total_minutes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_id\")\r\n\t\t\t\t\tgenerallog.setOwnerId(jsonObject[\"owner_id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_name\")\r\n\t\t\t\t\tgenerallog.setOwnerName(jsonObject[\"owner_name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"bill_status\")\r\n\t\t\t\t\tgenerallog.setBillStatus(jsonObject[\"bill_status\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\tgenerallog.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn generallog\r\n\t\t\tend", "def log(log)\n post(formatter.call(log, self), log.time.strftime(@logging_path))\n end", "def registrar_log(tipo)\n logd = Logdocumento.new(:usuario_id => Usuario.current.id, \n :documento_id => self.id, \n :tipo => tipo, \n :producto_id => self.producto_id, \n :nusuario => Usuario.current.nombre, \n :ndocumento => self.TipoDocumento.descripcion, \n :nproducto => self.producto.nombre)\n\n return logd.save\n\n end", "def create\n @m_general = MGeneral.new(params[:m_general])\n\n respond_to do |format|\n if @m_general.save\n format.html { redirect_to(@m_general, :notice => 'M general was successfully created.') }\n format.xml { render :xml => @m_general, :status => :created, :location => @m_general }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @m_general.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updateTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"+String(tasklog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def create_new_log (log_data)\n new_log = Log.new()\n logs_columns = Log.column_lists\n string_columns = logs_columns[\"string_columns\"]\n string_columns.each do |string_column|\n new_log[string_column] = log_data[string_column]\n end\n time_columns = logs_columns[\"time_columns\"]\n time_columns.each do |time_column|\n new_log[time_column] = Time.at(log_data[time_column].to_f / 1000).getutc\n end\n if new_log[\"application\"].to_s == ''\n new_log[:application] = \"Unknown: \" + request.referer.to_s\n end\n new_log[:parameters] = log_data[\"parameters\"] || {}\n new_log[:extras] = log_data.reject do |key, value|\n key == \"parameters\" || string_columns.include?(key) || time_columns.include?(key)\n end\n\n # first commit the log to the database\n saved = new_log.save\n\n # and then send the log message to the AWS log manager if defined\n if ENV[\"AWS_LOG_MANAGER_URL\"]\n result = HTTParty.post(ENV[\"AWS_LOG_MANAGER_URL\"], :body => log_data.to_json, :headers => {\"Content-Type\" => \"application/json\"})\n if result.code != 201\n logger.error(result)\n end\n end\n\n return saved, new_log\n end", "def set_general\n @general = General.find(params[:id])\n end", "def set_general\n\t @general = General.find(params[:id])\n\t end", "def log \n @log #||= Log.create\n end", "def newlog(name, accesscode, status)\n @log = Log.new\n @log.name = name\n @log.accesscode = accesscode\n @log.status = status\n @log.gid = Guest.where(:name => name).first.try(:id)\n @log.save\n end", "def create\n @log = @task.logs.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @log }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to admin_log_path(@log), notice: 'Log was successfully created.' }\n# format.json { render action: 'show', status: :created, location: @log }\n format.json {render :json => { :success => :created}}\n else\n format.html { render action: 'new' }\n# format.json { render json: @log.errors, status: :unprocessable_entity }\n format.json { render :json => {:errors => @log.errors, :success => :failed}, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cgeneral = Cgeneral.new(params[:cgeneral])\n\n respond_to do |format|\n if @cgeneral.save\n format.html { redirect_to(@cgeneral, :notice => 'Cgeneral was successfully created.') }\n format.xml { render :xml => @cgeneral, :status => :created, :location => @cgeneral }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cgeneral.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @formlog = Formlog.new(params[:formlog])\n\n respond_to do |format|\n if @formlog.save\n flash[:notice] = 'Formlog was successfully created.'\n format.html { redirect_to(@formlog) }\n format.xml { render :xml => @formlog, :status => :created, :location => @formlog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @formlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @hospital_general = HospitalGeneral.new(hospital_general_params)\n\n respond_to do |format|\n if @hospital_general.save\n format.html { redirect_to @hospital_general, notice: 'Hospital general was successfully created.' }\n format.json { render :show, status: :created, location: @hospital_general }\n else\n format.html { render :new }\n format.json { render json: @hospital_general.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# Builds enttry for current user\n\t\t@fitness_log = current_user.fitness_logs.build(fitness_params)\n\t\tif @fitness_log.save # if save\n\t\t\tflash[:success] = \"Log Updated\"\n\t\telse\n\t\t\tflash[:error] = \"Failed to add log\"\n\t\tend\n\t\tredirect_to log_user_path(current_user)\n\tend", "def do_log(log)\r\n log.debug \"This is a message with level DEBUG\"\r\n log.info \"This is a message with level INFO\"\r\n log.warn \"This is a message with level WARN\"\r\n log.error \"This is a message with level ERROR\"\r\n log.fatal \"This is a message with level FATAL\"\r\nend", "def registrar_log(tipo)\n logp = Logproducto.new(:usuario_id => self.usuario_id, \n :producto_id => self.id, \n :tipo => tipo, \n :nusuario => self.usuario.nombre, \n :nproducto => self.nombre)\n return logp.save\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @log }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_homolog(new_homolog)\n @homologs[new_homolog.id] = new_homolog\n\n #TODO :implement for multiple alignments\n if @homologs[new_homolog.id].size == 2\n # HomoloGenie::Cost::calc_cost(@homologs[new_homolog.id])\n puts \"Calculating cost for: \"\n p @species\n puts \"At homolog \" + new_homolog.id.to_s + \"\\n\\n\"\n end #if\n end", "def create\n @log = Log.new(params[:log])\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render json: @log, status: :created, location: @log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.75810695", "0.5910373", "0.5597355", "0.53472376", "0.5316535", "0.52600914", "0.50749403", "0.50287175", "0.49866185", "0.49507076", "0.48273593", "0.4794948", "0.47909224", "0.47854152", "0.47738454", "0.47495914", "0.46370867", "0.46265438", "0.46098772", "0.45838755", "0.45838755", "0.45838755", "0.4567583", "0.45645443", "0.4553019", "0.45520523", "0.45309335", "0.44776237", "0.44762644", "0.44501704" ]
0.84833056
0
Update the details of a general log. ==== Parameters projectId:: ID of the project. generallog:: Generallog object. ==== Returns Generallog object.
def updateGenerallog(projectId, generallog) url = getBaseURL+"projects/"+String(projectId)+"/logs/"+String(generallog.getId)+"/" requestBody = generallog.toParamMAP requestBody["name"] = generallog.getName response = ZohoHTTPClient.post(url, getQueryMap, requestBody) return $timesheetParser.getGenerallog(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def updateTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"+String(tasklog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(response)\r\n\t\t\tend", "def deleteGenerallog(projectId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def update\n @log_pelea_blaz_blue_general = LogPeleaBlazBlueGeneral.find(params[:id])\n\n respond_to do |format|\n if @log_pelea_blaz_blue_general.update_attributes(params[:log_pelea_blaz_blue_general])\n format.html { redirect_to(@log_pelea_blaz_blue_general, :notice => 'Log pelea blaz blue general was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @log_pelea_blaz_blue_general.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updateBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"+String(buglog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend", "def update\n @m_general = MGeneral.find(params[:id])\n\n respond_to do |format|\n if @m_general.update_attributes(params[:m_general])\n format.html { redirect_to(@m_general, :notice => 'M general was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @m_general.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @liga_mvc3_general = LigaMvc3General.find(params[:id])\n\n respond_to do |format|\n if @liga_mvc3_general.update_attributes(params[:liga_mvc3_general])\n format.html { redirect_to(@liga_mvc3_general, :notice => 'Liga mvc3 general was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @liga_mvc3_general.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_general\n\t @general = General.find(params[:id])\n\t end", "def set_general\n @general = General.find(params[:id])\n end", "def getGenerallog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\tgenerallogs_array = timeLogs_json[\"timelogs\"][\"generallogs\"]\r\n\t\t\t\treturn jsonToGenerallog(generallogs_array[0])\r\n\t\t\tend", "def update\n @log = Log.find(params[:id])\n @logs = @goal.logs\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to goal_logs_url(@goal), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'index' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @formlog = Formlog.find(params[:id])\n\n respond_to do |format|\n if @formlog.update_attributes(params[:formlog])\n flash[:notice] = 'Formlog was successfully updated.'\n format.html { redirect_to(@formlog) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @formlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "def jsonToGenerallog(jsonObject)\r\n\t\t\t\tgenerallog = Generallog.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\tgenerallog.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\tgenerallog.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"notes\")\r\n\t\t\t\t\tgenerallog.setNotes(jsonObject[\"notes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"log_date\")\r\n\t\t\t\t\tgenerallog.setLogDate(jsonObject[\"log_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"log_date_format\")\r\n\t\t\t\t\tgenerallog.setLogDateFormat(jsonObject[\"log_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"log_date_long\")\r\n\t\t\t\t\tgenerallog.setLogDateLong(jsonObject[\"log_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"hours\")\r\n\t\t\t\t\tgenerallog.setHours(jsonObject[\"hours\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"minutes\")\r\n\t\t\t\t\tgenerallog.setMinutes(jsonObject[\"minutes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"hours_display\")\r\n\t\t\t\t\tgenerallog.setHoursDisplay(jsonObject[\"hours_display\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"total_minutes\")\r\n\t\t\t\t\tgenerallog.setTotalMinutes(jsonObject[\"total_minutes\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_id\")\r\n\t\t\t\t\tgenerallog.setOwnerId(jsonObject[\"owner_id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_name\")\r\n\t\t\t\t\tgenerallog.setOwnerName(jsonObject[\"owner_name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"bill_status\")\r\n\t\t\t\t\tgenerallog.setBillStatus(jsonObject[\"bill_status\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\tgenerallog.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn generallog\r\n\t\t\tend", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to admin_log_path(@log), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cgeneral = Cgeneral.find(params[:id])\n\n respond_to do |format|\n if @cgeneral.update_attributes(params[:cgeneral])\n format.html { redirect_to(@cgeneral, :notice => 'Cgeneral was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cgeneral.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @log = Log.find(params[:id])\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @general = General.find(params[:id])\n\n @general.general = params[:content][:general][:value]\n @general.annual_events = params[:content][:annual_events][:value]\n @general.transportation = params[:content][:transportation][:value]\n @general.bizhour = params[:content][:bizhour][:value]\n @general.prices = params[:content][:prices][:value]\n @general.money = params[:content][:money][:value]\n @general.safety = params[:content][:safety][:value]\n @general.emergency = params[:content][:emergency][:value]\n @general.useful = params[:content][:useful][:value]\n\n respond_to do |format|\n if @general.update_attributes(params[:general])\n format.html { redirect_to @general, notice: 'General was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @general.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @log = Log.find(params[:id])\n\n if @log.update(log_params)\n head :no_content\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @hospital_general.update(hospital_general_params)\n format.html { redirect_to @hospital_general, notice: 'Hospital general was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospital_general }\n else\n format.html { render :edit }\n format.json { render json: @hospital_general.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t \t@log = Log.find(params[:id])\n @all_projects = current_user.projects.where([\"active = ?\", true]).includes(:customer, {:todos => [:logs]})\n @customers = current_firm.customers\n @projects = current_firm.projects.where([\"active = ?\", true])\n \n @model = \"log\"\n @model_instanse = @log\n # regular update \n if !@log.todo.nil?\n if params[:done] == \"1\" \n \t\n @log.todo.completed = true\n @log.todo.save!\n \n elsif params[:done].nil?\n \t\n @log.todo.completed = false\n @log.todo.save!\n \n end\n end\n \n respond_to do |format|\n if @log.update_attributes!(params[:log])\n flash[:notice] = flash_helper(\"Log was successfully saved.\")\n \n format.js\n else\n format.js { render \"shared/validate_update\" }\n \n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @log }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to(@log, :notice => 'Log was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @general_information = GeneralInformation.find(params[:id])\n\n respond_to do |format|\n if @general_information.update_attributes(params[:general_information])\n format.html { redirect_to @general_information.personal_detail, notice: 'General information was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @general_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if autenticacion == \"admin\"\n @log_pelea_guilty = LogPeleaGuilty.find(params[:id])\n\n respond_to do |format|\n if @log_pelea_guilty.update_attributes(params[:log_pelea_guilty])\n format.html { redirect_to(@log_pelea_guilty, :notice => 'Log pelea guilty was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @log_pelea_guilty.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n @effort_log = EffortLog.find(params[:id])\n\n respond_to do |format|\n if @effort_log.update_attributes(params[:effort_log])\n format.html { redirect_to(:controller => \"effort_logs\", :action => \"index_by_project\",\n :id => @effort_log.project_phase_deliverable.project_phase.project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @effort_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @log = Log.find(params[:id])\n end" ]
[ "0.7433099", "0.59417474", "0.5861666", "0.55503225", "0.5535288", "0.54980934", "0.54008055", "0.51105887", "0.50986356", "0.50932467", "0.5079231", "0.507351", "0.5068042", "0.50541276", "0.505149", "0.5027356", "0.5014346", "0.49955258", "0.4991671", "0.4991671", "0.4991671", "0.49462688", "0.4933409", "0.49221766", "0.4910843", "0.4898658", "0.4855565", "0.4854615", "0.47825748", "0.4745338" ]
0.86089516
0
Delete an existing general log for the project. ==== Parameters projectId:: ID of the project. logId:: ID of the log. ==== Returns String object.
def deleteGenerallog(projectId, logId) url = getBaseURL+"projects/"+String(projectId)+"/logs/"+String(logId)+"/" response = ZohoHTTPClient.delete(url, getQueryMap) return $timesheetParser.getResult(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteTasklog(projectId, taskId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(taskId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def deleteBuglog(projectId, bugId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(bugId)+\"/logs/\"+String(logId)+\"/\"\t\t\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend", "def updateGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(generallog.getId)+\"/\"\t\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def delete_log(log_file = '')\n File.delete(log_file) if File.exists?(log_file) && $SYNC_CONFIG[:wipe_log]\n log_file\n end", "def delete_log name\n ensure_connection!\n resp = connection.delete_log name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end", "def addGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\treturn $timesheetParser.getGenerallog(response)\r\n\t\t\tend", "def delete_log_loggly(opts = {})\n data, _status_code, _headers = delete_log_loggly_with_http_info(opts)\n data\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_logs_url(@goal) }\n format.json { head :no_content }\n end\n end", "def delete_sleep_log(log_id)\n successful_delete?(delete(path_user_version(\"/sleep/#{log_id}\")))\n end", "def delete_water_log(log_id, opts={})\n delete(\"user/#{user_id}/foods/log/water/#{log_id}.json\", opts)\n end", "def delete_water_log(water_log_id)\n delete(\"/user/-/foods/log/water/#{water_log_id}.json\")\n end", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to admin_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n\n head :no_content\n end", "def delete_log\n unless UserSession.find == nil\n Log.create(user_id: UserSession.find.user.id, message: \n \"#{UserSession.find.user.name} har slettet rollen: #{self.name}\",\n logtype_id: 3)\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def delete_log_gcp_pubsub(opts = {})\n data, _status_code, _headers = delete_log_gcp_pubsub_with_http_info(opts)\n data\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n \n respond_to do |format|\n flash[:notice] = flash_helper('Log was deleted.')\n format.html { redirect_to logs_path }\n format.xml { head :ok }\n format.js\n end\n end", "def log(log_id)\n raise Auth0::MissingParameter, 'Must supply a valid log_id' if log_id.to_s.empty?\n path = \"#{logs_path}/#{log_id}\"\n get(path)\n end", "def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end", "def delete_log_hub_metric(metric_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['MetricName'] = metric_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/logHubMetrics/[MetricName]'\n\t\targs[:query]['Action'] = 'DeleteLogHubMetric'\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 @formlog = Formlog.find(params[:id])\n @formlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(formlogs_url) }\n format.xml { head :ok }\n end\n end", "def delete_body_fat_log(user_id: '-', log_id:)\n delete(\"#{API_URI}/#{BODY_API_VERSION}/user/#{user_id}/body/log/fat/#{log_id}.json\")\n end", "def delete(projectId, documentId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/documents/\"+String(documentId)+\"/\"\r\n\t\t\t\tresponse = Projects::Util::ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $documentParser.getResult(response)\r\n\t\t\tend", "def load_log(log_id)\n service.get log_path(log_id)\n end", "def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to dlogs_url }\n format.json { head :no_content }\n end\n end", "def delete(project_id)\n raw_response = delete_request(\"projects/#{project_id}\")\n parse_response(raw_response)\n end", "def delete(project_id)\n raw_response = delete_request(\"projects/#{project_id}\")\n parse_response(raw_response)\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n respond_to do |format|\n format.html { redirect_to index_logs_path(params[:device_id], :page => 1) }\n format.json { head :no_content }\n end\n end", "def delete_body_fat_log(body_fat_log_id, options = {})\n successful_delete?(delete(path_user_version(\"/body/log/fat/#{body_fat_log_id}\", options)))\n end" ]
[ "0.72782505", "0.709319", "0.6227472", "0.60458577", "0.6035807", "0.5991523", "0.58855873", "0.57131463", "0.5693283", "0.5641964", "0.55347586", "0.55156606", "0.5511078", "0.5510426", "0.5468517", "0.5468517", "0.5423575", "0.53990316", "0.5356973", "0.53476304", "0.5297565", "0.52959293", "0.5287961", "0.5259928", "0.523506", "0.51885015", "0.5172464", "0.5172464", "0.5171265", "0.51668835" ]
0.86152554
0
Resolve security group names to their ids in the given VPC
def get_vpc_security_group_ids(vpc_id, group_names) group_map = {} @log.info "resolving security groups #{group_names} in #{vpc_id}" ec2.describe_security_groups(filters: [{ name: 'vpc-id', values: [vpc_id] }]). each do |response| response.security_groups.each do |sg| group_map[sg.group_name] = sg.group_id end end group_ids = [] group_names.each do |sg_name| raise "Couldn't find security group #{sg_name} in #{vpc_id}" unless group_map.has_key?(sg_name) group_ids << group_map[sg_name] end group_ids end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_security_group(name, vpc_id)\n sg = ec2.create_security_group({\n group_name: name,\n description: \"Kontena Grid\",\n vpc_id: vpc_id\n })\n\n sg.authorize_ingress({ # SSH\n ip_protocol: 'tcp', from_port: 22, to_port: 22, cidr_ip: '0.0.0.0/0'\n })\n sg.authorize_ingress({ # HTTP\n ip_protocol: 'tcp', from_port: 80, to_port: 80, cidr_ip: '0.0.0.0/0'\n })\n sg.authorize_ingress({ # HTTPS\n ip_protocol: 'tcp', from_port: 443, to_port: 443, cidr_ip: '0.0.0.0/0'\n })\n sg.authorize_ingress({ # OpenVPN\n ip_protocol: 'udp', from_port: 1194, to_port: 1194, cidr_ip: '0.0.0.0/0'\n })\n sg.authorize_ingress({ # Overlay / Weave network\n ip_permissions: [\n {\n from_port: 6783, to_port: 6783, ip_protocol: 'tcp',\n user_id_group_pairs: [\n { group_id: sg.group_id, vpc_id: vpc_id }\n ]\n },\n {\n from_port: 6783, to_port: 6784, ip_protocol: 'udp',\n user_id_group_pairs: [\n { group_id: sg.group_id, vpc_id: vpc_id }\n ]\n }\n ]\n })\n\n sg\n end", "def vpc_security_groups\n vsgs = []\n @dbi.vpc_security_groups.each do |vsg|\n vsgs << vsg.vpc_security_group_id if vsg.status == 'active'\n end\n vsgs\n end", "def vpc_security_groups\n vsgs = []\n @dbi.vpc_security_groups.each do |vsg|\n vsgs << vsg.vpc_security_group_id if vsg.status == 'active'\n end\n vsgs\n end", "def select_security_group\n compute.security_groups.each { |s| [s.name, s.id] }\n end", "def security_group\n node = 'AWS_SECURITY_GROUP'\n q = []\n\n # security_group node\n q.push(_upsert({ node: node, id: @name }))\n\n # vpc node and relationship\n if @data.vpc_id\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_VPC',\n child_name: @data.vpc_id,\n relationship: 'MEMBER_OF_VPC'\n }\n\n q.push(_upsert_and_link(opts))\n end\n\n # ingress rules\n @data.ip_permissions.each do |ingress|\n ingress.ip_ranges.each_with_index do |ip_range, i|\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_SECURITY_GROUP_INGRESS_RULE',\n child_name: \"#{@name}-#{ingress.ip_protocol}-#{ingress.to_port}-#{i}\",\n relationship: 'HAS_INGRESS_RULE',\n relationship_attributes: {\n cidr_ip: ip_range.cidr_ip,\n ip_protocol: ingress.ip_protocol,\n to_port: ingress.to_port,\n from_port: ingress.from_port,\n direction: 'ingress'\n }\n }\n\n q.push(_upsert_and_link(opts))\n end\n end\n\n # egress rules\n @data.ip_permissions_egress.each do |egress|\n egress.ip_ranges.each_with_index do |ip_range, i|\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_SECURITY_GROUP_EGRESS_RULE',\n child_name: \"#{@name}-#{egress.ip_protocol}-#{egress.to_port}-#{i}\",\n relationship: 'HAS_EGRESS_RULE',\n relationship_attributes: {\n cidr_ip: ip_range.cidr_ip,\n ip_protocol: egress.ip_protocol,\n to_port: egress.to_port,\n from_port: egress.from_port,\n direction: 'egress'\n }\n }\n\n q.push(_upsert_and_link(opts))\n end\n end\n\n q\n end", "def vpc_security_groups\n data[:vpc_security_groups]\n end", "def vpc_security_groups\n data[:vpc_security_groups]\n end", "def subnets_to_aws\n @subnets.map do |local_subnet|\n if local_subnet =~ /^subnet-[a-zA-Z0-9]+$/\n EC2::id_subnets[local_subnet]\n else\n # Assume its in vpc/subnet form\n vpc, subnet = local_subnet.split(\"/\")\n aws_vpc = EC2::id_vpcs[vpc] || EC2::named_vpcs[vpc]\n if !aws_vpc\n raise \"Could not find vpc for #{local_subnet}\"\n end\n aws_subnet = EC2::vpc_subnets[aws_vpc.vpc_id].find { |s| s.subnet_id == subnet || s.name == subnet }\n if !aws_subnet\n raise \"Could not find subnet for #{local_subnet}\"\n end\n aws_subnet\n end\n end\n end", "def authorize_ec2_security_group(group_name, group_owner_id=owner_id)\n key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'\n authorize_ingress({\n key => group_name,\n 'EC2SecurityGroupOwnerId' => group_owner_id\n })\n end", "def lookup_security_group_names(instance_info)\n group_names = []\n # puts \"lookup_security_group_names(#{instance_info.inspect})\"\n instance_info['groupSet']['item'].each() {|group_info|\n group_name = group_info['groupName'] || group_info['groupId']\n group_names << group_name\n }\n group_names\n end", "def security_groups\n catch_aws_errors do\n @security_groups ||= instance.security_groups.map do |sg|\n { id: sg.group_id, name: sg.group_name }\n end\n end\n end", "def create_and_setup_SGs(client, vpc_id)\n # Create security group for private subnet ingress TCP port 80 (for httpd (nginx)).\n puts 'Creating security group for ingress TCP port 80 on private subnet...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_priv',\n description: 'Ingress TCP HTTP:80 priv subnet',\n vpc_id: vpc_id)\n sg_tcp_80_priv = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_priv}]\"\n\n # Create security group for public LBs ingress TCP port 80.\n puts 'Creating security group for ingress TCP port 80 for LBs...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_lb',\n description: 'Ingress TCP HTTP:80 LBs',\n vpc_id: vpc_id)\n sg_tcp_80_lb = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_lb}]\"\n\n\n # Create security group for private subnet ingress TCP port 22 (for sshd).\n puts 'Creating security group for ingress TCP port 22 for private subnet...'\n response = client.create_security_group(group_name: 'sg_in_tcp_22_priv',\n description: 'Ingress TCP SSH:22 priv subnet',\n vpc_id: vpc_id)\n sg_tcp_22_priv = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_22_priv}]\"\n\n # Create security group for ingress TCP port 22 (for sshd) for public nat instances.\n puts 'Creating security group for ingress TCP port 22 for public nat instances...'\n response = client.create_security_group(group_name: 'sg_in_tcp_22_pub',\n description: 'Ingress TCP SSH:22 NAT instances',\n vpc_id: vpc_id)\n sg_tcp_22_pub = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_22_pub}]\"\n\n # Create security group for ingress TCP port 80 (for nginx instance updates) through nat instances.\n puts 'Creating security group for ingress TCP port 80 for NAT instance...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_nat',\n description: 'Ingress TCP HTTP:80 to/through NAT instances',\n vpc_id: vpc_id)\n sg_tcp_80_nat = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_nat}]\"\n\n # Add an ingress rule of *any* (0.0.0.0/0) to the TCP port 80 private subnet security group.\n puts 'Adding ingress rule of *any* to the TCP port 80 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_priv,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '0.0.0.0/0') # TODO: limit to aws LB address space\n puts 'Rule added.'\n\n # Add an ingress rule of *any* (0.0.0.0/0) to the TCP port 80 LB security group.\n puts 'Adding ingress rule of *any* to the TCP port 80 LB security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_lb,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '0.0.0.0/0')\n puts 'Rule added.'\n\n # Add an ingress rule of (10.0.0.0/16) to the TCP port 80 for the nat instances.\n puts 'Adding ingress rule of (10.0.0.0/16) to the TCP port 80 for the private nat instance side...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_nat,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '10.0.0.0/16')\n puts 'Rule added.'\n\n # Add an ingress rule of 10.0.100.0/24 to the TCP port 22 private subnet security group.\n puts 'Adding ingress rule of 10.0.100.0/24 to the TCP port 22 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_22_priv,\n ip_protocol: 'tcp',\n from_port: 22, # This is the start of the port range\n to_port: 22, # This is the end of the port range\n cidr_ip: '10.0.100.0/24') # eg. for ssh access from nat instance\n puts 'Rule added.'\n\n # Add an ingress rule of 10.0.200.0/24 to the TCP port 22 private subnet security group.\n puts 'Adding ingress rule of 10.0.200.0/24 to the TCP port 22 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_22_priv,\n ip_protocol: 'tcp',\n from_port: 22, # This is the start of the port range\n to_port: 22, # This is the end of the port range\n cidr_ip: '10.0.200.0/24') # eg. for ssh access from nat instance\n puts 'Rule added.'\n\n # Add an ingress rule of your choice here to the TCP port 22 public subnet security group.\n # puts 'Adding ingress rule of x.x.x.x/32 to the TCP port 22 public subnet security group...'\n # client.authorize_security_group_ingress(group_id: sg_tcp_22_pub,\n # ip_protocol: 'tcp',\n # from_port: 22, # This is the start of the port range\n # to_port: 22, # This is the end of the port range\n # cidr_ip: 'x.x.x.x/32') # Replace this with your src IP.\n # puts 'Rule added.'\n return sg_tcp_80_priv, sg_tcp_22_priv, sg_tcp_22_pub, sg_tcp_80_nat, sg_tcp_80_lb\nend", "def adjust_security_groups\n\n all_regions.each do |region|\n c = connection(region)\n g = c.security_groups.get(primary_group)\n \n g.authorize_port_range(1024..65535, :cidr_ip => \"#{master.public_ip_address}/32\")\n nodes.each do |node|\n g.authorize_port_range(1024..65535, :cidr_ip => \"#{node.public_ip_address}/32\")\n end\n end\n end", "def update_security_groups(elb_name, vpc_id, security_groups)\n @elb.apply_security_groups_to_load_balancer({\n load_balancer_name: elb_name,\n security_groups: security_groups.map do |sg_name|\n SecurityGroups::vpc_security_groups[vpc_id][sg_name].group_id\n end\n })\n end", "def aws_vpc_security_groups_get(opts)\n opts[:vpc].security_groups.select{ |sg| !sg.name == \"default\"}\n end", "def security_group_to_security_group(_options = {})\n return {} if ar_ems.nil?\n\n cloud_network = field(:cloud_network)\n return {} if cloud_network.nil?\n\n ar_security_group = ar_ems.security_groups.select { |security_group| security_group.cloud_network.ems_ref == cloud_network }\n index_dropdown(ar_security_group)\n rescue => e\n logger(__method__).ui_exception(e)\n end", "def aws_vpc_security_group_get(opts)\n opts[:vpc].security_groups.first\n end", "def apply_security_groups_to_load_balancer(security_group_ids, lb_name)\n params = Fog::AWS.indexed_param('SecurityGroups.member', [*security_group_ids])\n request({\n 'Action' => 'ApplySecurityGroupsToLoadBalancer',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::ApplySecurityGroupsToLoadBalancer.new\n }.merge!(params))\n end", "def security_groups\n @resource.security_groups.map { |sg| SecurityGroup.new(id: sg.group_id, ec2_resource: @ec2_resource) }\n end", "def revoke_ec2_security_group(group_name, group_owner_id=owner_id)\n key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'\n revoke_ingress({\n key => group_name,\n 'EC2SecurityGroupOwnerId' => group_owner_id\n })\n end", "def describe_security_groups(list=[])\n result = [] \n @ec2.describe_security_groups(list).each do |item|\n perms = []\n item.ipPermissions.each do |perm|\n perm.groups.each do |ngroup|\n perms << {:group => ngroup.groupName,\n :owner => ngroup.userId}\n end\n perm.ipRanges.each do |cidr_ip|\n perms << {:from_port => perm.fromPort, \n :to_port => perm.toPort, \n :protocol => perm.ipProtocol,\n :cidr_ips => cidr_ip}\n end\n end\n \n # delete duplication\n perms.each_index do |i|\n (0...i).each do |j|\n if perms[i] == perms[j] then perms[i] = nil; break; end\n end\n end\n perms.compact!\n\n result << {:aws_owner => item.ownerId, \n :aws_group_name => item.groupName, \n :aws_description => item.groupDescription,\n :aws_perms => perms}\n end \n return result\n rescue Exception\n on_query_exception('describe_security_groups')\n end", "def authorize_security_group_IP_ingress(name, owner, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n @ec2.autorize_security_group_ingress_IP(name, protocol, from_port, to_port, cidr_ip) \n rescue Exception\n on_query_exception('authorize_security_group_IP_ingress')\n end", "def id_vpcs\n @vpc_ids ||= Hash[vpcs.map { |vpc| [vpc.vpc_id, vpc] }]\n end", "def security_group=(new_cidr_block)\n new_cidr_block = new_cidr_block + '/32' unless new_cidr_block.include? \"/\"\n @environment.vpc.security_groups.each do |sg|\n @security_group = sg if sg.group_name == 'SshSecurityGroup' + new_cidr_block\n end\n\n # only create security group if it does not exist\n if @security_group.nil?\n ec2 = Aws::EC2::Resource.new(region: 'us-west-2')\n\n @security_group = ec2.create_security_group(\n group_name: 'SshSecurityGroup' + new_cidr_block,\n description: 'Enable SSH access via port 22',\n vpc_id: @environment.vpc.id\n )\n\n @security_group.authorize_egress(\n ip_permissions: [\n ip_protocol: 'tcp',\n from_port: 22,\n to_port: 22,\n ip_ranges: [\n cidr_ip: new_cidr_block\n ]\n ]\n )\n end\n end", "def modify_security_group(db_instance_identifier, vpc_security_groups)\n modify_db_instance(db_instance_identifier: db_instance_identifier, vpc_security_group_ids: vpc_security_groups)\n end", "def create_secgroup(group)\n connect = aws_api_connect('EC2_Client')\n begin\n p group[:name]\n sec_id = connect.describe_security_groups({\n filters: [\n {\n name: \"group-name\",\n values: [group[:name]],\n },\n ],\n }).security_groups[0].group_id\n return sec_id\n rescue => e\n not_created = true\n end\n\n if not_created == true\n resp = aws_api_connect(\"EC2_Resource\")\n pants = resp.create_security_group({\n group_name: group[:name], # required\n description: group[:description], # required\n vpc_id: group[:vpc_id],\n })\n secgroup_id = pants.id\n puts \"Created secgroup id #{group[:name]} with id #{secgroup_id}.\"\n return secgroup_id\n end\n end", "def vpc_subnets\n @group.vpc_zone_identifier.split(',').map(&:strip)\n end", "def convert_security_groups_to_ids(security_groups)\n security_group_ids = security_groups.map do |group_name|\n group = @compute_provider.security_groups.get(group_name)\n group.group_id if group\n end\n security_group_ids.compact\n end", "def createSubnetGroup\n subnet_ids = []\n if @config[\"vpc\"] && !@config[\"vpc\"].empty?\n raise MuError.new \"Didn't find the VPC specified for #{@mu_name}\", details: @config[\"vpc\"].to_h unless @vpc\n\n vpc_id = @vpc.cloud_id\n\n # Getting subnet IDs\n if @config[\"vpc\"][\"subnets\"].empty?\n @vpc.subnets.each { |subnet|\n subnet_ids << subnet.cloud_id\n }\n MU.log \"No subnets specified for #{@config['identifier']}, adding all subnets in #{@vpc}\", MU::DEBUG\n else\n @config[\"vpc\"][\"subnets\"].each { |subnet|\n subnet_obj = @vpc.getSubnet(cloud_id: subnet[\"subnet_id\"].to_s, name: subnet[\"subnet_name\"].to_s)\n raise MuError.new \"Couldn't find a live subnet matching #{subnet} in #{@vpc}\", details: @vpc.subnets if subnet_obj.nil?\n subnet_ids << subnet_obj.cloud_id\n }\n end\n else\n # If we didn't specify a VPC try to figure out if the account has a default VPC\n vpc_id = nil\n subnets = []\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_vpcs.vpcs.each { |vpc|\n if vpc.is_default\n vpc_id = vpc.vpc_id\n subnets = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_subnets(\n filters: [\n {\n name: \"vpc-id\", \n values: [vpc_id]\n }\n ]\n ).subnets\n break\n end\n }\n\n if !subnets.empty?\n mu_subnets = []\n subnets.each { |subnet|\n subnet_ids << subnet.subnet_id\n mu_subnets << {\"subnet_id\" => subnet.subnet_id}\n }\n\n @config['vpc'] = {\n \"vpc_id\" => vpc_id,\n \"subnets\" => mu_subnets\n }\n\n MU.log \"Using default VPC for cache cluster #{@config['identifier']}\"\n end\n end\n\n if subnet_ids.empty?\n raise MuError, \"Can't create subnet group #{@config[\"subnet_group_name\"]} because I couldn't find a VPC or subnets\"\n else\n MU.log \"Creating subnet group #{@config[\"subnet_group_name\"]} for cache cluster #{@config['identifier']}\"\n\n MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_cache_subnet_group(\n cache_subnet_group_name: @config[\"subnet_group_name\"],\n cache_subnet_group_description: @config[\"subnet_group_name\"],\n subnet_ids: subnet_ids\n )\n\n allowBastionAccess\n\n if @dependencies.has_key?('firewall_rule')\n @config[\"security_group_ids\"] = []\n @dependencies['firewall_rule'].values.each { |sg|\n @config[\"security_group_ids\"] << sg.cloud_id\n }\n end\n end\n end", "def revoke_security_group_IP_ingress(name, owner, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n @ec2.revoke_security_group_ingress_IP(name, protocol, from_port, to_port, cidr_ip) \n rescue Exception\n on_query_exception('revoke_security_group_IP_ingress')\n end" ]
[ "0.6421951", "0.60523486", "0.60523486", "0.59858024", "0.5910377", "0.590571", "0.590571", "0.574062", "0.5737266", "0.57033783", "0.56034845", "0.5554998", "0.5508641", "0.54767305", "0.54542273", "0.54423124", "0.5420101", "0.54068077", "0.53830445", "0.53771174", "0.5308918", "0.5292589", "0.5284783", "0.52757984", "0.52077985", "0.520604", "0.5186051", "0.51699954", "0.51679283", "0.516207" ]
0.68202025
0
POST /alerts or /alerts.json
def create @alert = Alert.new(alert_params) respond_to do |format| if @alert.save format.html { redirect_to root_path, notice: "Has creado una nueva alerta. Pronto te avisaremos cuando encontremos lo que buscas" } format.json { render :show, status: :created, location: @alert } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @alert.errors, status: :unprocessable_entity } end 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 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 alerts(type = 'price')\n authenticated_post(\"auth/r/alerts\", params: {type: type}).body\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 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 !@alert.nil? && @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 enable_alert_feature \n put(\"/globalsettings.json/alerts/enable\")\nend", "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 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\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 @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_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 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 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 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 @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\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 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 post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "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 post(request)\n # sure thing!\n json_response(200, { message: \"This dummy POST endpoint didn't do anything.\" })\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 index\n \t#render json: Api::Alert.all, status: :ok\n \tend", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def alerts(query)\n get_json(\"#{api_url}/alerts/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\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 # 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 disable_alert_feature \n put(\"/globalsettings.json/alerts/disable\")\nend", "def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end", "def 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" ]
[ "0.66645277", "0.6408699", "0.62529373", "0.6199479", "0.6155851", "0.6121954", "0.6121954", "0.6100382", "0.6080726", "0.6074785", "0.6049897", "0.5976953", "0.59527975", "0.59466314", "0.5938756", "0.5926984", "0.59240925", "0.59033805", "0.5862788", "0.585587", "0.5824317", "0.5806898", "0.5786556", "0.5762095", "0.5757895", "0.5755868", "0.57403433", "0.5720669", "0.5705447", "0.56211275" ]
0.6582375
1
GET /push_notifications/1 GET /push_notifications/1.json
def show @push_notification = PushNotification.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @push_notification } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end", "def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end", "def notifications(params={})\n Endpoints::Notifications.new(self).get(params)\n end", "def api_payment_get_notification\n\n raise \"No notification ID\" unless @payment_notification_id\n\n url = \"#{@config['api_host']}/1/payments/notifications/#{@payment_notification_id}?access_token=#{@oauth_token}\"\n\n puts \"Finding notification info...\"\n log_error \"Request: #{url}\" if @debug >= AttApiReporter::DEBUG_INFO\n\n begin\n page = @agent.get(url)\n notificationStatus = JSON.parse(page.body)\n log_error JSON.pretty_generate(notificationStatus)\n rescue Exception => e\n log_error e.backtrace\n log_error e.page.body\n end\n end", "def new\n @push_notification = PushNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @push_notification }\n end\n end", "def push(notif)\n\n end", "def notifications\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get first 50 notifications (github paginates at 50)\n notifications = @client.notifications({all: true, per_page: 50})\n\n # if there are more pages, get page 2\n more_pages = @client.last_response.rels[:next]\n if more_pages\n notifications.concat more_pages.get.data\n end\n\n # Consider how to get more pages...\n # page_count = 0\n # while more_pages and page_count < 10\n # notifications.concat more_pages.get.data\n # page_count++\n # more_pages = @client.last_response.rels[:next]\n # end\n\n # iterate over notifications to:\n # add score value\n # add notification_url value\n @json = notifications.map do |notification|\n add_score_url_to_notification(notification, {favRepos: @current_user.UserPreference.repos})\n end\n\n respond_to do |format|\n format.json {\n render json: @json.to_json, status: 200\n }\n end\n end", "def index\n @notifications = Notification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notifications }\n end\n end", "def show\n render json: @notification\n end", "def index\n notifications = params[:unread].nil? || params[:unread] == 0 ? current_user.notifications : Notification.where(user: current_user, status: :unread).all\n\n render json: {\n status: 'Success',\n message: '',\n notifications: notifications.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end", "def show\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notification }\n end\n end", "def index\n @notifications = Notification.all\n @notifications = @notifications.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @notifications }\n end", "def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end", "def notifications\n response = query_api(\"/rest/notifications\")\n return response[\"notifications\"].map {|notification| Notification.new(self, notification)}\n end", "def list_notifications\n BrickFTP::API::Notification.all\n end", "def list_notifications\n BrickFTP::API::Notification.all\n end", "def notifications(page = 1)\n\t\t\toptions = {\"page\" => page}\n\t\t\tdata = oauth_request(\"/notifications.xml\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend", "def notify_by_push\n PushNotification.new(user: context.user,\n message: context.message,\n n_type: context.n_type,\n data: { from_id: context.user_from.try(:id), from_name: context.user_from.try(:name),\n donation_id: context.donation.try(:id) })\n .simple_notification\n end", "def index\n @kpi_notifications = KpiNotification.all\n end", "def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end", "def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n respond_with @notifications = Notification.latest.paginate(:page => params[:page], :per_page => 100)\n end", "def index\n @pushups = current_user.pushups.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pushups }\n end\n end", "def index\n # @notifications = current_user.notifications\n @notifications = @notifications.order(\"id desc\")\n\n if !params[:search].blank?\n @notifications = @notifications&.search(params[:search])\n end\n\n total = @notifications&.count\n\n @notifications = @notifications&.paginate(per_page: params[:per_page], page: params[:page])\n\n render json: {\n data: @notifications.collect{|n| NotificationSerializer.new(n).attributes},\n meta: {\n current_page: params[:page],\n per_page: params[:per_page],\n total: total\n }\n }\n end", "def push_notifications\n # post \"/push\" do\n Webpush.payload_send(\n message: params[:message],\n endpoint: params[:subscription][:endpoint],\n p256dh: params[:subscription][:keys][:p256dh],\n auth: params[:subscription][:keys][:auth],\n vapid: {\n subject: \"mailto:sender@example.com\",\n public_key: ENV['VAPID_PUBLIC_KEY'],\n private_key: ENV['VAPID_PRIVATE_KEY']\n }\n )\n end", "def show\n @emails = JSON.parse(@notification.fetch_emails)\n end", "def index\n @notifications = Notification.all\n end", "def index\n @notifications = Notification.all\n end", "def index\n @notifications = Notification.all\n end", "def index\n @notifications = Notification.all\n end" ]
[ "0.71470237", "0.71149594", "0.702024", "0.6739455", "0.67365307", "0.65377253", "0.6502985", "0.6464229", "0.6418267", "0.6395495", "0.63823366", "0.63689196", "0.6342196", "0.6319888", "0.62753266", "0.62753266", "0.62730664", "0.622044", "0.6213916", "0.6213185", "0.61519766", "0.61481154", "0.613111", "0.6116113", "0.6084836", "0.6077988", "0.60543036", "0.60543036", "0.60543036", "0.60543036" ]
0.7308819
0
GET /push_notifications/new GET /push_notifications/new.json
def new @push_notification = PushNotification.new respond_to do |format| format.html # new.html.erb format.json { render json: @push_notification } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @push_notification = PushNotification.new(params[:push_notification])\n\n respond_to do |format|\n if @push_notification.save\n format.html { redirect_to @push_notification, notice: 'Push notification was successfully created.' }\n format.json { render json: @push_notification, status: :created, location: @push_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @push_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_with @notification = @application.notifications.new\n end", "def new\n @notify = Notify.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify }\n end\n end", "def new\n\n @notification = Notification.new\n @current_user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notification }\n end\n end", "def new\n @pushup = Pushup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pushup }\n end\n end", "def new\n @payment_notification = PaymentNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_notification }\n end\n end", "def new\n @new_city_notification = NewCityNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_city_notification }\n end\n end", "def new\n @eve_notification = EveNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @eve_notification }\n end\n end", "def new\n @alarm_notification = AlarmNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alarm_notification }\n end\n end", "def new\n @notification = Notification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification }\n end\n end", "def new\n @notification = current_user.notifications.new\n load_context\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification }\n end\n end", "def create\n @notification = Notification.new(params[:notification])\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render json: @notification, status: :created, location: @notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n if @notification.save\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def new\n @job_notification = JobNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_notification }\n end\n end", "def new\n @apn_notification = APN::Notification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @apn_notification }\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notification }\n else\n format.html { render action: 'new' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notification }\n else\n format.html { render action: 'new' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pushup_reminder = @user.presence ? @user.pushup_reminders.build : PushupReminder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pushup_reminder }\n end\n end", "def new\n @notify_observer = NotifyObserver.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @notify_observer }\n end\n end", "def new\n=begin\n @notification_log = NotificationLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notification_log }\n end\n=end\n end", "def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def create\n @Notification = Notification.new(params[:note])\n @Notification.state = \"new\";\n \n respond_to do |format| \n format.html { render :action => \"new\" }\n format.xml { render :xml => @Notification.errors, :status => :created }\n end\n end", "def new\n authorize! :create, NotificationTemplate.new\n\n @notification_template = NotificationTemplate.new\n @supported_events = Notifier.supported_events\n @supported_formats = Notifier.supported_formats\n #prepare some help text arrays for available tokens\n @available_tokens = self.notification_tokens\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification_template }\n end\n end", "def new\n @notification_type = NotificationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification_type }\n end\n end", "def create\n @notification = Notification.new(params[:notification])\n @notification.user_id = current_user.id\n\n respond_to do |format|\n if @notification.save\n push_notification(@notification.id, @notification.car.device_token, @notification.text) if @notification.car.device_token\n format.html { redirect_to notifications_path, notice: t(\"activerecord.models.notification\") + t(\"message.created\") }\n format.json { render json: @notification, status: :created, location: @notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @notify_config = NotifyConfig.new\n\n add_breadcrumb('Create Notification Configuration')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify_config }\n end\n end", "def create\n @notification = Notification.new(notification_params)\n if @notification.save\n Notifier.send_notification(@notification)\n render json: \"Created succesfully\", status: :ok\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def create\n authorize(Notification)\n @notification = Notification.new(notification_params)\n # Will eventually need to be removed if we introduce new notification types\n @notification.notification_type = 'global'\n if @notification.save\n flash.now[:notice] = success_message(@notification, _('created'))\n redirect_to edit_super_admin_notification_path(@notification)\n else\n flash.now[:alert] = failure_message(@notification, _('create'))\n render :new\n end\n end" ]
[ "0.7425958", "0.73184174", "0.7194499", "0.7119298", "0.7028306", "0.6984908", "0.697821", "0.6941635", "0.6912806", "0.6861983", "0.68489474", "0.68405056", "0.68377465", "0.67580867", "0.67577994", "0.67005837", "0.67005837", "0.6647367", "0.6646978", "0.65984", "0.65745527", "0.6551399", "0.6504932", "0.648895", "0.64742106", "0.64696455", "0.64470327", "0.642661", "0.6406871", "0.6398703" ]
0.81968904
0
DELETE /push_notifications/1 DELETE /push_notifications/1.json
def destroy @push_notification = PushNotification.find(params[:id]) @push_notification.destroy respond_to do |format| format.html { redirect_to push_notifications_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @notification.destroy\n send_success_json(@notification.id, {:msg => \"deleted\"})\n else\n send_error_json(@notification.id, \"delete_error\", 400)\n end\n end", "def destroy\n #@notification = Notification.find(params[:id])\n #@notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to app_notifications_url, notice: 'Notifiation was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n head :no_content \n end", "def destroy\n @notification = current_user.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification = @application.notifications.find(params[:id])\n @notification.destroy\n\n respond_with @notification\n end", "def destroy\n @push = Push.find(params[:id])\n @push.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_pushes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_Notification\n dest = Notification.where(id: params[:idNotification]).first\n if (dest) \n Notification.where(id: params[:idNotification]).destroy_all\n render json: { status: 'SUCCESS', message: 'ELIMINACION EXITOSA'}, status: :ok\n else\n render json: { status: 'INVALID', message: 'NOTIFICACION NO ENCONTRADA'}, status: :unauthorized\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @eve_notification = EveNotification.find(params[:id])\n @eve_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to eve_notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "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 destroy\n client = current_user.find_client(params[:client_id])\n @notification = client.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to client_notifications_url(client) }\n end\n end", "def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to project_notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n @notification = Users::Notification.find_by_id(params[:id])\n @notification.set_status_deleted\n\n respond_to do |format|\n format.html { redirect_to notification_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.73669475", "0.7322984", "0.7322984", "0.7322984", "0.7322984", "0.72661036", "0.7231263", "0.7179823", "0.7177439", "0.71410805", "0.71193784", "0.7118383", "0.709722", "0.7091996", "0.70538527", "0.7053221", "0.7049058", "0.70370585", "0.70303464", "0.70303464", "0.70303464", "0.70303464", "0.70303464", "0.70020014", "0.69937474", "0.69911766", "0.6980331", "0.69797266", "0.697344", "0.6969815" ]
0.78665096
0
The host on which this process' tasks run This is always 'localhost' as ruby tasks are instanciated inside the ruby process
def host_id; 'localhost' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host\n @manager.primary_pool.host\n end", "def get_host\n @host\n end", "def host\n 'localhost'\n end", "def host\n @host\n end", "def host\r\n return for_context(nil, false) { |c| c.host }\r\n end", "def hostname\n name + '.localhost'\n end", "def local_host\n get('beef.http.host') || '0.0.0.0'\n end", "def host\n self.host\n end", "def host\n '127.0.0.1'\n end", "def host\n @host\n end", "def host\n @host\n end", "def host\n return @host\n end", "def host\n return @host\n end", "def host\n Socket.gethostname\n end", "def host\n Socket.gethostname\n end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def server_host\n Socket.gethostname\n end", "def host\n @connection.host\n end", "def beef_host\n public_host || local_host\n end", "def host_with_port\n WaterManager.singleton.http_host\n end", "def remote_host\n @remote_host || ::REMOTE_HOST\n end", "def current_host\n @current_host ||= \"#{request.protocol}#{request.host_with_port}\"\n end" ]
[ "0.7599148", "0.75907105", "0.75867385", "0.7541308", "0.7479843", "0.74679273", "0.73633075", "0.7356637", "0.73507243", "0.7324868", "0.7324868", "0.7320991", "0.7320991", "0.7307072", "0.73064476", "0.7283643", "0.7283643", "0.7283643", "0.7283643", "0.7283643", "0.7283643", "0.7283643", "0.7283643", "0.7283643", "0.7253057", "0.7165989", "0.7141895", "0.7107567", "0.70467436", "0.7028531" ]
0.76236296
0
The PID of the process in which the tasks run This is always Process.pid as ruby tasks are instanciated inside the ruby process
def pid; ::Process.pid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pid\n @pid ||= Process.pid\n end", "def pid\n @pid ||= Process.pid\n end", "def pid\n @pid ||= Process.pid\n end", "def pid\n $PROCESS_ID\n end", "def _pid\n @@_pid ||= Process.pid\n end", "def ppid\n Process.ppid\n end", "def pid\n @__pid\n end", "def pid() end", "def pid() end", "def pid() end", "def pid\n @pid\n end", "def get_pid\n\t\tEventMachine::get_subprocess_pid @signature\n\tend", "def process_id\n\n\t\t::Pantheios::Core.process_id\n\tend", "def pid; end", "def pid; end", "def pid; end", "def pid\n File.read(@pid_file).to_i\n end", "def pid\n `cat #{pid_file_path}`.gsub(\"\\n\", \"\")\n end", "def pid\n nil\n end", "def pid\n pid = nil\n begin\n pid = capture :pgrep, \"-o -f resque-pool\"\n rescue SSHKit::Command::Failed\n end\n \n pid \n end", "def pid\n @pid ||= metadata.fetch(@args.command, nil)\n end", "def pid()\n #This is a stub, used for indexing\n end", "def service_pid\n _pid_file_pid\n end", "def pid\n raise \"pid() must be overridden\"\n end", "def process_id\n return @process_id\n end", "def pid\n end", "def pid(*) end", "def pid\n File.read(@pid_file).strip.to_i\n end", "def pid\n @child_pid\n end", "def pid\n process_pid = ::Process.pid\n if @ppid != process_pid\n @pid = nil\n @ppid = process_pid\n end\n @pid ||= SecureRandom.urlsafe_base64.tap { |str| @prefix_len = str.length }\n end" ]
[ "0.8546602", "0.84667057", "0.84667057", "0.8281586", "0.8248475", "0.7923126", "0.7800208", "0.77250016", "0.77250016", "0.77250016", "0.7653343", "0.7580763", "0.7555151", "0.7496516", "0.7496516", "0.7496516", "0.7415169", "0.7398324", "0.73734504", "0.7369817", "0.73678344", "0.7362177", "0.7361695", "0.7358712", "0.7321455", "0.72564083", "0.7251742", "0.7222951", "0.7206334", "0.71880674" ]
0.8517214
1
GET /event_facebook_pages GET /event_facebook_pages.json
def index @event_facebook_pages = EventFacebookPage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pages\n get(\"v1/event/#{@id}/pages\")\n end", "def index\n @facebook_pages = FacebookPage.all\n end", "def set_event_facebook_page\n @event_facebook_page = EventFacebookPage.find(params[:id])\n end", "def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n pag = params[:page] || 1\n limit = params[:limit] || 30\n events = ::Event.paginate(:page => pag, :per_page => limit).where(user_id: current_user.id)\n render :status => 200, :json => {success: true, limit: limit, page:pag, data: events }\n end", "def create\n @event_facebook_page = EventFacebookPage.new(event_facebook_page_params)\n\n respond_to do |format|\n if @event_facebook_page.save\n format.html { redirect_to @event_facebook_page, notice: 'Event facebook page was successfully created.' }\n format.json { render :show, status: :created, location: @event_facebook_page }\n else\n format.html { render :new }\n format.json { render json: @event_facebook_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/callback?event_id='+params[:id])\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"email, user_events, friends_events, rsvp_event\") \n puts session.to_s + \"<<< session\"\n \n\n @event = Event.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def index\n @event_events = Event::Event.paginate(:order => 'execute_at DESC', :page => params[:page], :per_page => 50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_events }\n end\n end", "def index\n @events = Event.available.page(params[:page])\n end", "def index\n @fb_pages = FbPage.all\n end", "def index\n @events = Event.paginate(page: params[:page], :per_page => 20)\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def past_events\n @events = Event.past\n render json: @events, include: :talks\n end", "def index\n Project.hit 19\n @dj_events = DjEvent.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dj_events, callback: params[:callback] }\n format.xml { render xml: @dj_events }\n end\n end", "def index\n # @events = Event.order('created_at desc').limit(15)\n @events = Event.by_site( current_user.sites )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n tenantId = params[:tenantId]\n if tenantId.present?\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: tenantId).page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\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 index\n @events = Event.all\n render json: @events, status: 200\n end", "def following_event\n @user = User.find(params[:id])\n @events = @user.following_event.paginate(page: params[:page])\n render 'client_pages/following'\n \tend", "def index\n @events = Event.paginate(:page => params[:page], :per_page => 6)\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n\t\t#@events = Event.all\n\t\t#params是一個hash key:value#\n\t\t@events = Event.page(params[:page]).per(5)\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.xml { render :xml => @events.to_xml }\n\t\t\tformat.json { render :json => @events.to_json }\n\t\t\tformat.atom { @feed_title = \"My event list\" } #index.atom.builder\n \t\tend\n\tend", "def index\n @events = Event.getRecords(params[:page])\n end", "def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n @json = Event.all.to_gmaps4rails\n @event = Event.paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "def event_facebook_page_params\n params.require(:event_facebook_page).permit(:evnt_id, :facebook_page_id, :created_dt)\n end", "def index\n @social_events = SocialEvent.all\n end", "def index\n @calendar_events = CalendarEvent.page(params[:page])\n end", "def index\n @event = Event.all\n render json: @event\n end", "def index\n @events = Event.all\n render json: @events\n end" ]
[ "0.74158573", "0.670044", "0.64896655", "0.6421518", "0.63990253", "0.6333035", "0.6326266", "0.6278609", "0.62673265", "0.62254834", "0.61614174", "0.61593974", "0.6149332", "0.613689", "0.613662", "0.613333", "0.6120827", "0.61084807", "0.60969895", "0.6076426", "0.60709494", "0.6060345", "0.60355103", "0.60271674", "0.6026695", "0.6016899", "0.6001364", "0.5991024", "0.598881", "0.59590065" ]
0.7717961
0
POST /event_facebook_pages POST /event_facebook_pages.json
def create @event_facebook_page = EventFacebookPage.new(event_facebook_page_params) respond_to do |format| if @event_facebook_page.save format.html { redirect_to @event_facebook_page, notice: 'Event facebook page was successfully created.' } format.json { render :show, status: :created, location: @event_facebook_page } else format.html { render :new } format.json { render json: @event_facebook_page.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_facebook_page_params\n params.require(:event_facebook_page).permit(:evnt_id, :facebook_page_id, :created_dt)\n end", "def index\n @event_facebook_pages = EventFacebookPage.all\n end", "def create\n \n params['facebook'] = {\n :name => params[:event][:name],\n :start_time => get_date_string_from_params(params[:event]['start_time(1i)'],params[:event]['start_time(2i)'],params[:event]['start_time(3i)'],params[:event]['start_time(4i)'],params[:event]['start_time(5i)']),\n :end_time => get_date_string_from_params(params[:event]['end_time(1i)'],params[:event]['end_time(2i)'],params[:event]['end_time(3i)'],params[:event]['end_time(4i)'],params[:event]['end_time(5i)']),\n :description => params[:event][:description],\n :location => params[:event][:location],\n :privacy_type => params[:event][:privacy_type]\n \n \n }\n \n @event = Event.new(params[:event])\n @event.status = true\n \n respond_to do |format|\n if @event.valid?\n faceresponse = @graph.put_object('me', 'events', params['facebook'] )\n if faceresponse\n @event.facebookID = faceresponse['id']\n @event.save\n \n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event } \n else\n format.html { render action: \"new\", notice: 'Error on facebook occure.' }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create\n @facebook_page = FacebookPage.new(facebook_page_params)\n\n respond_to do |format|\n if @facebook_page.save\n format.html { redirect_to @facebook_page, notice: 'Facebook page was successfully created.' }\n format.json { render :show, status: :created, location: @facebook_page }\n else\n format.html { render :new }\n format.json { render json: @facebook_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n fbpage = @graph.get_object(params['page']['page_id'].to_i)\n picture = @graph.get_picture(params['page']['page_id'].to_i)\n rescue Koala::Facebook::ClientError => exc\n error = true\n redirect_to root_url\n end\n\n unless error\n params[\"page\"][\"name\"] = fbpage['name']\n params[\"page\"][\"picture\"] = picture\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.js { }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def set_event_facebook_page\n @event_facebook_page = EventFacebookPage.find(params[:id])\n end", "def pages\n get(\"v1/event/#{@id}/pages\")\n end", "def facebook_page_params\n params.require(:facebook_page).permit(:facebook_page_id, :access_token, :created_dt)\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n # Now, Create it a Facebook event too.\n if !savefb(@event.id).nil?\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(edit_listing_path(@event.listing_id)) }\n format.fbml { redirect_to(edit_listing_path(@event.listing_id)) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n @event.delete\n flash[:notice] = 'Cannot create Facebook event. Please authorize this application to create FB events for you.'\n format.html { redirect_to(edit_listing_path(@event.listing_id)) }\n format.fbml { redirect_to(edit_listing_path(@event.listing_id)) }\n format.xml { render :xml => @event.errors, :status => \"FB extened permission error\" }\n end\n \n format.html { redirect_to(edit_listing_path(@event.listing_id)) }\n format.fbml { redirect_to(edit_listing_path(@event.listing_id)) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.fbml { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @fb_page = FbPage.new(fb_page_params)\n\n respond_to do |format|\n if @fb_page.save\n format.html { redirect_to @fb_page, notice: 'Fb page was successfully created.' }\n format.json { render :show, status: :created, location: @fb_page }\n else\n format.html { render :new }\n format.json { render json: @fb_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event_facebook_page.update(event_facebook_page_params)\n format.html { redirect_to @event_facebook_page, notice: 'Event facebook page was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_facebook_page }\n else\n format.html { render :edit }\n format.json { render json: @event_facebook_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def page_params\n params.require(:page).permit(:facebook_page_id)\n end", "def create_rest\n @page_usage_event = PageUsageEvent.new(params[:page_usage_event])\n\n respond_to do |format|\n if @page_usage_event.save\n flash[:notice] = 'PageUsageEvent was successfully created.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { render :xml => @page_usage_event, :status => :created, :location => @page_usage_event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def publishPostOnCompanyPage(pageID,message,options)\n pageToken = @me.get_page_access_token(pageID)\n companyPage = Koala::Facebook::API.new(pageToken)\n companyPage.put_wall_post(message,options)\n end", "def publish_on_fb_page(msg, link_txt, link)\n if facebook_id && facebook_page_id\n begin\n u = Koala::Facebook::API.new(self.fb_access_token)\n page_token = Koala::Facebook::API.new(self.fb_access_token).get_page_access_token(self.facebook_page_id) #['access_token']\n @graph = Koala::Facebook::API.new(page_token)\n if link && link_txt\n @graph.put_wall_post(msg, {:actions => [{:name => link_txt, :link => link}].to_json})\n else\n @graph.put_wall_post(msg)\n end\n rescue => e\n ::Rails.logger.error(\"Opp! got error while spublishing to user's facebook page : #{e.inspect}\")\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n if @page.save\n render json: @page, status: :created, location: @page\n else\n render json: @page.errors, status: :unprocessable_entity\n end\n end", "def create\n if(params[:event][:source]=='facebook')\n @event = Event.new(get_event_info_facebook)\n else\n @event = Event.new(event_params)\n end\n @event.is_approved = false\n respond_to do |format|\n if @event.save\n if params[:event][:source]=='facebook'\n format.html { redirect_to \"/events/#{@event.id}/edit\"}\n else \n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n end\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:page].except!(:map_info) unless params[:page][:map_info].present?\n @page = current_user.pages.new(params[:page])\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n @business = Business.select('id, title')\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n @pages = current_user.pages\n format.html { redirect_to page_url(@page), notice: \"Page was successfully created.\" }\n format.json { render :show, status: :created, location: @page }\n flash.now[:notice] = \"Page was successfully created.\"\n format.turbo_stream { render \"shared/index\", locals: { object: Page.new, objects: @pages } }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @facebook_pages = FacebookPage.all\n end", "def create\r\n @projects_pages = []\r\n projects = Project.all.sort{|a,b| a.name <=> b.name}\r\n projects.each do |project|\r\n @projects_pages << [\"#{project.name}\", project.pages.exclude_placeholder] unless project.pages.blank?\r\n end\r\n\r\n @event = Event.new(params[:event])\r\n\r\n @event.is_published = true unless params[:is_published].blank?\r\n\r\n params[:connection_dialogs].values.each { |value| @event.connection_dialog_list << value.strip unless value.blank? } if params[:connection_dialogs]\r\n params[:organizations].values.each { |value| @event.organization_list << value.strip unless value.blank? } if params[:organizations]\r\n params[:affiliations].values.each { |value| @event.affiliation_list << value.strip unless value.blank? } if params[:affiliations]\r\n #arenas comes in as a HashWithIndifferentAccess\r\n params[:arenas][0].to_hash.values.each { |value| @event.arena_list << value.strip unless value.blank?} if params[:arenas]\r\n params[:tags].values.each { |value| @event.tag_list << value.strip unless value.blank? } if params[:tags]\r\n #web_links comes in as a HashWithIndifferentAccess\r\n params[:web_links][0].to_hash.values.each { |value| @event.web_link_list << value.strip unless value.blank? } if params[:web_links]\r\n\r\n event_users = []\r\n event_users << current_user\r\n\r\n @event.errors.add(:location, \"can't be blank\" ) if params[:event][:location].first.blank?\r\n\r\n respond_to do |format|\r\n if @event.errors.empty? && @event.save\r\n expire_fragment('all_funders')\r\n expire_fragment('all_projects')\r\n Rails.cache.delete('total_stats')\r\n\r\n event_users += User.all(:include => :projects, :conditions => [\"projects.id = ?\", @event.page.project.id])\r\n event_users.uniq!\r\n @event.users << event_users\t\t\t\t\r\n @event.save!\r\n\r\n unless @event.location.first.blank?\r\n location = Location.find_by_name(@event.location.first.name)\r\n unless location\r\n location = Location.new\r\n location.name = @event.location.first.name\r\n sleep(1) #ensure requests are made only once per second, in the event we are flooded with form submissions. Google gets mad if requests are too frequent\r\n res=Geokit::Geocoders::MultiGeocoder.geocode(\"#{location.name}\")\r\n location.lat = res.lat\r\n location.lng = res.lng\r\n location.save!\r\n end\r\n end\r\n\r\n session[:from_event] = nil\r\n session[:from_page] = nil\r\n flash[:notice] = @event.is_published? ? \"Event was successfully created.\" : \"The draft of this event was successfully created.\"\r\n format.html { redirect_to(@event) }\r\n format.xml { render :xml => @event, :status => :created, :location => @event }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def destroy\n @event_facebook_page.destroy\n respond_to do |format|\n format.html { redirect_to event_facebook_pages_url, notice: 'Event facebook page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @event = Event.new(params[:event])\n @event.user = current_user\n\n @event.transaction do\n\n \n @event.save\n \n tags(@event)\n \n respond_to do |format|\n if @event.save\n #twitter(@event)\n @event.post_to_fb_page(current_facebook_client) if current_facebook_client\n @events = Event.current.paginate_by_user_id(current_user.id,:page=>params[:page],:per_page=>\"30\",:order=>\"start_date,name\")\n flash.now[:notice] = 'Event was successfully created.'\n format.html { render :action=>:edit}\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n @events = Event.current.paginate_by_user_id(current_user.id,:page=>params[:page],:per_page=>\"30\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def fb_feed_post_callback\n redirect_to root_url\n end", "def create\n @site = Site.find(params[:site_id])\n @idea = Idea.new(params[:idea])\n @idea.user = current_user\n @site.ideas. << @idea\n @ideas = @site.ideas.page(params[\"page\"])\n\n respond_to do |format|\n if @idea.save\n if params[:post_to_facebook] == 'yes'\n facebook_user.feed!(:message => \"Posted an idea to #{base_url}: \\\"#{@idea.ideaText}\\\"\", :link => \"#{@base_url}\", :caption => \"View Site\")\n end\n format.html { redirect_to :controller=>'ideas', :action => 'viewIdeas' }\n format.json { render json: @idea, status: :created, location: @idea }\n format.js\n else\n format.html { render :template => '/ideas/viewIdeas' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def posts_by_page page_id, since\n page = FbGraph::Page.new(page_id, access_token: config.access_token)\n page.posts(limit: 100, since: since.to_i, return_ssl_resources: 1)\n end", "def create\n @page = Page.new(page_params)\n @page.profile_pic = params[:page][:profile_pic]\n @page.timeline_pic = params[:page][:timeline_pic]\n @page.like = 0\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end", "def create\n is_facebook_event = params.delete(\"is_facebook_event\")\n facebook_cover_url = params.delete(\"facebook_cover_url\")\n\n categories = params[:event].delete(\"categories\")\n \n uploaded_flyer = params[:event].delete(:flyer_url)\n\n if is_facebook_event == \"true\" and facebook_cover_url != nil\n params[:event][:flyer_url] = facebook_cover_url\n elsif uploaded_flyer != nil\n flyer_buf = ''\n uploaded_flyer.read(uploaded_flyer.size(), flyer_buf)\n\n original = uploaded_flyer.original_filename\n response = dropbox_client().put_file(original, flyer_buf)\n logger.info response\n params[:event][:flyer_url] = original\n else\n params[:event][:flyer_url] = ''\n end\n\n @event = Event.new(params[:event])\n\t@event.user = current_user\n\n editEvent(@event, params, categories)\n end", "def create\n @event = Event.new(params[:event])\n @event.date_at = DateTime.parse(\"#{params[:event][:date_at]} #{params[:event][:start_at]} -0600\")\n @event.start_at = DateTime.parse(\"#{params[:event][:date_at]} #{params[:event][:start_at]} -0600\")\n respond_to do |format|\n if @event.save\n @current_user.delay.create_fb_event(@event) if @current_user.is_admin\n format.html { redirect_to admin_events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69411737", "0.67510545", "0.6624868", "0.6488519", "0.6393019", "0.63797003", "0.62870497", "0.6284959", "0.60912263", "0.602314", "0.5971448", "0.5904261", "0.5788121", "0.57671255", "0.57366395", "0.5735167", "0.57136226", "0.5707099", "0.5673284", "0.56723607", "0.5639634", "0.5627098", "0.559609", "0.55905294", "0.557759", "0.55612254", "0.5559175", "0.5553837", "0.5536454", "0.55351907" ]
0.7537748
0
PATCH/PUT /event_facebook_pages/1 PATCH/PUT /event_facebook_pages/1.json
def update respond_to do |format| if @event_facebook_page.update(event_facebook_page_params) format.html { redirect_to @event_facebook_page, notice: 'Event facebook page was successfully updated.' } format.json { render :show, status: :ok, location: @event_facebook_page } else format.html { render :edit } format.json { render json: @event_facebook_page.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n \n params['facebook'] = {\n :name => params[:event][:name],\n :start_time => get_date_string_from_params(params[:event]['start_time(1i)'],params[:event]['start_time(2i)'],params[:event]['start_time(3i)'],params[:event]['start_time(4i)'],params[:event]['start_time(5i)']),\n :end_time => get_date_string_from_params(params[:event]['end_time(1i)'],params[:event]['end_time(2i)'],params[:event]['end_time(3i)'],params[:event]['end_time(4i)'],params[:event]['end_time(5i)']),\n :description => params[:event][:description],\n :location => params[:event][:location],\n :privacy_type => params[:event][:privacy_type]\n \n \n }\n \t\n @event = Event.find(params[:id])\n\t@event.assign_attributes(params[:event])\n\t\n respond_to do |format|\n if @event.valid?\n faceresponse = @graph.put_object(@event.facebookID,'', params['facebook'] )\n if faceresponse == true\n @event.update_attributes(params[:event])\n \n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", notice: 'Error on facebook occure.' }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n\n respond_to do |format|\n if @page_usage_event.update_attributes(params[:page_usage_event])\n flash[:notice] = 'PageUsageEvent was successfully updated.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facebook_page.update(facebook_page_params)\n format.html { redirect_to @facebook_page, notice: 'Facebook page was successfully updated.' }\n format.json { render :show, status: :ok, location: @facebook_page }\n else\n format.html { render :edit }\n format.json { render json: @facebook_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n\tif !@event.can_modify?(current_user)\n\t\traise Exceptions::AccessDeniedException\n\tend\n\n is_facebook_event = params.delete(\"is_facebook_event\")\n facebook_cover_url = params.delete(\"facebook_cover_url\")\n\n\tuploaded_flyer = params[:event][:flyer_url]\n if uploaded_flyer != nil\n flyer_buf = ''\n uploaded_flyer.read(uploaded_flyer.size(), flyer_buf)\n\n original = uploaded_flyer.original_filename\n response = dropbox_client().put_file(original, flyer_buf)\n logger.info response\n params[:event][:flyer_url] = original\n elsif is_facebook_event and facebook_cover_url != nil\n params[:event][:flyer_url] = facebook_cover_url\n else\n params[:event][:flyer_url] = @event.flyer_url\n end\n\n updated_categories = params[:event].delete(\"categories\")\n\t@event.update_attributes(params[:event])\n\t\n editEvent(@event, params, updated_categories)\n\t\n end", "def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@event = Event.find(params[:id])\n \n venue_id = params[:venue_id]\n venue = VenuesController.getVenueInformation(venue_id, @tokensHash[FourSquareProvider.service_name].access_token)\n \n \n create_event_hash = createFacebookEvent(@tokensHash[FacebookProvider.service_name].access_token,\n name,\n venue)\n #self.createFacebookEvent(oauth_token=\"\", name=\"Home\", venue=Venue.new, start_time=\"2012-07-04T19:00:00-0700\", end_time=\"2012-07-04T19:00:00-0700\", description=\"\", privacy_type = \"FRIENDS\")\n #@event = Event.create(:user_id => @user.id, :date_time, :email_invitees, :facebook_id, :facebook_invitees, :description, :google_id, :loacation_id)\n\n=begin\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n=end\n end", "def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end", "def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @fb_page.update(fb_page_params)\n format.html { redirect_to @fb_page, notice: 'Fb page was successfully updated.' }\n format.json { render :show, status: :ok, location: @fb_page }\n else\n format.html { render :edit }\n format.json { render json: @fb_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.fbml { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.fbml { render :action => \"edit\" }\n format.xml { render :xml => @event.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.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end", "def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.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 {head :no_content}\n else\n format.html {render action: 'edit'}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @social_event.update(social_event_params)\n format.html { redirect_to @social_event, notice: 'Social event was successfully updated.' }\n format.json { render :show, status: :ok, location: @social_event }\n else\n format.html { render :edit }\n format.json { render json: @social_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.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.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n# @event.update_eventbrite_event(event_params)\n\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 else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = current_user.events.find_by_url(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: !(:event_update_success) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to organization_event_url(@event.organization, @event), notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6905974", "0.6639611", "0.6562121", "0.6425062", "0.63814306", "0.6377962", "0.63669616", "0.6346461", "0.6345063", "0.6315546", "0.631254", "0.63024455", "0.63018286", "0.62860894", "0.6268523", "0.6268523", "0.61567485", "0.6151587", "0.61481", "0.61447835", "0.61439", "0.613963", "0.61240834", "0.61240834", "0.6091913", "0.6086294", "0.60789603", "0.60775495", "0.60775495", "0.6075515" ]
0.7414764
0
DELETE /event_facebook_pages/1 DELETE /event_facebook_pages/1.json
def destroy @event_facebook_page.destroy respond_to do |format| format.html { redirect_to event_facebook_pages_url, notice: 'Event facebook page was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event = Event.find(params[:id])\n faceresponse = @graph.delete_object(@event.facebookID)\n \n if faceresponse == true\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n @page_usage_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_usage_events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @facebook_page.destroy\n respond_to do |format|\n format.html { redirect_to facebook_pages_url, notice: 'Facebook page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fb_page.destroy\n respond_to do |format|\n format.html { redirect_to fb_pages_url, notice: 'Fb page 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\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.fbml { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @social_event.destroy\n respond_to do |format|\n format.html { redirect_to social_events_url, notice: 'Social event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to top_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @myevent = Myevent.find(params[:id])\n @myevent.destroy\n\n respond_to do |format|\n format.html { redirect_to myevents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = current_user.events.find_by_url(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html {redirect_to events_url}\n format.json {head :no_content}\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.mobile { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_event.destroy\n respond_to do |format|\n format.html { redirect_to post_events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html {\n redirect_to :back and return unless request.referrer == events_path(@event)\n redirect_to events_url\n }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @event = EventPost.find(params[:id])\n @event.destroy\n track_activity @event\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_event = ActivityEvent.find(params[:id])\n @activity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n \n head :no_content\n end", "def delete\n if params[:social_event_type_id]\n socialEventType = SocialEventType.where(id: params[:social_event_type_id]).first\n if socialEventType.delete \n render json: { message: \"deleted successfully.\" } , status: 200\n else \n render json: socialEventType.errors , status: 422\n end\n else\n render json: { message: \"send social event type id.\" } , status: 422 \n end \n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7375406", "0.7243202", "0.72237515", "0.7064322", "0.7013192", "0.68683267", "0.68385804", "0.6826523", "0.6807789", "0.6778725", "0.676255", "0.67607397", "0.67584455", "0.6749123", "0.6744463", "0.6734683", "0.6734683", "0.6734683", "0.6723085", "0.671951", "0.67194915", "0.6714241", "0.6710276", "0.6708306", "0.6708306", "0.6708306", "0.6705722", "0.66964406", "0.669298", "0.6688855" ]
0.7853551
0
pass in limit: 5 to get the top 5 errors
def get_honeybadger_errors(options = {}) api_token = "YOUR API TOKEN HERE" project_id = "YOUR PROJECT ID HERE" url = "https://api.honeybadger.io/v1/projects/#{project_id}/faults?auth_token=#{api_token}" if options[:order] url += "&order=#{options[:order]}" end uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri, {'Accept' => 'application/json', 'Content-Type' => 'application/json'}) response = http.request(request) json_response = JSON.parse(response.body) upper_bound = options[:limit] || 5 json_response['results'][0..(upper_bound - 1)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errors(queue, limit, offset)\n conditions = {:error.not => nil}\n conditions[:record_class_name] = queue.class_names unless queue.class_names.empty?\n all(conditions.merge(:limit => limit, :offset => offset, :order => :id))\n end", "def max_errors\n OrigenSim.max_errors || config[:max_errors] || 100\n end", "def problematic(limit = nil)\n find(:all, :conditions => [\"read_at IS NOT null AND error_info IS NOT null\"], :limit => limit)\n end", "def limit; end", "def limit; end", "def limit; end", "def max_failed_count\n MAX_FAILED_COUNT\n end", "def get_honeybadger_errors(options = {})\n api_token = ENV['HONEYBADGER_TOKEN']\n project_id = options[:project_id]\n\n url = \"https://app.honeybadger.io/v2/projects/#{project_id}/faults?q=environment:production\"\n url += \"&order=#{options[:order]}\" if options[:order]\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(\n uri.request_uri,\n {\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{Base64.encode64(api_token).strip}\"\n })\n\n response = http.request(request)\n json_response = JSON.parse(response.body)\n\n upper_bound = options[:limit] || 5\n\n json_response['results'][0..(upper_bound - 1)]\nend", "def max_retry\n 5\n end", "def default_limit\n 10\n end", "def errors(queue, limit, offset)\n conditions = [\"#{connection.quote_column_name('error')} IS NOT NULL\"]\n unless queue.class_names.empty?\n conditions.first << \" AND #{connection.quote_column_name('record_class_name')} IN (?)\"\n conditions << queue.class_names\n end\n all(:conditions => conditions, :limit => limit, :offset => offset, :order => :id)\n end", "def max_bad_records\n @gapi.max_bad_records\n end", "def top_five\n self.destinations.max(5){|destination| destination.posts.count}\n end", "def validate_api_call_count\n if outbound_request?\n data = $redis.get(\"api_call_count_for_#{from}\")\n errors.add(:base, message: \"limit reached for from #{from}\") if data && JSON.parse(data)['count'] > 50\n end\n end", "def limit(limit); end", "def at_most_3_tests\n errors.add(:base, 'This package should have at most three tests') if test_ids.count > 3\n end", "def miter_limit(limit)\n end", "def index\n @common_errors = CommonError.all.order(:description).paginate(page: params[:page], per_page: 7 )\n end", "def inspect_limit\n @inspect_limit || 500\n end", "def no_spamming\n cnt = user\n .submitted_urls\n .where('created_at > ?', 1.minutes.ago)\n .count\n\n errors.add(:no_spamming, \"can't submit more than 5 urls / minute\") if cnt >= 5\n end", "def five_hundred(_error)\n json_response({ message: Message.something_went_wrong }, :internal_server_error)\n end", "def limited_bugs offset, number = 10\n if !offset\n offset = 1\n end\n is_successful = search_bugzilla [\"id\",\"assigned_to\",\"component\",\"last_change_time\",\"status\",\"summary\"],number,(offset.to_i-1)*10\n return is_successful if is_successful\n return []\n end", "def fetch_more\n $limit += 5\n $offset_counter = ($offset_counter >= 5? $offset_counter - 5: 0)\n @room_messages = (@room.room_messages.includes(:user).order(:id).limit($limit).offset($offset_counter)).to_a.reverse()\n end", "def latest_five\n self.find :all, :limit=>5, :order => \"created_at desc\"\n end", "def max_attempts\n 5\n end", "def too_many_rounds\n if self.rounds.count > 3\n errors.add(:rounds, \"there are too many rounds\")\n end\n end", "def results_limit\n # max number of search results to display\n 10\n end", "def errors(show_resolved=false)\n options = {}\n options[:show_resolved] = 1 if show_resolved\n page = 1\n errors = []\n begin\n options[:page] = page\n doc = Nokogiri::XML(api_get(\"/errors.xml\", options))\n new_errors = doc.xpath(\"/groups/group\").map {|node| Airbrake::Error.from_xml(node) }\n errors += new_errors\n page += 1\n end while new_errors.any?\n return errors\n end", "def maximum_limit\n 100\n end", "def construct_validation_count_error_message(n)\n \"Method '#{@exp}' called incorrect number of times\\n\" +\n \"#{describe_limit} matching #{calls(@limit)} expected\\n\" +\n \"#{n} matching #{calls(n)} found\\n\" +\n describe_calls(@exp.mock)\n end" ]
[ "0.6226895", "0.62037313", "0.6157945", "0.6070162", "0.6070162", "0.6070162", "0.6034135", "0.59960884", "0.59824985", "0.59481597", "0.5932228", "0.59252304", "0.58591545", "0.58138794", "0.5812405", "0.5768332", "0.57221687", "0.56619966", "0.56574327", "0.5652571", "0.56514716", "0.56472474", "0.56394744", "0.5629202", "0.5623429", "0.56066746", "0.55956626", "0.5532816", "0.55214334", "0.55091757" ]
0.6254479
0
GET /secret_keys GET /secret_keys.json
def index @secret_keys = SecretKey.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secretkey(apikey)\n get 'secretkey', {apikey: apikey} { |x| x['secretkey'] }\n end", "def secret_key\n credentials['secret_key']\n end", "def secret_key\n credentials['secret_key']\n end", "def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end", "def show\n render :json => @secret_key.to_json({})\n end", "def get(secret_id)\n request('/accounts/' + account_id + '/secrets/' + secret_id)\n end", "def authorized_keys\n get \"/setup/api/settings/authorized-keys\", password_hash\n end", "def secret_key; end", "def secret_key\n \"\"\n end", "def index\n logger.debug(\"get secret page\")\n end", "def secret\n query[\"client_secret\"]\n end", "def opaque(secret_key); end", "def secret_key\n jwt_config['secret_key']\n end", "def get_keys\n access_key = USER_DATA[0].to_s.strip\n secret_access_key = USER_DATA[1].to_s.strip\n keys = { :access_key_id => access_key,\n :secret_access_key => secret_access_key}\nend", "def get_secret(key)\n secret node['openstack']['secret']['secrets_data_bag'], key\n end", "def keys\n JSON.parse get('/users/ssh_keys', :accept => 'json').to_s\n end", "def get_secret(params)\n return @api_secret\n end", "def client_secret; end", "def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end", "def get_secret(opts = {})\n data, _status_code, _headers = get_secret_with_http_info(opts)\n data\n end", "def secret(client:)\n parsed_response(\n path: \"#{url_for(client)}/client-secret\"\n )['value']\n end", "def get_secret(secret_id)\n @client.call(\n :get_secret,\n message: {\n token: @token,\n secretId: secret_id\n }\n ).to_hash.dig(:get_secret_response, :get_secret_result)\n end", "def secret_key_base; end", "def secret_key_base; end", "def secret_key_base; end", "def secret_key_base; end", "def access_token_secret\n credentials['secret']\n end", "def secret\n decrypt_secret\n end", "def secret\n decrypt_secret\n end", "def secret_key\n ActionController::Base.session_options[:secret]\n end" ]
[ "0.7315136", "0.71182024", "0.71182024", "0.7078885", "0.7009751", "0.6991159", "0.69349295", "0.691555", "0.6743916", "0.66876966", "0.66311103", "0.6575756", "0.65401965", "0.6512641", "0.65039593", "0.64806354", "0.64522874", "0.6422989", "0.63935554", "0.6378652", "0.6357355", "0.6326297", "0.6288422", "0.6288422", "0.6288422", "0.6288422", "0.6277404", "0.6203264", "0.6203264", "0.6189147" ]
0.7366338
0
GET /secret_keys/1 GET /secret_keys/1.json
def show render :json => @secret_key.to_json({}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secretkey(apikey)\n get 'secretkey', {apikey: apikey} { |x| x['secretkey'] }\n end", "def index\n @secret_keys = SecretKey.all\n end", "def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end", "def get(secret_id)\n request('/accounts/' + account_id + '/secrets/' + secret_id)\n end", "def secret_key\n credentials['secret_key']\n end", "def secret_key\n credentials['secret_key']\n end", "def secret_key; end", "def secret_key\n \"\"\n end", "def secret_key\n jwt_config['secret_key']\n end", "def index\n logger.debug(\"get secret page\")\n end", "def authorized_keys\n get \"/setup/api/settings/authorized-keys\", password_hash\n end", "def get_secret(key)\n secret node['openstack']['secret']['secrets_data_bag'], key\n end", "def get_secret(params)\n return @api_secret\n end", "def get_keys\n access_key = USER_DATA[0].to_s.strip\n secret_access_key = USER_DATA[1].to_s.strip\n keys = { :access_key_id => access_key,\n :secret_access_key => secret_access_key}\nend", "def secret\n query[\"client_secret\"]\n end", "def opaque(secret_key); end", "def create\n @secret_key = SecretKey.new(secret_key_params)\n\n respond_to do |format|\n if @secret_key.save\n #format.html { redirect_to @secret_key, notice: 'Secret key was successfully created.' }\n format.json { render :json=> @secret_key.to_json({}) }\n else\n format.html { render action: 'new' }\n format.json { render json: @secret_key.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_secret project_id:, secret_id:\n # Create a Secret Manager client.\n client = Google::Cloud::SecretManager.secret_manager_service\n\n # Build the resource name of the secret.\n name = client.secret_path project: project_id, secret: secret_id\n\n # Get the secret.\n secret = client.get_secret name: name\n\n # Get the replication policy.\n if !secret.replication.automatic.nil?\n replication = \"automatic\"\n elsif !secret.replication.user_managed.nil?\n replication = \"user managed\"\n else\n raise \"Unknown replication #{secret.replication}\"\n end\n\n # Print a success message.\n puts \"Got secret #{secret.name} with replication policy #{replication}\"\nend", "def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end", "def apikey(username, password)\n md5 = Digest::MD5.new\n digest = md5.update(password).hexdigest\n\n query = { action: 'apikey', userName: username, password: digest }\n get('apikey', query) { |x| x['apikey'] }\n end", "def secret(client:)\n parsed_response(\n path: \"#{url_for(client)}/client-secret\"\n )['value']\n end", "def get_secret(secret_id)\n @client.call(\n :get_secret,\n message: {\n token: @token,\n secretId: secret_id\n }\n ).to_hash.dig(:get_secret_response, :get_secret_result)\n end", "def secret_key_base; end", "def secret_key_base; end", "def secret_key_base; end", "def secret_key_base; end", "def client_secret; end", "def show\n if current_user.nil?\n redirect_to root_path\n # Redirects to secrets index when te user tries to access another user secret\n elsif @secret.user_id != current_user.id\n redirect_to secrets_path\n else\n @algorithm_name = CriptoAlgorithms.names\n @key = params[:key] #unsafe? :v\n end\n end", "def call\n JsonWebToken.encode_secret( { app_id: app_id, key: key } )\n end", "def secret\n secret_value or raise 'secret is only available for new access keys'\n end" ]
[ "0.7278278", "0.69595635", "0.69550973", "0.6954143", "0.6925694", "0.6925694", "0.67357373", "0.6636985", "0.6565648", "0.65168345", "0.6457483", "0.64468193", "0.6431183", "0.6392815", "0.63761866", "0.63154864", "0.6286288", "0.6274083", "0.6254343", "0.62469256", "0.6232828", "0.621317", "0.6201418", "0.6201418", "0.6201418", "0.6201418", "0.6201247", "0.61570084", "0.6148556", "0.6119488" ]
0.7147912
1
POST /secret_keys POST /secret_keys.json
def create @secret_key = SecretKey.new(secret_key_params) respond_to do |format| if @secret_key.save #format.html { redirect_to @secret_key, notice: 'Secret key was successfully created.' } format.json { render :json=> @secret_key.to_json({}) } else format.html { render action: 'new' } format.json { render json: @secret_key.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create body = {}\n @connection.request(method: :post, path: \"/secrets/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def secret_key_params\n params.require(:secret_key).permit(:secretKey)\n end", "def secret_key; end", "def call\n JsonWebToken.encode_secret( { app_id: app_id, key: key } )\n end", "def create\n @secret = current_user.secrets.build(secret_params)#Secret.new(secret_params)\n\n if @secret.save\n render json: @secret\n else\n render json: @secret.errors, status: :unprocessable_entity\n end\n end", "def secret_key\n \"\"\n end", "def secret_params\n params.require(:secret).permit(:body, :password, :expiration, :unlock_password)\n end", "def after_create\n self.secret_key = secret_keygen\n self.save!\n end", "def create\n @secret = Secret.new(secret_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @secret.save\n format.html { redirect_to @secret, notice: 'Secret was successfully created.' }\n format.json { render :show, status: :created, location: @secret }\n else\n format.html { render :new }\n format.json { render json: @secret.errors, status: :unprocessable_entity }\n end\n end\n end", "def secret_key\n credentials['secret_key']\n end", "def secret_key\n credentials['secret_key']\n end", "def secretkey(apikey)\n get 'secretkey', {apikey: apikey} { |x| x['secretkey'] }\n end", "def create_client_secret_file\n File.exist?(KEY_FILE.to_s) && File.delete(KEY_FILE.to_s)\n File.open(KEY_FILE.to_s, 'w') do |f|\n f.write(CLIENT_SECRET.to_json.gsub('\\\\\\\\', '\\\\'))\n end\n end", "def index\n @secret_keys = SecretKey.all\n end", "def secret_params\n params.require(:secret).permit(:message, :key, :algorithm)\n end", "def secret_key\n jwt_config['secret_key']\n end", "def set_secret_key\n @secret_key = SecretKey.find(params[:id])\n end", "def opaque(secret_key); end", "def client_secret; end", "def create\n @secret = Secret.new(secret_params)\n\n respond_to do |format|\n if @secret.save\n format.html { render :preview, status: :ok, location: @secret, notice: 'Secret was successfully created.' }\n format.json { render :preview, status: :ok, location: @secret }\n else\n format.html { render :new }\n format.json { render json: @secret.errors, status: :unprocessable_entity }\n end\n end\n end", "def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end", "def secret_code_params\n params.require(:secret_code).permit(:secret_key)\n end", "def secret_params\n params.require(:secret).permit(:name, :value)#.merge(user_id: current_user.id)\n end", "def new_api_key\n @application = Doorkeeper::Application.find(params[:id])\n @application.secret = Doorkeeper::OAuth::Helpers::UniqueToken.generate\n @application.save\n message = I18n.t('new_api_key')\n flash[:notice] = render_to_string partial: 'applications/flash',\n locals: { message: message }\n redirect_to authorizations_path\n end", "def secret_params\n params.require(:secret).permit(:content)\n end", "def token_secret; end", "def token_secret; end", "def token_secret; end", "def seed_api_key\n\t\t\tDoorkeeper::Application.create(name: \"sample app\", \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t uid: \"836ec399a145ffafbd7774c57e06960397b77a53bb1ccc03d4e45d95d0c31a3d\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t secret: \"cf8dc84d17c69e17a8b9d74ec971bdb636f231d3ba7d2ad2ebfca45bdc8ae3c9\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t redirect_uri: \"urn:ietf:wg:oauth:2.0:oob\")\n\t\tend", "def create_secret(opts = {})\n data, _status_code, _headers = create_secret_with_http_info(opts)\n data\n end" ]
[ "0.6654314", "0.65644795", "0.6501072", "0.6404883", "0.6358265", "0.62994224", "0.6282049", "0.62638855", "0.6228947", "0.6197391", "0.6197391", "0.6192218", "0.61480415", "0.6134636", "0.6103253", "0.610023", "0.60743576", "0.60434437", "0.60247207", "0.60117745", "0.6005219", "0.59615386", "0.59156245", "0.59135586", "0.58676934", "0.58661133", "0.58661133", "0.58661133", "0.58576673", "0.5827109" ]
0.7164528
0
PATCH/PUT /secret_keys/1 PATCH/PUT /secret_keys/1.json
def update respond_to do |format| if @secret_key.update(secret_key_params) format.html { redirect_to @secret_key, notice: 'Secret key was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @secret_key.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_secret\n resource.refresh_secret!\n\n respond_to do |format|\n format.json { render json: { secret: resource.secret } }\n end\n end", "def update!(**args)\n @legacy_secret_key = args[:legacy_secret_key] if args.key?(:legacy_secret_key)\n end", "def update\n if @secret.update_attributes(secret_params)\n head :no_content\n else\n render json: @secret.errors, status: :unprocessable_entity\n end\n end", "def update_keys\n public_identity = params.require(:public)\n private_identity = params[:private]\n private_id_label = params[:label]\n\n # Check if encryption is already enabled (but not changing passphrase).\n old_identity = current_user.custom_fields[DiscourseEncrypt::PUBLIC_CUSTOM_FIELD]\n if params[:overwrite].blank? && old_identity && old_identity != public_identity\n return render_json_error(I18n.t('encrypt.enabled_already'), status: 409)\n end\n\n current_user.custom_fields[DiscourseEncrypt::PUBLIC_CUSTOM_FIELD] = public_identity\n\n if private_identity.present?\n if private_id_label.present?\n data = JSON.parse(current_user.custom_fields[DiscourseEncrypt::PRIVATE_CUSTOM_FIELD]) rescue {}\n data[private_id_label.downcase] = private_identity\n current_user.custom_fields[DiscourseEncrypt::PRIVATE_CUSTOM_FIELD] = JSON.dump(data)\n else\n current_user.custom_fields[DiscourseEncrypt::PRIVATE_CUSTOM_FIELD] = private_identity\n end\n end\n\n current_user.save_custom_fields\n\n render json: success_json\n end", "def update\n authorize @secret, :update?\n\n respond_to do |format|\n if @secret.update(secret_params)\n format.html { redirect_to @secret, notice: 'Secret was successfully updated.' }\n format.json { render :show, status: :ok, location: @secret }\n else\n format.html { render :edit }\n format.json { render json: @secret.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @key.update(key_params)\n render json: @key\n else\n render json: @key.errors, status: :unprocessable_entity\n end\n end", "def refresh_secret!\n set_secret\n save!\n end", "def update\n respond_to do |format|\n if @secret.update(secret_params)\n format.html { redirect_to @secret, notice: 'El secreto se actualizó correctamente.' }\n format.json { render :show, status: :ok, location: @secret }\n else\n format.html { render :edit }\n format.json { render json: @secret.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def edit\n @user = User.find(current_user.id)\n if @user.api.key.nil?\n @user.api.key = SecureRandom.hex\n if@user.api.save\n redirect_to @user\n flash[:success] = 'New api key' +@user.api.key + ' was created'\n else\n render @user\n flash.now[:danger] = 'Api key could not be saved'\n end\n else\n @user.api.key = nil\n @user.api.save\n redirect_to user_path\n flash[:success] = 'Api key was removed'\n end\n end", "def update!(**args)\n @secret_version = args[:secret_version] if args.key?(:secret_version)\n end", "def update\n respond_to do |format|\n if @api_key.update(api_key_params)\n format.html { redirect_to [:admin, @api_key], notice: 'Api key was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_key }\n else\n format.html { render :edit }\n format.json { render json: @api_key.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n code_parameters = code_params\n if code_parameters[\"new_secret\"] == \"1\"\n puts \"New Secret Param Set\"\n @code.secret = @code.new_secret\n @code.save\n code_parameters = code_parameters.except(\"secret\")\n end\n code_parameters = code_parameters.except(\"new_secret\")\n respond_to do |format|\n if @code.update(code_parameters)\n format.html { redirect_to @code, notice: 'Code was successfully updated.' }\n format.json { render :show, status: :ok, location: @code }\n else\n format.html { render :edit }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_secret_key\n @secret_key = SecretKey.find(params[:id])\n end", "def update_API_key(new_key)\n \n #get the old key\n old_key = $drugbank_api_key\n\n # update key\n $drugbank_api_key = new_key\n\n # update the local config\n $config[\"auth-key\"] = new_key\n\n # try to write back to config file\n begin\n File.write($config_file, JSON.pretty_generate($config)) \n $drugbank_headers[\"Authorization\"] = new_key\n return 200 \n rescue StandardError => msg \n # in case anything goes wrong, revert changes\n puts msg\n $config[\"auth-key\"] = old_key\n $drugbank_api_key = old_key\n $drugbank_headers[\"Authorization\"] = old_key\n return 400\n end \n\nend", "def update\r\n @secret = Secret.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @secret.update_attributes(params[:secret])\r\n format.html { redirect_to(:action => 'index') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @secret.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def upgrade_api_key_for(user)\n user.update(api_key: 2)\n end", "def update!(**args)\n @key_id = args[:key_id] if args.key?(:key_id)\n @signed_jwt = args[:signed_jwt] if args.key?(:signed_jwt)\n end", "def update_keys\n public_key = params.require(:public_key)\n private_key = params.require(:private_key)\n salt = params.require(:salt)\n\n # Check if encrypt settings are visible to user.\n groups = current_user.groups.pluck(:name)\n encrypt_groups = SiteSetting.encrypt_groups.split('|')\n raise Discourse::InvalidAccess if !SiteSetting.encrypt_groups.empty? && (groups & encrypt_groups).empty?\n\n # Check if encryption is already enabled (but not changing passphrase).\n old_public_key = current_user.custom_fields['encrypt_public_key']\n if old_public_key && old_public_key != public_key\n return render_json_error(I18n.t('encrypt.enabled_already'), status: 409)\n end\n\n current_user.custom_fields['encrypt_public_key'] = public_key\n current_user.custom_fields['encrypt_private_key'] = private_key\n current_user.custom_fields['encrypt_salt'] = salt\n current_user.save_custom_fields\n\n render json: success_json\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n respond_to do |format|\n if @credential_key.update(credential_key_params)\n format.html { redirect_to @credential_key, notice: 'Credential key was successfully updated.' }\n format.json { render :show, status: :ok, location: @credential_key }\n else\n format.html { render :edit }\n format.json { render json: @credential_key.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @key = Key.find(params[:id])\n\n respond_to do |format|\n if @key.update_attributes(params[:key])\n format.html { redirect_to @key, notice: 'Key was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key.errors, status: :unprocessable_entity }\n end\n end\n end", "def regenerate_apikeys\n current_path = '/api/v1/users/all/api-keys'\n @conn.delete(current_path)\n end", "def update_secret\n o = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten\n secret = (0...64).map{ o[rand(o.length)] }.join\n self.client_secret = Password.create(secret)\n self.save\n\n secret\n end", "def update\n respond_to do |format|\n if @apikey.update(apikey_params)\n format.html { redirect_to @apikey, notice: 'API key was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @apikey.update(apikey_params)\n format.html { redirect_to @apikey, notice: \"Apikey was successfully updated.\" }\n format.json { render :show, status: :ok, location: @apikey }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @apikey.errors, status: :unprocessable_entity }\n end\n end\n end", "def reset_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n client_api_secret_e = r.data[:ciphertext_blob]\n\n @client_webhook_setting.secret_key = client_api_secret_e\n @client_webhook_setting.set_decrypted_secret_key(client_api_secret_d)\n @client_webhook_setting.source = GlobalConstant::AdminActivityChangeLogger.web_source\n\n @client_webhook_setting.save! if @client_webhook_setting.changed?\n end", "def secret_params\n params.require(:secret).permit(:body, :password, :expiration, :unlock_password)\n end" ]
[ "0.7113271", "0.6653773", "0.6574041", "0.64721984", "0.63784695", "0.62995344", "0.6260749", "0.62383765", "0.6217892", "0.61888534", "0.61790395", "0.611519", "0.60868496", "0.60821855", "0.6072671", "0.6070256", "0.6044613", "0.6027984", "0.6004947", "0.5990207", "0.59476805", "0.59476805", "0.5926087", "0.5865863", "0.5836848", "0.58219934", "0.57876724", "0.57851076", "0.5779755", "0.5735601" ]
0.71105415
1
DELETE /secret_keys/1 DELETE /secret_keys/1.json
def destroy @secret_key.destroy respond_to do |format| format.html { redirect_to secret_keys_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @secret.destroy\n head :no_content\n end", "def delete_secret_key\n\t\takey = GPGME::Key.find(:secret, @dname)\n\t\takey.each do |akey|\n\t\takey.delete!(allow_secret = true)\n\t\tend\n\tend", "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'El secreto se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'Secret was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @secret, :destroy?\n\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'Secret was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @secret = Secret.find(params[:id])\r\n @secret.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(:action => 'index') }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n get_context!\n @deploy_heroku_api_key.destroy\n\n respond_to do |format|\n format.html { redirect_to deploy_heroku_api_keys_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @credential_key.destroy\n respond_to do |format|\n format.html { redirect_to credential_keys_url, notice: 'Credential key was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apikey.destroy\n respond_to do |format|\n format.html { redirect_to apikeys_url, notice: 'API key was successfully destroyed.' }\n end\n end", "def destroy\n @api_key.destroy\n\n respond_to do |format|\n format.html { redirect_to(api_keys_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n secret = Secret.find(params[:id])\n secret.destroy\n redirect_to \"/users/#{secret.user_id}\"\n end", "def call(id)\n client.delete(\"/api/rest/v1/api_keys/#{id}.json\")\n true\n end", "def destroy\n @apikey.destroy\n respond_to do |format|\n format.html { redirect_to apikeys_url, notice: \"Apikey was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_key_pair(name)\n delete(\"tenants/#{tenant}/sshkeys/#{name}\")\n end", "def delete\n client.delete_access_key(resource_options)\n nil\n end", "def destroy\n\n api_key = ApiKey.where(access_token: token).first\n\n api_key.access_token = ''\n api_key.expires_at = Time.now\n\n if api_key.save\n render json: {}, status: 200\n else\n render json: {}, status: 422\n end\n end", "def delete\n connection.delete(\"/#{URI.escape(@key)}\", @bucket_name)\n end", "def webhelper_delete_all_signing_keys(username, password, base_url = @base_url)\r\n private_resource = RestClient::Resource.new base_url + \"/api/v1/keys\", {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.get :accept => :json\r\n json = JSON.parse(response)\r\n\r\n puts \"\"\r\n # delete ios signing_keys\r\n puts \"+ Delete iOS signing-key: \"\r\n json['keys']['ios']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n # delete android signing_keys\r\n puts \"+ Delete Android signing-key: \"\r\n json['keys']['android']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n # delete blackberry signing_keys\r\n puts \"+ Delete BlackBerry signing-key: \"\r\n json['keys']['blackberry']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n end", "def destroy\n @key = Key.find(params[:id])\n @key.destroy\n\n respond_to do |format|\n format.html { redirect_to keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @swift_api_key.destroy\n respond_to do |format|\n format.html { redirect_to swift_api_keys_url, notice: 'Swift api key was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'api'\n end", "def destroy\n @configuration_key.destroy\n respond_to do |format|\n format.html { redirect_to configuration_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @keystore.destroy\n respond_to do |format|\n format.html { redirect_to keystores_url, notice: 'Keystore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n delete(\"/2.0/oauth_providers/#@consumer_key\")['success']\n end", "def destroy\n @secret = Secret.find(params[:id])\n if current_user == @secret.user\n @secret.destroy\n end\n redirect_to \"/users/#{session[:user_id]}\"\n end", "def destroy\n @public_key.destroy\n # PublicKey.regenerate_authorized_keys\n GitWit.remove_authorized_key(@public_key.raw_content)\n\n respond_to do |format|\n format.html { redirect_to public_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @key_pair = KeyPair.find(params[:id])\n @key_pair.destroy\n\n respond_to do |format|\n format.html { redirect_to key_pairs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @login_key = LoginKey.find(params[:id])\n @login_key.destroy\n\n respond_to do |format|\n format.html { redirect_to login_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sshkey.destroy\n respond_to do |format|\n format.html { redirect_to sshkeys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @whiskey = Whiskey.find(params[:id])\n @whiskey.destroy\n\n respond_to do |format|\n format.html { redirect_to whiskeys_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end" ]
[ "0.71263814", "0.7061591", "0.69951266", "0.68707645", "0.68013763", "0.6764238", "0.6719346", "0.67113805", "0.66667426", "0.66657424", "0.6661418", "0.6655528", "0.6620707", "0.6620132", "0.6596752", "0.6561845", "0.6548554", "0.65265644", "0.6500443", "0.6485812", "0.64506036", "0.6448499", "0.6446256", "0.6428649", "0.6423145", "0.63984686", "0.6350917", "0.634269", "0.6341662", "0.6328724" ]
0.7774702
0
GET /matchs/1 GET /matchs/1.json
def show @match = Match.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @match } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end", "def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @match }\n end\n end", "def get_match ( match_key )\n get_api_resource \"#{@@api_base_url}match/#{match_key}\"\n end", "def show\n #@match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match }\n end\n end", "def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def index\n @matches = Match.where(\"player2_id IS NOT NULL\").order(\"#{:id} desc\")\n\n respond_to do |format|\n format.html { @matches }\n format.json { render json: @matches}\n end\n end", "def match(match_id)\n get_request(shard_endpoint_uri(\"matches/#{match_id}\"))\n end", "def show\n authorize! :show, Match\n\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match }\n end\n end", "def find options={}, match_id:\n DynamicModel.new perform_request api_url \"matches/#{match_id}\", options\n end", "def get_match\n @match = Match.find(params[:match_id])\n end", "def show\n @match_stat = MatchStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match_stat }\n end\n end", "def index\n @matches = Match.page(params[:page]).per(1)\n end", "def recent_matches\n @matches = Match.where(status: nil);\n render json: { matches: @matches }, status: :ok\n end", "def get_match_data(match_id)\n # Given a matchId, make an API request for the match data.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matches/#{match_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n sleep(1)\n match_data = JSON.parse(response_string)\nend", "def show\n @match_image = MatchImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match_image }\n end\n end", "def show\n @match = @contest.matches.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @match }\n end\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matches = Match.all\n end", "def index\n @matchs_du_jour = Match.find_all_by_date_match(DateTime.now.to_date)\n\n @matchs_termines = Match.where(\"date_match < ? \",DateTime.now.to_date)\n\n @matchs_a_venir = Match.where(\"date_match > ? \",DateTime.now.to_date)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def show\n render json: @clan_match\n end", "def get_match\n @match = Match.find( params[:match_id] )\n raise ActiveRecord::RecordNotFound unless @match\n end", "def index\n @clan_matches = ClanMatch.all\n\n render json: @clan_matches\n end", "def index\n @match_sets = MatchSet.all\n end", "def index\n if @tournament = Tournament.where(:id => params[:tournament_id]).first\n @matches = @tournament.matches\n else\n @matches = Match.all\n end\n\n @matches_in_dates = Match.matches_in_dates(@matches)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def show\n @interpro_match = InterproMatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interpro_match }\n end\n end", "def show\n @matchsindiv = Matchsindiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matchsindiv }\n end\n end", "def index\n @matches = @current_user.matches.includes(:matched_with_user) + @current_user.matched_with_users.includes(:user)\n options = {include: [:user, :matched_with_user]}\n render json: serializer.new(@matches, options), include: ['user', 'matched_with_user']\n end" ]
[ "0.7566503", "0.7555019", "0.7450852", "0.73728883", "0.72528493", "0.70715123", "0.7068406", "0.7018088", "0.7017495", "0.69765025", "0.68974364", "0.687791", "0.68285143", "0.6807695", "0.676487", "0.675521", "0.6708733", "0.6708733", "0.6708733", "0.6708733", "0.6708733", "0.6706309", "0.6664659", "0.66455394", "0.66394025", "0.66215366", "0.6621117", "0.6619404", "0.6616752", "0.6598893" ]
0.75990415
0
PUT /matchs/1 PUT /matchs/1.json
def update @match = match.find(params[:id]) respond_to do |format| if @match.update_attributes(params[:match]) format.html { redirect_to @match, notice: 'match was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @match.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n match = Match.find_by(id: match_params[:id])\n\n match.update match_params\n if match.valid?\n render json: { match: match}, status: :created\n else\n render json: { errors: match.errors.full_messages }, status: :not_accepted\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, :notice => 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: \"Match was successfully updated.\" }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to matches_path, notice: 'Match was successfully updated.' }\n format.json { render :index, status: :ok, location: @match }\n else\n set_matches\n format.html { redirect_to matches_path, alert: @match.errors.full_messages.join(\"<br/>\") }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to matches_url, notice: 'Match modifié avec succès' }\n format.json { render :index, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n # format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.html { redirect_to [@fes, @match], notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match_set.update(match_set_params)\n format.html { redirect_to @match_set, notice: 'Match set was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_set }\n else\n format.html { render :edit }\n format.json { render json: @match_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n UpdateMatch.run(params)\n redirect_to tournament_path(tournament_id), status: 303\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to(@match, :notice => 'Match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to(@match, :notice => 'Match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @match = @contest.matches.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(contest_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n Rails.logger.debug \"GOT TO matches -> update\"\n match = Match.find(params[:match_id].to_i)\n requestor = match.user_for_id(params[:requestor_id].to_i)\n recipient = match.user_for_id(params[:requested_id].to_i)\n match.ask_for_cards(requestor: requestor, recipient: recipient, card_rank: params['rank'].upcase)\n match.save!\n render json: nil, status: :ok\n end", "def update\n respond_to do |format|\n if @team_match.update(team_match_params)\n format.html { redirect_to @team_match, notice: 'Team match was successfully updated.' }\n format.json { render :show, status: :ok, location: @team_match }\n else\n format.html { render :edit }\n format.json { render json: @team_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.js {}\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(@match) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @clan_match = ClanMatch.find(params[:id])\n\n if @clan_match.update(clan_match_params)\n head :no_content\n else\n render json: @clan_match.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.7366723", "0.6968276", "0.69544584", "0.694611", "0.69208413", "0.69208413", "0.69208413", "0.69208413", "0.69208413", "0.69208413", "0.69208413", "0.69208413", "0.69208413", "0.69208413", "0.69204366", "0.69202495", "0.6915333", "0.68965554", "0.68938047", "0.6764857", "0.6759824", "0.6708932", "0.65921724", "0.65921724", "0.65825784", "0.65704465", "0.65642774", "0.6553435", "0.6537848", "0.652259" ]
0.7070172
1
DELETE /matchs/1 DELETE /matchs/1.json
def destroy @match = match.find(params[:id]) @match.destroy respond_to do |format| format.html { redirect_to matchs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n respond_to do |format|\n if @match\n if @match.destroy\n format.json { head :no_content, status: :ok}\n end\n else\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @match.destroy\n render json: {success: true}\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(matches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match = @contest.matches.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_to) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n \n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(matches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match supprimé' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clan_match.destroy\n\n head :no_content\n end", "def destroy\n @match.destroy\n respond_to do |format|\n # format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.html { redirect_to fes_matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_stat = MatchStat.find(params[:id])\n @match_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to match_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_set.destroy\n respond_to do |format|\n format.html { redirect_to match_sets_url, notice: 'Match set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_path, notice: 'Partida deletada com sucesso' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_path(tournament: match_params[:tournament_id]), notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.76211053", "0.76043123", "0.76043123", "0.76043123", "0.755507", "0.7508835", "0.7446173", "0.7330209", "0.7319407", "0.7309181", "0.73089856", "0.72890025", "0.72890025", "0.72890025", "0.72890025", "0.72890025", "0.72890025", "0.72890025", "0.72890025", "0.72890025", "0.72890025", "0.72890025", "0.7288469", "0.7238052", "0.71368957", "0.7119826", "0.7113334", "0.7103023", "0.70975184", "0.7060214" ]
0.7758525
0
evaluate transaction status change
def eval_transaction_status_change params return if params.blank? or params[:status_notification].blank? or params[:status_notification][:transaction].blank? init_data_by_payment(Spree::Payment.find_by_sofort_transaction(params[:status_notification][:transaction])) raw_response = HTTParty.post(@sofort_payment.payment_method.preferred_server_url, :headers => header, :body => transaction_request_body) new_entry = I18n.t("sofort.transaction_status_default") if raw_response.parsed_response["transactions"].present? and raw_response.parsed_response["transactions"]["transaction_details"].present? td = raw_response.parsed_response["transactions"]["transaction_details"] alter_payment_status(td) new_entry = "#{td["time"]}: #{td["status"]} / #{td["status_reason"]} (#{td["amount"]})" end old_entries = @sofort_payment.sofort_log || "" @sofort_payment.update_attribute(:sofort_log, old_entries += "#{new_entry}\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_transfer\n if status_changed? && status_changed?(from: \"finish\")\n errors.add(:base, \"错误的操作\")\n end\n end", "def changed\n @status = true\n end", "def update_status\n begin\n if self.service_test.status_changed?\n results = self.service_test.test_results.last(2)\n unless results.empty?\n case results.length\n when 1\n previous = TestResult.new_with_unknown_status\n when 2\n previous = results[0] \n end\n \n if USE_EVENT_LOG\n \n service = self.service_test.service\n \n ActivityLog.create(:action => \"status_change\",\n :data =>{:current_result_id => self.id, :previous_result_id =>previous.id },\n :activity_loggable => self.service_test,\n :referenced => service)\n \n current_status = ServiceCatalographer::Monitoring::TestResultStatus.new(self)\n previous_status = ServiceCatalographer::Monitoring::TestResultStatus.new(previous)\n \n \n if ENABLE_TWITTER\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so submitting a job to tweet about...\"\n msg = \"Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label} (#{self.created_at.strftime(\"%Y-%m-%d %H:%M %Z\")})\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::PostTweet.new(msg), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n unless MONITORING_STATUS_CHANGE_RECIPIENTS.empty?\n status_recipients_emails = MONITORING_STATUS_CHANGE_RECIPIENTS.dup\n \n if NOTIFY_SERVICE_RESPONSIBLE\n status_recipients_emails = status_recipients_emails + self.responsible_emails\n end\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so emailing the special set of recipients about it...\"\n subject = \"[#{SITE_NAME}] Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label}\"\n text = \"A monitoring test status change has occurred! Service '#{ServiceCatalographer::Util.display_name(service)}' has a test (#{self.service_test.test_type}, ID: #{self.service_test.test_id}) change status from #{previous_status.label} to #{current_status.label}. Last test result message: #{current_status.message}. Go to Service: #{ServiceCatalographer::Api.uri_for_object(service)}\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::StatusChangeEmails.new(subject, text, status_recipients_emails), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n end\n end\n end\n rescue Exception => ex\n logger.error(\"There was problems updating the status for service test : #{self.service_test.id}\")\n logger.error(ex)\n end\n end", "def execute_transaction\n if self.status == \"pending\" && self.sender.balance > self.amount && self.valid?\n self.sender.balance -= self.amount\n self.receiver.balance += self.amount\n self.status = \"complete\"\n else\n self.status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\n end\n end", "def compare_with_previous_state(node)\n saved_node = @nodes[node['uid']]\n return node unless saved_node\n\n node_progress = node['progress'] || saved_node['progress'].to_i\n\n return if final_status?(saved_node['status']) &&\n !final_status?(node['status'])\n # Allow to send only node progress/status update\n return if node_progress.to_i <= saved_node['progress'].to_i &&\n node['status'] == saved_node['status'] &&\n node['deployment_graph_task_name'] == saved_node['deployment_graph_task_name'] &&\n node['task_status'] == saved_node['task_status']\n node\n end", "def execute_transaction\n if valid? && sender.balance > amount && self.status == \"pending\"\n sender.balance -= amount\n receiver.balance += amount\n self.status = \"complete\"\n else \n self.status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\" \n end\n end", "def update_transaction_log\n begin\n gateway = TransferredEventOrder.gateways.find{|g| g[:model] == self.class.to_s}\n log = self.event_order.transaction_logs.where(gateway_transaction_id: self.dd_number, status: TransactionLog.statuses['pending'], transaction_type: TransactionLog.transaction_types[:pay], gateway_name: gateway[:symbol]).last\n log.update(status: TransactionLog.statuses['success']) if log.present?\n rescue => e\n Rollbar.error(e)\n end\n errors.empty?\n end", "def execute_transaction\n if self.valid? == true && @sender.balance > amount && @status == 'pending'\n @sender.balance -= amount\n @receiver.balance += amount\n @status = 'complete'\n else\n @status = 'rejected'\n \"Transaction rejected. Please check your account balance.\"\n end\n end", "def update_status\n authorize @event_order\n begin\n\n raise \"Please enter the transaction id.\" unless params[:transaction_id].present? if (@event_order.pending? || @event_order.failure?)\n\n ApplicationRecord.transaction do\n update_event_order_status(params[:status])\n @event_order.after_manual_status_update(params[:transaction_id])\n @event_order.update_columns(reg_ref_number: \"manual_\"+@event_order.reg_ref_number) if @event_order.success?\n end\n\n rescue SyException, AASM::InvalidTransition => e\n @message = e.message\n if @event_order.errors.present?\n error = @event_order.errors.messages.first\n @message = error.is_a?(Array) ? error.flatten.join(' ') : error\n end\n\n rescue Exception => e\n @message = e.message\n end\n @message.present? ? flash[:error] = @message : flash[:success] = \"Status Updated Successfully.\"\n respond_to do |format|\n format.js\n format.html{ redirect_back(fallback_location: proc { root_path }) }\n end\n end", "def execute_transaction\n if self.valid? == true && status != \"complete\"\n self.receiver.balance += self.amount\n self.sender.balance -= self.amount\n self.status = \"complete\"\n else\n self.status = \"rejected\"\n return \"Transaction rejected. Please check your account balance.\"\n end\n end", "def lint_transaction_support\n result = gateway_instance.transaction { 1 }\n\n complain \"#{gateway_instance} must return the result of a transaction block\" if result != 1\n\n gateway_instance.transaction do |t|\n t.rollback!\n\n complain \"#{gateway_instance} must interrupt a transaction on rollback\"\n end\n end", "def execute_transaction\n if self.valid?\n @sender.balance -= @amount\n @receiver.balance += @amount\n @amount -= @amount\n @status = \"complete\"\n else\n @status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\nend\nend", "def change_status(status)\n #not implemented \n end", "def check_transaction_status\n data = basic_credentials.merge(\n 'x_trans_key' => @x_trans_key,\n 'x_invoice_num' => invoice_num,\n 'x_type' => (type || 0)\n )\n\n astro_curl(@transtatus_url, data)\n end", "def within_transaction; end", "def within_transaction; end", "def execute_transaction\n if valid? && sender.balance > amount && self.status == \"pending\"\n sender.balance -= amount\n receiver.balance += amount\n self.status = \"complete\"\n else\n reject_transfer\n end\n\n end", "def check_for_state_change\n\n stored_task = ModelTask.find(self.id) if self.id\n\n if stored_task \n if !stored_task.completed? && self.completed?\n self.completed_at = Time.now\n state_change = 'Task Completed'\n elsif !stored_task.closed? && self.closed?\n self.closed_at = Time.now\n state_change = 'Task Closed'\n elsif stored_task.closed? && !self.closed?\n state_change = 'Task Reopened'\n elsif stored_task.completed? && !self.completed?\n state_change = 'Task Incomplete - Needs more work/input'\n end\n\n if state_change\n self.model_comments << ModelComment.new( :user_id => self.get_user.id, \n :comment => 'STATUS CHANGE: ' + state_change)\n end\n end\n \n end", "def execute_transaction\n if @counter != 0\n @status = 'rejected'\n false\n elsif !@sender.valid? || @sender.balance <= @amount\n @status = 'rejected'\n \"Transaction rejected. Please check your account balance.\"\n else\n @sender.balance = @sender.balance - @amount\n @receiver.balance = @receiver.balance + @amount\n @counter += 1\n @status = 'complete'\n end\n end", "def status\n @status ||= if checksum_ok?\n if transaction_id.blank?\n 'invalid'\n else\n transaction_status.downcase\n end\n else\n 'tampered'\n end\n end", "def execute_transaction\n if self.sender.balance > self.amount && self.status == \"pending\" && self.valid?\n self.receiver.deposit(self.amount)\n self.sender.deposit(-self.amount) \n self.status = \"complete\"\n else\n self.status = \"rejected\" \n \"Transaction rejected. Please check your account balance.\"\n end\n end", "def execute_transaction\n if valid? && @sender.balance > amount && @status == \"pending\"\n @sender.balance -= amount\n @receiver.balance += amount\n @status = \"complete\"\n else\n reject\n end\n end", "def post_transaction_process\n fail(ActiveRecord::Rollback) unless @status\n end", "def advancing_status\n if Task.statuses[status_was] > Task.statuses[status]\n errors.add(:status, 'change is invalid')\n end\n end", "def execute_transaction\n if valid? && sender.balance > amount && status == \"pending\"\n receiver.balance += amount\n sender.balance -= amount\n self.status = \"complete\"\n else \n reject_transfer\n end\n end", "def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend", "def transaction_status\n params['TxStatus']\n end", "def update\n if @transaction.update(transaction_params)\n\n # implement all admin approved transactions here.\n if @transaction.kind == 'withdraw' and @transaction.status == 'approved' and @transaction.processed == false\n account = Account.find(@transaction.account_id)\n if account.balance > @transaction.amount\n account.balance -= @transaction.amount\n account.save\n @transaction.eff_date = Time.current\n @transaction.processed = true\n @transaction.save\n user_to_mail = User.find(Account.find(@transaction.account_id).user_id)\n UserMailer.transaction_email(user_to_mail, @transaction).deliver_later\n end\n elsif @transaction.kind == 'deposit' and @transaction.status == 'approved' and @transaction.processed == false\n account = Account.find(@transaction.account_id)\n account.balance += @transaction.amount\n account.save\n @transaction.eff_date = Time.current\n @transaction.processed = true\n @transaction.save\n user_to_mail = User.find(Account.find(@transaction.account_id).user_id)\n UserMailer.transaction_email(user_to_mail, @transaction).deliver_later\n elsif @transaction.kind == 'borrow' and @transaction.status == 'approved' and @transaction.processed == false\n account1 = Account.find(@transaction.from)\n account2 = Account.find(@transaction.to)\n if account1.balance > @transaction.amount\n account1.balance -= @transaction.amount\n account2.balance += @transaction.amount\n account1.save\n account2.save\n @transaction.start_date = Time.current\n @transaction.eff_date = Time.current\n @transaction.status = 'approved'\n @transaction.processed = true\n @transaction.account_id = account1.id\n @transaction.save\n sender = User.find(Account.find(@transaction.from).user_id)\n recipient = User.find(Account.find(@transaction.to).user_id)\n UserMailer.transaction_email(sender, @transaction).deliver_later\n UserMailer.transaction_email(recipient, @transaction).deliver_later\n end\n end\n\n redirect_to @transaction, notice: 'Transaction was successfully updated.', id: @transaction.id\n else\n render :edit\n end\n end", "def transaction_status\n params['TxStatus']\n end", "def transaction_status\n params['TxStatus']\n end" ]
[ "0.64662635", "0.6388516", "0.62790674", "0.623466", "0.61943907", "0.61943156", "0.6155995", "0.6134327", "0.61225134", "0.61059034", "0.60855407", "0.60820657", "0.607373", "0.6066787", "0.60397434", "0.60397434", "0.60300416", "0.6027858", "0.60225224", "0.60185456", "0.60174876", "0.6015697", "0.6002203", "0.59799486", "0.5957946", "0.59557915", "0.59453183", "0.5911393", "0.58986086", "0.58986086" ]
0.71097296
0
Return an array list of themes that this user is permitted to use in a project
def author_themes return [] if meta.nil? || meta['roles'].nil? # if this is a superuser, return all available themes # if we only have an array of roles, all themes are available if role?(:superuser) || (meta['roles'].is_a?(Array) && role?(:author, :editor)) themes = Rails.configuration.autotune.themes.keys else # otherwise get all the themes for all the roles and make an array themes = [] [:author, :editor, :superuser].each do |r| themes += meta['roles'][r.to_s] if meta['roles'][r.to_s] end themes.uniq! end # return an array list of theme objects Theme.where :value => themes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_themes\n themes_dir = File.join(File.dirname(__FILE__), '/public/themes')\n\n themes = []\n Dir.entries(themes_dir).sort.each do |dir|\n themes.push dir if ((dir != 'fonts') and (dir[0] != '.'))\n end\n themes\n end", "def editor_themes\n return [] if meta.nil? || meta['roles'].nil?\n # authors can't edit other projects\n return [] unless role?(:editor, :superuser)\n # if we only have an array, superusers and editors can edit all themes\n # also, superusers can always edit all the themes, even if we have a hash of roles\n if meta['roles'].is_a?(Array) || role?(:superuser)\n themes = Rails.configuration.autotune.themes.keys\n else\n # otherwise get all the themes for editor\n themes = meta['roles']['editor']\n end\n # return an array list of theme objects\n Theme.where :value => themes\n end", "def themes(theme_list)\n @themes = theme_list\n end", "def index\n @cms_themes = current_portal.themes\n end", "def index\n @settings = self.current_user.setting\n @themes = Theme.by_weight\n rescue => ex\n handle_exception(ex)\n ensure\n end", "def theme_elements\n theme.split('-')\n end", "def themes_menu(user)\n pastel = Pastel.new\n puts \" \"\n puts pastel.white.inverse.bold(\"Here are a list of themes, please select one.\") \n puts \"*********************\"\n Joke.all_themes \n puts \"*********************\"\n user_theme = gets.chomp\n if Joke.find_by_theme(user_theme) == []\n puts \"*********************\"\n puts pastel.white.inverse.bold(\"No such theme, please try again.\")\n puts \"*********************\"\n self.return_to_menu(user)\n else Joke.puts_user_theme_jokes(user_theme)\n puts \" \"\n self.return_to_menu(user)\n end\n end", "def index\n @user_themes = Theme.where(\"user_id = ?\", current_user.id).order(\"created_at\")\n \n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @user_themes }\n end\n end", "def index\n @themes = Theme.all\n end", "def assigned_theme_ids(is_preview = false)\n if @theme_ids.nil?\n @theme_ids = []\n @theme_ids << find_theme_id(is_preview)\n @theme_ids << find_theme_id(is_preview, is_detail = true)\n end\n @theme_ids\n end", "def index\n @theme_names = ThemeName.all\n end", "def index\n @node_has_themes = NodeHasTheme.all\n end", "def fetch_themes(options={})\n url = build_url options\n themes = Nokogiri::XML(open(url)).search('//item').map do |item|\n Kuler::Theme.new item.at('./kuler:themeItem')\n end\n themes\n end", "def wp_theme_enumerator(site=@site, verbose=true)\n @wp_paths.each do |p|\n theme_dir = site.sub(/\\/$/, '') + p + '/wp-content/themes/'\n res = @http.get(theme_dir)\n if res[0] =~ /<title>Index of.+\\/wp-content\\/themes<\\/title>|<h1>Index of.+\\/wp-content\\/themes<\\/h1>/i\n t1 = res[0].scan(/href=\"(.+)\\/\">?[a-z]/)\n t2 = res[0].scan(/href=\"(.+)\\/\"> ?[a-z]/)\n themez = t1 + t2\n bad=['foo'] # Defaults and/or useless for our purposes...\n themes=[]\n themez.each {|t| themes << t unless themes.include?(t) or bad.include?(t) } \n print_good(\"Themes Directory Located: #{p}/wp-content/themes/\") if verbose\n print_good(\"Themes Found: \") if verbose\n if verbose\n themes.uniq.each do |p|\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"#{p[0]}\".white\n end\n end\n return themes.uniq\n end\n end\n return nil \n end", "def concept_themes\n find_related_frbr_objects( :has_as_its_theme, :which_concepts?) \n end", "def concept_themes\n find_related_frbr_objects( :has_as_its_theme, :which_concepts?) \n end", "def index\n @themes = Theme.all\n json_response(@themes)\n end", "def theme_with_user_ids_for_feed(is_not_authorized) \n\tids_arr = []\n\tvalue = []\n\tv_status_id = 1 if is_not_authorized\n\tv_status_id = [1,2] if !is_not_authorized\n\tuserThemesMessages = messages.select(\"DISTINCT theme_id\").where(:theme_id != nil, :status_id => 1)\n\ttheme_where_wrote_ids = themes.select(:id).where(:id => userThemesMessages, :status_id => [1,3], :visibility_status_id => v_status_id)\n\tself_themes_ids = themes.select(:id).where(:status_id => [1,3], :visibility_status_id => v_status_id)\n\tids_arr += theme_where_wrote_ids if theme_where_wrote_ids != [] #Ids тем в которых пользователь писал\n\tids_arr += self_themes_ids if self_themes_ids != [] #Ids тем которые пользователь создал\n\tids_arr.uniq! if ids_arr != []\n\tvalue = Theme.where(id: ids_arr).order('created_at DESC') if ids_arr != []\n\treturn value\n end", "def index\n @theme_groups = ThemeGroup.all\n end", "def index\n @theme_groups = ThemeGroup.all\n end", "def theme\n Design::Theme.array.find_by_name(self.theme_name) || site.theme\n end", "def index\n @organization_themes = if current_manager\n current_manager.organization.organization_theme\n else\n OrganizationTheme.newest_first.per_page(params[:page])\n end\n end", "def all_themes\n Dir.chdir(wasko_directory) do |path|\n Dir[\"*.color\"].map do |filename|\n filename.gsub(/\\.color$/, \"\")\n end\n end\n end", "def theme\n @theme ||= resource.cache.theme(theme_id)\n end", "def themes_path\n File.join(RAILS_ROOT, 'themes')\n end", "def get_theme_mods\n theme_slug = get_option( 'stylesheet' )\n mods = get_option( \"theme_mods_#{theme_slug}\" )\n if mods\n theme_name = get_option( 'current_theme' )\n unless theme_name\n theme_name = wp_get_theme.get( 'Name' )\n end\n # mods = get_option( \"mods_#{theme_name}\" ) # Deprecated location.\n # if is_admin() && false != mods\n # update_option( \"theme_mods_#{theme_slug}\", mods )\n # delete_option( \"mods_#{theme_name}\" )\n # end\n else\n mods = {}\n end\n mods\n end", "def index\n if current_user.has_role? :admin\n @projects = Project.all\n elsif current_user.has_role? :developer\n @projects = Project.is_dev_here(current_user.developer.id)\n else\n @projects = []\n end\n end", "def theme\n @theme\n end", "def gemed_themes\n @@gemed_themes ||= @@gem_theme_classes.uniq.collect {|listener| listener.instance}\n end", "def projects\n if is_deploy_key\n [project]\n else\n user.authorized_projects\n end\n end" ]
[ "0.7200508", "0.6968776", "0.6531828", "0.6449759", "0.63100535", "0.6282218", "0.6279101", "0.6198157", "0.61793166", "0.6157119", "0.6125918", "0.6083742", "0.6067845", "0.60221076", "0.5992865", "0.5992865", "0.5986286", "0.5970423", "0.59126174", "0.59126174", "0.59011084", "0.58894366", "0.57888925", "0.5728916", "0.57271475", "0.5674332", "0.567264", "0.5660298", "0.5657981", "0.55833465" ]
0.71059227
1
Return an array of themes that this user is allowed to edit. Editors can see and change other users' projects. This user will be limited to projects that use these themes.
def editor_themes return [] if meta.nil? || meta['roles'].nil? # authors can't edit other projects return [] unless role?(:editor, :superuser) # if we only have an array, superusers and editors can edit all themes # also, superusers can always edit all the themes, even if we have a hash of roles if meta['roles'].is_a?(Array) || role?(:superuser) themes = Rails.configuration.autotune.themes.keys else # otherwise get all the themes for editor themes = meta['roles']['editor'] end # return an array list of theme objects Theme.where :value => themes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author_themes\n return [] if meta.nil? || meta['roles'].nil?\n # if this is a superuser, return all available themes\n # if we only have an array of roles, all themes are available\n if role?(:superuser) || (meta['roles'].is_a?(Array) && role?(:author, :editor))\n themes = Rails.configuration.autotune.themes.keys\n else\n # otherwise get all the themes for all the roles and make an array\n themes = []\n [:author, :editor, :superuser].each do |r|\n themes += meta['roles'][r.to_s] if meta['roles'][r.to_s]\n end\n themes.uniq!\n end\n # return an array list of theme objects\n Theme.where :value => themes\n end", "def get_themes\n themes_dir = File.join(File.dirname(__FILE__), '/public/themes')\n\n themes = []\n Dir.entries(themes_dir).sort.each do |dir|\n themes.push dir if ((dir != 'fonts') and (dir[0] != '.'))\n end\n themes\n end", "def themes(theme_list)\n @themes = theme_list\n end", "def editors\n editor_collaborators = collaborators.where(role: \"editor\").all\n if editor_collaborators\n editor_collaborators.map {|e| e.user}\n else\n []\n end\n end", "def themes_menu(user)\n pastel = Pastel.new\n puts \" \"\n puts pastel.white.inverse.bold(\"Here are a list of themes, please select one.\") \n puts \"*********************\"\n Joke.all_themes \n puts \"*********************\"\n user_theme = gets.chomp\n if Joke.find_by_theme(user_theme) == []\n puts \"*********************\"\n puts pastel.white.inverse.bold(\"No such theme, please try again.\")\n puts \"*********************\"\n self.return_to_menu(user)\n else Joke.puts_user_theme_jokes(user_theme)\n puts \" \"\n self.return_to_menu(user)\n end\n end", "def get_theme_mods\n theme_slug = get_option( 'stylesheet' )\n mods = get_option( \"theme_mods_#{theme_slug}\" )\n if mods\n theme_name = get_option( 'current_theme' )\n unless theme_name\n theme_name = wp_get_theme.get( 'Name' )\n end\n # mods = get_option( \"mods_#{theme_name}\" ) # Deprecated location.\n # if is_admin() && false != mods\n # update_option( \"theme_mods_#{theme_slug}\", mods )\n # delete_option( \"mods_#{theme_name}\" )\n # end\n else\n mods = {}\n end\n mods\n end", "def all_sheet_editable_projects\n Project.current.editable_by_user(self)\n end", "def assigned_theme_ids(is_preview = false)\n if @theme_ids.nil?\n @theme_ids = []\n @theme_ids << find_theme_id(is_preview)\n @theme_ids << find_theme_id(is_preview, is_detail = true)\n end\n @theme_ids\n end", "def index\n @cms_themes = current_portal.themes\n end", "def editors\n\t\teditors = [self.user]\n\t\teditors\n\tend", "def all_editable_sites\n Site.current.with_project_or_as_site_editor(all_projects.select(:id), id)\n end", "def theme\n Design::Theme.array.find_by_name(self.theme_name) || site.theme\n end", "def theme_elements\n theme.split('-')\n end", "def index\n @settings = self.current_user.setting\n @themes = Theme.by_weight\n rescue => ex\n handle_exception(ex)\n ensure\n end", "def index\n @user_workspaces = UserWorkspace.owned_by(current_user)\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def theme\n @theme ||= resource.cache.theme(theme_id)\n end", "def editable_by?(user)\n return true unless has_limited_editors?\n\n (editor_roles & user.alchemy_roles).any?\n end", "def index\n @user_themes = Theme.where(\"user_id = ?\", current_user.id).order(\"created_at\")\n \n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @user_themes }\n end\n end", "def editors\n @editors ||= settings.github.team_members(settings.joss_editor_team_id).collect { |e| e.login }\nend", "def theme_with_user_ids_for_feed(is_not_authorized) \n\tids_arr = []\n\tvalue = []\n\tv_status_id = 1 if is_not_authorized\n\tv_status_id = [1,2] if !is_not_authorized\n\tuserThemesMessages = messages.select(\"DISTINCT theme_id\").where(:theme_id != nil, :status_id => 1)\n\ttheme_where_wrote_ids = themes.select(:id).where(:id => userThemesMessages, :status_id => [1,3], :visibility_status_id => v_status_id)\n\tself_themes_ids = themes.select(:id).where(:status_id => [1,3], :visibility_status_id => v_status_id)\n\tids_arr += theme_where_wrote_ids if theme_where_wrote_ids != [] #Ids тем в которых пользователь писал\n\tids_arr += self_themes_ids if self_themes_ids != [] #Ids тем которые пользователь создал\n\tids_arr.uniq! if ids_arr != []\n\tvalue = Theme.where(id: ids_arr).order('created_at DESC') if ids_arr != []\n\treturn value\n end", "def index\n @themes = Theme.all\n end", "def index\n if current_user.has_role? :admin\n @projects = Project.all\n elsif current_user.has_role? :developer\n @projects = Project.is_dev_here(current_user.developer.id)\n else\n @projects = []\n end\n end", "def themes_path\n File.join(RAILS_ROOT, 'themes')\n end", "def concept_themes\n find_related_frbr_objects( :has_as_its_theme, :which_concepts?) \n end", "def concept_themes\n find_related_frbr_objects( :has_as_its_theme, :which_concepts?) \n end", "def index\n @organization_themes = if current_manager\n current_manager.organization.organization_theme\n else\n OrganizationTheme.newest_first.per_page(params[:page])\n end\n end", "def update_theme user\n user.theme = Theme.get(params[\"theme\"])\n end", "def projects\n if is_deploy_key\n [project]\n else\n user.authorized_projects\n end\n end" ]
[ "0.71528304", "0.64106244", "0.5802137", "0.57948714", "0.5700719", "0.56590044", "0.56555265", "0.5652926", "0.5596658", "0.55074036", "0.55002177", "0.54541475", "0.54521096", "0.5438579", "0.53935593", "0.5368208", "0.5368208", "0.5335459", "0.5335307", "0.52945167", "0.529128", "0.52868193", "0.52810895", "0.5276427", "0.52687675", "0.5268396", "0.5268396", "0.5249982", "0.52110696", "0.5175832" ]
0.8083726
0
Validation uniqueness of path, constrained by county.
def path_must_be_unique_in_county return nil if path.blank? || !county my_path = self.path.to_s.downcase county.graveyards.each do |g| if (g.path.to_s.downcase == my_path) && (g.id != self.id) errors.add(:path, "#{self.path} has already been taken") end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniqueness_for_school_and_subject\n school = School.find(school_id)\n school.courses.where(subject_id: subject_id).each do |course|\n if (course.call_number == call_number)\n errors.add(:course, 'course call number already exists')\n return\n elsif (course.friendly_name == friendly_name)\n errors.add(:course, 'course friendly name already exists')\n return\n end\n end\n end", "def validate_path\n site = self.try(:site) || (self.try(:tippable_type) == 'Site' ? Site.find(self.tippable_id) : nil)\n if site && path.present? && Site.where(hostname: site.hostname + self.path).any?\n errors.add(:path, 'you can\\'t use this path. Another website is defined with this hostname+path')\n end\n end", "def slug_unique_in_clinic\n errors.add(:slug, \"Slug: #{slug} already in use\") unless\n slug_unique_in_clinic?\n end", "def validate_name_is_unique_among_folders\n return if folder.nil?\n\n conflicts = folder.children.where.has { |parent| name =~ parent.name }\n errors.add(:name, :taken) unless conflicts.empty?\n end", "def uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end", "def validate_districts(districts)\n uniq_districts = []\n districts.each do |district|\n if (uid_exists?(\"district\", did = district[\"ident\"].to_s))\n if (uniq_districts.include?(district))\n val_warn(\"Duplicate District Declaration\", did, \"in Jurisdiction Definition\")\n else\n val_err(\"Non-Unique District UID\", did, \"in Jurisdiction Definition\")\n end\n else \n uniq_districts.push(district)\n uid_add(\"district\", did)\n end\n end\n end", "def validate_unique_with_status\n psl = PersonSchoolLink.where(:person_id => self.person_id, :school_id => self.school_id).status_active\n if self.id\n psl = psl.where(\"id != #{self.id}\")\n end\n if psl.length > 0\n errors.add(:status, \"Username already associated with this school.\")\n end\n end", "def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end", "def validate_unique(child, child_type)\n if child_id_of.has_key?(child_type[0]) and child_id_of[child_type[0]].has_key?(child[child_type[1]])\n raise TPX_2_2::DuplicateElementInsertError, \"Duplicate input object id #{child[child_type[1]]} provided to #{self.class}!\"\n end\n end", "def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end", "def validate_name_uniqueness\n existing_files = ProjectFile.where(directory_id: directory_id, \n project_id: project_id, name: name)\n unless existing_files.empty? or (existing_files.size == 1 and \n existing_files.first == self)\n errors.add(:name, \"must be unique within a folder; please \"+\n \"change #{project.name}:#{path} to something different.\")\n end\n end", "def name_must_be_unique_if_organization\n unless type == \"Individual\"\n self.errors.add(:name, :is_already_taken) if Entity.where('lower(name) = ?', name.downcase).any?\n end\n end", "def validate_uniqueness_of_new_image_url\n self.errors[:\"image.url\"] = 'Image url has already been added to this collection' if self.dup_image?\n end", "def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end", "def test_uniqueness_of_name\n client = Client.new(:name => \"XXX\", :tat => 14,\n :partener_bank_group_code => 'KK', :internal_tat => 90, :group_code => 'JO',\n :max_jobs_per_user_payer_wise => 5, :max_jobs_per_user_client_wise => 5,\n :max_eobs_per_job => 5)\n assert_equal(false,client.save)\n end", "def name_is_unique\n return if self.name.nil?\n errors.add(:name, 'has already been taken') if Institution.where(name: self.name).reject{|r| r == self}.any?\n end", "def validate_unique(record)\n return if provided(record).uniq.length == provided(record).length\n\n record.errors.add(\n options[:attribute],\n 'contains an option more than once'\n )\n end", "def slug_unique_in_clinic?\n Department.in_clinic(self).where(slug: slug).count == 0\n end", "def already_visited?(path, current_city)\n path.count(current_city) > 1\n end", "def allows_unique?\n true\n end", "def validate_precincts(precincts)\n uniq_precincts = []\n precincts.each do |precinct|\n if (uid_exists?(\"precinct\", pid = precinct[\"ident\"].to_s))\n if (uniq_precincts.include?(precinct))\n val_warn(\"Duplicate Precinct Declaration\", pid, \"in Jurisdiction Definition\")\n else\n val_err(\"Non-Unique Precinct UID\", pid, \"in Jurisdiction Definition\")\n end\n else\n uniq_precincts.push(precinct)\n uid_add(\"precinct\", pid)\n end\n end\n end", "def name_unique_in_clinic\n errors.add(:name, \"Name: #{name} already in use\") unless\n name_unique_in_clinic?\n end", "def value_uniqueness_without_scheme\n # if scheme is nil, then just unique for identifiable\n return unless Identifier.where(identifiable: identifiable, value: value).any?\n\n errors.add(:value, _('must be unique'))\n end", "def value_uniqueness_with_scheme\n if new_record? && Identifier.where(identifier_scheme: identifier_scheme,\n identifiable: identifiable).any?\n errors.add(:identifier_scheme, _('already assigned a value'))\n end\n end", "def assert_unique(attrs)\n index_key = index_key_for(Array(attrs), read_locals(Array(attrs)))\n assert(db.scard(index_key).zero? || db.sismember(index_key, id), [Array(attrs), :not_unique])\n end", "def subdomain_is_unique\n if subdomain.present? && (League.all.count > 0)\n unless League.find_by_subdomain(subdomain).nil?\n errors.add(:subdomain, \"is already taken\")\n end\n if Apartment::Elevators::Subdomain.excluded_subdomains.include?(subdomain)\n errors.add(:subdomain, \"is not available\")\n end\n end\n end", "def validate_unique_nested_attributes(parent, collection, attribute, options = {})\n return true if collection.empty?\n\n build_default_options(options)\n validate_unique_attribute_in_collection(parent, attribute, collection, options)\n end", "def validates_unique(*atts)\n message = (atts.pop[:message] if atts.last.is_a?(Hash)) || 'is already taken'\n atts.each do |a|\n ds = model.filter(Array(a).map{|x| [x, send(x)]})\n errors.add(a, message) unless (new? ? ds : ds.exclude(pk_hash)).count == 0\n end\n end", "def check_paths_are_unique!(path_drv_map)\n set = Set.new\n path_drv_map.each do |key, drv|\n if set.include?(drv)\n raise AnticipatedError, \"The derivation #{key} is the same as \" \\\n \"other derivations in the list. Maybe use the 'omni' namespace.\"\n end\n set << drv\n end\nend", "def check_uniqueness \n has_visits = pat.visits.where(doc_id: OWNER_DOC_ID).order(entry_ts: :desc).first.entry_ts.today? rescue nil #where('date(entry_ts)=?', self.entry_ts.to_date)\n errors.add(:reason, \"Only 1 visit is allowed by OHIP per patient per day\") if has_visits\n end" ]
[ "0.5821685", "0.56460184", "0.56175864", "0.54954046", "0.54770005", "0.5422412", "0.53575736", "0.5328905", "0.53194606", "0.52935666", "0.529042", "0.52890325", "0.5287985", "0.5246418", "0.5206022", "0.5187312", "0.51832515", "0.5117289", "0.51170653", "0.51132596", "0.50997496", "0.5097773", "0.50922966", "0.50660276", "0.50498825", "0.50387496", "0.5019284", "0.5015503", "0.49980488", "0.49875024" ]
0.8701248
0
GET /constituencies/1 GET /constituencies/1.xml
def show @constituency = Constituency.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @constituency } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup\n @constituency = @request.get.first\n\n redirect_to constituency_path(@constituency.graph_id)\n end", "def show\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concert }\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 new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\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 entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\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 index\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n end", "def path\n \"/onca/xml\"\n end", "def show\n\n @venue = Venue.find(params[:id])\n @concerts = Concert.where(:venue_id=>@venue.id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue }\n end\n end", "def show\n @clenum = Clenum.find(params[:ids])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clenum }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @correspondence = Correspondence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @correspondence }\n end\n end", "def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @county }\n format.xml { render :xml => @county.to_xml(:include => { :libraries => { :include => :departments } }) }\n end\n end", "def index\n @certs = Cert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @certs }\n end\n end", "def fetch_xml(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n http.read_timeout = GoogleCustomSearch.configuration.timeout\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.initialize_http_header({ 'User-Agent' => user_agent })\n\n response = http.request(request)\n\n raise GoogleCustomSearch::InvalidRequest if response.code.match(/[34]\\d{2}/)\n raise GoogleCustomSearch::ServerError if response.code.match(/5\\d{2}/)\n\n response.body\n end", "def index\n @constats = Constat.all\n end", "def show\n @contratacion = Contratacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contratacion }\n end\n end", "def index\n @correspondences = Correspondence.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @correspondences }\n end\n end", "def show\n @catalogs_priority = Catalogs::Priority.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def show\n @occurrence = Occurrence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @occurrence }\n end\n end", "def show\n @convenio = Convenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @convenio }\n end\n end", "def index\n @cst_icms = CstIcm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_icms }\n end\n end", "def show\n @ccl = Ccl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccl }\n end\n end", "def show\n @title_view = 'Estados de Conservación'\n @cultural_heritage_conservational_state = CulturalHeritage::ConservationalState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_conservational_state }\n end\n end", "def show\n @colo = Colo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def show\n @cst_icm = CstIcm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_icm }\n end\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end", "def show\n @occurence = Occurence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def show\n @concerts = Concert.find(params[:id])\n end" ]
[ "0.6222115", "0.5971463", "0.5902317", "0.5852832", "0.58352184", "0.5820329", "0.57773244", "0.5688305", "0.56456155", "0.5645165", "0.56139857", "0.5613748", "0.55987144", "0.55851483", "0.5571247", "0.55611724", "0.55537677", "0.55506533", "0.5541908", "0.5526804", "0.55246836", "0.55190474", "0.5507042", "0.5506415", "0.54980016", "0.5491035", "0.5482194", "0.5436731", "0.54336166", "0.54282814" ]
0.6909627
0
GET /constituencies/new GET /constituencies/new.xml
def new @constituency = Constituency.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @constituency } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 create\n @constituency = Constituency.new(params[:constituency])\n\n respond_to do |format|\n if @constituency.save\n flash[:notice] = 'Constituency was successfully created.'\n format.html { redirect_to(@constituency) }\n format.xml { render :xml => @constituency, :status => :created, :location => @constituency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def new\n @conseq = Conseq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conseq }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @catalogs_priority = Catalogs::Priority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end", "def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @convenio }\n end\n end", "def new\n @colo = Colo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @ccl = Ccl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ccl }\n end\n end", "def new\n @incidenttype = Incidenttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incidenttype }\n end\n end", "def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def new\n @retain_node = RetainNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node }\n format.json { render :json => @retain_node }\n end\n end", "def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end", "def new\n @court = Court.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @court }\n end\n end", "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new\n @title = \"New income classification\"\n @incomeclassification = Incomeclassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incomeclassification }\n end\n end", "def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\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 respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\n end\n end", "def new\n @contratacion = Contratacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contratacion }\n end\n end" ]
[ "0.68227774", "0.6763014", "0.66978467", "0.66190505", "0.65733135", "0.65503794", "0.6540074", "0.65079314", "0.6492418", "0.6488922", "0.6488922", "0.6463498", "0.64566034", "0.6436784", "0.642023", "0.64196604", "0.6419493", "0.6410595", "0.6410595", "0.6400944", "0.63914263", "0.63818747", "0.6373058", "0.6364328", "0.6363447", "0.634487", "0.63377875", "0.6332098", "0.6328968", "0.6319778" ]
0.7473389
0
POST /constituencies POST /constituencies.xml
def create @constituency = Constituency.new(params[:constituency]) respond_to do |format| if @constituency.save flash[:notice] = 'Constituency was successfully created.' format.html { redirect_to(@constituency) } format.xml { render :xml => @constituency, :status => :created, :location => @constituency } else format.html { render :action => "new" } format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\n end\n end", "def create\n @constat = Constat.new(constat_params)\n\n respond_to do |format|\n if @constat.save\n format.html { redirect_to @constat, notice: 'Constat was successfully created.' }\n format.json { render :show, status: :created, location: @constat }\n else\n format.html { render :new }\n format.json { render json: @constat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @constitution = Constitution.new(params[:constitution])\n\n respond_to do |format|\n if @constitution.save\n format.html { redirect_to @constitution, notice: 'Constitution was successfully created.' }\n format.json { render json: @constitution, status: :created, location: @constitution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contrac_establishment = ContracEstablishment.new(contrac_establishment_params)\n\n respond_to do |format|\n if @contrac_establishment.save\n format.html { redirect_to @contrac_establishment, notice: 'Contrac establishment was successfully created.' }\n format.json { render :show, status: :created, location: @contrac_establishment }\n else\n format.html { render :new }\n format.json { render json: @contrac_establishment.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def create\n @condolence = Condolence.new(params[:condolence])\n @orbituarysite = @condolence.orbituarysite\n respond_to do |format|\n if @condolence.save\n format.html { redirect_to @orbituarysite, notice: 'Condolence was successfully created.' }\n format.json { render json: @condolence, status: :created, location: @condolence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @condolence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to(@concert, :notice => 'Concert was successfully created.') }\n format.xml { render :xml => @concert, :status => :created, :location => @concert }\n else\n format.html { render :action => 'new' }\n format.xml { render :xml => @concert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n if @constituency.update_attributes(params[:constituency])\n flash[:notice] = 'Constituency was successfully updated.'\n format.html { redirect_to(@constituency) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def solicitation_params\n params.require(:solicitation).permit(:kind, :departure, :return, :origin, :destination, :description, :status)\n end", "def destroy\n @constituency = Constituency.find(params[:id])\n @constituency.destroy\n\n respond_to do |format|\n format.html { redirect_to(constituencies_url) }\n format.xml { head :ok }\n end\n end", "def coference_params\n params.require(:coference).permit(:tipo, :titulo, :evento, :descripcion, :horas, :fecha_i, :fecha_f, :ano_periodo, :creador, user_ids: [])\n end", "def lookup\n @constituency = @request.get.first\n\n redirect_to constituency_path(@constituency.graph_id)\n end", "def index\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n end", "def create\n @converstation_request = ConverstationRequest.new(converstation_request_params)\n\n respond_to do |format|\n if @converstation_request.save\n format.html { redirect_to @converstation_request, notice: 'Converstation request was successfully created.' }\n format.json { render :show, status: :created, location: @converstation_request }\n else\n format.html { render :new }\n format.json { render json: @converstation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidence = Incidence.new(incidence_params)\n\n respond_to do |format|\n if @incidence.save\n format.html { redirect_to @incidence, notice: 'Incidencia creada exitosamente.' }\n format.json { render :show, status: :created, location: @incidence }\n else\n format.html { render :new }\n format.json { render json: @incidence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tramite_constitucional = TramiteConstitucional.new(params[:tramite_constitucional])\n\n respond_to do |format|\n if @tramite_constitucional.save\n format.html { redirect_to @tramite_constitucional, notice: 'Tramite constitucional was successfully created.' }\n format.json { render json: @tramite_constitucional, status: :created, location: @tramite_constitucional }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tramite_constitucional.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end", "def constat_params\n params.require(:constat).permit(:name1, :name2, :phone1, :phone2, :cni1, :cni2, :immatriculation1, :immatriculation2, :marque1, :marque2, :police1, :police2, :typeaccident_id)\n end", "def concert_params\n params.require(:concert).permit(:title, :description, :cdatetime, :location_name, :ccity, :buy_tickets_website)\n end", "def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def concert_params\n params.require(:concert).permit(:title, :start, :end, :artist, :city, :state, :address, :latitude, :longitude)\n end", "def create\n @contratacion = Contratacion.new(params[:contratacion])\n\n respond_to do |format|\n if @contratacion.save\n flash[:notice] = 'Contratacion was successfully created.'\n format.html { redirect_to(@contratacion) }\n format.xml { render :xml => @contratacion, :status => :created, :location => @contratacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contratacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @insurance_co = InsuranceCo.new(params[:insurance_co])\n\n respond_to do |format|\n if @insurance_co.save\n format.html { redirect_to(@insurance_co, :notice => 'Insurance co was successfully created.') }\n format.xml { render :xml => @insurance_co, :status => :created, :location => @insurance_co }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @insurance_co.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end", "def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def create\n @residence = Residence.new(params[:residence])\n\n respond_to do |format|\n if @residence.save\n format.html { redirect_to @residence, notice: 'Residence was successfully created.' }\n format.json { render json: @residence, status: :created, location: @residence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @residence.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.55601114", "0.5400987", "0.5211219", "0.51572895", "0.5139422", "0.50838923", "0.5079335", "0.5051694", "0.5023281", "0.50112855", "0.5005782", "0.4980672", "0.49752426", "0.49628162", "0.49553454", "0.4943119", "0.49299672", "0.49194336", "0.49115142", "0.48938355", "0.48938355", "0.48898053", "0.48830387", "0.48818964", "0.4881045", "0.4866521", "0.4859989", "0.48598984", "0.48592606", "0.48541138" ]
0.64474565
0
PUT /constituencies/1 PUT /constituencies/1.xml
def update @constituency = Constituency.find(params[:id]) respond_to do |format| if @constituency.update_attributes(params[:constituency]) flash[:notice] = 'Constituency was successfully updated.' format.html { redirect_to(@constituency) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @condolence = Condolence.find(params[:id])\n\n respond_to do |format|\n if @condolence.update_attributes(params[:condolence])\n format.html { redirect_to @condolence, notice: 'Condolence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @condolence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @incidenttype = Incidenttype.find(params[:id])\n\n respond_to do |format|\n if @incidenttype.update_attributes(params[:incidenttype])\n flash[:notice] = 'Incidenttype was successfully updated.'\n format.html { redirect_to(@incidenttype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incidenttype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @constituency = Constituency.new(params[:constituency])\n\n respond_to do |format|\n if @constituency.save\n flash[:notice] = 'Constituency was successfully created.'\n format.html { redirect_to(@constituency) }\n format.xml { render :xml => @constituency, :status => :created, :location => @constituency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n if @constitution.update_attributes(params[:constitution])\n format.html { redirect_to @constitution, notice: 'Constitution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n if @concert.update_attributes(concert_params)\n format.html { redirect_to(@concert, :notice => 'Concert was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @concert.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 respond_to do |format|\n if @constat.update(constat_params)\n format.html { redirect_to @constat, notice: 'Constat was successfully updated.' }\n format.json { render :show, status: :ok, location: @constat }\n else\n format.html { render :edit }\n format.json { render json: @constat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n if @consensu.update_attributes(params[:consensu])\n format.html { redirect_to @consensu, notice: 'Consensu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @consensu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @conseq = Conseq.find(params[:id])\n\n respond_to do |format|\n if @conseq.update_attributes(params[:conseq])\n format.html { redirect_to(@conseq, :notice => 'Conseq was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @conseq.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @constituency = Constituency.find(params[:id])\n @constituency.destroy\n\n respond_to do |format|\n format.html { redirect_to(constituencies_url) }\n format.xml { head :ok }\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @violency = Violency.find(params[:id])\n\n respond_to do |format|\n if @violency.update_attributes(params[:violency])\n format.html { redirect_to(@violency, :notice => 'Violency was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @violency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contratacion = Contratacion.find(params[:id])\n\n respond_to do |format|\n if @contratacion.update_attributes(params[:contratacion])\n flash[:notice] = 'Contratacion was successfully updated.'\n format.html { redirect_to(@contratacion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contratacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n if @gene_ontology.update_attributes(params[:gene_ontology])\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @node_incident = NodeIncident.find(params[:id])\n\n respond_to do |format|\n if @node_incident.update_attributes(params[:node_incident])\n format.html { redirect_to @node_incident, :notice => 'Node incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @node_incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @constituency }\n end\n end", "def update\n @tramite_constitucional = TramiteConstitucional.find(params[:id])\n\n respond_to do |format|\n if @tramite_constitucional.update_attributes(params[:tramite_constitucional])\n format.html { redirect_to @tramite_constitucional, notice: 'Tramite constitucional was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tramite_constitucional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @covariate = Covariate.find(params[:id])\n\n respond_to do |format|\n if @covariate.update_attributes(params[:covariate])\n flash[:notice] = 'Covariate was successfully updated.'\n format.html { redirect_to(@covariate) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @covariate.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @covariate.errors, :status => :unprocessable_entity }\n format.json { render :json => @covariate.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::StatementInvalid => e\n # Constraint violations not handled by Rails in the else clause\n # are handled here.\n handle_constraint_violations(e)\n end", "def update\n @claim_type = ClaimType.find(params[:id])\n\n respond_to do |format|\n if @claim_type.update_attributes(params[:claim_type])\n flash[:notice] = 'ClaimType was successfully updated.'\n format.html { redirect_to(@claim_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @claim_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @fault_type = FaultType.find(params[:id])\n\n respond_to do |format|\n if @fault_type.update_attributes(params[:fault_type])\n format.html { redirect_to(@fault_type, :notice => 'FaultType was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fault_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @node_config = NodeConfig.find(params[:id])\n\n respond_to do |format|\n if @node_config.update_attributes(params[:node_config])\n format.html { redirect_to(@node_config, :notice => 'NodeConfig was successfully updated.') }\n format.json { render :json => @node_config, :status => :ok }\n format.xml { render :xml => @node_config, :status => :ok }\n else\n format.xml { render :xml => @node_config.errors, :status => :unprocessable_entity }\n format.any { render :json => @node_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @reqinfo = Reqinfo.find(params[:id])\n\n respond_to do |format|\n if @reqinfo.update_attributes(params[:reqinfo])\n flash[:notice] = 'Reqinfo was successfully updated.'\n format.html { redirect_to(@reqinfo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reqinfo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @county = County.find(params[:id])\n\n respond_to do |format|\n if @county.update_attributes(params[:county])\n flash[:notice] = 'County was successfully updated.'\n format.html { redirect_to(@county) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @county.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.5962064", "0.58543646", "0.55823255", "0.5503839", "0.54679924", "0.54611045", "0.543626", "0.5423922", "0.5384145", "0.53753436", "0.5324049", "0.5320335", "0.53050303", "0.53023005", "0.5279995", "0.52788395", "0.52670753", "0.5208511", "0.52018803", "0.5181989", "0.5178609", "0.5157609", "0.5155216", "0.5142228", "0.51400894", "0.51381874", "0.5128356", "0.51221937", "0.51187474", "0.51172453" ]
0.65752196
0
DELETE /constituencies/1 DELETE /constituencies/1.xml
def destroy @constituency = Constituency.find(params[:id]) @constituency.destroy respond_to do |format| format.html { redirect_to(constituencies_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url, :notice=> 'Concert was deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @conseq = Conseq.find(params[:id])\n @conseq.destroy\n\n respond_to do |format|\n format.html { redirect_to(conseqs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @convenio = Convenio.find(params[:id])\n @convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to(convenios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def 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 @erratum = Erratum.find(params[:id])\n @erratum.destroy\n\n respond_to do |format|\n format.html { redirect_to(errata_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @constituency_duplicate.destroy\n respond_to do |format|\n format.html { redirect_to constituencies_url, notice: \"Constituency was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contratacion = Contratacion.find(params[:id])\n @contratacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(contratacions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @covariate = Covariate.find(params[:id])\n @covariate.destroy\n\n respond_to do |format|\n format.html { redirect_to(covariates_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { 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 @constat.destroy\n respond_to do |format|\n format.html { redirect_to constats_url, notice: 'Constat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @tramite_constitucional = TramiteConstitucional.find(params[:id])\n @tramite_constitucional.destroy\n\n respond_to do |format|\n format.html { redirect_to tramite_constitucionals_url }\n format.json { head :ok }\n end\n end", "def destroy\n\n @cita = Cita.find(params[:id])\n paciente_id=@cita.paciente_id\n Operation.delete_all \"cita_id = #{@cita.id}\"\n consulta=Consulta.find_by_cita_id(params[:id])\n consulta.update_attributes(:cita_id => nil)\n @cita.destroy\n \n respond_to do |format|\n format.html { redirect_to :controller => \"lab\",:action => \"crea_cita\",:id => paciente_id,:id_cons => consulta.id }\n format.xml { head :ok }\n end\n end", "def destroy\n @incidenttype = Incidenttype.find(params[:id])\n @incidenttype.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidenttypes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_files_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @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 @violency = Violency.find(params[:id])\n @violency.destroy\n\n respond_to do |format|\n format.html { redirect_to(violencies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @configuracion = Configuracion.find(params[:id])\n @configuracion.destroy\n\n respond_to do |format|\n format.html { redirect_to(configuracions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @arc = Arc.find(params[:id])\n @arc.destroy\n\n respond_to do |format|\n format.html { redirect_to(arcs_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.646807", "0.64062953", "0.637815", "0.63681245", "0.6295755", "0.62838995", "0.6182841", "0.61613566", "0.6142679", "0.6137103", "0.6135968", "0.6131631", "0.6129161", "0.6129106", "0.61277664", "0.61153686", "0.6107311", "0.6097522", "0.608922", "0.60174847", "0.6014349", "0.60129356", "0.60074943", "0.60071284", "0.60061854", "0.6002596", "0.60021126", "0.6001546", "0.5996283", "0.5981049" ]
0.72173804
0
GET /win_conditions GET /win_conditions.json
def index @win_conditions = params[:game_id].present? ? Game.find(params[:game_id]).win_conditions.all : WinCondition.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_conditions\n question = Question.find(params[:question_id])\n authorize question\n render json: { container: render_to_string(partial: 'org_admin/conditions/container',\n formats: :html,\n layout: false,\n locals: {\n question: question,\n conditions: question.conditions.order(:number)\n }),\n webhooks: webhook_hash(question.conditions) }\n end", "def get_conditions(params = {})\n request_by_ids(\"get-conditions\", params)\n end", "def conditions(query)\n get_json(\"#{api_url}/conditions/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end", "def create\n @win_condition = WinCondition.new(win_condition_params)\n\n respond_to do |format|\n if @win_condition.save\n format.html { redirect_to @win_condition, notice: 'Win condition was successfully created.' }\n format.json { render :show, status: :created, location: @win_condition }\n else\n format.html { render :new }\n format.json { render json: @win_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def win_condition_params\n params.require(:win_condition).permit(:name, :game_id)\n end", "def get_conditions\n @conditions\n end", "def conditions\n if !@values.has_key?('conditions')\n allConditions = Array.new\n @values['conditions'] = REXML::XPath.match(@xml, '/dwml/data[1]/parameters[1]/weather[1]/weather-conditions').map {|node|\n # handle weather-conditions with child values\n if node.has_elements?\n # Array to hold <value> attributes\n cValues = Array.new\n # gather the attributes of each <value> into a Hash\n node.get_elements(\"value\").each do |v|\n atts = Hash.new\n v.attributes.each do |k, v|\n atts[k] = v.to_s\n end\n cValues.push(atts)\n end\n end\n allConditions.push(NationalWeather::Conditions.new(node.attributes[\"weather-summary\"], cValues))\n }\n @values['conditions'] = allConditions\n end\n @values['conditions']\n end", "def index\r\n @query_params = {}\r\n build_query_params(params)\r\n build_query_scenario_params\r\n\r\n @conditions = []\r\n @conditions << Scenario.arel_table[:name].matches(\"%#{@query_params[:name]}%\") if @query_params[:name]\r\n\r\n if @conditions.length > 0\r\n conditions = @conditions[0]\r\n @conditions.each_with_index do |item, index|\r\n conditions = conditions.or(item) if index > 0\r\n end\r\n @conditions = conditions\r\n end\r\n\r\n respond_to do |format|\r\n format.html { set_scenarios_grid(@conditions) }\r\n format.json { render json: Scenario.where(@conditions) }\r\n end\r\n end", "def current_conditions(city:)\n result = api_call(path: '/data/2.5/weather', query: { q: city, units: 'metric' })\n { city: result['name'],\n cloud_cover: result.dig('clouds', 'all'),\n condition: result.dig('weather', 0, 'description').titleize,\n country_code: result.dig('sys', 'country'),\n icon_url: icon_url(icon_id: result.dig('weather', 0, 'icon')),\n temp: result.dig('main', 'temp'),\n visibility: (result['visibility'] / 1000.0 if result['visibility']),\n wind_deg: result.dig('wind', 'deg'),\n wind_speed: wind_speed_in_kmh(result.dig('wind', 'speed')) }\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def set_win_condition\n @win_condition = WinCondition.find(params[:id])\n end", "def conditions\n @conditions\n end", "def conditions\n @conditions\n end", "def check_conditions\n\t\tclauses = Array.new\n\t\tparty_list.each do |uid, hash|\n\t\t\tcond = hash[:condition]\n\t\t\tif cond[:cond_type] != COND_NONE && cond[:cond_met] == COND_MET\n\t\t\t\tclauses.push({ operands: false, value: uid })\n\t\t\telsif cond[:cond_type] == COND_NUM_ATTENDING\n\t\t\t\tclauses.push({ operands: cond[:num_users], value: uid })\n\n\t\t\telsif cond[:cond_type] == COND_USER_ATTENDING_ANY\n\n\t\t\t\toper = Array.new\n\t\t\t\tcond[:id_list].each { |id| oper.push(id)}\n\t\t\t\t#cond[:user_list].each { |key, value| oper.push(value[:uid]) }\n\t\t\t\tclauses.push({ operands: oper, value: uid })\n\n\t\t\telsif cond[:cond_type] == COND_USER_ATTENDING_ALL\n\t\t\t\t#cond[:user_list].each do |count, table|\n\t\t\t\tcond[:id_list].each do |id|\n\t\t\t\t\tclauses.push({ operands: [id], value: uid})\n\t\t\t\t\t#clauses.push({ operands: [table[:uid]], value: uid })\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif hash[:status] == STATUS_ATTENDING\n\t\t\t\t\tclauses.push({ operands: false, value: uid})\n\t\t\t\telse\n\t\t\t\t\tclauses.push({ operands: true, value: uid})\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tresult = Event.compute_horn_formula(clauses)\n\n\t\tresult.each do |uid, value|\n\t\t\tif party_list[uid][:condition][:cond_met] == COND_NOT_MET && party_list[uid][:condition][:cond_type] != COND_NONE\n\t\t\t\tcomplete_condition(uid, Condition.create_from_hash(party_list[uid][:condition])) if !value\n\t\t\tend\n\t\tend\n\n\tend", "def index\r\n @query_params = {}\r\n build_query_params(params)\r\n build_query_round_params\r\n\r\n @conditions = []\r\n @conditions << Round.arel_table[:name].matches(\"%#{@query_params[:name]}%\") if @query_params[:name]\r\n\r\n if @conditions.length > 0\r\n conditions = @conditions[0]\r\n @conditions.each_with_index do |item, index|\r\n conditions = conditions.or(item) if index > 0\r\n end\r\n @conditions = conditions\r\n end\r\n\r\n respond_to do |format|\r\n format.html { set_rounds_grid(@conditions) }\r\n format.json { render json: Round.where(@conditions) }\r\n end\r\n end", "def FetchWin(aim)\r\n\r\n\tbuffer = open(aim, \"UserAgent\" => \"Ruby-Wget\").read\r\n\tmatch_result = JSON.parse(buffer)\r\n\tmatch_result = match_result[\"result\"]\r\n\t$radiant_win = match_result[\"radiant_win\"]\r\n\t$lobby_type = match_result[\"lobby_type\"]\r\n\r\n#Excluding cases where the match isn't returning true or false if API \r\n#is being weird because that will fuck up everything - Also only want\r\n#lobby_type of 0 or 5\r\n\tif [0, 2, 5].include?($lobby_type)\r\n\t\tcase $radiant_win\r\n\t\t\twhen true, false \r\n\t\t\t\treturn $radiant_win\r\n\t\telse\r\n\t\t\t\treturn \"No data\"\r\n\t\tend\r\n\tend\r\nend", "def condition(response)\ncondition = response.condition['text']\nend", "def index\n @search_conditions = SearchConditionService.list(current_user.id)\n end", "def index\n @conditions = Condition.all\n end", "def index\n @conditions = Condition.all\n end", "def update\n respond_to do |format|\n if @win_condition.update(win_condition_params)\n format.html { redirect_to @win_condition, notice: 'Win condition was successfully updated.' }\n format.json { render :show, status: :ok, location: @win_condition }\n else\n format.html { render :edit }\n format.json { render json: @win_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @work_flow_transition_conditions = WorkFlowTransitionCondition.all\n end", "def conditions\n @conditions ||= []\n end", "def test_can_get_current_conditions\n c = Conditions.new\n assert_equal \"52 F (11.1 C)\", c.temperature\n assert_equal \"Durham, NC\", c.location\n assert_equal \"Mostly Cloudy\", c.weather\n end", "def condition_values\n @rule_details.conditions[0].values\n end", "def show\n @human_condition = HumanCondition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human_condition }\n end\n end", "def index\n @wins = Win.all\n params.each do |key, value|\n if key == 'last' && value == 'true'\n @win = Win.last\n render json: @win\n end\n end\n end", "def supply_condition\n if !check_step_image(@restaurant)\n return\n end\n\n @conditions = SupplyCondition.where(:restaurant_id => @restaurant.id).order('sequence ASC')\n if @conditions.blank?\n redirect_to '/restaurant_manage/supply_time'\n else\n @special_conditions = @conditions.select { |x| x.is_special == 't' }\n @normal_conditions = @conditions.select { |x| x.is_special != 't' }\n\n render json: {:success => true, :attachmentPartial => render_to_string('restaurant_manage/supply_condition', :layout => false) }\n end\n end", "def criteria\n\t\tif @criteria.nil?\n\t\t\t[ :score, :buchholz_score, :neustadtl_score, :c_score, :opp_c_score, :wins ]\n\t\telse\n\t\t\t@criteria\n\t\tend\n\tend", "def conditions\n @conditions ||= begin\n REXML::XPath.first(document, \"/p:Response/a:Assertion[@ID='#{document.signed_element_id[1,document.signed_element_id.size]}']/a:Conditions\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\n end\n end" ]
[ "0.64627", "0.6295687", "0.6100754", "0.59391516", "0.5691808", "0.56303114", "0.56244797", "0.55324847", "0.55153716", "0.5447018", "0.544389", "0.5428287", "0.5428287", "0.5385598", "0.5363043", "0.53579056", "0.5295867", "0.52797246", "0.5255074", "0.5255074", "0.52535844", "0.5198428", "0.51903933", "0.5189766", "0.51839757", "0.5170104", "0.51685375", "0.5120994", "0.51178193", "0.51127404" ]
0.6649024
0
POST /win_conditions POST /win_conditions.json
def create @win_condition = WinCondition.new(win_condition_params) respond_to do |format| if @win_condition.save format.html { redirect_to @win_condition, notice: 'Win condition was successfully created.' } format.json { render :show, status: :created, location: @win_condition } else format.html { render :new } format.json { render json: @win_condition.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_condition_params\n params.require(:win_condition).permit(:name, :game_id)\n end", "def create\n render_json_auto @survey.add_logic_control_rule(params[:logic]) and return\n end", "def win_params\n params.require(:win).permit(:company, :agents, :mrr, :reps)\n end", "def create\n @human_condition = HumanCondition.new(params[:human_condition])\n\n respond_to do |format|\n if @human_condition.save\n format.html { redirect_to @human_condition, notice: 'Human condition was successfully created.' }\n format.json { render json: @human_condition, status: :created, location: @human_condition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @human_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_win_condition\n @win_condition = WinCondition.find(params[:id])\n end", "def condition_state_save\n data = request.raw_post\n @conditions = RestaurantManage.condition_state_save(data, @restaurant)\n if @conditions.blank?\n render json: {:error => true, :message => '阿! 發生錯誤了!'}\n else\n get_restaurant()\n render json: {:success => true, :data => '設定成功!'}\n end\n end", "def update\n respond_to do |format|\n if @win_condition.update(win_condition_params)\n format.html { redirect_to @win_condition, notice: 'Win condition was successfully updated.' }\n format.json { render :show, status: :ok, location: @win_condition }\n else\n format.html { render :edit }\n format.json { render json: @win_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def insert_condition_params\n params.require(:insert_condition).permit(:conditionname, :responsecode)\n end", "def create\n @app_condition = AppCondition.new(app_condition_params)\n\n respond_to do |format|\n if @app_condition.save\n format.html { redirect_to @app_condition, notice: 'App condition was successfully created.' }\n format.json { render :show, status: :created, location: @app_condition }\n else\n format.html { render :new }\n format.json { render json: @app_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def open_conditions\n question = Question.find(params[:question_id])\n authorize question\n render json: { container: render_to_string(partial: 'org_admin/conditions/container',\n formats: :html,\n layout: false,\n locals: {\n question: question,\n conditions: question.conditions.order(:number)\n }),\n webhooks: webhook_hash(question.conditions) }\n end", "def condition_params\n params.require(:condition).permit(:name, :category_id, :upperbound, :lowerbound, :value, :needsDate, :date)\n end", "def pre_win_params\n params.require(:pre_win).permit(:result_no, :generate_no, :e_no, :win, :draw, :lose, :all)\n end", "def create\n @accept_condition = AcceptCondition.new(accept_condition_params)\n @accept_condition.user_id = current_user.id\n @companies = Company.where(user_id: current_user.id)\n\n respond_to do |format|\n if @accept_condition.save\n @companies.each do |company|\n check = Check.new\n check.company_id = company.id\n check.accept_condition_id = @accept_condition.id\n check.accept = 'no_evidence'\n check.save\n end\n format.html { redirect_to accept_conditions_path, notice: \"内定承諾条件の作成に成功しました。\" }\n format.json { render :index, status: :created, location: @accept_condition }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @accept_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def condition_params\n params.require(:condition).permit(:question_id, :operator, :answer, :rule_id)\n end", "def create\n @customfieldcondition = Customfieldcondition.new(customfieldcondition_params)\n\n respond_to do |format|\n if @customfieldcondition.save\n format.html { redirect_to @customfieldcondition, notice: 'Customfieldcondition was successfully created.' }\n format.json { render :show, status: :created, location: @customfieldcondition }\n else\n format.html { render :new }\n format.json { render json: @customfieldcondition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @confirmed_condition = ConfirmedCondition.new(confirmed_condition_params)\n\n respond_to do |format|\n if @confirmed_condition.save\n format.html { redirect_to @confirmed_condition, notice: 'Confirmed condition was successfully created.' }\n format.json { render :show, status: :created, location: @confirmed_condition }\n else\n format.html { render :new }\n format.json { render json: @confirmed_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:encounter_event_skill_check_condition][:skill] = EncounterEventSkillCheckCondition::SKILLS.invert[params[:encounter_event_skill_check_condition][:skill].to_i]\n @encounter_event_skill_check_condition = EncounterEventSkillCheckCondition.new(params[:encounter_event_skill_check_condition])\n \n respond_to do |format|\n if @encounter_event_skill_check_condition.save\n format.html { redirect_to(@encounter_event_skill_check_condition.encounter_event.encounter.adventure, :notice => 'Encounter event skill check condition was successfully created.') }\n format.xml { render :xml => @encounter_event_skill_check_condition, :status => :created, :location => @encounter_event_skill_check_condition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @encounter_event_skill_check_condition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def supply_condition_save\n condition = params[:condition]\n zones = []\n zones.push(params[:zone0])\n zones.push(params[:zone1])\n zones.push(params[:zone2])\n zones.push(params[:zone3])\n zones.push(params[:zone4])\n zones.push(params[:zone5])\n\n if condition[:id].blank?\n result = RestaurantManage.supply_condition_create(@restaurant.id, condition, zones)\n else\n result = RestaurantManage.supply_condition_update(@restaurant.id, condition, zones)\n end\n\n @conditions = SupplyCondition.where(:restaurant_id => @restaurant.id).order('sequence ASC')\n @special_conditions = @conditions.select { |x| x.is_special == 't' }\n @normal_conditions = @conditions.select { |x| x.is_special != 't' }\n result[:attachmentPartial] = render_to_string('restaurant_manage/supply_condition', :layout => false, :locals => { :normal_conditions => @normal_conditions, :special_conditions => @special_conditions })\n render json: result\n end", "def create\n @condition = Condition.new(condition_params)\n if condition_params[:name].empty?\n @condition.errors.add('Race condition', \"must have a name.\")\n end\n if condition_params[:category_id].empty?\n @condition.errors.add('Race condition', \"must have a category.\")\n end\n category = Category.find_by_id(condition_params[:category_id])\n if category\n @condition.category = category\n end\n\n if category && category.datatype == 'Value'\n @condition.lowerbound = nil\n @condition.upperbound = nil\n if params[:valueText].empty?\n @condition.errors.add('This race condition', \"must have a value.\")\n else\n @condition.value = params[:valueText]\n end\n elsif category && category.datatype == 'Range'\n if !condition_params[:needsDate] || condition_params[:needsDate] == \"0\"\n @condition.value = nil\n end\n if condition_params[:upperbound].empty? && condition_params[:lowerbound].empty?\n @condition.errors.add('This race condition', \"must have either a lower or upper bound.\")\n end\n end\n @categories = Category.all\n\n respond_to do |format|\n if @condition.errors.any?\n format.html { render action: 'new' }\n format.json { render json: @condition.errors, status: :unprocessable_entity }\n elsif @condition.save\n format.html { redirect_to conditions_url, notice: 'Condition was successfully created.' }\n format.json { render action: 'index', status: :created, location: @conditions }\n else\n format.html { render action: 'new' }\n format.json { render json: @condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rule = Rule.new(rule_params)\n create_result = @rule.save\n\n condition_result = true\n unless condition_params.values.all? {|x| x.empty?}\n @condition = Condition.create(condition_params)\n @rule.conditions << @condition \n condition_result = @rule.save\n else\n @condition = Condition.new\n end\n\n respond_to do |format|\n if create_result && condition_result\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render :show, status: :created, location: @rule }\n else\n format.html { render :new }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n unless condition_params.values.all? {|x| x.empty?}\n @rule.conditions << Condition.create(condition_params)\n @rule.save\n end\n end", "def create\n @insert_condition = InsertCondition.new(insert_condition_params)\n\n respond_to do |format|\n if @insert_condition.save\n format.html { redirect_to @insert_condition, notice: 'Insert condition was successfully created.' }\n format.json { render :show, status: :created, location: @insert_condition }\n else\n format.html { render :new }\n format.json { render json: @insert_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @condition = Condition.new(condition_params)\n @condition.user = current_user\n\n respond_to do |format|\n if @condition.save\n format.html { redirect_to @condition, notice: 'Condition was successfully created.' }\n format.json { render :show, status: :created, location: @condition }\n else\n format.html { render :new }\n format.json { render json: @condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @priority_condition = PriorityCondition.new(priority_condition_params)\n\n respond_to do |format|\n if @priority_condition.save\n format.html { redirect_to @priority_condition, notice: 'Priority condition was successfully created.' }\n format.json { render :show, status: :created, location: @priority_condition }\n else\n format.html { render :new }\n format.json { render json: @priority_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def app_condition_params\n params.require(:app_condition).permit(:status, :user, :reason)\n end", "def create\n @condition_type = ConditionType.new(condition_type_params)\n\n respond_to do |format|\n if @condition_type.save\n format.html { redirect_to @condition_type, notice: 'Condition type was successfully created.' }\n format.json { render :show, status: :created, location: @condition_type }\n else\n format.html { render :new }\n format.json { render json: @condition_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_to_JSON\n evaluate_checks = [check_times, check_dates, check_day_of_week]\n evaluate_checks.all?\n end", "def create\n battery = Battery.find(params[:battery_id])\n params[:cells].each_value do |test|\n test[:inserted_by] = current_user.full_name\n battery.battery_weekly_tests.build(test) unless test.values.all?(&:blank?)\n end\n \n respond_to do |format|\n if battery.save\n format.html { redirect_to station_batteries_path(battery.station), notice: 'Battery weekly test was successfully created.' }\n format.json { render json: @battery_weekly_test, status: :created, location: @battery_weekly_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @battery_weekly_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def terms_and_conditions_params\n params.fetch(:terms_and_condition, {}).permit(:terms_and_condition, :status, :summary, :full, :version)\n end", "def create\n @win = Win.new(win_params)\n\n respond_to do |format|\n if @win.save\n format.html { redirect_to @win, notice: 'Win was successfully created.' }\n format.json { render :show, status: :created, location: @win }\n else\n format.html { render :new }\n format.json { render json: @win.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cancel_condition = CancelCondition.new(cancel_condition_params)\n\n respond_to do |format|\n if @cancel_condition.save\n format.html { redirect_to @cancel_condition, notice: 'Cancel condition was successfully created.' }\n format.json { render :show, status: :created, location: @cancel_condition }\n else\n format.html { render :new }\n format.json { render json: @cancel_condition.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6565656", "0.58910054", "0.57967585", "0.5756708", "0.57271993", "0.5668605", "0.56656796", "0.56583244", "0.5614089", "0.55920935", "0.55799574", "0.5519848", "0.5453747", "0.5432144", "0.54258853", "0.54057586", "0.5348766", "0.5344986", "0.53258073", "0.5309213", "0.5277693", "0.52513266", "0.52307034", "0.5228018", "0.5224924", "0.5222871", "0.5197779", "0.5193446", "0.51865506", "0.51653147" ]
0.7375267
0
PATCH/PUT /win_conditions/1 PATCH/PUT /win_conditions/1.json
def update respond_to do |format| if @win_condition.update(win_condition_params) format.html { redirect_to @win_condition, notice: 'Win condition was successfully updated.' } format.json { render :show, status: :ok, location: @win_condition } else format.html { render :edit } format.json { render json: @win_condition.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render_json_auto @survey.update_logic_control_rule(params[:id].to_i, params[:logic]) and return\n end", "def update\n @human_condition = HumanCondition.find(params[:id])\n\n respond_to do |format|\n if @human_condition.update_attributes(params[:human_condition])\n format.html { redirect_to @human_condition, notice: 'Human condition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @human_condition.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 @app_condition.update(app_condition_params)\n format.html { redirect_to @app_condition, notice: 'App condition was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_condition }\n else\n format.html { render :edit }\n format.json { render json: @app_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @condition.update(condition_params)\n format.html { redirect_to @condition, notice: 'Condition was successfully updated.' }\n format.json { render :show, status: :ok, location: @condition }\n else\n format.html { render :edit }\n format.json { render json: @condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customfieldcondition.update(customfieldcondition_params)\n format.html { redirect_to @customfieldcondition, notice: 'Customfieldcondition was successfully updated.' }\n format.json { render :show, status: :ok, location: @customfieldcondition }\n else\n format.html { render :edit }\n format.json { render json: @customfieldcondition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game_round.update(game_round_params)\n\n if @game_round.started? && @game_round.previous_changes.key?( 'custom_highlow')\n RedisService.custom_game_ground_winlose @game_round\n end\n\n format.html { redirect_to action: :index, notice: 'Game round was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_round }\n else\n format.html { render :edit }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cancel_condition.update(cancel_condition_params)\n format.html { redirect_to @cancel_condition, notice: 'Cancel condition was successfully updated.' }\n format.json { render :show, status: :ok, location: @cancel_condition }\n else\n format.html { render :edit }\n format.json { render json: @cancel_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_compliance.update_attributes(params[:chiropractic_compliance])\n format.html { redirect_to @chiropractic_compliance, notice: 'Chiropractic compliance was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_compliance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dispatching = Dispatching.find(params[:id])\n workflow = @dispatching.workflow\n respond_to do |format|\n if params[:warranty] == \"进厂\"\n if @dispatching.update_attributes(params[:dispatching])\n workflow.update_attributes(:status => \"vehicle\")\n workflow.user_ids = params[:repairman_ids]\n workflow.users.each do |user|\n user.update_attributes(:status => \"busy\")\n end\n format.json { head :ok }\n else\n format.json { render :json => @dispatching.errors, :status => :unprocessable_entity }\n end\n elsif params[:warranty] == \"救援\"\n if @dispatching.update_attributes(params[:dispatching])\n workflow.update_attributes(:status => \"newpart\")\n format.json {head :ok}\n else\n format.json { render :json => @dispatching.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @wod.update(wod_params)\n render json: @wod\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end", "def update\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n if @survey_choice.update_attributes(params[:survey_choice])\n format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_choice.errors, status: :unprocessable_entity }\n5 end\n end\n end", "def update\n @patient_condition = PatientCondition.find(params[:id])\n\n respond_to do |format|\n if @patient_condition.update_attributes(params[:patient_condition])\n format.html { redirect_to @patient_condition, :notice => 'Patient condition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patient_condition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @encounter_event_skill_check_condition = EncounterEventSkillCheckCondition.find(params[:id])\n\n respond_to do |format|\n if @encounter_event_skill_check_condition.update_attributes(params[:encounter_event_skill_check_condition])\n format.html { redirect_to(@encounter_event_skill_check_condition, :notice => 'Encounter event skill check condition was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @encounter_event_skill_check_condition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @win.update(win_params)\n format.html { redirect_to @win, notice: 'Win was successfully updated.' }\n format.json { render :show, status: :ok, location: @win }\n else\n format.html { render :edit }\n format.json { render json: @win.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @svc_criterium.update(svc_criterium_params)\n format.html { redirect_to @svc_criterium, notice: 'Service criterium was successfully updated.' }\n format.json { render :show, status: :ok, location: @svc_criterium }\n else\n format.html { render :edit }\n format.json { render json: @svc_criterium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @criterion = Criterion.find(params[:id])\n\n if @criterion.update_attributes(params[:criterion])\n head :no_content\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @power_rack.update(power_rack_params)\n format.html { redirect_to @power_rack, notice: \"Power rack was successfully updated.\" }\n format.json { render :show, status: :ok, location: @power_rack }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @power_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @unique_whiteline.update(unique_whiteline_params)\n format.html { redirect_to @unique_whiteline, notice: 'Unique whiteline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @unique_whiteline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_outcome.update(api_v1_outcome_params)\n format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_outcome }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_outcome.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n\n respond_to do |format|\n if @weekly_expectation.update_attributes(params[:weekly_expectation])\n format.html { redirect_to @weekly_expectation, notice: 'Weekly expectation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weekly_expectation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @liver_condition.update(liver_condition_params)\n format.html { redirect_to @liver_condition, notice: 'Liver condition was successfully updated.' }\n format.json { render :show, status: :ok, location: @liver_condition }\n else\n format.html { render :edit }\n format.json { render json: @liver_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_win_condition\n @win_condition = WinCondition.find(params[:id])\n end", "def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @attribution_model_settings = args[:attribution_model_settings] if args.key?(:attribution_model_settings)\n @category = args[:category] if args.key?(:category)\n @click_through_lookback_window_days = args[:click_through_lookback_window_days] if args.key?(:click_through_lookback_window_days)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @floodlight_settings = args[:floodlight_settings] if args.key?(:floodlight_settings)\n @id = args[:id] if args.key?(:id)\n @include_in_client_account_conversions_metric = args[:include_in_client_account_conversions_metric] if args.key?(:include_in_client_account_conversions_metric)\n @include_in_conversions_metric = args[:include_in_conversions_metric] if args.key?(:include_in_conversions_metric)\n @name = args[:name] if args.key?(:name)\n @owner_customer = args[:owner_customer] if args.key?(:owner_customer)\n @primary_for_goal = args[:primary_for_goal] if args.key?(:primary_for_goal)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n @type = args[:type] if args.key?(:type)\n @value_settings = args[:value_settings] if args.key?(:value_settings)\n end", "def update\n continue_to_summary && return if params['change_requirements'].present?\n\n continue_to_results && return if params['continue_to_results'].present?\n\n set_route_to_market && return if params['set_route_to_market'].present?\n\n continue_to_contract_details && return if params['continue_da'].present?\n\n update_procurement if params['facilities_management_procurement'].present?\n end", "def update\n respond_to do |format|\n if @confirmed_condition.update(confirmed_condition_params)\n format.html { redirect_to @confirmed_condition, notice: 'Confirmed condition was successfully updated.' }\n format.json { render :show, status: :ok, location: @confirmed_condition }\n else\n format.html { render :edit }\n format.json { render json: @confirmed_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @terms_and_condition.update(terms_and_conditions_params)\n format.html { redirect_to admin_terms_and_conditions_path, notice: 'terms_and_condition was succesfully updated.' }\n format.json { render :show, status: :ok, location: @terms_and_condition }\n else\n format.html { render :edit }\n format.json { render json: @terms_and_condition.errors, status: :unprocesable_entity }\n end\n end\n end" ]
[ "0.66584647", "0.6166113", "0.6012476", "0.6001384", "0.59345716", "0.58404654", "0.5839187", "0.5829148", "0.58228487", "0.5820189", "0.5800443", "0.5798872", "0.5782197", "0.5777942", "0.5769346", "0.5748067", "0.5740029", "0.571588", "0.5711324", "0.5711117", "0.569516", "0.5681036", "0.56577504", "0.5651223", "0.56489724", "0.5648148", "0.5645694", "0.564306", "0.5633215", "0.56272954" ]
0.71610093
0
DELETE /win_conditions/1 DELETE /win_conditions/1.json
def destroy @win_condition.destroy respond_to do |format| format.html { redirect_to win_conditions_url, notice: 'Win condition was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @human_condition = HumanCondition.find(params[:id])\n @human_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to human_conditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @condition.destroy\n respond_to do |format|\n format.html { redirect_to conditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render_json_auto @survey.delete_logic_control_rule(params[:id].to_i) and return\n end", "def destroy\n @customfieldcondition.destroy\n respond_to do |format|\n format.html { redirect_to customfieldconditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @condition.destroy\n respond_to do |format|\n format.html { redirect_to conditions_url, notice: 'La condicion ha sido eliminada con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @condition.destroy\n respond_to do |format|\n format.html { redirect_to conditions_url, notice: 'Condition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @insert_condition.destroy\n respond_to do |format|\n format.html { redirect_to insert_conditions_url, notice: 'Insert condition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to criteria_url }\n format.json { head :no_content }\n end\n end", "def destroy(conditions)\n response = Response.new SurveyGizmo.delete(handle_route(:delete, conditions))\n response.ok?\n end", "def destroy\n @app_condition.destroy\n respond_to do |format|\n format.html { redirect_to app_conditions_url, notice: 'App condition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_condition = PatientCondition.find(params[:id])\n @patient_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_conditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @encounter_event_skill_check_condition = EncounterEventSkillCheckCondition.find(params[:id])\n @encounter_event_skill_check_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to(encounter_event_skill_check_conditions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def destroy\n @svc_criterium.destroy\n respond_to do |format|\n format.html { redirect_to svc_criteria_url, notice: 'Svc criterium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @criterium.destroy\n respond_to do |format|\n format.html { redirect_to criteria_url, notice: 'Criterium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @logic = Logic.find(params[:id])\n @logic.destroy\n\n respond_to do |format|\n format.html { redirect_to logics_url }\n format.json { head :no_content }\n end\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @two_criterium.destroy\n respond_to do |format|\n format.html { redirect_to two_criteria_url, notice: 'Two criterium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @criterion_detail.destroy\n respond_to do |format|\n format.html { redirect_to criterion_details_url, notice: 'Criterion detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @liver_condition.destroy\n respond_to do |format|\n format.html { redirect_to liver_conditions_url, notice: 'Liver condition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @condition_type = ConditionType.find(params[:id])\n @condition_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(condition_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @condition_type.destroy\n respond_to do |format|\n format.html { redirect_to condition_types_url, notice: 'Condition type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subcriterion = Subcriterion.find(params[:id])\n @subcriterion.destroy\n\n respond_to do |format|\n format.html { redirect_to subcriteria_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @willclause = Willclause.find(params[:id])\n @willclause.destroy\n\n respond_to do |format|\n format.html { redirect_to willclauses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @conditioninfograph = Conditioninfograph.find(params[:id])\n @conditioninfograph.destroy\n\n respond_to do |format|\n format.html { redirect_to conditioninfographs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @confirmed_condition.destroy\n respond_to do |format|\n format.html { redirect_to confirmed_conditions_url, notice: 'Confirmed condition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.67884463", "0.67107534", "0.66656786", "0.64525366", "0.6440423", "0.6417379", "0.63794756", "0.6322817", "0.6315701", "0.62950385", "0.62916243", "0.6227997", "0.62242717", "0.6211542", "0.6200861", "0.61911196", "0.61656684", "0.61544955", "0.6153352", "0.61040944", "0.6100293", "0.6095498", "0.6083957", "0.6058722", "0.6045801", "0.6042466", "0.6042232", "0.60380846", "0.6037976", "0.6033003" ]
0.710256
0
Add the exhibit home page to the sitemap
def add_exhibit_root sitemap.add sitemap.exhibit_root_path(exhibit) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_pages\n exhibit.feature_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at\n end\n\n exhibit.about_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priority: 0.5, lastmod: p.updated_at\n end\n end", "def sitemap\n store_location\n\n # note: icons could be included, but do not seem to add much\n # note: tried showing unavailable pages as 'sans link', results not particularly attractive\n\n # TBD: My Talks, My Messsages, Current Messages\n # TBD: Maps, Calendars, Tags & Topics, Friends & Groups, Attachments, Venues\n @routes = talk_routes + user_routes + message_routes + admin_routes + common_routes \n\n end", "def set_home\n end", "def root_page\n sitemap.find_resource_by_path(config.index_file)\n end", "def home_page\n @home_page ||= \"/#{(Page.find_by_title('Home') || Page.first(:order => 'position')).title.downcase.parameterize}\"\n end", "def add_browse_categories\n exhibit.searches.published.find_each do |s|\n sitemap.add sitemap.exhibit_browse_path(exhibit, s), priority: 0.5, lastmod: s.updated_at\n end\n end", "def homepage\n end", "def homepage\n end", "def home\n @static_page = StaticPage.preload_for(:content).find_by(role: :home)\n # return unless stale?(@static_page)\n\n set_custom_splash\n set_metadata(@static_page)\n end", "def home\n @static_page = StaticPage.preload_for(:content).find_by(role: :home)\n # return unless stale?(@static_page)\n\n set_custom_splash\n set_metadata(@static_page)\n end", "def generate_sitemap\n end", "def homepage\n end", "def homepage\n end", "def google_sitemap\n\t\t@urls = []\n\t\t# 1. 305 - Redirected back to the reverse proxy to show old site page.\n\t\tREDIRECTIONS.select {|k,v| v[:action] == 305}.each {|r| @urls.push(r[0])}\n\t\t# 2. All Homepage's (including mainpage)\n\t\tSection.environments().each do |section|\n\t\t\thome = section_homepage_url(section)\n\t\t\t@urls << home if home\n\t\tend\n\t\t# 3. All Pages\n\t\tAsset.find_all_by_resource_type('Page').select {|p| p.published_page?}.each {|p| @urls << site_page_url(p)}\n\n respond_to do |format|\n format.xml\n end\n\tend", "def sitemap\n @pages = Page.sitemap\n end", "def sitemap\n self.root\n self.follow('dtime:sitemap')\n self.get\n self\n end", "def create_sitemap\n end", "def set_home_if_first\n if Page.all.empty?\n self.home = true\n elsif page_collection && page_collection.empty?\n self.home = true\n end\n end", "def add_resources\n exhibit.solr_documents.each do |d|\n sitemap.add sitemap.exhibit_solr_document_path(exhibit, d), priority: 0.25, lastmod: document_last_modified(d)\n end\n end", "def add_welcome_page\n self.pages << Page.welcome_page(self)\n end", "def url_home\n\tvisit url_visit\n end", "def home\n @home ||= \"#{site.local_url}\"\n end", "def sitemap\n @pages = []\n website.available_locales.each do |l|\n @pages << { url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago }\n end\n render \"sitemap_index\"\n end", "def main_homepage\n\t\t\t@section = Section.homepage\n\t\t\t@main_homepage = @page = Asset.find_by_section_id_and_resource_type(@section.id, 'Homepage')\n\t\t\t@is_homepage = true\n\t\t\thomepage\n end", "def sitemap\n @pages = Page.find_all_by_sitemap_and_public(true, true)\n respond_to do |format|\n format.xml { render :layout => \"sitemap\" }\n end\n end", "def sitemap\n @tlsitemap_entries = []\n #Get only published timelines\n Timeline.find_each(:batch_size => 500, :conditions => [\"visibility = ?\", VIS_PUBLIC]) do |each_tl|\n @tlsitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{timeline_path(each_tl)}\")\n end\n \n @homepage_entry = \"#{request.protocol}#{request.host_with_port}\"\n \n @other_sitemap_entries = []\n # About, FAQ, Browse, Showcase\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{about_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{browse_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{showcase_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{faq_path}\")\n \n render :template => \"timelines/sitemap\", :formats => [:xml], :handlers => :haml\n end", "def home_page_url\n return @home_page_url\n end", "def home_page\n nil\n end", "def home\n\t\t# Home Page\n\tend", "def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: 'alchemy/sitemap' }\n end\n end" ]
[ "0.70925486", "0.67437726", "0.65935045", "0.6369032", "0.63406163", "0.63031775", "0.6259364", "0.6259364", "0.62206346", "0.62206346", "0.61736685", "0.6119472", "0.6119472", "0.60759777", "0.6031398", "0.6025497", "0.6018672", "0.6013575", "0.59930176", "0.59622645", "0.5959424", "0.59557915", "0.5955043", "0.5953471", "0.5931823", "0.5929816", "0.5922936", "0.59071064", "0.5887641", "0.5853376" ]
0.7341908
0
Add all published feature and about pages to the sitemap
def add_pages exhibit.feature_pages.published.find_each do |p| sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at end exhibit.about_pages.published.find_each do |p| sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priority: 0.5, lastmod: p.updated_at end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sitemap\n store_location\n\n # note: icons could be included, but do not seem to add much\n # note: tried showing unavailable pages as 'sans link', results not particularly attractive\n\n # TBD: My Talks, My Messsages, Current Messages\n # TBD: Maps, Calendars, Tags & Topics, Friends & Groups, Attachments, Venues\n @routes = talk_routes + user_routes + message_routes + admin_routes + common_routes \n\n end", "def sitemap\n @pages = []\n website.available_locales.each do |l|\n @pages << { url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago }\n end\n render \"sitemap_index\"\n end", "def generate_sitemap\n end", "def sitemap\n @pages = Page.find_all_by_sitemap_and_public(true, true)\n respond_to do |format|\n format.xml { render :layout => \"sitemap\" }\n end\n end", "def sitemap\n @pages = Page.sitemap\n end", "def create_sitemap\n end", "def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: 'alchemy/sitemap' }\n end\n end", "def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: \"alchemy/sitemap\" }\n end\n end", "def google_sitemap\n\t\t@urls = []\n\t\t# 1. 305 - Redirected back to the reverse proxy to show old site page.\n\t\tREDIRECTIONS.select {|k,v| v[:action] == 305}.each {|r| @urls.push(r[0])}\n\t\t# 2. All Homepage's (including mainpage)\n\t\tSection.environments().each do |section|\n\t\t\thome = section_homepage_url(section)\n\t\t\t@urls << home if home\n\t\tend\n\t\t# 3. All Pages\n\t\tAsset.find_all_by_resource_type('Page').select {|p| p.published_page?}.each {|p| @urls << site_page_url(p)}\n\n respond_to do |format|\n format.xml\n end\n\tend", "def index\n @pages = []\n website.available_locales.each do |l|\n @pages << {\n url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago}\n end\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def sitemap\n\tpages = []\n\tPage.each_with_level(Page.find(:all, :order => 'lft ASC')) do |page,level|\n\t pages << {\n\t :page => page,\n\t :level => level\n\t }\n\tend\n\tpages[0..-2].map! do |p|\n\t p.update(:have_children => p[:level] < pages[pages.index(p)+1][:level])\n\tend\n\tpages.last.update(:have_children => false) unless pages.empty?\n\n\tul_li_for pages do |page|\n %[<a href=\"#{root_url+page[:page].url}\">#{page[:page].menu}</a>]\n\tend\n end", "def add_browse_categories\n exhibit.searches.published.find_each do |s|\n sitemap.add sitemap.exhibit_browse_path(exhibit, s), priority: 0.5, lastmod: s.updated_at\n end\n end", "def add_resources\n exhibit.solr_documents.each do |d|\n sitemap.add sitemap.exhibit_solr_document_path(exhibit, d), priority: 0.25, lastmod: document_last_modified(d)\n end\n end", "def sitemap\n self.root\n self.follow('dtime:sitemap')\n self.get\n self\n end", "def sitemaps\n @sitemaps ||= extract_urls('sitemap')\n end", "def sitemap(tree)\n list_children(tree, nil, 'sitemap')\n end", "def generate_sitemap\n menu, current_context = parse_and_create_menu_data_structure\n return '<ul class=\"site_map\">' + sitemap_output( menu ) + '</ul>'.html_safe\n end", "def sitemap\n @tlsitemap_entries = []\n #Get only published timelines\n Timeline.find_each(:batch_size => 500, :conditions => [\"visibility = ?\", VIS_PUBLIC]) do |each_tl|\n @tlsitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{timeline_path(each_tl)}\")\n end\n \n @homepage_entry = \"#{request.protocol}#{request.host_with_port}\"\n \n @other_sitemap_entries = []\n # About, FAQ, Browse, Showcase\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{about_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{browse_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{showcase_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{faq_path}\")\n \n render :template => \"timelines/sitemap\", :formats => [:xml], :handlers => :haml\n end", "def sitemap_links\n each_sitemap_link.to_a\n end", "def index\n headers['Content-Type'] = 'application/xml'\n @routes = website_routes + @opportunity_routes\n @blog_sitemap_route = buttercms_blog_sitemap_url\n end", "def create_sitemap\n @items.each do |item|\n if %w{png gif jpg jpeg coffee scss sass conf less css xml js txt ico}.include?(item[:extension]) ||\n item.identifier =~ /404|500|htaccess|google59d36f32ac93e5ca|google402908db7c07eb10/\n item[:is_hidden] = true unless item.attributes.has_key?(:is_hidden)\n end\n end\n @items << Nanoc3::Item.new(\n \"<%= xml_sitemap %>\",\n { :extension => 'xml', :is_hidden => true },\n '/sitemap/'\n )\nend", "def sitemap\n @sitemap ||= raw_sitemap\n end", "def generate(site)\n puts \"Generating sitemap...\"\n @site = site\n @site.config[\"time\"] = Time.new\n @site.config[\"html_files\"] = html_files.map(&:to_liquid)\n unless sitemap_exists?\n write\n @site.keep_files ||= []\n @site.keep_files << \"sitemap.xml\"\n end\n end", "def add\n if page.url && !find_page(page)\n Octopress.site.pages << page\n plugin.config['permalinks'] ||= {}\n permalink_config ||= page.url\n end\n end", "def sitemap_index_links\n each_sitemap_index_link.to_a\n end", "def sitemap\n expires_in 1.day, public: true\n\n # The sitemap itself is hosted on Google Cloud storage, we read it from them and send it back to the accessor of this endpoint.\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket ENV.fetch('GCLOUD_BUCKET')\n file = bucket.file \"sitemaps/sitemap.#{I18n.locale}.xml.gz\"\n\n send_data file.download.read, type: 'text/xml'\n end", "def sitemap\n expires_in 1.day, public: true\n\n # The sitemap itself is hosted on Google Cloud storage, we read it from them and send it back to the accessor of this endpoint.\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket ENV.fetch('GCLOUD_BUCKET')\n file = bucket.file \"sitemaps/sitemap.#{I18n.locale}.xml.gz\"\n\n send_data file.download.read, type: 'text/xml'\n end", "def generate_sitemap_options(*args)\n SemiStatic::Engine.config.has?('sitemap')\n end", "def linkPages\n @all_pages.each_value do |one_page|\n one_page.addPageLinks\n end\n @all_pages.each_value do |one_page|\n one_page.addMissingLinkNames\n end\n end", "def add_template_pages; end" ]
[ "0.73238945", "0.7089889", "0.7019592", "0.69738644", "0.69283986", "0.67798644", "0.67486095", "0.6743766", "0.65847194", "0.6533413", "0.6515004", "0.65099895", "0.6489272", "0.6356194", "0.6268795", "0.6219053", "0.61954296", "0.61258113", "0.6106279", "0.60770166", "0.60073334", "0.5815842", "0.58106494", "0.58085823", "0.57710546", "0.5766344", "0.5766344", "0.5764348", "0.568758", "0.5662791" ]
0.82855546
0
Add published browse categories to the sitemap
def add_browse_categories exhibit.searches.published.find_each do |s| sitemap.add sitemap.exhibit_browse_path(exhibit, s), priority: 0.5, lastmod: s.updated_at end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end", "def set_categories\n new_categories = extract_categories_from_url\n unless new_categories.nil?\n @categories = new_categories\n else\n @categories = Type::DefaultCategories\n end\n end", "def fetch_categories\r\n page = File.open(\"#{Rails.root}/public/Categories.html\") { |f| Nokogiri::HTML(f) }\r\n Category.save_fetched_categories_and_subcategories(page)\r\n end", "def generate_categories(site, category_base_path, category_layout)\n categories = sorted_categories site\n\n # Generate the pages\n for category in categories\n posts_in_category = site.categories[category]\n category_path = File.join(category_base_path, category)\n\n site.pages << CategoryIndexPage.new(site, category_path, INDEXFILE, category, category_layout, posts_in_category, false)\n end\n\n Jekyll.logger.debug(\"Categories\", \"Processed \" + categories.size.to_s + \" category index pages\")\n end", "def add_pages\n exhibit.feature_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at\n end\n\n exhibit.about_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priority: 0.5, lastmod: p.updated_at\n end\n end", "def set_categories\n @categories = {}\n @mechanize.page.search('//*[@id=\"prtcalst\"]//li').each do |cat|\n cat_link = cat.search('a')[0]\n cat_name = cat.search('.//em')[0].inner_text()\n catObj = Category.new()\n catObj.elem = cat_link\n catObj.name = cat_name\n @categories[cat_name] = catObj\n\n puts(\"#{cat_name}\")\n puts(\"-------------------\")\n end\n end", "def categories_from_path(special_dir); end", "def create_category_pages\n articles_by_category.each do |category, posts|\n @items << Nanoc::Item.new(\n \"<%= render('category', :category => '#{category}') %>\",\n {\n :title => \"Posts in #{category}\",\n :h1 => \"#{category} posts\",\n :posts => posts\n },\n \"/categories/#{category}\",\n :binary => false\n )\n end\n end", "def create_category_pages\n tags.keys.each do |tag|\n items << Nanoc3::Item.new(\n \"= render('category', :tag => '#{tag}')\",\n {\n :title => \"Category: #{tag}\",\n :changefreq => 'daily',\n :priority => 0.4\n },\n \"/categories/#{tag.downcase.parameterize}/\",\n :binary => false\n )\n end\nend", "def find_categories\n page = agent.get(WEBSITE_URL)\n\n page.search(CATEGORIES_SELECTOR).each do |a|\n category_name = a.text.strip\n path = a.attribute('href').value.strip\n\n next if category_name.blank? || path.blank?\n\n data[category_name] = {\n 'url' => URI.join(WEBSITE_URL, path).to_s\n }\n end\n\n Helpers.wait\n end", "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end", "def category\n @category = NewsCategory.find_by! slug: params[:category_slug]\n @collection = News.of_type(:news).in_category(@category).page_for_visitors(current_page)\n end", "def categories=(value)\n @categories = value\n end", "def add_category(path, name)\n @list[path] ||= []\n if @list[path].include?(name + \"/\")\n @count[path + name + \"/\"] ||= 1\n @count[path + name + \"/\"] += 1\n name = name + \" (#{@count[path + name + \"/\"]})\"\n end\n @list[path] << name + \"/\"\n @dir << name\n end", "def categories\n nodes = @doc.xpath(\"atom:feed/atom:category\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomCategory.new(node) }\n end", "def categories_without_update\n ((fspath + '@categories').read rescue '').lines.\n map { |l| site.page_for l.chomp rescue nil }.\n select { |p| p.is_a? Category }.to_set\n end", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def category_tree\n @category_tree = {}\n get_category_browse_nodes.each do |n|\n build_category_tree(n)\n end\n @category_tree\n end", "def add_categories(collection)\n\tcategory = \"\"\n\tcollection[\"results\"][\"collection1\"].each do |article|\n\t\tif article[\"category\"] == \"\"\n article[\"category\"] = category\n else\n category = article[\"category\"]\n end\n\tend\nend", "def sitemap\n @pages = []\n website.available_locales.each do |l|\n @pages << { url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago }\n end\n render \"sitemap_index\"\n end", "def uhook_new_category_sidebar category\n show_translations(category, :hide_preview_link => true)\n end", "def category_links(category)\n links = \"\"\n iterated_cat = category\n if iterated_cat.parent.nil?\n links = insert_category_link(links,iterated_cat)\n else \n i = 0\n while !iterated_cat.parent.nil? and iterated_cat != Sfcatnode.root\n links = insert_category_link(links,iterated_cat)\n iterated_cat = iterated_cat.parent\n i+= 1\n end\n end\n links.insert(0,\"#{link_to('All Solutions', :action => 'index')}\")\n end", "def webSiteBuildCategoryLinkPage(labels, pageShortPath, pageTitle)\n # Create page path.\n destDir = Pathname.new(pathWebSitePages())\n destFile = destDir + pageShortPath + \"index.html\"\n \n puts \"Building page: \" + destFile.to_s\n \n # Get content HTML.\n html = webSiteBuildLinkListForLabels(labels, pageShortPath)\n \n # Save the page.\n webSiteBuildPageFromStandardTemplate(\n pageTitle,\n html,\n destFile)\nend", "def index\n @categories = collections_config.values\n end", "def scrape_categories_page\n categories = {}\n # On non-root pages, the xpath is:\n # \"//ul[@id='nav-categories']/li/a\"\n @agent.get(clean_url('/')) do |page|\n page.search(\"//h2[text()='Categories']/following-sibling::ul/li/a\").each do |link|\n category_url = link.attributes[\"href\"].value\n categories[link.text.gsub(/[^\\w\\s]+/,'').lstrip] = category_url\n end\n end\n\n categories\n end", "def categories\n add_to_query restrict_kind: 'category'\n end", "def sitemap\n store_location\n\n # note: icons could be included, but do not seem to add much\n # note: tried showing unavailable pages as 'sans link', results not particularly attractive\n\n # TBD: My Talks, My Messsages, Current Messages\n # TBD: Maps, Calendars, Tags & Topics, Friends & Groups, Attachments, Venues\n @routes = talk_routes + user_routes + message_routes + admin_routes + common_routes \n\n end", "def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end", "def create_sitemap\n end", "def index\n @categories = @current_website.categories.all\n end" ]
[ "0.608349", "0.6065135", "0.5996792", "0.5961147", "0.5954829", "0.5884802", "0.5876969", "0.5845587", "0.582028", "0.58174735", "0.57482165", "0.56921375", "0.56493396", "0.56242836", "0.56211925", "0.56196785", "0.56089264", "0.56074655", "0.5592723", "0.5590939", "0.5562596", "0.5561988", "0.5559333", "0.55497444", "0.55429286", "0.5541846", "0.55389", "0.5532799", "0.5504442", "0.54894614" ]
0.8357393
0
Add all catalog resources to the sitemap
def add_resources exhibit.solr_documents.each do |d| sitemap.add sitemap.exhibit_solr_document_path(exhibit, d), priority: 0.25, lastmod: document_last_modified(d) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sitemap\n store_location\n\n # note: icons could be included, but do not seem to add much\n # note: tried showing unavailable pages as 'sans link', results not particularly attractive\n\n # TBD: My Talks, My Messsages, Current Messages\n # TBD: Maps, Calendars, Tags & Topics, Friends & Groups, Attachments, Venues\n @routes = talk_routes + user_routes + message_routes + admin_routes + common_routes \n\n end", "def sitemap\n @pages = []\n website.available_locales.each do |l|\n @pages << { url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago }\n end\n render \"sitemap_index\"\n end", "def generate_sitemap\n end", "def add_browse_categories\n exhibit.searches.published.find_each do |s|\n sitemap.add sitemap.exhibit_browse_path(exhibit, s), priority: 0.5, lastmod: s.updated_at\n end\n end", "def add_pages\n exhibit.feature_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at\n end\n\n exhibit.about_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priority: 0.5, lastmod: p.updated_at\n end\n end", "def sitemap\n @pages = Page.find_all_by_sitemap_and_public(true, true)\n respond_to do |format|\n format.xml { render :layout => \"sitemap\" }\n end\n end", "def google_sitemap\n\t\t@urls = []\n\t\t# 1. 305 - Redirected back to the reverse proxy to show old site page.\n\t\tREDIRECTIONS.select {|k,v| v[:action] == 305}.each {|r| @urls.push(r[0])}\n\t\t# 2. All Homepage's (including mainpage)\n\t\tSection.environments().each do |section|\n\t\t\thome = section_homepage_url(section)\n\t\t\t@urls << home if home\n\t\tend\n\t\t# 3. All Pages\n\t\tAsset.find_all_by_resource_type('Page').select {|p| p.published_page?}.each {|p| @urls << site_page_url(p)}\n\n respond_to do |format|\n format.xml\n end\n\tend", "def create_sitemap\n end", "def sitemap\n @pages = Page.sitemap\n end", "def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: 'alchemy/sitemap' }\n end\n end", "def manipulate_resource_list(resources)\n resources + options[:targets].map do |t|\n StaticResource.new(\n app.sitemap,\n t[:output]\n ) { \n File.read(File.expand_path(tmp_path(t), app.root))\n }\n end\n end", "def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: \"alchemy/sitemap\" }\n end\n end", "def add_resources!\n return unless exhibit.published?\n\n add_exhibit_root\n add_pages\n add_resources\n add_browse_categories\n end", "def append_path(path)\n @app.sitemap.rebuild_resource_list!(:sprockets_paths)\n\n super\n end", "def index\n @pages = []\n website.available_locales.each do |l|\n @pages << {\n url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago}\n end\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def sitemap\n self.root\n self.follow('dtime:sitemap')\n self.get\n self\n end", "def sitemap\n @tlsitemap_entries = []\n #Get only published timelines\n Timeline.find_each(:batch_size => 500, :conditions => [\"visibility = ?\", VIS_PUBLIC]) do |each_tl|\n @tlsitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{timeline_path(each_tl)}\")\n end\n \n @homepage_entry = \"#{request.protocol}#{request.host_with_port}\"\n \n @other_sitemap_entries = []\n # About, FAQ, Browse, Showcase\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{about_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{browse_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{showcase_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{faq_path}\")\n \n render :template => \"timelines/sitemap\", :formats => [:xml], :handlers => :haml\n end", "def urls\n @urls ||= all_urls(sitemap)\n end", "def collect_sitemaps( &block )\n local_sitemap = sitemap\n\n if !master?\n block.call( local_sitemap )\n return\n end\n\n foreach = proc { |peer, iter| peer.spider.sitemap { |s| iter.return( s ) } }\n after = proc do |sitemap|\n block.call( (sitemap | local_sitemap).flatten.uniq.sort )\n end\n\n map_peers( foreach, after )\n end", "def sitemap(tree)\n list_children(tree, nil, 'sitemap')\n end", "def sitemaps\n @sitemaps ||= extract_urls('sitemap')\n end", "def collect_resources\n logger.info \"Collecting resources from #{configuration.resource_path}\" do\n Dir.glob(File.join(configuration.resource_path, \"*.rb\")).each do |file|\n @run_context.add_resource_from_file ResourceFile.new(file)\n end\n end\n end", "def sub_pages(dir)\n sitemap.resources.select do |r|\n r.url.start_with? \"/#{dir}\"\n end\n end", "def index\n headers['Content-Type'] = 'application/xml'\n @routes = website_routes + @opportunity_routes\n @blog_sitemap_route = buttercms_blog_sitemap_url\n end", "def catalogs\n path = \"#{api_root}/index/catalogs\"\n process_api_request(:get, path)\n end", "def build_keyword_pages\n keyword_pages = {}\n sitemap.resources.each do |resource|\n keywords = resource.metadata[:page][\"keywords\"]\n next if keywords.blank?\n keywords.each do |keyword|\n (keyword_pages[keyword] ||= []) << resource\n end\n end\n keyword_pages\nend", "def sitemap_links\n each_sitemap_link.to_a\n end", "def manipulate_resource_list(resources)\n\n\n index_file = app.index_file\n new_index_path = \"/#{index_file}\"\n\n # for each resource\n resources.each do |resource|\n\n # has custom_url in frontmatter\n if resource.raw_data[:custom_url]\n\n # set path as custom_url\n resource.destination_path = resource.raw_data[:custom_url] + new_index_path\n end\n end\n end", "def sitemap\n expires_in 1.day, public: true\n\n # The sitemap itself is hosted on Google Cloud storage, we read it from them and send it back to the accessor of this endpoint.\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket ENV.fetch('GCLOUD_BUCKET')\n file = bucket.file \"sitemaps/sitemap.#{I18n.locale}.xml.gz\"\n\n send_data file.download.read, type: 'text/xml'\n end", "def sitemap\n expires_in 1.day, public: true\n\n # The sitemap itself is hosted on Google Cloud storage, we read it from them and send it back to the accessor of this endpoint.\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket ENV.fetch('GCLOUD_BUCKET')\n file = bucket.file \"sitemaps/sitemap.#{I18n.locale}.xml.gz\"\n\n send_data file.download.read, type: 'text/xml'\n end" ]
[ "0.663915", "0.65118396", "0.62684333", "0.6230909", "0.60525185", "0.60361695", "0.6025151", "0.5959331", "0.5937014", "0.59295493", "0.5924765", "0.59173447", "0.5867088", "0.5858609", "0.58148926", "0.571064", "0.56768185", "0.56091964", "0.55983377", "0.55945176", "0.5577178", "0.5505362", "0.5493158", "0.5480051", "0.5468062", "0.54274327", "0.5412151", "0.53928924", "0.53791046", "0.53791046" ]
0.74172276
0
To Track the entity
def track(entity) if entity.is_a?(Sociographer::Entity) # @@neo = Neography::Rest.new self_node = self.get_node tracked_node = entity.get_node if self_node && tracked_node && !self.tracks?(entity) relation = Neography::Relationship.create(:friends, self_node, tracked_node) @@neo.set_relationship_properties(relation, {"magnitude" => 1, "created_at" => DateTime.now.to_i}) else false end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track\n self.class.track(@tracking)\n end", "def save\n if @entity\n before_save\n @entity.save\n end\n self\n end", "def track\n post\n end", "def track(entity_type='npc')\n GameMachine::GameSystems::EntityTracking::GRID.set(entity.id,position.x,position.y,position.z,entity_type)\n end", "def persist(entity)\n @adapter.persist(collection, entity)\n end", "def collect entity\n touch entity, true\n end", "def track(object)\n tracker.store_transient(object, mapper)\n self\n end", "def record_to_persist\n record\n end", "def _process_on_create(entity)\n end", "def persist\n \n end", "def to_record(entity)\n end", "def save_entity(entity)\n result = service.put(entity.path, entity)\n entity[:updatedAt] = result[:updatedAt]\n entity[:createdAt] = result[:createdAt]\n entity\n end", "def to_entity\n \tentity = Google::Cloud::Datastore::Entity.new\n \tentity.key = Google::Cloud::Datastore::Key.new \"Feedback\", id\n \tentity[\"comment\"] = comment\n \tentity[\"overall\"] = overall \n \tentity[\"cleanliness\"] = cleanliness\n \tentity[\"odour\"] = odour\n \tentity[\"safety\"] = safety\n \tentity[\"user_id\"] = user_id\n \tentity[\"toilet_id\"] = toilet_id\n \tentity\n end", "def track!\n tracker.track(params)\n end", "def track!\n tracker.track(params)\n end", "def entity=newe\n if newe # Propogate the entity's identifying info to the rest of the item\n self.id = newe.id\n self.klass = newe.class\n end\n @entity = newe\n end", "def track\n @tracker.track\n backup\n end", "def entity\n @keys[:entity]\n end", "def entityID\n end", "def entityID\n end", "def set_tracking\n end", "def entity\n raise \"No entity class defined for #{self.class}\"\n end", "def persist; end", "def persist; end", "def persist; end", "def track_record_update\n true\n end", "def track(model)\n @queue << model.name\n end", "def set_track\n # @track = Track.find(params[:id])\n end", "def persist_new(entity)\n cargo_persistence.create(to_dao(entity))\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end" ]
[ "0.67914736", "0.6594084", "0.6452052", "0.6438693", "0.6316617", "0.63028574", "0.6280601", "0.62383753", "0.62269795", "0.6203516", "0.61181885", "0.6090879", "0.60651416", "0.60590696", "0.60590696", "0.60570484", "0.603211", "0.6016936", "0.60007244", "0.60007244", "0.5979664", "0.5923741", "0.5909704", "0.5909704", "0.5909704", "0.58686525", "0.58446467", "0.58380115", "0.5836658", "0.5830462" ]
0.691833
0
To unTrack the entity
def untrack(entity) if entity.is_a?(Sociographer::Entity) # @@neo = Neography::Rest.new self_node = self.get_node tracked_node = entity.get_node if self_node && tracked_node relation = @@neo.get_node_relationships_to(self_node, tracked_node, "out", :friends).first @@neo.delete_relationship(relation) if relation.present? return true # self_node.outgoing(:friends) << tracked_node else false end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @entity.destroy\n self\n end", "def unsave\n client.post('/api/unsave', id: read_attribute(:name))\n end", "def unsave\n self.saved_at = nil\n end", "def destroy\n @world.remove_entity(self)\n end", "def unsave\n post(\"/api/unsave\", id: fullname)\n end", "def unlove( params )\n LastFM.requires_authentication\n LastFM.post( \"track.unlove\", params )\n end", "def finalize\n @entities.clear\n end", "def destroy_entities entities; end", "def delete\n self.store -= self\n end", "def desist\n self.class.delete self\n end", "def undo\n\t\t@space.entities.delete @ui_entity\n\tend", "def remove_inverse_instance(record)\n if inverse = inverse_association_for(record)\n inverse.inversed_from(nil)\n end\n end", "def destroy\n @tracker.destroy\n end", "def undestroy\n self.update_attribute(:deleted, nil)\n self.update_attribute(:deleted_at, nil)\n end", "def unsave(object)\n full_name = extract_full_name object\n post 'api/unsave', :id => full_name\n end", "def destroy entity\n entity.parent = nil\n # index = entities.index(entity)\n # return if index.nil? || index < static_entity_length - 1\n # entities.delete_at index\n # players.delete entity\n # entity.destroy\n\n # @todo It might make sense to destroy the entity completely now. It\n # will still have a reference in the index, but that shouldn't impact\n # the current state of the plot.\n return if static.include?(entity)\n entities.delete entity\n players.delete entity\n end", "def unfollow\n @camera_target = nil\n end", "def remove_entity(entity)\n key = \"contacts_for:#{entity.id}\"\n @redis.srem(key, self.id)\n end", "def unfollow! followee\n following_ids.delete(followee.id)\n save\n followee.followers_ids.delete(id)\n followee.save\n end", "def unown!(owned)\r\n master_song_relationships.find_by_master_song_owned_id(owned).destroy\r\n end", "def discard_transaction\n\t clear_relations\n\tend", "def remove_entity_snapshot(id)\n entities.where(:id => id).update(:snapshot => nil)\n end", "def delete\n @service.delete_entity(self)\n end", "def nullify\n criteria.update_all(foreign_key => nil)\n _target.clear do |doc|\n unbind_one(doc)\n doc.changed_attributes.delete(foreign_key)\n end\n end", "def unpost\n Rentlinx.client.unpost(type, send(identity))\n end", "def undelete!\n new_type = changes.delete(\"type\")\n new_id = changes.delete(\"id\")\n new_object = change_loggable_type.constantize.new(changes)\n new_object.update_attribute(:id, new_id)\n if new_object.valid?\n new_object.save!\n self.restored_at = Time.now\n self.restored_user_id = Thread.current['user'].try(:id)\n self.save!\n end\n new_object\n end", "def nuke\n self.open_graph_event.destroy unless self.open_graph_event.nil?\n self.teamsheet_entries.destroy_all\n self.messages.destroy_all\n self.activity_items.destroy_all\n self.result.destroy unless self.result.nil?\n self.destroy\n end", "def delete(entity)\n @dataset.delete(entity)\n end", "def destroy\n clear\n save\n end", "def delete(entity)\n @dataset.delete(\n _serialize(entity)\n )\n end" ]
[ "0.6821956", "0.6688395", "0.65249914", "0.6486991", "0.6439338", "0.6330571", "0.63251334", "0.62900496", "0.6231193", "0.6187877", "0.6182222", "0.61566496", "0.61472493", "0.6133834", "0.61223525", "0.6121989", "0.6101171", "0.61001396", "0.6070958", "0.60514283", "0.60153186", "0.60143495", "0.60020363", "0.5995854", "0.5972993", "0.59680057", "0.596022", "0.5946231", "0.594398", "0.59292054" ]
0.7271832
0
To get friends: The common entities between trackers and trackings
def friends # @@neo = Neography::Rest.new friends = self.trackers & self.tracking end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trackers\n # @@neo = Neography::Rest.new\n self_node = User.first.get_node\n if self_node\n trackers = []\n begin\n trackers_list = self_node.incoming(:friends).map{ |n| [n.object_type, n[:object_id]] }\n trackers_list = trackers_list.group_by{|x| x[0]}\n trackers_list.each do |tracker_type|\n tracker_ids = tracker_type[1].map{|u|u[1]}\n trackers << tracker_type[0].safe_constantize.where(id: tracker_ids).try(:to_a)\n end\n rescue Exception\n end\n return trackers.flatten\n else\n return []\n end\n end", "def friends\n friend_uids = []\n friend_uids = friend_uids + self.sent_friends.pluck(:reciever_uid)\n friend_uids = friend_uids + self.received_friends.pluck(:sender_uid)\n return User.where(:uid => friend_uids)\n end", "def common_friends_with(user)\n self.friends & user.friends\n end", "def common_friends_with(user)\n self.friends & user.friends\n end", "def tracking\n # @@neo = Neography::Rest.new\n self_node = self.get_node\n if self_node\n trackers = []\n begin\n trackers_list = self_node.outgoing(:friends).map{ |n| [n.object_type, n[:object_id]] }\n trackers_list = trackers_list.group_by{|x| x[0]}\n trackers_list.each do |tracker_type|\n tracker_ids = tracker_type[1].map{|u|u[1]}\n trackers << tracker_type[0].safe_constantize.where(id: tracker_ids).try(:to_a)\n end\n rescue Exception\n end\n\n return trackers.flatten\n else\n return []\n end\n end", "def friends\n User.where(:guid => self.friend_guids)\n end", "def friends\n @_friends ||=\n Rails.cache.fetch(\"accounts/#{self.id}/friends\", expires_in: Settings.cache.friends) do\n Set.new client.friend_ids\n end\n end", "def friends\n begin\n if @@friends.size == 25 then @@friends.clear end # clear cache at 25 users\n unless @@friends[uid]\n @@friends[uid] = Set.new\n url = GRAPH_API[0] + uid + GRAPH_API[1] + oauth_token\n data = JSON.parse(open(url).read)\n data[\"friends\"][\"data\"].each { |h| @@friends[uid].add h[\"id\"] }\n @@friends[uid]\n else\n @@friends[uid]\n end\n rescue => e\n p e\n end\n end", "def friends \n friends = []\n friendships = Relationship.where(\"follower_id = :user_id and friend_status = 'FRIENDS' or followed_id = :user_id and friend_status = 'FRIENDS'\", {user_id: self.id})\n\n friendships.each do |friendship|\n if friendship.followed_id == self.id\n friends.append(friendship.follower)\n else\n friends.append(friendship.followed)\n end\n end\n\n\tfriends << self\n\t\n return friends \n end", "def friends\n self.invited + self.invited_by\n end", "def facebook_friends\n User.where(:guid => self.facebook_friend_guids)\n end", "def friends\n self.friended_users + self.users_friended_by\n end", "def friends\n first_set = self.initiated_friendships\n second_set = self.received_friendships\n return first_set + second_set\n end", "def my_friends\n (invited_friends + asked_friendships).compact.uniq\n end", "def friends\n user_ids = $redis.sinter(self.redis_key(:following), self.redis_key(:followers))\n User.where(:id => user_ids)\n end", "def friends\n friend_ids = active_friendships.where(confirmed: true).pluck(:recipient_id) + passive_friendships.where(confirmed: true).pluck(:initiator_id)\n User.where(id: friend_ids)\n end", "def get_all_friends\n friends = []\n self.friends_ids.each do |id|\n unless Person.find_by_twitter_id(id).nil?\n friends << Person.find_by_twitter_id(id)\n end \n end\n return friends\n end", "def common_friends(other_user_friends)\n\t\tcommon_friends = []\n\t\tother_user_friends.each do |user|\n\t\t\tif self.is_friend?(user)\n\t\t\t\tcommon_friends.push(user)\n\t\t\tend\n\t\tend\n\t\treturn common_friends\n\tend", "def all_friends\n User.where ['external_user_id IN (?) OR id IN (?)', facebook_friends_ids, email_friends_ids]\n end", "def friends\n user_ids = $redis.sinter(self.following_redis_key('user:following'), self.following_redis_key('user:followers'))\n User.where(id: user_ids)\n end", "def all_friends\n return self.users\n end", "def friends\n output = []\n friendships.each do |f|\n output << f.friend\n end\n output\n end", "def friends\n active_friends | received_friends\n end", "def friends\n active_friends | received_friends\n end", "def friends\n return friendships_confirmed + inverse_friendships_confirmed\n end", "def friends\n @user ||= auth_user\n friends = ::User.search_users_in_circle(@user).results\n following_user_ids = ::Stores::Following.where(user_id: @user.id).collect(&:follower_user_id) # others following user\n followings = ::Stores::Following.where(follower_user_id: @user.id).includes(:user).order('last_traded_at desc, id desc') # user following others, already ordered newest to oldest\n followed_user_ids = Set.new # for excluding the non-followers\n both_side_followers = []\n one_side_followers = []\n bound = :circle\n user_ids_to_exclude = []\n auth_user.boundaries.group_by(&:type).each do|btype, blist|\n case btype\n when 'Users::ChildCircleOption'\n case blist.first.content_keyword\n when 'GRADE_ONLY'\n bound = :grade\n when 'CLASS_ONLY'\n bound = :class\n end\n when 'Users::UserBlock'\n user_ids_to_exclude = user_ids_to_exclude + ::Users::Boundary.extract_content_values_from_list(blist)\n end\n end\n followings.each do|following|\n user = following.user\n is_mutual = following_user_ids.include?(following.user_id) # y is also following user\n user.is_follower = true\n user.is_mutual_friend = is_mutual\n if is_mutual\n both_side_followers << user.as_more_json({}, auth_user.id)\n else\n if bound.eql? :circle and ::Schools::SchoolGroup.grades_around(auth_user.grade).include?(user.grade)\n one_side_followers << user.as_more_json({}, auth_user.id)\n elsif bound.eql? :grade and auth_user.grade.eql?(user.grade)\n one_side_followers << user.as_more_json({}, auth_user.id)\n elsif bound.eql? :class and auth_user.teacher.eql? user.teacher\n one_side_followers << user.as_more_json({}, auth_user.id)\n end\n end\n logger.debug \" | %20s | %1s | %10d\" % [user.user_name, is_mutual ? 'B' : 's', following.id]\n followed_user_ids << following.user_id\n end\n non_followers = friends.find_all {|friend| !followed_user_ids.include?(friend.id) }.sort{|x,y| y.id <=> x.id } # newest registered friends\n logger.debug \"-------- #{both_side_followers.size} both side, #{one_side_followers.size} one side, #{non_followers.size} non-followers\"\n @friends = both_side_followers + one_side_followers + non_followers.as_json\n #if they're blocked, remove them regardless.\n result = @friends.map do |friend|\n if not user_ids_to_exclude.include?(friend['id'])\n friend\n else\n nil\n end\n end\n result = result.compact\n respond_to do|format|\n format.json { render json:{ success: true, users: result} }\n format.html\n end\n end", "def friends\n\t\t#sql query for the requested and accepted friendships ID's using the user id\n\t\tactive_ids = \"SELECT friend_pasive_id FROM relationships WHERE friend_active_id = :user_id AND accepted = true\"\n\t\t#sql query for the received and accepted friendships ID's using the user id\n\t\tpasive_ids = \"SELECT friend_active_id FROM relationships WHERE friend_pasive_id = :user_id AND accepted = true\"\n\t\treturn User.where(\"id IN (#{active_ids}) OR id IN (#{pasive_ids})\", user_id: self.id).includes( avatar_attachment: :blob)\n\tend", "def followers \r\n\tlovers = []\r\n\tself.likes.each do |l|\r\n\t\tlovers << l.user\r\n\tend\r\n\tself.feature_groups.each do |fg|\r\n\t\tfg.features.each do |f|\r\n\t\t\tf.likes.each do |l|\r\n\t\t\t\tlovers << l.user\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn lovers.unique\r\n end", "def shared_friends\n @friends = current_user.friends\n @shared_friend_ids = @blog.linked_users.map{|user| user.id.to_s} if @blog.present?\n end", "def all_friends\n requested_friends + accepted_friends\n end" ]
[ "0.74777555", "0.7411428", "0.7242166", "0.7242166", "0.71287173", "0.70923585", "0.702671", "0.70255065", "0.7011074", "0.69539845", "0.69445086", "0.69310766", "0.69235945", "0.6912643", "0.690255", "0.68993014", "0.6896605", "0.6894356", "0.68681747", "0.6859657", "0.68555593", "0.6801914", "0.67986727", "0.67986727", "0.6782901", "0.6778512", "0.6755009", "0.6741654", "0.6732191", "0.6731446" ]
0.80789185
0
To check if friend with the entity or net
def friend_with?(entity) if entity.is_a?(Sociographer::Entity) # @@neo = Neography::Rest.new # self_node = self.get_node tracked_node = entity.get_node # if self_node && tracked_entity_node # trackings = self_node.outgoing(:friends).map{ |n| n} # trackers = self_node.incoming(:friends).map{ |n| n} # friends = trackers & trackings current_friends = self.friends if current_friends && !current_friends.try(:empty?) return current_friends.include?(tracked_node) else false end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_friends_with?(friend)\n \t friends.include?(friend)\n \t end", "def for_friend?\n return true if skill? and skill.for_friend?\n return true if item? and item.for_friend?\n return false\n end", "def is_friends_or_pending_with?(friend)\n \t pending_or_accepted_friends.include?(friend)\n \t end", "def is_friend?\n @friended\n end", "def is_friend\n friend_request_exists? && @friend.accepted?\n end", "def friends?(other)\n\treturn true if other == self\n \n relationship = get_relationship(other)\n \n return relationship && relationship.friend_status == \"FRIENDS\"\n end", "def is_friends_with?(friend)\n self.friends.include?(friend)\n end", "def friend?\r\n infoxml = get_info\r\n \r\n if friend = infoxml['friend']\r\n return friend == '1'\r\n end\r\n \r\n return false\r\n end", "def has_friend?(actor)\n return true if actor == self\n !self.contact_to!(actor).blocked && !actor.contact_to!(self).blocked\n end", "def friend? friend_identity\n account.all_friends.friend.find_by_friend_kopal_identity(Kopal::Identity.normalise_identity(friend_identity.to_s))\n end", "def friend_of?(user)\n relation = self.facebook_friends.include?(user)\n end", "def me_or_friend?\n unless current_user.is_friends_with? @user or @user == current_user\n flash[:notice] = \"You aren't allowed to view that page.\"\n end\n end", "def friends?(other_user)\n if Friendship.where(\"asker_id = #{self.id} AND receiver_id = #{other_user.id}\") != []\n return true\n else\n return false\n end\n end", "def friend_request_requester?\n friend_request_exists? && friend.requester == record\n end", "def is_pending_friends_with?(friend)\n \t pending_friends.include?(friend)\n \t end", "def friend_request_exists?\n both_user_verified?\n users = Friend.user_sequence(object.id, current_user.id)\n @friend = Friend.find_by(user1_id: users[0], user2_id: users[1])\n @friend.present?\n end", "def friend?(other_user)\n friends_with.include?(other_user)\n end", "def friend_request?(id)\n inverse_friendships.where(user_id: id).any?\n end", "def friend?(user)\n friends.include?(user)\n end", "def friends_with?(other_user)\n friends.include?(other_user)\n end", "def friends?(other_user)\n\t\tself.friends.include?(other_user)\n\tend", "def friends_with?(other_user)\n self.mutually_following?(other_user)\n end", "def friend_of_current_user?\n current_user.friends.pluck(:id).include?(@profile.user.id) ? \n current_user.friendships.find_by_friend_id(@profile.user.id) : false\n end", "def friends?(other_user)\n friends.include?(other_user)\n end", "def friend_of?(user)\n friends.include?(user)\n end", "def friend_with?(user)\n friends.include?(user)\n end", "def friend_with?(user)\n return false if user == self\n (friend_ids + inverse_friend_ids).include?(user.id)\n end", "def friend_request_accepted?\n friend_request_exists? && friend.accepted?\n end", "def is_friends_or_pending_with?(friend)\n self.pending_or_accepted_friends.include?(friend)\n end", "def friend?(user)\n\t\tfriendships.find_by_friend_id(user)\n\tend" ]
[ "0.71997064", "0.7134967", "0.7095948", "0.707487", "0.7072164", "0.6989772", "0.6989354", "0.6963993", "0.6954462", "0.6939116", "0.6923071", "0.6891178", "0.6885402", "0.68337446", "0.68187237", "0.68136144", "0.68000585", "0.67836857", "0.67826045", "0.67732733", "0.6757388", "0.6730177", "0.6729869", "0.6728644", "0.66949296", "0.6691466", "0.66798365", "0.667364", "0.66568184", "0.6637767" ]
0.80415875
0
Suggest friends: friends of friends
def friend_suggestions # @@neo = Neography::Rest.new self_node = self.get_node if self_node recommendations = self_node.both(:friends).order("breadth first").uniqueness("node global").filter("position.length() == 2;").depth(2) all_recommendations = recommendations.map{|n| begin n.object_type.safe_constantize.find(n[:object_id]) # n.object_type.safe_constantize.find(n["object_id"]) rescue Exception end } else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friends_suggestion(friends_of_friends = false)\n\t\t#sql query for the requested and accepted friendships ID's using the user id\n\t\tactive_ids = \"SELECT friend_pasive_id FROM relationships WHERE friend_active_id = :user_id AND accepted = true\"\n\t\t#sql query for the received and accepted friendships ID's using the user id\n\t\tpasive_ids = \"SELECT friend_active_id FROM relationships WHERE friend_pasive_id = :user_id AND accepted = true\"\n\t\t#not answered friendship request\n\t\tfriend_requests_ids = \"SELECT friend_active_id FROM relationships WHERE friend_pasive_id = :user_id AND accepted = false\"\n\t\t#sql query for the id's of the pasive friends from the user's id friends\n\t\tfriends_pasive_friends_ids =\"SELECT friend_pasive_id FROM relationships WHERE friend_active_id IN (#{active_ids}) OR friend_active_id IN (#{pasive_ids})\"\n\t\t#sql query for the id's of the active friends from the user's id friends\n\t\tfriends_active_friends_ids =\"SELECT friend_active_id FROM relationships WHERE friend_pasive_id IN (#{active_ids}) OR friend_pasive_id IN (#{pasive_ids})\"\t\t\n\t\t\n\t\tif friends_of_friends\n\t\t\tusers_query = \"NOT (id IN (#{active_ids}) OR id IN (#{pasive_ids})) AND (id IN (#{friends_pasive_friends_ids}) OR id IN (#{friends_active_friends_ids}) ) AND (id <> :user_id ) \"\n\t\t\t\n\t\telse\n\t\t\tusers_query = \"NOT (id IN (#{active_ids}) OR id IN (#{pasive_ids}) OR id IN (#{friend_requests_ids})) AND NOT (id IN (#{friends_pasive_friends_ids}) OR id IN (#{friends_active_friends_ids}) ) AND (id <> :user_id ) \"\n\t\t\n\t\tend\n\t\treturn User.where(\"#{users_query}\", user_id: self.id).distinct.includes( avatar_attachment: :blob)\n\tend", "def suggested_friends(page = 1, per_page = 15)\n calc_suggested_friends\n my_suggested_friends.where.not(id: rejected_friend_suggestions.pluck(:user_id) + [User.bot_id]).page(page).per(per_page)\n end", "def calc_suggested_friends\n Rails.cache.fetch(\"suggested_user_friends_#{id}\", expires_in: 1.weeks.from_now.end_of_day) do\n friend_suggestions.delete_all\n queries = _possible_friends.map{|q|\n \"(#{q.\n where.not(id: rejected_friend_suggestions.pluck(:user_id)).\n where(\"NOT EXISTS(#{UserFriendRelationship.where('user_id = ? or user_to_id = ?', id, id).where('user_id = users.id or user_to_id = users.id').select(:id).to_sql})\").\n to_sql\n })\"\n }.join(' UNION ')\n res = User.from(\"(#{queries}) as users\").uniq.order('u_priority ASC, pref_priority DESC')\n res.pluck('users.id, u_priority, pref_priority').map{|a| friend_suggestions.create(user_id: a.first) }\n end\n end", "def proposed_friends\n friendships.map{ |fs| fs.friend unless fs.accepted? }.compact\n end", "def auto_suggest_friends\n query = \"\n SELECT companies.* FROM companies as companies \n JOIN company_relationships as destinies \n ON (companies.id = destinies.company_origin_id and confirmed=true) \n WHERE (destinies.company_destiny_id=#{self.id.to_s})\"\n query << \" \n UNION SELECT companies.* \n FROM companies as companies \n JOIN company_relationships as origins \n ON (companies.id = origins.company_destiny_id and confirmed=true) \n WHERE (origins.company_origin_id=#{self.id.to_s})\"\n \n Company.find_by_sql query\n end", "def all_friends\n requested_friends + accepted_friends\n end", "def suggestions\n @users = User.all.to_ary.select { |user| user != current_user &&\n !current_user.to_fr_ids.include?(user.id) &&\n !current_user.friends.include?(user) &&\n !current_user.from_fr_ids.include?(user.id)\n }\n @requests = current_user.received_friend_requests\n end", "def possible_friends\n User.all - self.requesters - self.requestees-self.friends-User.where(id:self.id)\n end", "def pending_or_accepted_friends\n \t friends + pending_friends\n \t end", "def friends\n return friendships_confirmed + inverse_friendships_confirmed\n end", "def follow_suggest\n User.all_but(self).map { |usr| usr unless following?(usr) }.compact\n end", "def friends\n friendships.where(accepted: true).map(&:friend)\n end", "def _possible_friends(_limit = 100)\n \n query = []\n \n # select columns\n # order by priorities\n order_prio = ['(case when 1 = 1 then 0 end)']\n order_prio << \"(case when users.sex = #{preferred_sex} then 1 else 0 end)\" if preferred_sex.present?\n order_prio << \"(case when users.sex = #{opposite_sex} then 1 else 0 end)\" if preferred_friendship == 'marriage'\n if preferred_countries.present?\n order_prio << \"(case when users.country in (#{preferred_countries.map{|a| User.sanitize(a) }.join(',')}) then 1 else 0 end)\"\n order_prio << \"(case when meta_info->>'continent'= #{User.sanitize(continent)} then 1 else 0 end)\"\n end\n order_prio << \"(case when extract(year from users.birthdate::DATE) BETWEEN #{preferred_age.split(',').join(' and ')} then 1 else 0 end)\" if preferred_age.present?\n \n selects = \"users.*, (#{order_prio.join(' + ')}) as pref_priority, %{prio} as u_priority\"\n \n # mobile contacts\n query << User.most_active.where(phone_number: user_settings.contact_numbers).select(selects % {prio: 1}) if user_settings.contact_numbers.present?\n \n # users in the same group\n query << User.most_active.joins(:user_relationships).where(user_relationships: {groupable_id: user_groups.pluck(:id)}).where('user_relationships.accepted_at is not null').select(selects % {prio: 2}) if user_groups.any?\n \n # filter by country\n # if preferred_countries.present?\n # query << User.most_active.where(country: preferred_countries).select(selects % {prio: 3})\n # query << User.most_active.where(\"meta_info->>'continent'= ?\", continent).select(selects % {prio: 4})\n # end\n \n query << User.valid_users.select(selects % {prio: 10}) # default suggestion\n \n # filter by sex\n # sexs = []\n # sexs << preferred_sex if preferred_sex.present?\n # sexs << opposite_sex if preferred_friendship == 'marriage'\n # query = query.map{|q| q.where(sex:sexs ) } if sexs.present?\n \n \n # filter by age\n # query = query.map{|q| q.between_ages(*preferred_age.split(',')) } if preferred_age.present?\n \n query.map{|q| q.where.not(id: [id, User.bot_id] + blocked_user_ids).limit(_limit) }\n end", "def pending_friends\n \t pending_friends_by_me + pending_friends_for_me\n \t end", "def worlize_friends\n User.where(:guid => self.worlize_friend_guids)\n end", "def my_friends\n (invited_friends + asked_friendships).compact.uniq\n end", "def is_friends_with?(friend)\n \t friends.include?(friend)\n \t end", "def friends\n active_friends + passive_friends\n end", "def possible_friends\n ids = (friendships.map{ |fs| fs.friend_id } +\n inverse_friendships.map{ |fs| fs.user_id }).compact\n User.where.not(id: ids) - [self]\n end", "def is_friends_or_pending_with?(friend)\n \t pending_or_accepted_friends.include?(friend)\n \t end", "def suggested_friends\n \tpeople_may_know_query = \"select r.follower_id, r.followed_id from Relationships r where r.follower_id in (select u1.id from Users u1, Relationships r1 where r1.follower_id = #{self.id} and r1.followed_id = u1.id and r1.friend_status = 'FRIENDS' and not u1.temp or r1.follower_id = u1.id and r1.followed_id = #{self.id} and r1.friend_status = 'FRIENDS') and r.followed_id != #{self.id} and r.followed_id not in (select u1.id from Users u1, Relationships r1 where r1.follower_id = #{self.id} and r1.followed_id = u1.id and r1.friend_status = 'FRIENDS' or r1.follower_id = u1.id and r1.followed_id = #{self.id} and r1.friend_status = 'FRIENDS') and r.friend_status = 'FRIENDS' or r.followed_id in (select u1.id from Users u1, Relationships r1 where r1.follower_id = #{self.id} and r1.followed_id = u1.id and r1.friend_status = 'FRIENDS' or r1.follower_id = u1.id and r1.followed_id = #{self.id} and r1.friend_status = 'FRIENDS') and r.follower_id != #{self.id} and r.follower_id not in (select u1.id from Users u1, Relationships r1 where r1.follower_id = #{self.id} and r1.followed_id = u1.id and r1.friend_status = 'FRIENDS' or r1.follower_id = u1.id and r1.followed_id = #{self.id} and r1.friend_status = 'FRIENDS') and r.friend_status = 'FRIENDS'\"\n \t\n \tpeople_may_know = ActiveRecord::Base.connection.execute(people_may_know_query)\n \tmutual_hash = {}\n \tpeople_may_know.each do |result|\n \t\t#Interface of result {\"follower_id\"=>value, \"followed_id\"=>value}\n \t\tfollower_id = result[\"follower_id\"].to_i\n \t\tfollowed_id = result[\"followed_id\"].to_i\n \t\t\n \t\tif self.friends?(User.find(follower_id)) && self.get_relationship(User.find(followed_id)).nil?\n \t\t\tif mutual_hash[followed_id].nil?\n \t\t\t\tmutual_hash[followed_id] = 1\n \t\t\telsif\n \t\t\t\tmutual_hash[followed_id] += 1\n \t\t\tend\n \t\telse self.friends?(User.find(followed_id)) && self.get_relationship(User.find(follower_id)).nil?\n \t\t\tif mutual_hash[follower_id].nil?\n \t\t\t\tmutual_hash[follower_id] = 1\n \t\t\telsif\n \t\t\t\tmutual_hash[follower_id] += 1\n \t\t\tend\n \t\tend\n \tend\n \tmutual_array = mutual_hash.sort.reverse\n \t\n \tmutual_users = []\n \tmutual_array.each do |keyvalue|\n \t\tmutual_users << User.find(keyvalue[0]) if keyvalue[1] > 1\n \tend\n \t\n \treturn mutual_users\n end", "def pending_or_accepted_friends\n self.friends + self.pending_friends\n end", "def friends_proposals\n # get all friend ids\n # friend_ids = Friendship.select(:friend_id).where user_id: self.id\n # friend_ids ||= []\n # User.where.not( id: friend_ids).where.not( id: self.id) # get all user that are not are not in the list of friend ids\n\n sent_ids = self.sent_friend_requests.map { |friend| friend.id} || []\n received_ids = self.received_friend_requests.map { |friend| friend.id} || []\n friend_ids = self.friends.map { |friend| friend.id } || []\n\n ids = friend_ids + received_ids + sent_ids\n ids +=[-1] if ids.size == 0 # edge case: if ids is empty this corresponds to null!\n # dirty hack: assume that no user will ever have an negative id.\n\n User.where('id NOT IN (?) AND id != ?', ids, self.id).limit(10).order(\"RANDOM()\")\n\n end", "def friends_as_requester\n\t\taccepted_friendship = self.requesting_friendships.where(\"accepted = ?\", true)\n\n\t\tfriends = []\n\n\t\taccepted_friendship.each do |friendship|\n\t\t\tfriends << friendship.accepter\n\t\tend\n\n\t\tfriends\n\tend", "def all_friends\n User.where ['external_user_id IN (?) OR id IN (?)', facebook_friends_ids, email_friends_ids]\n end", "def friends_bets\n # this is a resource intensive method; it should be changed to something\n # quicker as soon as possible.\n\n # actually, i need to set the friends system in place first.\n # whoops.\n end", "def friends\n friendship_model = Amistad::Friendships.const_get(:\"#{Amistad.friendship_model}\")\n\n approved_friendship = friendship_model.where(friendable_id: id, pending: false, blocker_id: nil).select(:friend_id).to_sql\n approved_inverse_friendship = friendship_model.where(friend_id: id, pending: false, blocker_id: nil).select(:friendable_id).to_sql\n\n self.class.where(\"id in (#{approved_friendship}) OR id in (#{approved_inverse_friendship})\")\n end", "def friends_as_accepter\n\t\taccepted_friendship = self.accepting_friendships.where(\"accepted = ?\", true)\n\n\t\tfriends = []\n\n\t\taccepted_friendship.each do |friendship|\n\t\t\tfriends << friendship.requester\n\t\tend\n\n\t\tfriends\n\tend", "def pending_friends\n Relationship.find_all_by_friend_id_and_approved(self,false)\n end", "def pending_friends\n inverse_friendships.map{ |fs| fs.user unless fs.accepted? }.compact\n end" ]
[ "0.7735645", "0.754192", "0.7355418", "0.7275208", "0.717137", "0.7074245", "0.7051741", "0.70130235", "0.69649345", "0.69506353", "0.6806629", "0.6778449", "0.6770352", "0.67640525", "0.6751163", "0.6750401", "0.6750112", "0.6740888", "0.6730716", "0.67286414", "0.6702798", "0.6696108", "0.66701204", "0.66469896", "0.65879476", "0.6575279", "0.65553075", "0.65512395", "0.65443057", "0.6528529" ]
0.7927101
0
Get all paths of entities between you and the entity (like linkedin)
def all_degrees_of_separation(entity) if entity.is_a?(Sociographer::Entity) # @@neo = Neography::Rest.new self_node = self.get_node entity_node = entity.get_node if self_node && entity_node paths = [] self_node.all_simple_paths_to(entity_node).incoming(:friends).depth(5).nodes.each do |path| # path << node.object_type.safe_constantize.find(node["object_id"]) in_between = path.map{|n| begin {entity_type: n.object_type, entity_id: n[:object_id]} rescue Exception end } path = {length: path.size-1, users: in_between} paths << path # puts "#{(path.size - 1)} degrees: " + path.map{|n| begin n.object_type.safe_constantize.find(n[:object_id]).name rescue Exception end }.join(" => friends =>") end return paths else false end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths_to(node)\n find_paths do\n find { |n| n == node }\n end\n end", "def ascendant_and_self_ids\n full_path.map{ |c| c.id }\n end", "def path_ids\n ancestor_ids + [id]\n end", "def path_ids\n ancestor_ids + [id]\n end", "def shortest_degrees_of_separation(entity)\n @@neo = Neography::Rest.new\n self_node = self.get_node\n entity_node = entity.get_node\n if self_node && entity_node\n paths = []\n self_node.shortest_path_to(entity_node).incoming(:friends).depth(5).nodes.each do |path|\n # path << node.object_type.safe_constantize.find(node[\"object_id\"])\n in_between = path.map{|n| begin n.object_type.safe_constantize.find(n[:object_id]).id rescue Exception end }\n path = {length: path.size-1, users: in_between}\n paths << path\n # puts \"#{(path.size - 1)} degrees: \" + path.map{|n| begin n.object_type.safe_constantize.find(n[:object_id]).name rescue Exception end }.join(\" => friends =>\") \n end\n paths\n end\n end", "def paths\n end_verts = ends\n paths = []\n vertices.each do |v|\n end_verts.each do |e|\n x = path?(v.id, e.id)\n if x.is_a?(Array)\n x[1] << v.data\n paths << x[1]\n end\n end\n end\n end_verts.each { |e| paths << e.data }\n paths\n end", "def find_all_paths\n found_paths = []\n \n explore(found_paths, nil, @start_node)\n \n found_paths\n end", "def getPaths (paths, pathToMe, from, ttl)\n if (pathToMe.contains(self)) \n return\n end\n\n ttl = ttl-1 # ?\n if (ttl == 0) \n return # Kill it off if the path is too long\n end\n\n pathIncludingMe = pathToMe.copy #or clone() per java orig?\n\t\n # if this is the start node 'from' will be nil\n if (from != nil) \n pathIncludingMe.push(from)\n end\n pathIncludingMe.addElement(self) \t# new path with me in it\n paths.add(pathIncludingMe) \t\t# add it to the other paths\n\n edges.each do |e| \n edge = e.pop\n if (edge == from) \n continue \n end\n\n otherEnd = edge.getOtherNode(self);\n\n # add paths for edges\n otherEnd.getPaths(paths, pathIncludingMe, edge, ttl);\n end\n end", "def paths\n trail.paths.dup\n end", "def find_all_slashpaths (prefix='', node_cursor = nil)\n node_cursor ||= node\n child_paths = []\n\n if node_cursor.kind_of?(Array)\n node_cursor.each_index do |idx|\n child_paths.push prefix + '/' + idx.to_s\n if node_cursor[idx].kind_of?(Mash) || node_cursor[idx].kind_of?(Array)\n child_paths += find_all_slashpaths(prefix + '/' + idx.to_s, node_cursor[idx])\n end\n end\n else\n node_cursor.keys.each do |key|\n child_paths.push prefix + '/' + key.to_s\n if node_cursor[key].kind_of?(Mash) || node_cursor[key].kind_of?(Array)\n child_paths += find_all_slashpaths(prefix + '/' + key, node_cursor[key])\n end\n end\n end\n child_paths\n end", "def path(source, target, meta)\n # retrieve the path to the target node, using the meta hash\n # that was constructed at each iteration of the `each` iteration\n predecessor = target\n result_path = []\n\n # follow the leads from the back\n until predecessor == source\n result_path << predecessor.number\n predecessor = meta[predecessor]\n end\n\n # add the source, since now `predecessor == source` is true\n result_path << source.number\n result_path.reverse.join(\", \")\nend", "def path_ids(*args)\n return call_ancestry_method(:path_ids) if use_ancestry?\n\n Relationship.resource_pairs(path_rels(*args))\n end", "def path(source, target)\n predecessor = target\n result_path = []\n\n # follow the leads from the back\n until predecessor == source\n result_path << predecessor.number\n predecessor = meta[predecessor]\n end\n\n # add the source, since now `predecessor == source` is true\n result_path << source.number\n result_path.reverse.join(\", \")\n end", "def paths\n @trail.paths.dup\n end", "def find_alternative_paths\n reset\n \n @pairs.reverse!\n find_paths\n @pairs.reverse!\n\n @pairs.map{|pair| pair.path}\n end", "def traverse(start_elements, relation_filter, stop_filter, from_path = [])\n return [] if from_path.size > 100\n start_elements.each_with_object([]) do |el, relations|\n concrete_rels = concrete_relationships(el, relation_filter, from_path)\n relations.concat(\n concrete_rels,\n *derived_relationship_paths(concrete_rels, relation_filter, stop_filter, from_path)\n )\n end\n end", "def get_rels\n @rels = []\n @heads.each_with_index do |h1, i|\n @heads[i+1..-1].each do |h2|\n path = @graph.shortest_path(h1, h2)\n s = path.shift\n o = path.pop\n @rels << [s, path, o] if (path & @heads).empty?\n end\n end\n end", "def trace_path_back(end_node)\n path = []\n\n current_node = end_node\n until current_node.nil?\n path << current_node\n current_node = current_node.parent\n end\n\n path\n end", "def relation(user)\n traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| (path.end_node[:fbid] == user[:fbid]) ? :include_and_continue : :exclude_and_continue }\n # self.both(:bobfather).depth(:all).filter{|path| path.end_node.rel?(:recommend, :incoming)}.\n # each{|node| puts node[:name]}\n \n #traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| puts path.end_node ; puts path.end_node.id ; :include_and_continue }\n # traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| :include_and_continue }\n # traversal = u1.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| :include_and_continue }\n return traversal\n end", "def nodes\n @pathway.graph.keys\n end", "def path_ids\n ancestry_ascendente_directo.split(',').map{|a| a.to_i if a.present?}.compact\n end", "def get_relations(service)\n\t\treturn @transport.get_path(\"relations\",service)\n\tend", "def path_ids\n @objects.map{|e| e.path_id}\n end", "def parents\n in_edges.each{|e| e.src}\n end", "def find_paths(&block)\n follow,kill,find,continue = SearchParams.process(&block)\n\n paths,path = [],[]\n search = lambda do |node|\n if find[node]\n paths << path.dup\n next if not continue[node]\n end\n next if kill[node]\n [*follow[node]].each do |n|\n next if path.include? n\n path.push(n)\n search[n]\n path.pop\n end\n end\n\n [*follow[self]].each do |n| \n path.push(n)\n search[n] \n path.pop\n end\n\n paths\n end", "def path_to\n\t\tresult = [self]\n\t\tresult = @parent.path_to + result if @parent\n\t\treturn result\n\tend", "def calc_path\n endpoint = grid.target\n while endpoint\n search.path[endpoint] = true\n endpoint = search.came_from[endpoint]\n end\n end", "def bidirectional_search_paths(from, to, generator, path, options={})\n search_paths('bidirectional-search-paths', from, to, generator, path,\n options)\n end", "def depth_first_search_paths(from, to, generator, path, options={})\n search_paths('depth-first-search-paths', from, to, generator, path,\n options)\n end", "def pathlist\n @path\n end" ]
[ "0.6391371", "0.62053007", "0.6157841", "0.6157841", "0.61304885", "0.60848004", "0.60718846", "0.60569453", "0.60332465", "0.6022259", "0.6021929", "0.6017129", "0.598154", "0.5928004", "0.59005487", "0.5890457", "0.58458966", "0.58448637", "0.58096784", "0.57796735", "0.57748693", "0.576486", "0.57516783", "0.57502645", "0.574867", "0.57259405", "0.57059807", "0.57019764", "0.5693614", "0.56905323" ]
0.6550341
0
Get the shortest path of entities between you and the entity (like linkedin)
def shortest_degrees_of_separation(entity) @@neo = Neography::Rest.new self_node = self.get_node entity_node = entity.get_node if self_node && entity_node paths = [] self_node.shortest_path_to(entity_node).incoming(:friends).depth(5).nodes.each do |path| # path << node.object_type.safe_constantize.find(node["object_id"]) in_between = path.map{|n| begin n.object_type.safe_constantize.find(n[:object_id]).id rescue Exception end } path = {length: path.size-1, users: in_between} paths << path # puts "#{(path.size - 1)} degrees: " + path.map{|n| begin n.object_type.safe_constantize.find(n[:object_id]).name rescue Exception end }.join(" => friends =>") end paths end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortest_path\n initial_position_obj = { position: start_position, source: {} }\n\n knights_path = [initial_position_obj]\n\n while knights_path.present?\n current_position = knights_path.shift\n\n position = current_position[:position]\n\n if position == end_position\n return path_to_destination(current_position, initial_position_obj)\n end\n\n add_possible_destination(position, current_position, knights_path)\n end\n end", "def solve(from_word, to_word)\n return @word_graph.shortest_path(from_word, to_word)\n end", "def shortest_path_to(node)\n return nil if @previous_nodes[node].nil?\n\n nodes = [node]\n while previous_node = @previous_nodes[nodes[0]] do\n nodes.unshift(previous_node)\n end\n\n nodes\n end", "def shortest_path(start_node, end_node, graph)\n adjacent_edges = graph.select{ | edge | edge[NODES].include?(start_node) }\n remaining_edges = graph - adjacent_edges\n shortest_path = Path.new\n adjacent_edges.each do | edge |\n path = Path.new [edge]\n neighbor_node = (edge[NODES] - [start_node])[0] # ['A', 'B'] - ['A'] => ['B']\n unless neighbor_node == end_node\n path_ahead = shortest_path(neighbor_node, end_node, remaining_edges)\n (path_ahead.empty?)? path.clear : path.concat(path_ahead)\n end \n shortest_path = path if path.distance < shortest_path.distance\n end\n shortest_path\n end", "def bfs_shortest_path(node1, node2)\n distance, route = breadth_first_search(node1)\n step = distance[node2]\n node = node2\n path = [ node2 ]\n while node != node1 and route[node]\n node = route[node]\n path.unshift(node)\n end\n return step, path\n end", "def shortest_paths(s)\n\t\t@source = s\n\t\tdijkstra s\n\t\tputs \"Source: #{@source}\"\n\t\t@nodes.each do |dest|\n\t\t\tputs \"\\nTarget: #{dest}\"\n\t\t\tprint_path dest\n\t\t\tif @d[dest] != @INFINITY\n\t\t\t\tputs \"\\nDistance: #{@d[dest]}\"\n\t\t\telse\n\t\t\t\tputs \"\\nNO PATH\"\n\t\t\tend\n\t\tend\n\tend", "def shortest_paths(s)\n @source = s\n dijkstra s\n puts \"Source: #{@source}\"\n @nodes.each do |dest|\n puts \"\\nTarget: #{dest}\"\n print_path dest\n if @d[dest] != @INFINITY\n puts \"\\nDistance: #{@d[dest]}\"\n else\n puts \"\\nNO PATH\"\n end\n end\n end", "def return_shortest_path(from)\r\n\r\n queue = Queue.new\r\n queue << from\r\n from.distance = 0\r\n while(!queue.empty?)\r\n v= queue.pop\r\n count=0\r\n adjDir = find_adjacent_rooms(v.roomObject)\r\n while(count < adjDir.length)\r\n w = @vertices[v.roomObject.return_title(adjDir[count])]\r\n\r\n if(w.distance==Float::INFINITY)\r\n w.distance = v.distance + 1\r\n w.path = v.path + \" \" + adjDir[count].to_s()\r\n queue << w\r\n end\r\n count = count + 1\r\n end\r\n count=0\r\n end\r\n\r\n end", "def shortest_path(nodes, starting, ending)\n queue = [starting]\n previous = {}\n previous[starting] = nil\n while !queue.empty?\n p queue\n last_node = queue.pop\n if last_node == ending\n path = []\n while previous[last_node]\n path.unshift(last_node)\n last_node = previous[last_node]\n end\n path.unshift(starting)\n return path\n end\n if neighbors = nodes[last_node]\n neighbors.each do |neighbor|\n unless previous.has_key?(neighbor)\n queue.unshift(neighbor) \n previous[neighbor] = last_node\n end\n end\n end\n end\nend", "def find_shortest_path(initial_node, final_node)\n\t\tunless @nodes.include?(initial_node) && @nodes.include?(final_node)\n\t\t raise(\"Either of the nodes not found in the Graph\") \n\t\tend\n\t\tdistance = {}\n\t previous = {}\n\t\tdistance[initial_node] = 0 # Distance from initial_node to initial_node\n\t previous[initial_node] = nil\n\t\tnodes_counted = @nodes\n\t\t\t\n\t\tnodes_counted.each do |n|\n\t\t if n != initial_node \n\t\t\t distance[n] = Float::INFINITY # Unknown distance function from initial_node to final_node\n\t\t\t previous[n] = nil \t # Previous node in optimal path from initial_node\n\t\t\tend\n\t\tend\n\n\t\tuntil nodes_counted.empty? \n\t\t\n\t\t\tu = distance.select{|k,v| nodes_counted.include?(k)}.min_by{|k,v| v}.first # Source node in first case\n\t\t\tbreak if (distance[u] == Float::INFINITY)\n\t\t\tnodes_counted.delete(u)\n\t\t\t\n\t\t\t@paths[u].keys.each do |v|\n\t\t\t\talt = distance[u] + @paths[u][v]\n\t\t\t\tif alt < distance[v] # A shorter path to v has been found\n\t\t\t\t\tdistance[v] = alt\n\t\t\t\t\tprevious[v] = u\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t \n\t\tpath = []\n\t\tcurrent = final_node\n\t\twhile current\n\t\t\tpath.unshift(current)\n\t\t\tcurrent = previous[current]\n\t\tend\n \n\t\treturn distance[final_node], path\n\n\tend", "def get_path(start, stop)\n @graph.dijkstra_shortest_path(@weight_map, start, stop)\n end", "def shortest_paths(source, dest)\n @graph_paths=[]\n @source = source\n dijkstra source\n @path=[]\n find_path dest\n actual_distance=if @distance[dest] != INFINITY\n @distance[dest]\n else\n \"no path\"\n end\n \"Shortest route and distance : #{@path.join(\"-->\")}, #{actual_distance} km\"\n end", "def shortest_path_to(other, options = {:method => :djikstra})\n latch = options[:method] == :breadth_first ? 2 : 1\n self.class.shortest_path(latch, id, other.id)\n end", "def compute_shortest_path\n update_distance_of_all_edges_to(Float::INFINITY)\n @distance_to[@source_node] = 0\n\n # The prioriy queue holds a node and its distance from the source node.\n @pq.insert(@source_node, 0)\n while @pq.any?\n node = @pq.remove_min\n node.adjacent_edges.each do |adj_edge|\n relax(adj_edge)\n end\n end\n end", "def find_shortest_path(start_node, end_node)\n\n\t\tif (!start_node || !end_node)\n\t\t\traise \"start and end nodes must be specified\"\n\t\tend\n\n\t\tqueue = Hash[@edges.keys.map { |k| [k, nil] }]\n\t\tqueue[start_node] = 0\n\n\t\tdistances = queue.dup\n\t\tcrumbs = {}\n\n\t\twhile queue.size > 0\n\n\t\t\texpanded_node = get_min(queue)\n\n\t\t\t# Check if the current path to each neighbor of the expanded_node\n\t\t\t# is shorter than the path currently stored on the distances hash\n\t\t\t@edges[expanded_node].each do |node, edge|\n\n\t\t\t\tif distances[expanded_node]\n\t\t\t\t\n\t\t\t\t\tcurrent_path_distance = distances[expanded_node] + edge.weight\n\n\t\t\t\t\t# The distance to node is shorter via the current path or the distance to node hasn't yet been computed.\n\t\t\t\t\t# Either way, the distance from start_node->node is updated with the current distance (since it is shorter)\n\t\t\t\t\tif (!distances[node] || current_path_distance < distances[node])\n\t\t\t\t\t\tdistances[node], queue[node] = current_path_distance, current_path_distance\n\t\t\t\t\t\tcrumbs[node] = expanded_node\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tqueue.delete(expanded_node)\n\n\t\tend\n\n\t\t# List of edges representing the shortest path from start_node to end_node\n\t\tshortest_path = []\n\t\tcurrent_node = end_node\n\n\t\twhile (current_node && current_node != start_node && crumbs.size > 0)\n\t\t\tprevious_node = crumbs[current_node]\n\t\t\tif (previous_node)\n\t\t\t\tshortest_path << @edges[previous_node][current_node]\n\t\t\t\tcrumbs.delete(current_node)\n\t\t\tend\n\t\t\tcurrent_node = previous_node\n\t\tend\n\n\t\treturn shortest_path.reverse\n\n\tend", "def degrees_of_separation(start_node, destination_node)\n start_node_id = start_node[\"self\"].split('/').last.to_i\n destination_node_id = destination_node[\"self\"].split('/').last.to_i\n @neo.execute_query(\"START me=node({start_node_id}),\n them=node({destination_node_id})\n MATCH path = allShortestPaths( me-[?*]->them )\n RETURN length(path), extract(person in nodes(path) : person.name)\",\n {:start_node_id => start_node_id,\n :destination_node_id => destination_node_id })[\"data\"]\nend", "def shortest_path\n dist, previous = Hash.new(Infinity), {}\n dist[@source] = 0.0\n queue = @graph.vertex_set.dup\n\n until queue.empty?\n u = queue.min { |a,b| dist[a.name] <=> dist[b.name] }\n break if dist[u.name].infinite?\n queue.delete(u)\n\n u.each_edge do |e, v|\n alt = dist[u.name] + e.weight\n if alt < dist[v.name]\n dist[v.name] = alt\n previous[v.name] = u.name\n end\n end\n end\n\n path = []\n u = @dest\n until previous[u].nil?\n path.unshift(u)\n u = previous[u]\n end\n\n path.unshift(@source)\n end", "def path(source, target)\n predecessor = target\n result_path = []\n\n # follow the leads from the back\n until predecessor == source\n result_path << predecessor.number\n predecessor = meta[predecessor]\n end\n\n # add the source, since now `predecessor == source` is true\n result_path << source.number\n result_path.reverse.join(\", \")\n end", "def djikstra(world, from_x, from_y, to_x, to_y)\n key = [world.join, from_x, from_y].join(',')\n cached_prev = DJ_GRAPH_MEMO[key]\n\n prev = cached_prev\n\n unless cached_prev\n nodes = map_each_cell(world) {|cell, x, y| cell == '.' ? [x, y] : nil }.\n flatten(1).\n reject(&:nil?)\n\n source = [from_x, from_y]\n dist = Hash[nodes.zip([INFINITY].cycle)]\n queue = nodes.dup\n queue.push(source) unless queue.include?(source)\n dist[source] = 0\n prev = {}\n\n while !queue.empty?\n queue.sort_by! {|node| dist[node]}\n u = queue.shift\n\n neighbors = DIRECTIONS.values.map {|d| [u[0] + d[:x], u[1] + d[:y]] }\n neighbors = neighbors & nodes\n\n neighbors.each do |v|\n alt = dist[u] + 1\n\n if alt < dist[v]\n dist[v] = alt\n prev[v] = u\n end\n end\n end\n\n DJ_GRAPH_MEMO[key] ||= prev\n end\n\n path = []\n target = [to_x, to_y]\n\n return [source] if target == source\n\n # cannot reach target:\n return nil if prev[target].nil?\n\n while target\n path.push(target)\n target = prev[target]\n end\n\n path = path.reverse\n path\nend", "def call\n return nil unless on_the_graph? # Prevents a stack overflow in the gem\n return shortest_path[1..-1] if shortest_path.length > 1\n end", "def shortest_path(start, finish)\n queue << [start, 0]\n loop do\n break if queue.empty?\n vertex, d = queue.pop\n graph[*vertex] = d\n break if vertex == finish\n enqueue_neighbours(*vertex, d + 1)\n end\n queue.clear\n !blank?(finish) ? build_path(start, finish) : []\n end", "def next_step_to_shortest_path(from_x, from_y, to_x, to_y)\n move = shortest_path(from_x, from_y, to_x, to_y)&.first\n return nil unless move\n if move[0] == from_x && move[1] == from_y + 1\n return 'S'\n elsif move[0] == from_x && move[1] == from_y - 1\n return 'N'\n elsif move[0] == from_x + 1 && move[1] == from_y\n return 'E'\n elsif move[0] == from_x - 1 && move[1] == from_y\n return 'W'\n end\n raise 'This should not happen'\n end", "def shortest_paths(source)\n init(source)\n relax_edges\n PathBuilder.new(source, @visitor.parents_map).paths(@graph.vertices)\n end", "def shortest_distance()\n min = 1000000\n s = \"\"\n @edges.each do |city, dests|\n dests.each do |dest|\n if min > dest.distance\n min = dest.distance\n s = \"#{city} to #{dest.name}\"\n end\n end\n end\n \"Shortest distance is #{min} from #{s}\"\n end", "def find_path(start, target)\n node = build_path(start, target)\n path = [node]\n until node.next_node.nil? do\n node = node.next_node\n path.push(node)\n end\n path = path.reverse\n puts \"You made it in #{path.length} moves. Here is your path: \"\n path.each do |node|\n puts \"[#{node.x}], [#{node.y}]\"\n end\nend", "def shortest_path_to_all_nodes(initial)\n initial.distance = 0\n\n current = initial\n loop do\n unvisited.delete(current)\n\n calculate_neighbor_shortest_distances(current)\n\n return graph.vertices if no_reachable_nodes\n\n current = unvisited.min_by(&:distance)\n end\n end", "def select_possible_path(possible_paths)\n vertex, data = possible_paths.min_by do |vertex, data|\n data[:cost]\n end\n vertex\nend", "def shortest_path\n pa = AI::AStarAlgorithm.new($map.grid, $map.gen_coordinates)\n pa.astar\n end", "def build_path(start, finish)\n path = [finish]\n loop do\n vertex = path.last\n d = graph[*vertex]\n neighbours = get_neighbours(*vertex)\n next_vertex = neighbours.select{|n_vert| graph[*n_vert] == d - 1}.first\n path << next_vertex if next_vertex\n break if vertex == start\n end\n path\n end", "def path(source, target, meta)\n # retrieve the path to the target node, using the meta hash\n # that was constructed at each iteration of the `each` iteration\n predecessor = target\n result_path = []\n\n # follow the leads from the back\n until predecessor == source\n result_path << predecessor.number\n predecessor = meta[predecessor]\n end\n\n # add the source, since now `predecessor == source` is true\n result_path << source.number\n result_path.reverse.join(\", \")\nend" ]
[ "0.67333233", "0.64659196", "0.64617217", "0.63662803", "0.6359947", "0.63562536", "0.634624", "0.63197494", "0.6240554", "0.62347084", "0.61692154", "0.61053044", "0.6094674", "0.60816056", "0.6070206", "0.6050557", "0.6046724", "0.6039486", "0.6020205", "0.6018814", "0.59477836", "0.59276694", "0.59235287", "0.59172183", "0.59072024", "0.590695", "0.5888413", "0.5880353", "0.5864661", "0.585049" ]
0.72070897
0
To sort the trackers according to "calculate_relation" method desendingly
def sorted_trackers ratings = [] self.trackers.each do |user| ratings << {entity: user.id, weight: self.calculate_relation(user).to_i} end return ratings.sort_by{ |h| h[:weight] }.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sorted_tracking\n ratings = []\n self.tracking.each do |user|\n ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}\n end\n return ratings.sort_by{ |h| h[:weight] }.reverse\n end", "def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end", "def sort\n @pokers.sort.reverse\n end", "def sort_data\n store.sort_data!\n end", "def sort_norm_data\n store.sort_norm_data!\n end", "def sort_by_metric_title rel\n rel.joins(sort_join(\"right_id = sort.id\"))\n .order(\"sort.key #{@sort_args[:sort_order]}\")\n end", "def sorted_movie_relation_ids\n @relations ||= movie.related.sort {|a,b| b[:rating] <=> a[:rating]}.map{|m| m[:movie_id]}\n end", "def advancedSort\n @sortField = params[:sortField]#field to search on \n @searchField =params[:searchField]# value to search for\n @sortField2 = params[:sortField2]\n @searchField2 =params[:searchField2]\n @graphField = params[:graphField] #datapoint to build graph around\n \n if @sortField2 == \" \"#check if default second value was changed\n @records = Record.where(@sortField => @searchField) #if not only use the first search field\n else#otherwise use both seach fields\n @records = Record.where(@sortField => @searchField, @sortField2 => @searchField2 )\n end\n @sortedSet = @records.order(@graphField)\n end", "def sort_my_list\n @tracks.clear\n @artists.clear\n @genres.clear\n @user_list.each do |item|\n @tracks << item['id'] if item['type'] == 'track'\n @artists << item['id'] if item['type'] == 'artist'\n @genres << item['name'].downcase if item['type'] == 'genre'\n end\n end", "def sort_entries; end", "def collect_compare_priority\n @compare_quque = []\n @compare_quque = ComparisonTable.sort_by{|k, dar|\n DisplayOrder[StringTable[dar.first]] ? DisplayOrder[StringTable[dar.first]] : DisplayOrder[MISC_text]\n }.collect{|p| p[0]}\n end", "def s_idsort; det.link(:text, 'ID'); end", "def sort_abschnitte_and_umschlaege\n abschnitt_umschlag_list = []\n # Hilfsmethode, baut einen nach Orten sortierten Hash auf.\n ort_to_detail = sort_abschnitte_and_umschlaege_by_ort\n File.open(\"log/transport.log\",\"w\"){|f| f.puts \"Ort to detail #{ort_to_detail}\" }\n unless self.start_anlage.nil?\n if self.start_anlage.ort\n ort_aktuell = self.start_anlage.ort\n if ort_aktuell.nil? || ort_to_detail[ort_aktuell.id].nil?\n ort_aktuell = abschnitt_only_start_ort(ort_to_detail.keys) \n end \n counter = 0\n while not (ort_aktuell.nil? || ort_to_detail.empty? || counter > 100)\n counter += 1\n next_ort = nil\n ort_aktuell_id = ort_aktuell.nil? ? 0 : ort_aktuell.id \n unless ort_to_detail[ort_aktuell_id].nil?\n ort_to_detail[ort_aktuell_id].each do |abschnitt_umschlag|\n File.open(\"log/transport.log\",\"a\"){|f| f.puts abschnitt_umschlag.attributes }\n abschnitt_umschlag_list << abschnitt_umschlag\n next_ort = abschnitt_umschlag.end_ort if abschnitt_umschlag.kind_of? Transportabschnitt \n end\n ort_to_detail.delete(ort_aktuell_id) \n ort_aktuell = next_ort\n end\n end \n # Rest nach Datum sortieren\n unless ort_to_detail.empty?\n File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Rest nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end\n else \n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Alles nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end \n end\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Transport #{id}: #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def apply_sorting_to_relation(rel)\n return rel if !params[:sort]\n\n sorts = params[:sort].split(',')\n\n sorts.each do |sort|\n if sort =~ /^([-+]?)(.*)$/\n desc = ($1 && $1 == '-')\n attrname = $2\n\n (attr, path) = rel.nested_attribute(attrname)\n\n rel = rel.joins { path[1..-1].inject(self.__send__(path[0]).outer) { |a,x| a.__send__(x).outer } } if path.any?\n\n # Call .asc explicitly to overcome a bug in pgsql adapter leading to undefined method to_sql\n attr = desc ? attr.desc : attr.asc\n\n rel = rel.order(attr)\n end\n end\n\n rel\n end", "def speed_order\r\n\t\t\tall_champions = @team.concat(@opp_team)\r\n\t\t\tspeed_hash = Hash.new\r\n\t\t\tfor x in 0..9\r\n\t\t\t\tspeed_hash[x] = all_champions[x].ms\r\n\t\t\t\tcreate_speed_record(x,all_champions[x].ms)\r\n\t\t\tend\r\n\t\t\tsorted_speed_hash = speed_hash.sort_by{|num,speed| speed}.reverse\r\n\t\t\tnew_speed_array = Array.new\r\n\t\t\tsorted_speed_hash.each do |num, speed|\r\n\t\t\t\tnew_speed_array << num\r\n\t\t\tend\r\n\t\t\tcreate_order_record(new_speed_array)\r\n\t\t\tnew_speed_array\r\n\t\tend", "def each_relation_sorted\n # Remove from the set of relations the ones that are not leafs\n for rel in sorted_relations\n yield(rel)\n end\n end", "def sort_drivers_by_miles\n\t\t@drivers.sort_by { |key,driver| -driver.trip_total_miles }\n\tend", "def sort_times\n @links.each_value { |l| l.sort_times }\n end", "def sort\n @entries = DependencySorter.new(@entries).sorted_items\n end", "def sort_related_posts(related_scores)\n related_scores.sort do |a, b|\n if a[1] < b[1]\n 1\n elsif a[1] > b[1]\n -1\n else\n b[0].date <=> a[0].date\n end\n end.collect { |post, _freq| post }\n end", "def sort\n self.roster.each do |grade, students|\n students.sort!\n end\n self.roster\n end", "def sort_drivers\n @drivers.sort! {|x, y| y.miles_driven <=> x.miles_driven}\n end", "def sort_abschnitte_and_umschlaege_by_ort\n ort_to_detail = {}\n self.umschlaege.each do |umschlag|\n ort = umschlag.ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << umschlag\n end \n self.transportabschnitte.each do |abschnitt|\n ort = abschnitt.start_ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << abschnitt\n end \n ort_to_detail\n end", "def sorted_affinities\n unless @sorted_affinities\n @sorted_affinities = hash_pidurl_affinity.collect { |product_idurl, affinity| affinity }\n @sorted_affinities.sort! { |a1, a2| a2.measure <=> a1.measure }\n current_ranking = 0; previous_measure = nil\n @sorted_affinities.each do |affinity|\n if affinity.measure != previous_measure\n current_ranking += 1\n previous_measure = affinity.measure\n end\n affinity.ranking = current_ranking\n end\n end\n @sorted_affinities\n end", "def bubble_print_sort\n @bubble.print_sort\n end", "def bubble_sort_rec(&prc)\n end", "def sort_by_popularity(dir='DESC')\n query = self.scoped.joins(\"LEFT OUTER JOIN punches ON punches.punchable_id = #{self.to_s.tableize}.id AND punches.punchable_type = '#{self.to_s}'\")\n query = query.group(:id)\n query.reorder(\"SUM(punches.hits) #{dir}\")\n end", "def sort_related_posts(related_scores)\n related_scores.sort do |a,b|\n if a[1] < b[1]\n 1\n elsif a[1] > b[1]\n -1\n else\n b[0].date <=> a[0].date\n end\n end.collect {|post,freq| post}\n end", "def proefssorted\n \tproefs.order(:position)\n end", "def comparer_methods\n super + [\n :four_of_a_kind_rank,\n :kicker_rank\n ]\n end" ]
[ "0.63994277", "0.6317887", "0.6144767", "0.61250585", "0.6035595", "0.602506", "0.59194386", "0.5871662", "0.5862867", "0.5768755", "0.5673008", "0.5663715", "0.5654938", "0.56385857", "0.5636068", "0.5630438", "0.5582725", "0.55579746", "0.5544479", "0.55114", "0.54913956", "0.54905313", "0.5484889", "0.5481166", "0.5466821", "0.54663724", "0.5464701", "0.54569805", "0.54443455", "0.54427254" ]
0.67141896
0
To sort the tracking entities according to "calculate_relation" method desendingly
def sorted_tracking ratings = [] self.tracking.each do |user| ratings << {entity: user.id, weight: self.calculate_relation(user).to_i} end return ratings.sort_by{ |h| h[:weight] }.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end", "def sort_norm_data\n store.sort_norm_data!\n end", "def group_relations\n relations = EntityGroupRelationship.where(entity_id: self.id)\n relations.sort_by { |r| r[:position] }\n end", "def sort_data\n store.sort_data!\n end", "def rewrite_order_relations\n return unless(@ordered_objects) # If this is nil, the relations weren't loaded in the first place\n objects = ordered_objects # Fetch them before deleting\n # Now destroy the existing elements\n SemanticRelation.destroy_all(['subject_id = ? AND rel_order IS NOT NULL', self.id])\n SemanticRelation.destroy_all(['subject_id = ? AND predicate_uri = ?', self.id, N::DCT.hasPart.to_s])\n # rewrite from the relations array\n objects.each_index do |index|\n if(obj = objects.at(index)) # Check if there's a value to handle\n # Create a new relation with an order\n self[index_to_predicate(index)].add_record(obj, index)\n self[N::DCT.hasPart] << obj\n end\n end\n end", "def each_relation_sorted\n # Remove from the set of relations the ones that are not leafs\n for rel in sorted_relations\n yield(rel)\n end\n end", "def sorted_movie_relation_ids\n @relations ||= movie.related.sort {|a,b| b[:rating] <=> a[:rating]}.map{|m| m[:movie_id]}\n end", "def sorted_trackers\n ratings = []\n self.trackers.each do |user|\n ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}\n end\n return ratings.sort_by{ |h| h[:weight] }.reverse\n end", "def property_relations\n relations = EntityPropertyRelationship.where(entity_id: self.id)\n relations.sort_by { |r| r[:position] }\n end", "def advancedSort\n @sortField = params[:sortField]#field to search on \n @searchField =params[:searchField]# value to search for\n @sortField2 = params[:sortField2]\n @searchField2 =params[:searchField2]\n @graphField = params[:graphField] #datapoint to build graph around\n \n if @sortField2 == \" \"#check if default second value was changed\n @records = Record.where(@sortField => @searchField) #if not only use the first search field\n else#otherwise use both seach fields\n @records = Record.where(@sortField => @searchField, @sortField2 => @searchField2 )\n end\n @sortedSet = @records.order(@graphField)\n end", "def sort_by_metric_title rel\n rel.joins(sort_join(\"right_id = sort.id\"))\n .order(\"sort.key #{@sort_args[:sort_order]}\")\n end", "def proefssorted\n \tproefs.order(:position)\n end", "def apply_sorting_to_relation(rel)\n return rel if !params[:sort]\n\n sorts = params[:sort].split(',')\n\n sorts.each do |sort|\n if sort =~ /^([-+]?)(.*)$/\n desc = ($1 && $1 == '-')\n attrname = $2\n\n (attr, path) = rel.nested_attribute(attrname)\n\n rel = rel.joins { path[1..-1].inject(self.__send__(path[0]).outer) { |a,x| a.__send__(x).outer } } if path.any?\n\n # Call .asc explicitly to overcome a bug in pgsql adapter leading to undefined method to_sql\n attr = desc ? attr.desc : attr.asc\n\n rel = rel.order(attr)\n end\n end\n\n rel\n end", "def normalize_order!\n @order = @order.map do |order_by|\n case order_by\n when Direction\n order_by\n when Property\n # TODO: if the property's resource doesn't match\n # self.resource, append the property's resource to @links\n # eg:\n #if property.resource != self.resource\n # @links << discover_path_for_property(property)\n #end\n\n Direction.new(order_by)\n when Symbol, String\n Direction.new(@properties[order_by])\n else\n raise ArgumentError, \"Order #{order_by.inspect} not supported\"\n end\n end\n end", "def normalize_order(order); end", "def calculate_relation(entity)\n if entity.is_a?(Sociographer::Entity)\n # @@neo = Neography::Rest.new\n self_node = self.get_node\n entity_node = entity.get_node\n if self_node && entity_node\n # begin\n qur = \"START r=rel(*) return distinct(type(r))\"\n relations = @@neo.execute_query(qur)[\"data\"].flatten\n all_relations = relations.map{|r| {\"type\" => r, \"direction\" => \"all\"}}\n all_rels_by_two_nodes = @@neo.get_paths(self_node, entity_node, all_relations, 2, \"allPaths\").select{ |l| l[\"length\"] == 2}.map{ |u| u[\"relationships\"]} # finds all paths between two nodes whose length == 2\n \n self_relations = all_rels_by_two_nodes.map{|u| u[0]}\n self_relations = self_relations.map{|r| Neography::Relationship.load(r.split(\"/\").last) }.flatten.map{|u| u.rel_type} \n self_relations = self_relations.group_by{|x|x}.map{|k,v| [k, v.length]}\n self_relations = self_relations.map{ |rel| self.relation_weight(rel[0])*rel[1] }.sum \n\n entity_relations = all_rels_by_two_nodes.map{|u| u[1]}\n entity_relations = entity_relations.map{|r| Neography::Relationship.load(r.split(\"/\").last) }.flatten.map{|u| u.rel_type} \n entity_relations = entity_relations.group_by{|x|x}.map{|k,v| [k, v.length]}\n entity_relations = entity_relations.map{ |rel| entity.relation_weight(rel[0])*rel[1] }.sum \n\n total_weight = self_relations+entity_relations\n # one_side.map{ |u| u[\"relationships\"].map{ |r| @@neo.get_relationship_properties(r.split(\"/\").last)[\"weight\"] } }.flatten.sum \n # one_side = @@neo.get_shortest_weighted_path(self_node, entity_node, all_relations ).select{ |l| l[\"length\"] < 3}\n # other_side = @@neo.get_shortest_weighted_path(entity_node, self_node, [{nil,\"all\"}]).select{ |l| l[\"length\"] == 2}\n # return [*one_side,*other_side].map{|l| l[\"weight\"]}.sum\n # rescue Exception\n # return 0\n # end\n else\n false\n end\n else\n false\n end\n end", "def s_idsort; det.link(:text, 'ID'); end", "def complile_relationships\n relationships = []\n @classifications.each do |classification|\n relationship = Relationship.new(@query, classification)\n relationships << relationship unless relationship.score.zero?\n end\n relationships.sort\n end", "def sort_entries; end", "def ordered_entities\n ids = self.entity_ids\n self.entities.sort { |a, b| ids.index(a.id) <=> ids.index(b.id) }\n end", "def ordering_query; end", "def order; end", "def order; end", "def all\n relation.order(\"CASE WHEN property_type IN ('land', 'mobile_home') THEN 1 ELSE 0 END, selling_date DESC\")\n end", "def sort_order\n 10 - object.id\n end", "def ordered_by_qualifications (collection)\n collection.sort_by {|x| [x[:years_of_experience], x[:github_points]]}.reverse!\nend", "def sort_features_by_dep\n dep_links = dependency_links\n graph = DepGraph.new(dep_links)\n sorted_deps = graph.tsort\n\n all_sorted = sorted_deps.map(&:dependee)\n @sorted_features = all_sorted.reject { |f| f.feature.anonymous? }\n end", "def topological_sort(vertices)\n \nend", "def entities\n ordering.map(&:entity).compact\n end", "def sort\n @entries = DependencySorter.new(@entries).sorted_items\n end" ]
[ "0.65073085", "0.6207778", "0.59522796", "0.5870793", "0.5827948", "0.5820088", "0.5776126", "0.5773468", "0.57366174", "0.5736589", "0.5722441", "0.5708928", "0.5692724", "0.5669905", "0.56661355", "0.56501687", "0.56373686", "0.5633106", "0.5602645", "0.55976903", "0.5589459", "0.5562946", "0.5562946", "0.5562441", "0.5541673", "0.5477059", "0.54738116", "0.54652166", "0.54649967", "0.5438264" ]
0.64485884
1
To sort the friends according to "calculate_relation" method desendingly
def sorted_friends ratings = [] self.friends.each do |user| ratings << {entity: user.id, weight: self.calculate_relation(user).to_i} end return ratings.sort_by{ |h| h[:weight] }.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend_requests \n self.friend_requests_as_receiver.sort_by{ |request| request.requestor.name }\n end", "def call\n Friendship.all.\n pluck(:from_member_id, :to_member_id).\n flat_map{ |friends| [friends, friends.reverse] }.\n map{ |friends| friends.append(DEFAULT_FRIENDSHIP_WEIGHT) }\n end", "def friend_and_user_posts\n user_friends = friends\n all_posts = []\n user_friends.each do |friend|\n friend.posts.each do |post|\n all_posts << post\n end\n end\n posts.each do |post|\n all_posts << post\n end\n ordered_posts = all_posts.sort_by { |post| post[:created_at] }.reverse\n end", "def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end", "def friend\n @friends = Friendship.paginate(:page => params[:page], :per_page => 5).where(user_id: current_user).where(aproved: 'yes')\n #@friends_g = Friendship.paginate(:page => params[:page], :per_page => 5).where(user_id: current_user)\n # @friends = @friends_g.select(\"DISTINCT(friend_id)\")\n end", "def possible_friends\n User.all - self.requesters - self.requestees-self.friends-User.where(id:self.id)\n end", "def sorted_movie_relation_ids\n @relations ||= movie.related.sort {|a,b| b[:rating] <=> a[:rating]}.map{|m| m[:movie_id]}\n end", "def _possible_friends(_limit = 100)\n \n query = []\n \n # select columns\n # order by priorities\n order_prio = ['(case when 1 = 1 then 0 end)']\n order_prio << \"(case when users.sex = #{preferred_sex} then 1 else 0 end)\" if preferred_sex.present?\n order_prio << \"(case when users.sex = #{opposite_sex} then 1 else 0 end)\" if preferred_friendship == 'marriage'\n if preferred_countries.present?\n order_prio << \"(case when users.country in (#{preferred_countries.map{|a| User.sanitize(a) }.join(',')}) then 1 else 0 end)\"\n order_prio << \"(case when meta_info->>'continent'= #{User.sanitize(continent)} then 1 else 0 end)\"\n end\n order_prio << \"(case when extract(year from users.birthdate::DATE) BETWEEN #{preferred_age.split(',').join(' and ')} then 1 else 0 end)\" if preferred_age.present?\n \n selects = \"users.*, (#{order_prio.join(' + ')}) as pref_priority, %{prio} as u_priority\"\n \n # mobile contacts\n query << User.most_active.where(phone_number: user_settings.contact_numbers).select(selects % {prio: 1}) if user_settings.contact_numbers.present?\n \n # users in the same group\n query << User.most_active.joins(:user_relationships).where(user_relationships: {groupable_id: user_groups.pluck(:id)}).where('user_relationships.accepted_at is not null').select(selects % {prio: 2}) if user_groups.any?\n \n # filter by country\n # if preferred_countries.present?\n # query << User.most_active.where(country: preferred_countries).select(selects % {prio: 3})\n # query << User.most_active.where(\"meta_info->>'continent'= ?\", continent).select(selects % {prio: 4})\n # end\n \n query << User.valid_users.select(selects % {prio: 10}) # default suggestion\n \n # filter by sex\n # sexs = []\n # sexs << preferred_sex if preferred_sex.present?\n # sexs << opposite_sex if preferred_friendship == 'marriage'\n # query = query.map{|q| q.where(sex:sexs ) } if sexs.present?\n \n \n # filter by age\n # query = query.map{|q| q.between_ages(*preferred_age.split(',')) } if preferred_age.present?\n \n query.map{|q| q.where.not(id: [id, User.bot_id] + blocked_user_ids).limit(_limit) }\n end", "def friends\n @user ||= auth_user\n friends = ::User.search_users_in_circle(@user).results\n following_user_ids = ::Stores::Following.where(user_id: @user.id).collect(&:follower_user_id) # others following user\n followings = ::Stores::Following.where(follower_user_id: @user.id).includes(:user).order('last_traded_at desc, id desc') # user following others, already ordered newest to oldest\n followed_user_ids = Set.new # for excluding the non-followers\n both_side_followers = []\n one_side_followers = []\n bound = :circle\n user_ids_to_exclude = []\n auth_user.boundaries.group_by(&:type).each do|btype, blist|\n case btype\n when 'Users::ChildCircleOption'\n case blist.first.content_keyword\n when 'GRADE_ONLY'\n bound = :grade\n when 'CLASS_ONLY'\n bound = :class\n end\n when 'Users::UserBlock'\n user_ids_to_exclude = user_ids_to_exclude + ::Users::Boundary.extract_content_values_from_list(blist)\n end\n end\n followings.each do|following|\n user = following.user\n is_mutual = following_user_ids.include?(following.user_id) # y is also following user\n user.is_follower = true\n user.is_mutual_friend = is_mutual\n if is_mutual\n both_side_followers << user.as_more_json({}, auth_user.id)\n else\n if bound.eql? :circle and ::Schools::SchoolGroup.grades_around(auth_user.grade).include?(user.grade)\n one_side_followers << user.as_more_json({}, auth_user.id)\n elsif bound.eql? :grade and auth_user.grade.eql?(user.grade)\n one_side_followers << user.as_more_json({}, auth_user.id)\n elsif bound.eql? :class and auth_user.teacher.eql? user.teacher\n one_side_followers << user.as_more_json({}, auth_user.id)\n end\n end\n logger.debug \" | %20s | %1s | %10d\" % [user.user_name, is_mutual ? 'B' : 's', following.id]\n followed_user_ids << following.user_id\n end\n non_followers = friends.find_all {|friend| !followed_user_ids.include?(friend.id) }.sort{|x,y| y.id <=> x.id } # newest registered friends\n logger.debug \"-------- #{both_side_followers.size} both side, #{one_side_followers.size} one side, #{non_followers.size} non-followers\"\n @friends = both_side_followers + one_side_followers + non_followers.as_json\n #if they're blocked, remove them regardless.\n result = @friends.map do |friend|\n if not user_ids_to_exclude.include?(friend['id'])\n friend\n else\n nil\n end\n end\n result = result.compact\n respond_to do|format|\n format.json { render json:{ success: true, users: result} }\n format.html\n end\n end", "def index\n # @friendships = current_user.friendships + current_user.inverse_friendships\n # # @friends = current_user.friends + current_user.inverse_friends\n # @friends = User.where(:id => current_user.friendships.collect(&:friend_id))\n # @inverse_friends = User.where(:id => current_user.inverse_friendships.collect(&:user_id))\n # @friends = (@friends + @inverse_friends)\n # @friends =@friends.paginate(:page => params[:page], :per_page => 10)\n \n if params[:name].present?\n @friends = (current_user.friends.search(params[:name]) + current_user.inverse_friends.search(params[:name])).compact.uniq.sort_by(&:updated_at).reverse\n @friends.uniq.delete(current_user)\n else\n @friends = current_user.friends + current_user.inverse_friends\n @friends.delete(current_user)\n @friends = @friends.uniq.paginate(:page => params[:page], :per_page => 10)\n end\n end", "def friend_names(reverse_alphabetical: false)\n names = friends.map(&:name).sort\n reverse_alphabetical ? names.reverse : names\n end", "def getRelatedPapers(curr_id, n)\n @article = Article.where('arxiv_id = ?', curr_id).first # get the article passed in from DB\n \n puts @article\n if @article == [] || @article.nil?\n puts 'articles NOT found'\n return nil\n end\n @valid_friends = []\n\n @friends = @article.friendships # this returns all 1 degree close articles\n\n # if they are in the same category, store in valid friends\n @friends.each do |friendship|\n friend = Article.find(friendship.friend_id)\n if friend.category == @article.category\n @valid_friends << friend\n end\n end\n\n # get all inwards edges for this artcle\n Friendship.find(:all, conditions: {friend_id: @article.id}).each do |cited_by|\n @valid_friends << Article.find(cited_by.article_id)\n puts 'ADDED CITED BY'\n end\n\n puts \"valid_friends\"\n puts @valid_friends\n\n if @valid_friends == []\n puts 'NO VALID FRIENDS'\n return nil\n end\n\n temp = Hash.new()\n\n # Make a hash for each of these filtered articles\n # the key for this hash the score, and value is the article\n\n @valid_friends.each do |friend|\n keywords = @article.keywords.split(',')\n friend_keywords = friend.keywords.split(',')\n score = get_score(keywords, friend_keywords)\n puts \"SCORE\"\n puts score\n\n if !temp[score]\n temp[score] = []\n end\n temp[score] << friend\n end\n\n @final_articles = []\n\n # puts \"TEMP SORT\"\n # ap temp\n\n sorted = temp.dup\n\n # sort based on the score and return the articles.\n\n sorted.sort.each do |score|\n\n\n temp[score[0]].each do |article|\n puts \"ARTICLE\"\n puts article\n if !@final_articles.include? article\n if article.id != @article.id\n @final_articles << article\n end\n end\n end\n\n end\n puts \"FINAL\"\n puts @final_articles\n\n\n if n == -1\n return @final_articles\n else \n return @final_articles.first(n)\n end\n\n end", "def index\n\t\t@profile_friends = @profile.friends.order(\"state DESC, mmr DESC, nickname ASC\")\n\tend", "def friendslist()\n hash_list = SQLQuery.new.get('friends', ['user_id', 'user2_id']).where.open_.if('user_id', @id).or.if('user2_id', @id).close_.and.if('status', 0).send\n list = []\n hash_list.each do |hash|\n if hash['user_id'] == @id\n list << Friend.get(@id, hash['user2_id'])\n else\n list << Friend.get(@id, hash['user_id'])\n end\n end\n return Sorter.last_interaction(list)\n end", "def payment_sorted_users\n members = []\n User.find(:all, :conditions => [\"team_id = ?\", self.id]).each do |member|\n\ttotal = 0\n\t@payments = Payment.find(:all,\n :conditions => [\"owner_id = ? AND description = ?\", member.id, Payment::DONE ] )\n\t@payments.each do |payment|\n\t\ttotal = total + payment.amount\n\tend\n\tmember.payments = total\n\tmembers << member\n end\n members.sort! { |y,x| x.payments <=> y.payments }\n # less than elegant\n self.total_donations = 0\n members.each do |member|\n self.total_donations = self.total_donations + member.payments\n end\n return members \n end", "def all_friends\n (friends.all + inverse_friends.all).uniq\n end", "def all_friends\n friends | inverse_friends \n end", "def calc_suggested_friends\n Rails.cache.fetch(\"suggested_user_friends_#{id}\", expires_in: 1.weeks.from_now.end_of_day) do\n friend_suggestions.delete_all\n queries = _possible_friends.map{|q|\n \"(#{q.\n where.not(id: rejected_friend_suggestions.pluck(:user_id)).\n where(\"NOT EXISTS(#{UserFriendRelationship.where('user_id = ? or user_to_id = ?', id, id).where('user_id = users.id or user_to_id = users.id').select(:id).to_sql})\").\n to_sql\n })\"\n }.join(' UNION ')\n res = User.from(\"(#{queries}) as users\").uniq.order('u_priority ASC, pref_priority DESC')\n res.pluck('users.id, u_priority, pref_priority').map{|a| friend_suggestions.create(user_id: a.first) }\n end\n end", "def each_relation_sorted\n # Remove from the set of relations the ones that are not leafs\n for rel in sorted_relations\n yield(rel)\n end\n end", "def grouped_friends\n friends = {\"Industry Participant\" => [], \"Respected Peer\" => [], \"Kindred Spirit\" => [], \"Purgatory\" => []}\n\n unless self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Industry Participant\"].blank?\n friends[\"Industry Participant\"] += self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Industry Participant\"].map{|friendship| friendship.proposee}\n end\n unless self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Industry Participant\"].blank?\n friends[\"Industry Participant\"] += self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Industry Participant\"].map{|friendship| friendship.proposer}\n end\n unless self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Respected Peer\"].blank?\n friends[\"Respected Peer\"] += self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Respected Peer\"].map{|friendship| friendship.proposee}\n end\n unless self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Respected Peer\"].blank?\n friends[\"Respected Peer\"] += self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Respected Peer\"].map{|friendship| friendship.proposer}\n end\n unless self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Kindred Spirit\"].blank?\n friends[\"Kindred Spirit\"] += self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Kindred Spirit\"].map{|friendship| friendship.proposee}\n end\n unless self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Kindred Spirit\"].blank?\n friends[\"Kindred Spirit\"] += self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Kindred Spirit\"].map{|friendship| friendship.proposer}\n end\n unless self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Purgatory\"].blank?\n friends[\"Purgatory\"] += self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Purgatory\"].map{|friendship| friendship.proposee}\n end\n unless self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Purgatory\"].blank?\n friends[\"Purgatory\"] += self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Purgatory\"].map{|friendship| friendship.proposer}\n end\n friends[\"Industry Participant\"].sort_by!{|user| user.last_name} unless friends[\"Industry Participant\"].blank?\n friends[\"Respected Peer\"].sort_by!{|user| user.last_name} unless friends[\"Respected Peer\"].blank?\n friends[\"Kindred Spirit\"].sort_by!{|user| user.last_name} unless friends[\"Kindred Spirit\"].blank?\n friends[\"Purgatory\"].sort_by!{|user| user.last_name} unless friends[\"Purgatory\"].blank?\n friends\n end", "def get_friends\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n\n if params['sortBy'] == \"status_changed\"\n params['sortOrder'] ||= \"ascending\"\n @friends = @person.contacts.all\n @friends.sort!{|a,b| sort_by_status_message_changed(a, b, params['sortOrder']) }\n else\n @friends = @person.contacts\n end\n @friends.filter_paginate!(params[:per_page], params[:page]){true}\n @friends.collect! { |p| p.to_hash(@user, @client)}\n render_json :entry => @friends, :size => @friends.count_available and return\n end", "def all_friends\n friends + inverse_friends\n end", "def friends_of_friends\n # Unit Test is in Friendship.rb\n #The first 'row' is a list of the user's friends of friends,\n #which are each in rings farther than the ring of the friend's friendship with the user\n #The second 'row' is the number of common friends the user has with the person listed in the first row.\n friends_of_friends = Array.new\n for friend in self.mutual_friends\n for friend_of_friend in friend.mutual_friends\n #A friend's friend is only seen if you are as close or closer to your friend as your friend's friend.\n if friend.which_ring(friend_of_friend) >= friend.which_ring(self)\n #If you can view the friend, then his/her presence in the friend_of_friends list is determined\n if friends_of_friends.flatten.include?(friend_of_friend)\n #If he/she is in the list, then just the number of common friends in the second row of the correct friend is incremented.\n friends_of_friends.assoc(friend_of_friend)[1] += 1\n else\n #If he/she isn't in the list, then a new column is added to the list unless the friend is you or he/she is already your friend.\n unless friend_of_friend == self or self.friends.exists?(friend_of_friend.id)\n friends_of_friends << Array.[](friend_of_friend, 1) \n end\n end\n end\n end\n end\n return friends_of_friends\n end", "def users_list\n User.joins(\"users left OUTER JOIN friendships ON \n users.id = friendships.friend_id AND \n friendships.user_id = #{self.id} WHERE users.id != #{self.id}\")\n .select(\"users.*, friendships.confirmed\")\n .order(:last_name)\n end", "def sorted_tracking\n ratings = []\n self.tracking.each do |user|\n ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}\n end\n return ratings.sort_by{ |h| h[:weight] }.reverse\n end", "def searchlist\n\t\t@friendsHash = current_user.multi_friends\n\t\t# Get current user invited friends\n\t\tinviteFriends\n\t\t@alreadyinvitedusers = []\n\t\tif !@invitedFriends.blank?\n\t\t\t@invitedFriends = @invitedFriends.map(&:inspect).join(', ')\n\t\t\t@alreadyinvitedusers = User.where(\"id in (#{@invitedFriends})\").pluck(:uid)\n\t\tend\n\n\t\t# Get user Accepted friends UID\n\t\tacceptedFriends\n\t\t@alreadyAcceptedUsers = []\n\t\tif !@acceptedFriends.blank?\n\t\t\t@acceptedFriends = @acceptedFriends.map(&:inspect).join(', ')\n\t\t\t@alreadyAcceptedUsers = User.where(\"id in (#{@acceptedFriends})\").pluck(:uid)\n\t\tend\n\t\t\n\t\t@dt = {}\n current_user.multi_friends.each do |k,v| \n dist = dist(k)\n \tdist = (dist == 'No found') ? 99999 : dist\n @dt.merge!( k => dist)\n end\n\n @sortFriends = @dt.sort_by {|_k, val| val}\n\tend", "def complile_relationships\n relationships = []\n @classifications.each do |classification|\n relationship = Relationship.new(@query, classification)\n relationships << relationship unless relationship.score.zero?\n end\n relationships.sort\n end", "def friends \n friends = []\n friendships = Relationship.where(\"follower_id = :user_id and friend_status = 'FRIENDS' or followed_id = :user_id and friend_status = 'FRIENDS'\", {user_id: self.id})\n\n friendships.each do |friendship|\n if friendship.followed_id == self.id\n friends.append(friendship.follower)\n else\n friends.append(friendship.followed)\n end\n end\n\n\tfriends << self\n\t\n return friends \n end", "def sort\n self.roster.each do |grade, students|\n students.sort!\n end\n self.roster\n end", "def friends\n output = []\n friendships.each do |f|\n output << f.friend\n end\n output\n end" ]
[ "0.6568983", "0.6302386", "0.6122671", "0.6073548", "0.60036314", "0.59447694", "0.59340316", "0.5915157", "0.59138596", "0.5741854", "0.5715058", "0.57112366", "0.57078093", "0.57025164", "0.56959426", "0.5686379", "0.56751907", "0.56744474", "0.56706077", "0.5661308", "0.5620186", "0.5600602", "0.55994725", "0.55505353", "0.55413157", "0.5518003", "0.5512166", "0.55020624", "0.5501819", "0.5491045" ]
0.7278169
0
Call it to make the relation between the entity and the actionable
def make_relation(actionable, relation, magnitude=1) if actionable.is_a?(Sociographer::Actionable) && relation.present? && relation # @@neo = Neography::Rest.new self_node = self.get_node actionable_node = actionable.get_node if self_node && actionable_node if magnitude magnitude = magnitude.try(:to_f).try(:round) if magnitude < 0 magnitude = -1 else magnitude = 1 end else magnitude = 1 end node_property = "#{relation.to_s.parameterize.underscore.to_s}_count" self_node_property = self_node[node_property] if self_node_property self_node[node_property] = self_node_property+1 elsif self_node[node_property] = 1 end relation = relation.to_s.parameterize.underscore.to_sym relation_relationship = Neography::Relationship.create(relation, self_node, actionable_node) @@neo.set_relationship_properties(relation_relationship, {"magnitude" => magnitude, "created_at" => DateTime.now.to_i}) # self.update_actions_cache(self_node, relation_relationship, 1) #removed will be set to -1 return true else false end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def create_actionable\n actionable_node = Neography::Node.create(\"object_id\" => self.id, \"object_type\" => self.class.to_s)\n actionable_node.add_to_index(\"actionables_nodes_index\", \"class0id\", \"#{self.class.to_s}0#{self.id}\")\n end", "def create_with_back_to\n item_class = params[:resource].typus_constantize\n options = { :controller => item_class.to_resource }\n assoc = item_class.relationship_with(@resource).to_s\n send(\"set_#{assoc}_association\", item_class, options)\n end", "def save_related\n if self.links.present?\n self.links.each do | link |\n link.parent_type = :action_item\n link.parent_key = self.key\n link.save!\n end\n end\n end", "def make_related(parent, child, resource_config)\n proc = resource_config[:relation][:create]\n proc.call(parent, child) if proc\n child\n end", "def target!(battle,opponent)\n action = Action.new\n action.ability = self\n action.target = opponent\n action.battle = battle\n action.damage = self.damage\n if action.save\n return action\n else\n return nil\n end\n end", "def set_relation_with(other_id, action, nick)\n\t\treturn OWN if other_id == id\n\t\t#cant use find_or_create_by, final status unknown\n\t\trelation = Relation.new(user_id: id, friend_id: other_id) unless relation = Relation.relates(id, other_id)\n\t\tcase action\n\t\twhen ALIAS\n\t\t\trelation.set_alias(nick)\n\t\twhen FRIEND\n\t\t\trelation.accepts(nick)\n\t\twhen REQUEST\n\t\t\trelation.request(nick)\n\t\twhen STRANGER\n\t\t\trelation.unfriend\n\t\twhen BLOCKED\n\t\t\trelation.block(nick)\n\t\tend\n\tend", "def transfer_ownership\n transaction do\n Collaborator.create resourceable: resourceable, user: resourceable.owner\n resourceable.update(owner: user)\n destroy\n end\n end", "def child_relation; end", "def as_nested_actions; end", "def action_interface_model\n coordination_model.action_interface\n end", "def <<(resource)\n relate_resource(resource)\n super\n end", "def relate(predicate, resource)\n self.assert(predicate, self.class.new(resource))\n end", "def make_inter_relationship(rel_id,rel_entity_type_id,object_id,rel_type_id)\n entity_type=EntityType.entityIdToType(rel_entity_type_id)\n type=Inflector.camelize(entity_type)\n logger.debug(\"TYPE: #{type}\")\n #special case\n #if type.to_s=='DistinctionInstance'\n # @inter_rel=DistinctionRelationship.new()\n #else\n @inter_rel=eval(type+'Relationship.new()')\n #end\n \n @inter_rel.relationship_id=rel_id\n eval('@inter_rel.'+entity_type+'_id=object_id')\n @inter_rel.relationship_type_id=rel_type_id\n return @inter_rel.save()\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 add_relationship(rel_attr); end", "def move_entity entity; end", "def make_reaction(user, reaction)\n return unless reaction.condition_met?(self, user)\n return unless movable? || reaction.forced\n chance = reaction.chance(self, user) \n return if chance < rand\n skill = $data_skills[reaction.react_id]\n action = Game_Action.new(self, reaction.forced)\n \n if skill.for_opponent?\n action.target_index = user.index\n elsif skill.for_friend?\n action.target_index = self.index\n end\n action.set_skill(reaction.react_id)\n action.make_targets\n @actions.push(action)\n BattleManager.force_reaction(self)\n end", "def create\n @actionable = Actionable.new(actionable_params)\n\n respond_to do |format|\n if @actionable.save\n format.html { redirect_to @actionable, notice: 'Actionable was successfully created.' }\n format.json { render :show, status: :created, location: @actionable }\n else\n format.html { render :new }\n format.json { render json: @actionable.errors, status: :unprocessable_entity }\n end\n end\n end", "def target\n relation\n end", "def target\n relation\n end", "def can! action, object\n can?(action, object) || raise(ActiveModel::ActionNotAllowed, action)\n end", "def add_actions; end", "def _process_on_create(entity)\n end", "def apply_actions!\n\t @entity.apply_actions!(params[:entity])\n\t\t\tset_async_actions!\n end", "def on_create_success(entity)\n Responder::CreateSuccess.new(self).respond_to entity\n end", "def save_action\n if new_record?\n :create\n elsif self.id.present?\n :update\n else\n raise MotionModelResource::ActionNotImplemented.new \"Action ist not implemented for #{self.class.name}!\"\n end\n end", "def inverse_class\n ManyToOne::Relationship\n end", "def inverse_class\n ManyToOne::Relationship\n end" ]
[ "0.60413265", "0.59907585", "0.5984374", "0.5908979", "0.56276965", "0.56272906", "0.5567703", "0.55306613", "0.5488789", "0.54324484", "0.5431984", "0.5349256", "0.53455496", "0.53401387", "0.53295684", "0.5326619", "0.5307637", "0.5297942", "0.5260373", "0.5260352", "0.5256652", "0.5256652", "0.5250493", "0.5248589", "0.5244104", "0.5243084", "0.5238806", "0.5229143", "0.5218906", "0.5218906" ]
0.6194696
0
removes "version" and "op_success" fields from the document before save or update, this ensures that these fields can only be persisted by the versioned_create and versioned_update methods. prevents inadvertent persistence of these fields. return[nil]
def filter_fields remove_attribute(:version) remove_attribute(:op_success) attributes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persist\n prepare do\n document.attributes.delete(field)\n execute(\"$unset\")\n end\n end", "def after_persist(doc,instance)\n\t\t\t\t\tdoc.keys.each do |f|\n\t\t\t\t\t\tif f == \"version\"\n\t\t\t\t\t\t\tinstance.send(\"#{f}=\",doc[f])\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif instance.send(\"#{f}\") != doc[f]\n\t\t\t\t\t\t\t\tinstance.send(\"#{f}=\",doc[f])\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\treturn true\n\t\t\tend", "def version_attribute(attributes)\n attributes.delete(version_field)\n end", "def before_create \n self.ver = 0\n end", "def touch\n self.updated_at = Time.zone.now\n skip_versioning_and_timestamps\n save :validate => false\n end", "def save_version\n\t\t\t\t\t$TRACE.debug 9, \"save_version: at beginning: #{self.inspect}\"\n\t\t\t\t\tself.changed_attributes_aado ||= []\n\t\t\t\t\t$TRACE.debug 5, \"save_version, changed_attributes = #{changed_attributes_aado.inspect}\"\n\t\t\t\t\t#save_version_on_create if save_version?\n\t\t\t\t\tif (dobj = get_database_object) && !changed_attributes_aado.empty? then\n\t\t\t\t\t\tdobj.save_version(changed_attributes_aado)\n\t\t\t\t\tend\n\t\t\t\tend", "def save_without_validation\n self.run_hook :before_save\n document = {}\n\n self.class.public_fields.each do |field|\n document[field] = self.send(field)\n end\n\n if self._id\n result = Driver.client[self.class.coll_name]\n .find({'_id' => self._id}).update_one(document, {:upsert => true})\n else\n document['_id'] = BSON::ObjectId.new\n Driver.client[self.class.coll_name].insert_one(document)\n self._id = document['_id']\n end\n\n self.run_hook :after_save\n set_old_values\n\n result ? true : false\n end", "def new_document?; not saved?; end", "def retain_except_on_create\n data[:retain_except_on_create]\n end", "def persist\n prepare do\n if document[field]\n values = document.send(field)\n value > 0 ? values.pop : values.shift\n values.tap do\n collection.update(document.atomic_selector, operation(\"$pop\"), options)\n document.remove_change(field) if document.persisted?\n end\n end\n end\n end", "def flag_for_upgrade!\n raise \"standard forms should not be versioned\" if is_standard?\n\n self.upgrade_needed = true\n save(:validate => false)\n end", "def reset_fields\n self.sender_doc_id_version = nil\n self.receiver_doc_id_version = nil\n self.project_doc_id_version = nil\n self.submission_receiver_doc_id = nil\n self.submission_project_doc_id = nil\n self.response_sender_doc_id = nil\n self.response_project_doc_id = nil\n self.plnd_submission = nil\n self.actl_submission = nil\n self.xpcd_response = nil\n self.actl_response = nil\n self.response_status = nil\n end", "def before_validation\n set_version\n super\n end", "def save\n self.attributes.delete('customer')\n self.attributes.delete('product')\n self.attributes.delete('credit_card')\n super\n end", "def version_attributes\n attributes = super\n\n if @reverted_from.nil?\n attributes\n else\n attributes.merge(:reverted_from => @reverted_from)\n end\n end", "def clear_version_instance\n @record.send(\"#{@record.class.version_association_name}=\", nil)\n end", "def clear_version_instance\n @record.send(\"#{@record.class.version_association_name}=\", nil)\n end", "def is_versioned\n\t\t\t@is_versioned = true\n\t\t\tbefore_destroy do |model|\n\t\t\t\tmodel._serialized = model.to_yaml\n\t\t\tend\n\n\t\t\tbefore_update do |model|\n\t\t\t\t# save the model as it was BEFORE it was updated\n\t\t\t\tmodel._serialized = self.class.find(model.id).to_yaml\n\t\t\tend\n\n\t\t\tafter_commit :create_version\n\t\tend", "def revert_to!(version)\n revert_to(version) ? save_without_revision : false\n end", "def restore\r\n self.update(deleted: false)\r\n end", "def save_version_on_create\n\t\t\t\t\t$TRACE.debug 9, \"save_version_on_create, changed_attributes = #{changed_attributes_aado.inspect}\"\n\t\t\t\t\tif self.database_object then\n\t\t\t\t\t\tself.database_object.save_version_on_create(self.id)\n\t\t\t\t\t\t\n\t\t\t\t\t\tsave_version if save_version?\n\t\t\t\t\tend\n\t\t\t\tend", "def destroy\n transaction do\n if self.old_version\n self.old_version.update_column :new_version_id, nil\n end\n super\n end\n end", "def clear_changes\n versioned_columns.each do |key|\n changed_attributes.delete(key)\n end\n end", "def unpublish_self\n if self.submitted?\n self.deleted!\n save\n end\n if self.revisions.present?\n self.revisions.each do |event|\n if event.submitted?\n event.deleted!\n event.save\n end\n end\n end\n end", "def reset_timestamp_attrs_for_update_if_needed!\n paper_trail.reset_timestamp_attrs_for_update_if_needed\n end", "def save\n if self.changed? || self.relationships_changed?\n self._version = current_version + 1\n super\n revise\n end\n end", "def versioned_create(query={},log=false)\n\t\t \t\t\n\n\t\t \t\tself.send(\"op_success=\",false) \t\t\n\t\t \t\tupdate = {}\n\t\t \t\toptions = {}\n\t\t \t\tid_query = {\"_id\" => as_document[\"_id\"]}\n\t\t \t\n\t\t \t\tquery = query.empty? ? id_query : query\n\n\n\t\t\t\tif version == 0\n\n\t\t\t\t\tupdate[\"$setOnInsert\"] = {}\n\t\t \t\t\toptions[:upsert] = true\n\t\t\t\t\t\n\t\t \t\t\texpected_version = 1\n\n\t\t\t\t\tprepare_insert(options) do\n\t\t\t\t\t\t\n\t\t\t\t\t\tas_document.keys.each do |k|\n\t\t\t \t\t\t\tif (k != \"version\" && k != \"op_success\")\n\t\t\t \t\t\t\t\tupdate[\"$setOnInsert\"][k] = as_document[k]\n\t\t\t \t\t\t\tend\n\t\t\t \t\t\tend\n\n\t\t\t \t\t\tupdate[\"$setOnInsert\"][\"version\"] = 1\n\n\t\t\t\t\t\toptions,update = self.class.before_persist(options,update,true)\n\n\t\t\t\t\t\t\tself.class.log_opts(query,update,options,\"create\",log)\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tpersisted_doc = collection.find_one_and_update(query,update,options)\n\t\t\n\t\t\t\t\t\t\tif persisted_doc.nil?\n\t\t\t\t\t\t\t\tself.send(\"op_success=\",false)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif persisted_doc[\"version\"] == expected_version\n\t\t\t\t\t\t\t\t\tself.send(\"op_success=\",true)\n\t\t\t\t\t\t\t\tend\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tself.class.after_persist(persisted_doc,self)\n\t\t\t\t\t\t\tend\t\n\t\t\t\t\t\t\n\t\t\t\t\tend\n\n\t\t\t\t\t\n\t\t\t\tend\t \n\n\t\t\t\treturn query,update,options \n\t\t\t\t\t\t\n\t\tend", "def revert\n version = InvoiceVersion.find(self.versions.last.id) if self.versions.last\n # if there are versions then revert to the previous one.\n if !version.blank? && version.reify\n self.transaction do\n # if the current status is :partial_payment or :paid_in_full then delete the last payment\n self.invoice_payments.last.revert if self.payment_made_current? && self.invoice_payments.last\n version.reify.save\n end\n else\n return false\n end\n return true\n end", "def obsolete!\n update!(:revision => -1)\n end", "def model_attributes\n super.merge(\n viewmodel: ->(_v) {\n self.schema_version = 2\n migrates from: 1, to: 2 do\n down do |view, refs|\n view.delete('child')\n end\n end\n })\n end" ]
[ "0.5988097", "0.5891741", "0.57869065", "0.5775962", "0.5774656", "0.5752363", "0.57133436", "0.5659219", "0.56515336", "0.55760515", "0.5569905", "0.55579877", "0.5555406", "0.5541297", "0.55291134", "0.5526416", "0.5526416", "0.5504303", "0.5500296", "0.54991007", "0.5483847", "0.5467398", "0.54314566", "0.5408186", "0.54076266", "0.53922313", "0.538869", "0.53745395", "0.5362669", "0.53598154" ]
0.6261284
1
creates the document, uses the query parameters provided. Increments the version of the document to 1 on successfull creation. Sets "op_success" to true on successfull creation , otherwise false.
def versioned_create(query={},log=false) self.send("op_success=",false) update = {} options = {} id_query = {"_id" => as_document["_id"]} query = query.empty? ? id_query : query if version == 0 update["$setOnInsert"] = {} options[:upsert] = true expected_version = 1 prepare_insert(options) do as_document.keys.each do |k| if (k != "version" && k != "op_success") update["$setOnInsert"][k] = as_document[k] end end update["$setOnInsert"]["version"] = 1 options,update = self.class.before_persist(options,update,true) self.class.log_opts(query,update,options,"create",log) persisted_doc = collection.find_one_and_update(query,update,options) if persisted_doc.nil? self.send("op_success=",false) else if persisted_doc["version"] == expected_version self.send("op_success=",true) end self.class.after_persist(persisted_doc,self) end end end return query,update,options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n set_unique_id if respond_to?(:set_unique_id) # hack\n save_doc\n end", "def create\r\n # not authorized\r\n unless dc_user_can(DcPermission::CAN_CREATE)\r\n flash[:error] = t('drgcms.not_authorized')\r\n return index\r\n end\r\n\r\n # create document\r\n if params['id'].nil?\r\n # Prevent double form submit\r\n params[:form_time_stamp] = params[:form_time_stamp].to_i\r\n session[:form_time_stamp] ||= 0\r\n return index if params[:form_time_stamp] <= session[:form_time_stamp] && !Rails.env.test?\r\n\r\n session[:form_time_stamp] = params[:form_time_stamp]\r\n create_new_empty_record\r\n if save_data\r\n flash[:info] = t('drgcms.doc_saved')\r\n params[:return_to] = 'index' if params[:commit] == t('drgcms.save&back') # save & back\r\n return process_return_to(params[:return_to]) if params[:return_to]\r\n\r\n @form_params['id'] = @record.id # must be set, for proper update link\r\n params[:id] = @record.id # must be set, for find_record\r\n edit\r\n else # error\r\n return process_return_to(params[:return_to]) if params[:return_to]\r\n\r\n render action: :new\r\n end\r\n else # duplicate record\r\n find_record\r\n new_doc = duplicate_document(@record)\r\n create_new_empty_record(new_doc)\r\n if (m = callback_method('dup_record')) then call_callback_method(m) end\r\n update_standards\r\n @record.save!\r\n index\r\n end\r\nend", "def create_doc(doc)\n @conn.query({url_path: \"#{database}\", opts: doc, method: :post})\n end", "def create\n authorize! :create, Document.new, @project\n main = @project.document_mains.create\n rev = main.revisions.create\n document = rev.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n rev.destroy\n main.destroy\n render json: document.errors, status: :unprocessable_entity\n end\n end", "def create\n @document = Document.new(document_params)\n\n if @document.save\n render json: {status: 'SUCCESS', message:'Document created', data:@document}, status: :ok\n else\n render json: {status: 'ERROR', message:'Document not created', data:@document.errors}, status: :unprocessable_entity\n end\n\n end", "def create\n if(@document = Document.new(params[:document])).save\n flash['notice'] = 'Document was successfully created.'\n respond_with @document, \n :location => site_document_url(@document.site.slug , @document.id.to_s)\n else\n\n if doc = Document.where(uri: params[:document][:uri]).first\n params[:id] = doc.id\n update\n else\n respond_with @document\n end\n end\n \n end", "def create\n\t\tbegin\n\t\t\traise ArgumentError, \"project id has to be specified.\" unless params[:project_id].present?\n\n\t\t\t@project = Project.editable(current_user).find_by_name(params[:project_id])\n\t\t\traise \"The project does not exist, or you are not authorized to make a change to the project.\\n\" unless @project.present?\n\n\t\t\tdoc_hash = if doc_params.present? && params[:commit].present?\n\t\t\t\tdoc_params\n\t\t\telse\n\t\t\t\ttext = if params[:text]\n\t\t\t\t\tparams[:text]\n\t\t\t\telsif request.content_type =~ /text/\n\t\t\t\t\trequest.body.read\n\t\t\t\tend\n\n\t\t\t\traise \"Could not find text.\" unless text.present?\n\n\t\t\t\t_doc = {\n\t\t\t\t\tsource: params[:source],\n\t\t\t\t\tsourcedb: params[:sourcedb] || '',\n\t\t\t\t\tsourceid: params[:sourceid],\n\t\t\t\t\tbody: text\n\t\t\t\t}\n\n\t\t\t\t_doc[:divisions] = params[:divisions] if params[:divisions].present?\n\t\t\t\t_doc[:typesettings] = params[:typesettings] if params[:typesettings].present?\n\t\t\t\t_doc\n\t\t\tend\n\n\t\t\tdoc_hash = Doc.hdoc_normalize!(doc_hash, current_user, current_user.root?)\n\t\t\tdocs_saved, messages = Doc.store_hdocs([doc_hash])\n\t\t\traise IOError, \"Could not create the document: #{messages.join(\"\\n\")}\" if messages.present?\n\n\t\t\t@doc = docs_saved.first\n\t\t\t@doc.projects << @project\n\t\t\texpire_fragment(\"sourcedb_counts_#{@project.name}\")\n\t\t\texpire_fragment(\"count_docs_#{@project.name}\")\n\t\t\texpire_fragment(\"count_#{@doc.sourcedb}_#{@project.name}\")\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to show_project_sourcedb_sourceid_docs_path(@project.name, doc_hash[:sourcedb], doc_hash[:sourceid]), notice: t('controllers.shared.successfully_created', :model => t('activerecord.models.doc')) }\n\t\t\t\tformat.json { render json: @doc.to_hash, status: :created, location: @doc }\n\t\t\tend\n\t\trescue => e\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to new_project_doc_path(@project.name), notice: e.message }\n\t\t\t\tformat.json { render json: {message: e.message}, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @document = Document.new(params[:document])\n @document.generate_token\n @document.archived = false\n if params[:group_id]\n @document.owner = Group.find(params[:group_id]) \n else\n @document.owner ||= default_company\n end\n @document.author = current_user\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to document_path(@document), :flash => { :success => 'Document was successfully created.'} }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(resource_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Primary document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #creates a new document and also its parameters(its title and its content)\n @doc = current_user.docs.build(doc_params)\n\n #says if the doc is saved then get the application to redirect the user to the document that was #just created/saved.\n if @doc.save\n redirect_to @doc\n # says if it fails to save then render the doc again so the user can have another go at saving it.\n # The reason why render 'new' is used here instead of 'redirect_to' is because redirect_to is a NEW http refresh. Meaning if the user has a long document and a save fails then if we used redireect_to they would lose all of their previous work!\n # but render does not refresh the page. It keeps the user where they are and they get to have another go at saving the doc.\n else\n render \"new\"\n end\n end", "def create\n @has_document = HasDocument.new(has_document_params)\n \n respond_to do |format|\n if @has_document.save\n format.html { redirect_to @has_document, notice: 'Has document was successfully created.' }\n format.json { render :show, status: :created, location: @has_document }\n else\n format.html { render :new }\n format.json { render json: @has_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(document_params)\n\n if @document.save\n render :show, status: :created, location: @document\n else\n render json: @document.errors, status: :unprocessable_entity\n end\n end", "def create\r\n# abusing create for turning filter on\r\n return index if params[:filter].to_s == 'on'\r\n# not authorized\r\n unless dc_user_can(DcPermission::CAN_CREATE)\r\n flash[:error] = t('drgcms.not_authorized')\r\n return index\r\n end\r\n#\r\n if params['id'].nil? # create record\r\n# Prevent double form submit\r\n params[:form_time_stamp] = params[:form_time_stamp].to_i\r\n session[:form_time_stamp] ||= 0\r\n return index if params[:form_time_stamp] <= session[:form_time_stamp]\r\n session[:form_time_stamp] = params[:form_time_stamp]\r\n# \r\n create_new_empty_record\r\n params[:return_to] = 'index' if params[:commit] == t('drgcms.save&back') # save & back\r\n if save_data\r\n @parms['action'] = 'update'\r\n @parms['id'] = @record.id # must be set, for proper update link\r\n flash[:info] = t('drgcms.doc_saved')\r\n return process_return_to(params[:return_to]) if params[:return_to]\r\n render action: :edit\r\n else\r\n render action: :new\r\n end\r\n else # duplicate record\r\n find_record\r\n params['dup_fields'] += ',' if params['dup_fields'] # for easier field matching\r\n new_doc = duplicate_document(@record)\r\n create_new_empty_record(new_doc)\r\n update_standards()\r\n @record.save!\r\n\r\n index\r\n end\r\nend", "def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, success: 'Documento creado con éxito.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n d_params = document_params.clone\n d_params[:date_opened] = DateTime.strptime(params[:document][:date_opened], '%m/%d/%Y').to_date\n @document = Document.new(d_params)\n @document.user = current_user\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @document }\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document = @instruction.documents.build(document_params)\n authorize @document\n disable_primary if @document.primary\n respond_to do |format|\n if @document.save\n format.html { redirect_to @instruction, notice: t('documents.create.success') }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_document\n # rubocop:disable Lint/AmbiguousOperatorPrecedence\n if template.metadata['subject'].presence &&\n template.metadata['subject'].casecmp('ela').zero? || template.prereq?\n @document = Document.actives.find_or_initialize_by(file_id: downloader.file_id)\n else\n @document = foundational? ? find_core_document : find_fs_document\n id_field = foundational? ? :foundational_file_id : :file_id\n\n @expand_document ||= @document.present?\n\n @document[id_field] = downloader.file_id if @document.present?\n @document ||= Document.actives.find_or_initialize_by(id_field => downloader.file_id)\n end\n # rubocop:enable Lint/AmbiguousOperatorPrecedence\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, :notice => 'Document was successfully created.' }\n format.json { render :json => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render jbuilder: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @current_user = User.find_by_id(session[:user_id])\n @document = Document.new(params[:document])\n @document.user = @current_user\n if @document.file && !document.file.empty?\n @document.name = @document.file.original_filename\n @document.status = 'pending'\n #@document.dt_reference = DocTrackrEnterprise.secure_document(@document.file, \"https://doctrackr-salesforce.herokuapp.com/documents/callback\")\n end\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to(@document, :notice => 'Document was successfully created.') }\n format.xml { render :xml => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @document = Document.new(document_params)\n @document.user = current_user\n @document.project = current_project\n @document.qr_code_position = QrCodePosition.find(@document.position)\n authorize @document\n respond_to do |format|\n if @document.save\n format.html { redirect_to documents_path, notice: t('document.create.confirmation') }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to documents_path, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: document_path }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n\n end\n end", "def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n format.html { redirect_to(@doc, :notice => 'Doc was successfully created.') }\n format.xml { render :xml => @doc, :status => :created, :location => @doc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_new\n create_doc_keys(true)\n initialize_document(@docs[:num_comments], 0)\n\n\t\t@comment_id = increase_atomic_count(@docs[:num_comments])\n\n\t\tcreate_doc_keys(true)\n\n create_default_docs\n end", "def create\n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n format.html { redirect_to @doc, notice: \"\\\"#{@doc.component}\\\" was successfully created.\" }\n format.json { render json: @doc, status: :created, location: @doc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end", "def save document\n ensure_connection!\n resp = connection.create_doc index_id, document.to_hash\n if resp.success?\n raw = document.instance_variable_get \"@raw\"\n raw.merge! JSON.parse(resp.body)\n return document\n end\n fail ApiError.from_response(resp)\n rescue JSON::ParserError\n raise ApiError.from_response(resp)\n end" ]
[ "0.648188", "0.62009674", "0.6178386", "0.61285865", "0.6108398", "0.60818386", "0.602869", "0.6019062", "0.60034835", "0.59937906", "0.59593177", "0.5952028", "0.59466875", "0.5932189", "0.59105223", "0.59067696", "0.59016013", "0.5891489", "0.58667207", "0.58667207", "0.5848474", "0.581488", "0.58148", "0.58109665", "0.5810166", "0.58056563", "0.5800964", "0.5799049", "0.57948107", "0.5780874" ]
0.7399619
0
Custom validation to be used in validates :email
def validate_email if !self.email.match(/\A#{ApplicationHelper.form_field_attr('email')[:regex]}\Z/i) self.errors.add(:email, "#{ApplicationHelper.form_field_attr('email')[:generic]}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_validator(user_email)\n EmailValidator.regexp\n EmailValidator.valid?(user_email)\n end", "def validate_email\n return if self.email.blank?\n errors.add(:email, :not_a_valid_email) if !Valid.email?(self.email)\n end", "def validates_email\n self.type == 'email'\n end", "def valid_email\n unless self.email =~ /\\w+@\\w+\\.\\w{2,}/\n errors.add(:email, \"is not valid.\")\n end\n end", "def email_validate\n if !normalized_email.include? '@'\n puts \"Invalid e-mail address entered #{normalized_email}\"\n else\n true\n end\n end", "def fValidateEmail (email)\n @users.validateEmail(email)\n end", "def email_validator\n [\n ActiveModel::Validations::FormatValidator,\n {\n :allow_blank => true,\n :with => /\\A[^@\\s]+@[^@\\s]+\\.(\\S+)\\z/,\n :message => :invalid_email\n }\n ]\n end", "def valid_email\n email_regex = !!(cas_email =~ /^[\\w+\\-.]+@[a-z\\d\\-]+[\\.[a-z\\d\\-]+]*\\.edu/i)\n errors.add :cas_email, I18n.t('users.valid_email') unless email_regex\n end", "def email_format\n\t\terrors.add(:email, :invalid) unless email.match(EMAIL_REGEXP)\n\tend", "def validateEmail\n email_check = email.include?(\"@\") && email.split(\"@\")[1].include?(\".\")\n if email_check == false\n errors.add(:email, 'Invalid email address')\n end\n email_check\n end", "def email_check\n if !email =~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n errors.add :base, \"Email is in an invalid format.\"\n end\n end", "def validate_email_field(value = nil)\n config(:validate_email_field, value, true)\n end", "def validate_email\n return error_with_identifier('invalid_api_params',\n 'um_u_c_ve_1',\n ['invalid_email']\n ) unless Util::CommonValidateAndSanitize.is_valid_email?(@email)\n\n success\n end", "def email_address_is_valid\n email_regex = /\\A([\\w+\\-].?)+@[a-z\\d\\-]+(\\.[a-z]+)*\\.[a-z]+\\z/\n if email.present? && email[email_regex].nil?\n errors.add(:email, \"is not valid\")\n end\n end", "def validate \n errors.add(:email, \"must be valid.\") unless email.include?(\"@\") \n if account.include?(\" \") \n errors.add(:account,\"cannot include spaces.\") \n end \n end", "def check_email\n self.email_address=~/^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i if email_address\n end", "def email_required?; false end", "def username_is_email\n errors.add(:userName,'is not in email format') unless userName=~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n end", "def validate_email\n if User.find_by(email: params[:email]).present?\n render_error :unprocessable_entity, I18n.t('common.messages.registrations.duplicate_email')\n else\n render_response\n end\n end", "def validate\n super\n if root? && (self.email.to_s.empty? || errors.invalid?(:email)) && self.phone.to_s.empty?\n errors.add(:base, \"Phone number or email address must be provided\".t)\n end\n if self.email\n unless self.organization.worldwide.map(&:site_domain).compact.include?(self.email_domain)\n errors.add(:email, \"not a valid email address at %{org}\".t % {:org => self.organization.root.name})\n end\n end\n end", "def validates_email(*args)\n options = args.last.kind_of?(Hash) ? args.pop : {}\n \n validates_each args do |record, attr, value|\n address = EmailVeracity::Address.new(value)\n # domain lookup errors should be ignored or logged\n unless address.valid?\n record.errors.add(attr, options[:message]||address.errors.to_s) \n end\n end\n end", "def validate_email(email)\n #^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$\n # accepts RFC 2822 email addresses:\n #^((?>[a-zA-Z\\d!#$%&'*+\\-/=?^_`{|}~]+\\x20*|\"((?=[\\x01-\\x7f])[^\"\\\\]|\\\\[\\x01-\\x7f])*\"\\x20*)*(?<angle><))?((?!\\.)(?>\\.?[a-zA-Z\\d!#$%&'*+\\-/=?^_`{|}~]+)+|\"((?=[\\x01-\\x7f])[^\"\\\\]|\\\\[\\x01-\\x7f])*\")@(((?!-)[a-zA-Z\\d\\-]+(?<!-)\\.)+[a-zA-Z]{2,}|\\[(((?(?<!\\[)\\.)(25[0-5]|2[0-4]\\d|[01]?\\d?\\d)){4}|[a-zA-Z\\d\\-]*[a-zA-Z\\d]:((?=[\\x01-\\x7f])[^\\\\\\[\\]]|\\\\[\\x01-\\x7f])+)\\])(?(angle)>)$\n end", "def validate_for_email_or_phone\n unless valid_format_email_or_phone?\n errors.add(:email_or_phone, :invalid)\n end\n end", "def email_valid?\n if self.class.exists?(email: self.email)\n false\n else\n true\n end\n end", "def validate_email(value)\n # For email length, the source was:\n # http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690\n #\n # Optionally we could force DNS lookups using ValidatesEmailFormatOf\n # by sending validate_email_format special options after the value\n # such as mx=true (see gem's github), however, this requires dns\n # availability 24/7, and we'd like this system to work a little more\n # independently, so for now simply check against the RFC 2822,\n # RFC 3696 and the filters in the gem.\n return true if (ValidatesEmailFormatOf::validate_email_format(value).nil? and\n value.to_s.length < MAX_EMAIL_LENGTH ) #ok\n return false #fail\n end", "def validate_regex\n if !company.nil? && company.allow_email_regex == true\n # if email =~ /#{company.email_format}/i\n if email =~ /^([^@\\s]+)@((?:#{company.email_format}))$/i\n true\n else\n errors.add(:email, ' format not match')\n end\n else \n return true\n end\n end", "def email_valid(email)\n if !email.empty?\n self.email = email\n return true\n end\n end", "def validates_email(*attr_names)\n configuration = {\n :with => RE_EMAIL,\n :message => I18n.translate('activerecord.errors.messages')[:email_invalid]\n }\n configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)\n validates_format_of attr_names, configuration\n end", "def validate(email)\n email.scan(/\\b(?:[\\w\\d\\S]+)@(?:[\\w\\d\\-\\.]){1,253}[\\.](?:[\\w]{2,5})\\b/).length > 0\nend", "def is_valid_email? email\n\temail =~ VALID_EMAIL_REGEX\nend" ]
[ "0.7823798", "0.7814339", "0.7598883", "0.7571887", "0.7397064", "0.73885334", "0.73600036", "0.73571575", "0.7267605", "0.7226947", "0.7219834", "0.7182961", "0.7081259", "0.7022746", "0.6956654", "0.6907628", "0.68923545", "0.68640786", "0.6857352", "0.6850524", "0.6822495", "0.68162817", "0.68162423", "0.6794557", "0.6786472", "0.6784599", "0.6782386", "0.6760084", "0.67502344", "0.6747777" ]
0.79128623
0
Change children value to zero if set to nil to be used before validation
def children_to_zero self.youngsters ||= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_parent_favorite_to_zero\n return unless parent\n\n parent.update_attribute(:favorite, '0')\n parent.change_parent_favorite_to_zero\n end", "def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end", "def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end", "def default_childs_number=(v)\n @@default_childs_number = v\n end", "def nil_check\n self.level = self.level || 0\n end", "def set_default_values\n if self.price.nil?\n self.price = 0.0\n end\n if self.rating.nil?\n self.rating = 0\n end\n if self.enabled.nil?\n self.enabled = false\n end\n if self.no_of_reviews.nil?\n self.no_of_reviews = 0\n end\n if self.no_of_registrations.nil?\n self.no_of_registrations = 0\n end\n end", "def set_value(input, root)\n\t\treturn root = Node.new(input) if root == nil\n\n\t\tcase input <=> root.value\n\t\twhen -1\n\t\t\treturn root.small_child = Node.new(input, root) if root.small_child == nil\n\t\t\tset_value(input, root.small_child)\n\t\twhen 1\n\t\t\treturn root.big_child = Node.new(input, root) if root.big_child == nil\n\t\t\tset_value(input, root.big_child)\n\t\twhen 0\n\t\t\troot.count += 1\n\t\tend\n\tend", "def clean_cost\n self.cost = 0\n save\n end", "def toggle_param_zero(obj)\n if obj.value.to_s == \"0\"\n obj.value = nil\n else\n obj.value = \"0\"\n end\n return obj\n end", "def default_childs_number\n @@default_childs_number ||= 1\n end", "def children_size\n leaf? ? 0 : children.map(&:size).reduce(:+)\n end", "def post_initialize\n @quantity = 0\n end", "def orphan_child_categories\n self.children.each do |child|\n child.parent_id = nil\n child.save\n end\n end", "def actual_amount\n children.length\n end", "def reject_zero(attributes)\n attributes['quantity'] == '0' || attributes['quantity'].blank?\n end", "def set_defaults\n if self.has_attribute?(:extra_cost)\n self.extra_cost ||= 0.0\n end\n if self.has_attribute?(:stock)\n self.stock ||= 0.0\n end\n end", "def set_zeros\n return if competition.nil?\n\n self.thousands = 0 unless competition.data_entry_format.thousands? || competition.data_entry_format.hundreds?\n end", "def clear_children!\n @children.clear\n end", "def children=(children)\n (self.children - children).each do |child_to_remove|\n remove_child(child_to_remove)\n end\n super\n end", "def aggregate_treat_undefined_attributes_as_default_value?; end", "def clear\n @tree.clear\n return 0\n end", "def set_defaults\n if self.has_attribute?(:hidden) && self.hidden.nil?\n self.hidden = true\n end\n if self.has_attribute?(:base_price)\n self.base_price ||= 0.0\n end\n end", "def mark_nullable\n rules.each do |prod|\n if prod.empty?\n prod.nullable = true\n else\n # If all rhs members are all nullable, then rule is nullable\n prod.nullable = prod.rhs.members.all?(&:nullable?)\n end\n end\n end", "def total_child_count\n count = 0\n self.apply_to_children { |e| count += 1 }\n count\n end", "def update_children\n return if children_attribs.nil?\n\n reload # Ancestry doesn't seem to work properly without this.\n\n # Symbolize keys if regular Hash. (not needed for HashWithIndifferentAccess)\n children_attribs.each{ |a| a.symbolize_keys! if a.respond_to?(:symbolize_keys!) }\n\n self.ranks_changed = false # Assume false to begin.\n self.options_added = false\n self.options_removed = false\n\n # Index all children by ID for better performance\n children_by_id = children.index_by(&:id)\n\n # Loop over all children attributes.\n # We use the ! variant of update and create below so that validation\n # errors on children and options will cascade up.\n (children_attribs || []).each_with_index do |attribs, i|\n\n # If there is a matching (by id) existing child.\n attribs[:id] = attribs[:id].to_i if attribs.key?(:id)\n if attribs[:id] && matching = children_by_id[attribs[:id]]\n self.ranks_changed = true if matching.rank != i + 1\n matching.update_attributes!(attribs.merge(rank: i + 1))\n copy_flags_from_subnode(matching)\n\n # Remove from hash so that we'll know later which ones weren't updated.\n children_by_id.delete(attribs[:id])\n else\n attribs = copy_denormalized_attribs_to_attrib_hash(attribs)\n self.options_added = true\n\n # We need to strip ID in case it's present due to a node changing parents.\n children.create!(attribs.except(:id).merge(rank: i + 1))\n end\n end\n\n # Destroy existing children that were not mentioned in the update.\n self.options_removed = true unless children_by_id.empty?\n children_by_id.values.each{ |c| c.destroy_with_copies }\n\n # Don't need this anymore. Nullify to prevent duplication on future saves.\n self.children_attribs = nil\n end", "def ignore_children!\n @ignoring_children += 1\n end", "def default_values\n \tself.total_worth ||= 0\n \tend", "def recalculate(inode)\n full_count = 0\n inode.list_of_children.each do |node|\n#p node\n komvos = self.get(node)\n#p komvos\n if komvos.normalize==0\n puts \"node #{node} is not leaf\"\n # if not leaf\n #recalc(holon.searchFor(node).listOfChildren)\n self.recalculate(komvos)\n else \n # exw kanei: node.normalize kai einai leaf\n puts \"node #{node} is leaf\"\n \n end\n # uplogizw to sum of coun and re-normalize\n full_count = full_count + komvos.weight\n end\n inode.weight = full_count\n end", "def valores_por_default\n \t\tself.costo ||= 0\n \tend", "def default_values\n\t\tself.status = 0 unless self.status\n\t\tself.tagged = 0 unless self.tagged\n\t\tself.searched = 0 unless self.searched\n\tend" ]
[ "0.60107934", "0.56709814", "0.56709814", "0.5652151", "0.56515354", "0.5592876", "0.55549604", "0.5549173", "0.55039585", "0.547701", "0.5437217", "0.54254687", "0.5419518", "0.5400208", "0.5383862", "0.53809404", "0.5348891", "0.5341103", "0.5305409", "0.5300384", "0.52918494", "0.5269143", "0.5252253", "0.5238677", "0.5228586", "0.52265704", "0.5224183", "0.5223664", "0.52029765", "0.5195236" ]
0.74915636
0
Verify the error returning the ActiveMerchant::Billing object with the message
def verify_error action, ret if !ret.nil? and ret.has_key? :erro ActiveMerchant::Billing::Response.new(false, "Cielo: #{ret[:erro][:codigo]} - #{ret[:erro][:mensagem]}", {}, {}) else ActiveMerchant::Billing::Response.new(false, Spree.t("cielo.messages.#{action}_rescue"), {}, {}) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failed_purchase_response\n <<~RESPONSE\n {\n \"error\": {\n \"message\": \"The card number is invalid. Make sure the number entered matches your credit card.\",\n \"caused_by\": \"buyer\",\n \"param\": \"number\",\n \"type\": \"card_error\",\n \"code\": \"incorrect_number\"\n }\n }\n RESPONSE\n end", "def verify_error action, ret\n if !ret.nil? and ret.has_key? :erro\n if ret[:erro][:codigo] == '001'\n ActiveMerchant::Billing::Response.new(false, Spree.t('cielo.messages.invalid_message'), {}, {})\n else\n ActiveMerchant::Billing::Response.new(false, \"Cielo: #{ret[:erro][:codigo]} - #{ret[:erro][:mensagem]}\", {}, {})\n end\n else\n ActiveMerchant::Billing::Response.new(false, Spree.t(\"cielo.messages.#{action}_rescue\"), {}, {})\n end\n end", "def test_failed_purchase_decline\n response = @gateway.purchase(@amount, @declined_card, @options)\n assert_failure response\n assert_equal 1, response.responses.count\n assert_equal 'Card declined.', response.message\n assert_equal 'card_declined', response.error_code\n end", "def test_failed\n initial_mbox_length = ActionMailer::Base.deliveries.length\n # Get any order.\n an_order = orders(:santa_next_christmas_order)\n \n # Create a standard failure response when cc number is wrong. Parameters: success, message, params = {}, options = {}\n a_negative_response = ActiveMerchant::Billing::Response.new(\n false,\n \"(TESTMODE) The credit card number is invalid\",\n {\n :response_reason_text => \"(TESTMODE) The credit card number is invalid.\",\n :response_reason_code => \"6\",\n :response_code => \"3\",\n :avs_message => \"Address verification not applicable for this transaction\",\n :transaction_id => \"0\",\n :avs_result_code => \"P\",\n :card_code => nil\n }, {\n :test => true,\n :authorization => \"0\",\n :fraud_review => false\n }\n )\n \n # Stub the purchase method to not call home (using commit) and return a standard failure response.\n ActiveMerchant::Billing::AuthorizeNetGateway.any_instance.stubs(:purchase).returns(a_negative_response)\n\n # Assert that with a failure response the method will return the response message.\n assert_equal an_order.run_transaction_authorize, a_negative_response.message \n assert_equal ActionMailer::Base.deliveries.length, initial_mbox_length + 1\n \n response_mail = ActionMailer::Base.deliveries.first\n \n assert_equal response_mail.subject, 'An order has failed on the site'\n assert_match /Order #: #{an_order.order_number}/, response_mail.body\n assert_equal response_mail.to.to_a, Preference.find_by_name('mail_copy_to').value.split(',')\n \n end", "def test_transaction_failed\n response = @gateway.setup_purchase(500, @options)\n\n # now try to authorize the payment, issuer simulator lets the payment fail\n response = @gateway.capture(response.transaction['transactionID'])\n assert_failure response\n assert_equal 'Failure', response.transaction['status'], 'Transaction should fail'\n end", "def paypal_errors_msg\n \"We are sorry, but the purchase was not completed due the following errors: #{errors.full_messages.join(', ')}\"\n end", "def verify_credit_card\n @credit_card = ActiveMerchant::Billing::CreditCard.new(\n :type => \"visa\",\n :number => \"3024007148673576\",\n :verification_value => \"123\",\n :month => 1,\n :year => Time.now.year+1,\n :first_name => \"Greg\",\n :last_name => \"Barber\"\n )\n\n unless @credit_card.valid?\n @credit_card.errors.full_messages.each do |message|\n # errors.add_to_base message\n $stdout.puts \"777777777777777777777777777777777777\"\n $stdout.puts \"777777777777777777777777777777777777 message: \" + message\n $stdout.puts \"777777777777777777777777777777777777\"\n end\n end\n render :layout => false, :inline => \"Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}\"\n end", "def test_unsuccessful_amex_request\n @gateway.expects(:ssl_post).returns(failed_purchase_amex_response)\n\n assert response = @gateway.purchase(@amount, @amex_credit_card, @amex_options)\n assert_match %r{requeridos para pagos con AMEX}, response.message\n assert_failure response\n assert response.test?\n end", "def failed_purchase_response\n end", "def test_unsuccessful_request\n skip\n @gateway.expects(:ssl_post).returns(failed_purchase_response)\n\n assert response = @gateway.purchase(@amount, @credit_card, @options)\n assert_failure response\n assert response.test?\n end", "def validate_billing_info\n errors = {}\n\n if (posted['stripeToken'].nil? || posted['stripeToken'].empty?)\n errors['stripeToken'] = \"Your card wasn't accepted.\"\n end\n\n errors\n end", "def test_invalid_login\n gateway = SecurePayAuExtendedGateway.new(\n :login => '',\n :password => ''\n )\n assert response = gateway.purchase(@amount, @credit_card, @purchase_options)\n assert_failure response\n assert_equal \"Invalid merchant ID\", response.message\n end", "def failed_purchase_response\n 'response=2&responsetext=DECLINE&authcode=&transactionid=1869031793&avsresponse=N&cvvresponse=N&orderid=1&type=sale&response_code=200&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id='\n end", "def test_successful_purchase_with_emv_credit_card_in_uk\n assert response = @gateway.purchase(@amount, @emv_credit_cards[:uk], @options)\n assert_success response\n assert_equal 'charge', response.params['object']\n assert response.params['paid']\n assert_match CHARGE_ID_REGEX, response.authorization\n end", "def gateway_error\n message\n end", "def test_successful_purchase_with_emv_credit_card_in_us\n assert response = @gateway.purchase(@amount, @emv_credit_cards[:us], @options)\n assert_success response\n assert_equal 'charge', response.params['object']\n assert response.params['paid']\n assert_match CHARGE_ID_REGEX, response.authorization\n end", "def test_invalid_login\n gateway = PayuLatamGateway.new(merchant_id: '', account_id: '', api_login: 'U', api_key: 'U', payment_country: 'AR')\n response = gateway.purchase(@amount, @credit_card, @options)\n assert_failure response\n end", "def verify!\n raise \"Payment details not active anymore\" if active == false\n end", "def test_successful_3ds_validate_purchase_request\n assert response = @gateway.purchase(1202, @three_ds_enrolled_card, @options.merge(payer_auth_validate_service: true, pares: pares))\n assert_equal '100', response.params['reasonCode']\n assert_equal '0', response.params['authenticationResult']\n assert response.success?\n end", "def test_successful_purchase\n skip\n @gateway.expects(:ssl_post).returns(successful_purchase_response)\n\n assert response = @gateway.purchase(@amount, @credit_card, @options)\n assert_instance_of\n assert_success response\n\n # Replace with authorization number from the successful response\n assert_equal '', response.authorization\n assert response.test?\n end", "def test_successful_purchase\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert response.test?\n end", "def test_successful_purchase\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert response.test?\n end", "def test_store_invalid_credit_card\n @credit_card.number = 2\n\n assert response = @gateway.store(@credit_card, @options)\n assert_success response\n end", "def test_check_purchase_and_credit_not_settled\n assert purchase = @gateway.purchase(@amount, @check, @options)\n assert_success purchase\n assert_equal 'Approved', purchase.message\n assert credit = @gateway.credit(@amount, purchase.authorization, @check, @options)\n assert_failure credit\n assert_equal 'CREDIT CANNOT BE COMPLETED ON A UNSETTLED TRANSACTION', credit.message\n end", "def test_failed_capture\n response = @gateway.capture(@amount, 'missing-txn-id')\n assert_failure response\n assert_equal \"Location `#{fixtures(:square)[:location_id]}` does not have a transaction with ID `missing-txn-id`.\", response.message\n end", "def test_invalid_transaction\n\t\tassert_raise(Payment::PaymentError) {\n\t\t\t@transaction = @bad_order.get_auth_transaction\n\t\t\tassert_equal @transaction.test_transaction, true\n\t\t\t@transaction.submit\n\t\t}\n\tend", "def test_transaction_unknown\n response = @gateway.setup_purchase(700, @options)\n\n # now try to authorize the payment, issuer simulator lets the payment fail\n response = @gateway.capture(response.transaction['transactionID'])\n\n assert_failure response\n assert_equal 'SO1000', response.error[ 'errorCode'], 'ErrorCode should be correct'\n end", "def test_failed_refund\n response = @gateway.refund(@amount, @invalid_txn)\n assert_failure response\n assert_equal 'Txn not found', response.message\n end", "def test_successful_purchase_with_emv_contactless_credit_card\n emv_credit_card = @emv_credit_cards[:contactless]\n emv_credit_card.read_method = 'contactless'\n assert response = @gateway.purchase(@amount, emv_credit_card, @options)\n assert_success response\n assert_equal 'charge', response.params['object']\n assert response.params['paid']\n assert_match CHARGE_ID_REGEX, response.authorization\n end", "def errors\n p = build_payment\n p.valid?\n p.errors\n end" ]
[ "0.72056973", "0.70541024", "0.67874736", "0.6717485", "0.66636217", "0.66073775", "0.6573101", "0.6562755", "0.65247095", "0.65093184", "0.64394206", "0.64335907", "0.6397986", "0.6356284", "0.63264555", "0.6324921", "0.6274152", "0.6256668", "0.62176573", "0.621561", "0.6176363", "0.6176363", "0.6174619", "0.613878", "0.613728", "0.61298066", "0.612106", "0.6106291", "0.6105758", "0.6085767" ]
0.71355
1
Generates a neighbor of this state by randomly selecting a parameter and then changing it by a randomly selected delta
def neighbor &block factory = block || lambda { |o| State.new o } new_params = @o.merge( (p = @params.sample) => @o[p] + @deltas.call(p).sample ) legal(new_params)? factory.call(new_params) : neighbor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_neighbor\n # rand_num = (rand * neighbors.size).floor\n # rand_key = neighbors.keys[rand_num]\n # neighbors[rand_key]\n # rand_key\n @neighbors.first[0]\n end", "def random_neighbor\n if roomAdj\n # Choose neighboring adjacent room\n return roomAdj.to_a.sample \n end \n end", "def go_to_next(rng)\n choice = rng.rand(0...@neighbors.size)\n @neighbors[choice]\n end", "def next_location(rando)\n random = Random.new(rando.seed)\n @neighbors[random.rand(0...@neighbors.count)]\n end", "def mutate\n @weights = (1..@size).map { Random.rand(-0.5..0.5) }\n end", "def random_node\n @vertices.shuffle.first\n end", "def neighbor()\n m1 = random_match\n m2 = random_match\n find_best_permutation([:permutation_one, :permutation_two,\n :permutation_three, :permutation_four],\n m1, m2)\n self\n end", "def random_point_change\n if (@count % 2 == 0)\n @random_points = rand(100)\n else\n @random_points = @random_points\n end\n end", "def next_location(random)\n raise 'Error: No location connections to current location' unless @neighbors.count != 0\n rand_position = random.rand(@neighbors.count)\n move_location = @neighbors[rand_position]\n move_location\n end", "def rand_point()\n \n end", "def target_vertex(graph=@graph, new_vertex_rate=1.0)\n vertices = graph.vertices\n if new_vertex_rate < rand and vertices.size > 0\n target_vertex = vertices[rand(vertices.size)]\n else\n graph.vertices.build(label: new_dummy_label)\n end\n end", "def next\r\n if !@neighbors.count.zero?\r\n @neighbors[@random.rand(num_neighbors)]\r\n else\r\n nil\r\n end\r\n end", "def initialize(position_variation = 1..100)\n @position = rand(position_variation)\n end", "def next_node(n)\n w = @weights[n]\n index = 0\n wmax = w[-1][1]\n beta = @random.rand(2*wmax)\n while w[index][1] < beta do\n beta -= w[index][1]\n index = (index + 1) % w.length\n end\n return w[index][0]\n end", "def rand_direction\n rand*2-1\n end", "def mutate\n d=MyDriver.new\n d.clutch=@clutch.map {|c| \n c*(0.9+0.2*rand)\n }\n d.gas=@gas.map {|c| \n c*(0.9+0.2*rand)\n }\n d\n end", "def populate_random(n)\n n.times do\n set(rand(0...@x_size), rand(0...@y_size), :alive)\n end\n end", "def choose\n # mv = Move::VALUES.sample\n # self.move = Move.new(mv)\n # or easier\n self.move = Move.new(Move::VALUES.sample)\n end", "def random_node\n self.to_a.random\n end", "def move\n @position += MOVMENT_ALTERATIONS[rand(0..1)]\n end", "def generate\n # Vælg et tilfældigt koordinat til at starte med.\n random_start = [@prng.rand(@width),@prng.rand(@height)]\n \n # Opret en stak og læg det tilfældige koordinat på stakken.\n stack = Array.new\n stack.push random_start\n until stack.empty?\n # Tag koordinaterne fra det øverste element på stakken.\n x,y = stack.last\n # Marker cellen som besøgt.\n @grid[y][x].visited = true\n # Gem alle cellens nabo-celler.\n neighbors = Array.new\n neighbors.push [x, y-1] unless y-1 < 0 # Nord\n neighbors.push [x+1, y] unless x+1 >= @width # Øst\n neighbors.push [x, y+1] unless y+1 >= @height # Syd\n neighbors.push [x-1, y] unless x-1 < 0 # Vest\n # Sorter de naboer fra der allerede er blevet besøgt af algoritmen.\n neighbors.delete_if {|x, y| @grid[y][x].visited }\n # tjek om der er nogle ubesøgte naboer.\n if neighbors.any?\n # Vælg en tilfældig ubesøgt nabo.\n random_neighbor = neighbors.sample(random:@prng)\n # Forbind denne celle med den tilfældige nabo.\n connect stack.last, random_neighbor\n # Læg den tilfældige nabo øverst på stakken.\n stack.push random_neighbor\n else\n # Hvis der ingen naboer er, så tager den en celle af stakken.\n stack.pop\n end\n end\n end", "def change\n @last_change = if rand < @change_probability[:speed]\n change_speed; :speed\n else\n change_offset; :offset\n end\n end", "def random_restart\n @controllers.each{|sc| @current_offset[sc] = rand(@current_cycle_time || sc.cycle_time)}\n if @change_probability[:speed].nonzero?\n @coordinations.each do |coord|\n @current_speed[coord] = coord.default_speed + SPEED_CHANGE_OPTIONS_WITH_ZERO.rand\n end\n end\n full_evaluation # all coordinations change, must do full reevaluation\n end", "def setupNewParam(_seed)\n _param = {} ;\n @paramListIndex.each{|_entry|\n _name = _entry[:name] ;\n _param[_name] = ( _seed.key?(_name) ?\n _seed[_name] :\n @paramListTable[_name][_entry[:index]] ) ;\n }\n shiftIndex(@paramListIndex,0) ;\n return _param ;\n end", "def find_neighboorhood(current_solution_vc)\n # se repite hasta que encuentre un par de valores buenos\n # puts \"vc: \" + current_solution_vc.inspect\n\n # clonar el arreglo\n current_solution = current_solution_vc.clone\n\n begin\n i = rand(current_solution.length)\n j = rand(current_solution.length)\n end while (i == current_solution.first or j == current_solution.first or i == j)\n item1 = current_solution[i]\n swapped_item1 = item1\n item2 = current_solution[j]\n current_solution[i] = item2\n current_solution[j] = swapped_item1\n\n # puts \"vn: \" + current_solution.inspect\n return current_solution\n # puts \"item1: #{item1}\"\n # puts \"item2: #{item2}\"\n\nend", "def random\n CYCLE * rand\nend", "def move_type_random\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Random\n move_random\n when 4 # 1 step forward\n move_forward\n when 5 # Temporary stop\n @stop_count = 0\n end\n end", "def randomly_select_different(n)\n old_self = self\n list = []\n n.times do\n list << old_self.delete_at(rand * size)\n end\n list\n end", "def move_type_random\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Random\n move_random\n when 4 # 1 step forward\n move_forward\n when 5 # Temporary stop\n @stop_count = 0\n end\n end", "def revac_mutate(random, table, index, h)\n\n # Sort the values of this parameter for all vectors into ascending order\n # before calculating the upper and lower bounds of the mutation distribution\n # and drawing a new parameter value at uniform random.\n return Array.new(table[0].length) do |i|\n window = (0...table.length).sort { |x, y| table[x][i] <=> table[y][i] }\n position = window.find_index(index)\n window = [\n window[[position - h, 0].max],\n window[[position + h, table.length - 1].min]\n ]\n window = table[window[0]][i] .. table[window[1]][i]\n random.rand(window)\n end\n \nend" ]
[ "0.6356956", "0.6192738", "0.6010979", "0.5998278", "0.59272575", "0.58092684", "0.5757316", "0.57493526", "0.5747699", "0.573366", "0.5675287", "0.56358904", "0.56284016", "0.5599641", "0.556666", "0.5523831", "0.5496732", "0.54812914", "0.5456059", "0.54249495", "0.5402633", "0.5401709", "0.53932554", "0.5379898", "0.5365247", "0.53593534", "0.53563035", "0.5347247", "0.53445995", "0.5341297" ]
0.72736067
0
Renders a blocklike block of HTML from title and content. This method can be used from anywhere to display a block of HTML content with a title.
def html_blocklike_show(title, content) render('layouts/block', :title => title, :content => content) unless content.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end", "def html_block_show(block)\n title, content = send(block.class.to_s.underscore, block)\n html_blocklike_show(title, content)\n end", "def display_as_html(content, &block)\n content = content.presence || \"\"\n if content !~ /<\\w+[^>]>/\n content = content.gsub(\"\\n\", \"<br />\")\n end\n content_tag :div, :class => \"rtf\" do\n if block_given?\n concat(capture(&block))\n end\n concat(content.html_safe)\n end\n end", "def display_as_html(content, &block)\n content = content.presence || \"\"\n if content !~ /<\\w+[^>]>/\n content = content.gsub(\"\\n\", \"<br />\")\n end\n content_tag :div, :class => \"rtf\" do\n if block_given?\n concat(capture(&block))\n end\n concat(content.html_safe)\n end\n end", "def content\n @blocks.map {|b| b.render } * EOL\n end", "def content_for(*args,&block)\n if block\n helpers.content_for(*args,&block)\n else\n rawtext(helpers.content_for(*args))\n ''\n end\n end", "def title_block\n #displays a fancy title block for our program\n puts \"WELCOME TO... \"\n puts \"____ ____ _____ \"\n puts \"\\\\ \\\\ / /____ ____ __ __ / \\\\ ____ ____ __ __ \"\n puts \" \\\\ Y // __ \\\\ / \\\\| | \\\\/ \\\\ / \\\\_/ __ \\\\ / \\\\| | \\\\ \"\n puts \" \\\\ /\\\\ ___/| | \\\\ | / Y \\\\ ___/| | \\\\ | / \"\n puts \" \\\\___/ \\\\___ >___| /____/\\\\____|__ /\\\\___ >___| /____/ \"\n puts \" \\\\/ \\\\/ \\\\/ \\\\/ \\\\/ \"\n puts \" BY: MINH AND JUSTIN\"\nend", "def text_block(text)\n h(text).gsub(/\\n/, '<br/>').html_safe\n end", "def content\n call_block\n end", "def render_block(name, context, blocks = {}, use_blocks = true)\n # ob_start();\n display_block(name, context, blocks, use_blocks)\n # return ob_get_clean();\n end", "def body_content\n call_block\n end", "def block_html(raw)\n raw = unindent(raw)\n\n if md = raw.match(/\\<(.+?)\\>(.*)\\<(\\/.+?)\\>/m)\n open_tag, content, close_tag = md.captures\n \"<#{open_tag}>\\n#{recursive_render(unindent(content))}<#{close_tag}>\"\n else\n raw\n end\n end", "def tabbed_body(tab_name, display = true, &block)\n class_name = !display ? \"class = \\\"display-none tab\\\"\" : \"class = \\\"tab\\\"\"\n name = sanitize_latin_characters(tab_name.downcase.squeeze(\" \").strip.gsub(/ /, '_'))\n concat(\"<div #{class_name} id=\\\"#{name}\\\">\")\n yield\n concat(\"</div>\")\n end", "def content\n div :id => 'doc3' do\n div :id => 'hd' do\n render_top_line\n h1 @page_title || 'Missing :page_title' \n end\n div :id => 'bd' do\n render_body\n end\n div :id => 'ft' do\n render_footer\n end\n end\n end", "def content\n super\n @renderer = @widget.content\n div :id => 'doc3' do\n if @renderer.render? :header\n div :id => 'hd' do\n if @renderer.render? :top_line\n render_top_line\n end\n if @renderer.render? :title\n h1 @page_title || 'Missing :page_title'\n end \n end\n end\n div :id => 'bd' do\n render_body\n end\n if @renderer.render? :footer\n div :id => 'ft' do\n render_footer\n end\n end\n end\n end", "def parse_block_html; end", "def format_as_block_html(name, attr, body, indent); end", "def content_for(symbol, &block)\n content_blocks[symbol] << capture_haml(&block)\n end", "def container_card(title, &block)\n content_tag(:div, class: \"card card-accent-info\") do\n content_tag(:div, class: \"card-header\") do\n title\n end +\n content_tag(:div, class: \"card-block\") do\n capture(&block)\n end\n\n end\n end", "def content(data = {}, &block)\n @renderer.render(get_data(data), &block)\n end", "def page_title(title = nil, &block)\n render partial: 'shared/title', locals: {title:title, block: (block_given? ? capture(&block) : '')}\n end", "def content_outline record\n blocks = record.content_blocks if record.parsed_content.present?\n return unless blocks\n\n content_tag :ul, class: 'content-outline' do\n # Loop through each block in the record, and generate a short piece of text describing that block.\n for block in blocks\n case block['type']\n when 'paragraph'\n text = block['data']['text']\n if block['data']['type'] == 'header'\n result = tag.strong(text)\n else\n result = block['data']['text'].truncate(200)\n end\n\n when 'list'\n result = ''\n result = \"<em>#{translate('admin.javascript.blocks.list.type.contents')}</em><br>\" if block['data']['type'] == 'contents'\n result += block['data']['items'].map { |i|\n depth = (i.is_a?(Hash) ? (i.dig('level') || 'h2')[1].to_i : 2) - 1\n text = i.is_a?(Hash) ? i['text'] : i\n \"#{'—' * depth} #{text}\".truncate(60)\n }.join('<br>')\n result = sanitize(result, tags: %w[em br])\n\n when 'layout'\n result = block['data']['items'].map { |i| \"— #{i['title']}\" }.join('<br>')\n result = sanitize(result, tags: %w[br])\n\n when 'catalog'\n result = translate(\"activerecord.models.#{block['data']['type'].singularize}.other\")\n result += \": #{translate('admin.content.items', count: block['data']['items'].length)}\"\n\n when 'textbox'\n result = ''\n result += \"<strong>#{block['data']['title']}</strong><br>\" if block['data']['title'].present?\n result += \"#{block['data']['text']&.truncate(60)}<br>\" if block['data']['text'].present?\n result += tag.span(\"[#{block['data']['action']}] → \") + tag.small(block['data']['url']) if block['data']['action'].present? && block['data']['url'].present?\n result = sanitize(result, tags: %w[strong br])\n\n when 'action'\n result = tag.span(\"[#{block['data']['action']}] → \") + tag.small(block['data']['url']) if block['data']['action'] && block['data']['url']\n\n when 'media'\n result = if block['data']['type'] == 'image'\n block['data']['items'].map { |i| \"#{tag.i(class: 'image icon')} <a href=\\\"#{i['image']['preview']}\\\" target=\\\"_blank\\\">#{i['image']['preview'].split('/').last}</a>#{\" - \\\"#{i['caption'].truncate(100)}\\\"\" if i['caption']}\" }\n elsif block['data']['type'] == 'audio'\n block['data']['items'].map { |i| \"#{tag.i(class: 'volume up icon')} <a href=\\\"#{i['audio']['preview']}\\\" target=\\\"_blank\\\">#{i['title']}</a>\" }\n elsif block['data']['type'] == 'youtube'\n tag.span('[YouTube Embed] → ') + tag.small(\"https://www.youtube.com/watch?v=#{block['data']['youtube_id']}\") if block['data']['youtube_id'] # TODO: Translate\n else\n block['data']['items'].map { |i| \"#{tag.i(class: \"#{block['data']['type']} icon\")} #{i['name']} (#{i['id']})\" }\n end\n result = result.join('<br>') if result.kind_of?(Array)\n result = sanitize(result, tags: %w[i a br], attributes: %w[href class target])\n\n when 'vimeo'\n result = block['data']['items'].map { |i| \"#{tag.i(class: 'video icon')} #{i['title']}\" }.join('<br>')\n result = sanitize(result, tags: %w[i a br])\n\n when 'whitespace'\n separators = {\n large: '==',\n medium: '—',\n small: '--',\n }\n\n result = separators[block['data']['size'].to_sym] * 3\n\n else\n concat block.inspect\n end\n\n concat content_tag :li, result, class: \"content-outline__#{block['type']} content-outline__#{block['type']}--#{block['data']['type']}\"\n end\n end\n end", "def content\n case @context\n when :preamble, :open\n @blocks.map {|b| b.render }.join\n # lists get iterated in the template (for now)\n # list items recurse into this block when their text and content methods are called\n when :ulist, :olist, :dlist, :colist\n @buffer\n when :listing, :literal\n apply_literal_subs(@buffer)\n when :pass\n apply_passthrough_subs(@buffer)\n when :admonition, :example, :sidebar, :quote, :verse\n if !@buffer.nil?\n apply_para_subs(@buffer)\n else\n @blocks.map {|b| b.render }.join\n end\n else\n apply_para_subs(@buffer)\n end\n end", "def main_content\n yield if block_given?\n end", "def box(title=nil, options={}, &block)\n title = I18n.t(\"admin.boxs.#{title}\", :default => title.to_s.humanize) if title.is_a?(Symbol)\n subtitle = options.delete(:subtitle)\n options[:style] ||= \"width:100%;\"\n options[:start] ||= :open\n concat_content (<<-HTML).gsub(/ {10}/, '')\n <div class=\"#{options[:class]}\" style=\"options[:style]\">\n <div class=\"x-box\">\n <div class=\"x-box-tl\">\n <div class=\"x-box-tr\">\n <div class=\"x-box-tc\">&nbsp;</div>\n </div>\n </div>\n <div class=\"x-box-ml\">\n <div class=\"x-box-mr\">\n <div class=\"x-box-mc\">\n <div id=\"x-body-title\" style=\"#{\"cursor:pointer\" if options[:collapsible]}\" onclick=\"#{\"Admin.app.collapseBoxes(this);\" if options[:collapsible]}\">\n #{\"<h3 style=\\\"margin-bottom:0px;padding-bottom:0px;float:left;\\\">\"+title+\"</h3>\" if title.present?}\n #{\"<div style=\\\"float:right\\\"><em>\"+subtitle+\"</em></div>\" if subtitle.present?}\n #{\"<br class=\\\"clear\\\" />\" if title.present? || subtitle.present?}\n #{\"<div style=\\\"font-size:0px\\\">&nbsp;</div>\" if title.present? || subtitle.present?}\n </div>\n <div class=\"#{\"x-box-collapsible\" if options[:collapsible]}\" style=\"width:99%;#{\"display:none\" if options[:collapsible] && options[:start] == :close}\">\n #{\"<div style=\\\"font-size:10px\\\">&nbsp;</div>\" if title.present? || subtitle.present?}\n #{capture_html(&block)}\n </div>\n </div>\n </div>\n </div>\n <div class=\"x-box-bl\">\n <div class=\"x-box-br\">\n <div class=\"x-box-bc\">&nbsp;</div>\n </div>\n </div>\n </div>\n </div>\n HTML\n end", "def pandoc_title_block( headers )\n title_block = \"\"\n headers.each do | header |\n if header[0].casecmp(\"title\") == 0\n title_block << \"% \" + header[1] + \"\\n\"\n headers.delete( header )\n elsif header[0].casecmp(\"author\") == 0\n title_block << \"% \" + header[1] + \"\\n\"\n headers.delete( header )\n elsif header[0].casecmp(\"date\") == 0\n title_block << \"% \" + header[1] + \"\\n\\n\"\n headers.delete( header )\n end\n end\n return title_block\n end", "def html_block!\n @page << @html_block\n end", "def yield_content(key, *args) \n blocks = content_blocks[key.to_sym]\n return nil if blocks.empty?\n blocks.map { |content|\n capture_html(*args, &content)\n }.join\n end", "def cms_block_render(identifier, blockable = @cms_page)\n return '' unless tag = ComfortableMexicanSofa::ViewMethods.cms_block_tag(identifier, blockable)\n render :inline => ComfortableMexicanSofa::Tag.process_content(blockable, tag.render)\n end", "def template(group_title, snippet_title, comment, code)\n rows = []\n rows << [print_group_title(group_title)]\n rows << :separator\n rows << [print_snippet_title(snippet_title)]\n unless comment.text.length == 0\n rows << :separator\n rows << [print_comment(comment.text)]\n end\n\n puts Terminal::Table.new(rows: rows)\n puts print_code(code.text)\n end" ]
[ "0.71504974", "0.6965838", "0.68358856", "0.68358856", "0.64900947", "0.64826816", "0.61566854", "0.61262363", "0.61181176", "0.6089423", "0.6080067", "0.60370106", "0.601753", "0.59882444", "0.59811985", "0.59563714", "0.5922628", "0.59192467", "0.59129065", "0.5907278", "0.58915997", "0.58865035", "0.5873542", "0.58499795", "0.58420503", "0.58332324", "0.5830763", "0.57664317", "0.5763229", "0.57140946" ]
0.7968744
0
Nonblocking request for service_addresses.
def service_addresses!(service, index = nil) meta = {} resp = _service.get(service, :all, {index: index, wait: '2s'}, meta) if (nindex = meta[:index]) != index addresses = resp.map do |address| { id: address.ServiceID, ip: address.ServiceAddress, node: address.Node, port: address.ServicePort } end [addresses, nindex] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end", "def get_contract_addresses\n service_response = ClientManagement::GetContractAddresses.new(params).perform\n render_api_response(service_response)\n end", "def service_addresses(service, index = nil)\n loop do\n addresses, nindex = service_addresses!(service, index)\n return [addresses, nindex] if addresses && nindex\n end\n end", "def addresses\n @client.request('getaddressesbyaccount', name)\n end", "def service_request(service); end", "def perform(params)\n send_request_of_type(\n 'get',\n GlobalConstant::SaasApi.get_addresses_by_uuids,\n params\n )\n end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def init_addresses\n @@client.describe_addresses.addresses\n end", "def getaddressesbyaccount(account)\n request :getaddressesbyaccount, account\n end", "def addresses\n IbmCloudRest.get \"#{@uri}/addresses\"\n end", "def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end", "def service_address(name)\n @services.fetch(name) do \n raise ArgumentError,\"no address for service #{name.inspect}\"\n end\n end", "def addresses(service_arg=service, options={})\n addresses_method = self.method(:addresses_dhcp)\n # check if ruby-libvirt was compiled against a new enough version\n # that can use dhcp_leases, as otherwise it will not provide the\n # method dhcp_leases on any of the network objects.\n has_dhcp_leases = true\n begin\n service.networks.first.dhcp_leases(self.mac)\n rescue NoMethodError\n has_dhcp_leases = false\n rescue\n # assume some other odd exception.\n end\n\n # if ruby-libvirt not compiled with support, or remote library is\n # too old (must be newer than 1.2.8), then use old fallback\n if not has_dhcp_leases or service.libversion() < 1002008\n addresses_method = self.method(:addresses_ip_command)\n end\n\n # replace current definition for this instance with correct one for\n # detected libvirt to perform check once for connection\n (class << self; self; end).class_eval do\n define_method(:addresses, addresses_method)\n end\n addresses(service_arg, options)\n end", "def lookup_addresses(data)\n return @servers\n end", "def each_address(&blk) # :yields: url\n addresses.each(&blk)\n end", "def service_list\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth user, passwd\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end", "def addresses\n query(:address)\n end", "def getaddressesbyaccount(account)\n @api.request 'getaddressesbyaccount', account\n end", "def callback_addresses\n request_api = \"#{api_call('api')}/namaster\"\n url = URI.parse(request_api)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = USE_SSL\n http = Net::HTTP::Get.new(url.request_uri)\n http['apiKey'] = api_call('key')\n res = req.request(http)\n result = JSON.parse(res.body)\n if Address.save_name_and_address_from_api(result)\n render :nothing => true, :layout => false, :status => 201\n else\n render :nothing => true, :layout => false, :status => 401\n end\n end", "def service_requests_list\n @service_requests = ServiceRequest.get_all_service_requests(@page)\n end", "def user_service_request\n @service_requests = @user.get_user_service_requests(@page)\n end", "def serve_service\n raise 'Service was already started' unless stopped?\n\n # set flag to signal shutdown by stop / shutdown command\n @shutdown = false\n\n # instantiate the service for all @addresses (ip_address:port)\n @addresses.each do |address|\n # break address into ip_address and port and serve service\n ip_address = address.rpartition(':').first\n port = address.rpartition(':').last\n serve_service_on_ip_address_and_port(ip_address, port)\n end\n end", "def show_addresses(**params)\n get('addresses', params)\n end", "def use_default_address\n return unless self.address\n self.address = client.addresses.first\n end", "def index\n @client_addresses = ClientAddress.all\n end", "def get_addresses\n parsed_script.get_addresses\n end", "def list_addresses\n Address.list(@id)\n end", "def each_service(&block)\n\t\tservices.each do |service|\n\t\t\tblock.call(service)\n\t\tend\n\tend", "def address_servers(options = {})\n servers_in :address, options\n end", "def all(options={})\n response = MLS.get('/addresses', options)\n MLS::Address::Parser.parse_collection(response.body)\n end" ]
[ "0.73342156", "0.6139034", "0.6009499", "0.5953351", "0.590231", "0.57831436", "0.5773047", "0.5744745", "0.5705205", "0.5700011", "0.56882113", "0.5545608", "0.5545509", "0.5526167", "0.5511673", "0.5460535", "0.54573846", "0.5425588", "0.54134387", "0.5359847", "0.5309535", "0.53065115", "0.530449", "0.5270057", "0.5260079", "0.5255673", "0.5201903", "0.51637083", "0.5162603", "0.51545745" ]
0.6599183
1
def twitter_url_exists? return false if twitter == "" || twitter == nil return true end
def facebook_url_exists? return false if facebook == "" || twitter == nil return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter?\n false\n end", "def twitter?; twitter.to_s != \"\" end", "def twitter_profile?\n @network = current_user.network ||= Network.new\n !(@network.twitter.nil? || @network.twitter.blank?)\n end", "def twitter?\n self.twitter_token && self.twitter_secret\n end", "def twitter?\n self.provider == 'twitter'\n end", "def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end", "def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end", "def twitter?\n provider_name == 'Twitter'\n end", "def valid_tweet(tweet)\n\t\t@url = tweet.text\n\n\t\tif @url.include? \"#radio\"\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def connected_to_twitter?\n twitter_token && twitter_secret\n end", "def has_website?\n !url.blank?\n end", "def url_filled?\n !url.blank?\n end", "def url?\n !url.nil?\n end", "def has_social_links?\n tauth = self.authorizations.where(:provider => 'Twitter')\n fauth = self.authorizations.where(:provider => 'Facebook')\n if tauth.present? || fauth.present?\n return true # Return true if true\n end\n false # Otherwise, return false\n end", "def usable_link?(type, url)\n case type\n when :twitter\n # twitter users starting with _ (like _NapervilleIl) are weatherbugs\n # if the username does not start with _ it is a valid username\n (url.match(/^http:\\/\\/(?:www\\.)?twitter.com[^\\/]*\\/[^_]/)) && (! url.match(/\\/share|\\/goodies/))\n when :facebook\n url.match(/^http:\\/\\/(?:www\\.)?facebook.com/)\n else\n true\n end\n end", "def twitter_login?\n\t\tself.uid ? true : false\n\tend", "def is?(url)\n return true if url.match('https?://twitter\\.com.*status/(\\d+)')\n end", "def share_to_twitter?\n self.tweet_id == TWSharing::Underway\n end", "def is_twitter_taken(db, twitter)\n\n # Return true if twitter is on database\n if db.execute('SELECT 1 FROM users WHERE twitter=?', twitter).length > 0 then\n return true\n else\n return false\n end\nend", "def check_twitter_credentials\n if session['twitter_token'].blank? || session['twitter_secret'].blank?\n redirect_to new_user_registration_path, :error => \"Debes linkear tu cuenta de twitter antes de continuar\" and return\n end\n end", "def has_github?\n !github_url.blank?\n end", "def isTwitter?\n self.category =~ /(tweet|twitter|suggested)/i\n end", "def twitter_url; \"https://twitter.com/#{twitter}\" end", "def email_required?\n provider != 'twitter'\n end", "def checkURL(twitter_user)\n\tchecker = twitter_user.to_s\n\tif checker.start_with?(\"http://\") or checker.start_with?(\"https://\") or checker.start_with?(\"twitter.\")\n\t\treturn checker[checker.rindex('/')+1..checker.length]\n\telse \n\t\treturn checker\n\tend\nend", "def contains_eb_blog_post(tweet)\n url = tweet.match(/http:\\/\\/t\\.co\\/\\w* /).to_s.chomp\n return false if url.empty?\n final_url = get_final_url(url)\n return (final_url.match(/http:\\/\\/blog.eventbrite.com/) ? final_url : false)\nend", "def twitter_register_enabled?\n Figaro.env.respond_to?(:twitter_key) && Figaro.env.respond_to?(:twitter_secret)\n end", "def real_url?\n url && url.present? && url != \"#\"\n end", "def url?\n !urn?\n end", "def valid_url?\n !Sailpoint.config.url.blank?\n end" ]
[ "0.8026088", "0.79164547", "0.75957566", "0.7543868", "0.736628", "0.73557776", "0.73441595", "0.7219426", "0.71831214", "0.71710753", "0.71428806", "0.70775014", "0.69464326", "0.69257295", "0.68999577", "0.6872689", "0.6865414", "0.6845968", "0.68290126", "0.68053347", "0.67969936", "0.67807245", "0.675586", "0.6754107", "0.6730914", "0.6712571", "0.668866", "0.6675748", "0.6665494", "0.6626727" ]
0.9134085
0
VALIDATE/CREATE CountryName for city as when artist is created/updated
def ensure_CountryName if self.CountryName == "" self.CountryName = "United States" end if ["AB", "BC", "MB", "NB"].include?(self.State) self.CountryName = "Canada" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_quick_city_name(hash,name)\n corrected_name = name.strip.titleize\n if[\n \"Houston\",\n \"Katy\",\n \"Spring\",\n \"Austin\",\n \"Sugar Land\",\n \"Blanco\",\n \"Portland\",\n \"Brenham\",\n \"Conroe\",\n \"Meadows Place\",\n \"League City\",\n \"Pearland\",\n \"College Station\",\n \"Sugarland\",\n \"Bee Cave\",\n \"Round Rock\",\n \"Beecave\",\n \"San Marcos\",\n \"San Antonio\"].include? corrected_name\n hash[:city] = corrected_name\n else\n return false\n end\n true\n end", "def save_city(api_city_data)\n unless city = City.find_by_name(api_city_data['name'])\n city_params = {\n :name => api_city_data['name'],\n :latitude => api_city_data['coord']['lat'],\n :longitude => api_city_data['coord']['lon'],\n :iso_code_alpha_2 => api_city_data['country'],\n :population => api_city_data['population']\n }\n\n city = City.new(city_params)\n unless city.save\n raise \"Cant save city\"\n end\n city\n end\n city\n end", "def hard_code_to_create_country(iso_name, iso, iso3, name, numcode, states_required, zipcode_required)\n @country = Spree::Country.create(iso_name: iso_name, iso: iso, iso3: iso3, name: name, numcode: numcode, states_required: states_required, zipcode_required: zipcode_required)\n if @country.save\n puts 'Successful!'\n else\n puts @country.errors.full_messages\n end\n end", "def normalize_country\n c = @data_object.add_country.strip\n\n c = c.downcase.gsub(/[\\. ]/, '').sub(/^the/, '')\n \n if US_MAP[c]\n @data_object.add_country = USA\n end\n\n end", "def create\n @city = City.new(params[:city])\n @city.state_id = params[:state_id]\n \n respond_to do |format|\n if @city.save\n format.html { redirect_to country_state_cities_path, :notice => t('controller_message.inserted') }\n format.json { render :json => @city, :status => :created, :location => @city }\n else\n @state = State.find(params[:state_id])\n @country = Country.find(@state.country_id)\n format.html { render :action => \"new\" }\n format.json { render :json => @city.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save_city\n user = current_user\n params.permit(:name, :country_name, :province_name, :state_name, :country_id, :province_id, :state_id, :id, :name, :access_token, :state)\n if user.admin?\n if !(params[:name].nil? || params[:country_name].nil? || params[:province_name].nil? || params[:state_name].nil?)\n city = City.where(\n name: params[:name],\n country_name: params[:country_name],\n province_name: params[:province_name],\n state_name: params[:state_name]).first\n if (city.nil?) # Insert\n city = City.new(\n name: params[:name],\n country_id: BSON::ObjectId.from_string(params[:country_id]),\n country_name: params[:country_name],\n province_id: BSON::ObjectId.from_string(params[:province_id]),\n province_name: params[:province_name],\n state_id: BSON::ObjectId.from_string(params[:state_id]),\n state_name: params[:state_name])\n if city.save\n render json: {status: 'SUCCESS', message:'Saved City', data:city},status: :ok\n else\n render json: {status: 'ERROR', message:'City not saved', data: nil},status: :unprocessable_entity\n end\n else\n render json: {status: 'ERROR', message:'City already exists', data: city},status: :unprocessable_entity\n end\n end \n elsif user.admin_country?\n if !(params[:name].nil? || params[:country_name].nil? || params[:province_name].nil? || params[:state_name].nil?)\n city = City.where(\n name: params[:name],\n country_name: params[:country_name],\n province_name: params[:province_name],\n state_name: params[:state_name]).first\n if (city.nil?) # Insert\n if (user['country_id'] == BSON::ObjectId.from_string(params[:country_id]))\n city = City.new(\n name: params[:name],\n country_id: BSON::ObjectId.from_string(params[:country_id]),\n country_name: params[:country_name],\n province_id: BSON::ObjectId.from_string(params[:province_id]),\n province_name: params[:province_name],\n state_id: BSON::ObjectId.from_string(params[:state_id]),\n state_name: params[:state_name])\n if city.save\n render json: {status: 'SUCCESS', message:'Saved City', data:city},status: :ok\n else\n render json: {status: 'ERROR', message:'City not saved', data: nil},status: :unprocessable_entity\n end\n else\n render json: {status: 'ERROR', message:'Action not allowed', data: nil},status: :unprocessable_entity \n end\n else\n render json: {status: 'ERROR', message:'City already exists', data: city},status: :unprocessable_entity\n end\n end \n end \n end", "def country(code, name); 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 set_city\n end", "def define_city\n @city = Faker::Address.city\n @city = '' unless @set_blank == false\n end", "def create\n @city = City.new(city_params)\n @city.use_for_api=@city.attributes.slice('name', 'city_id', 'lat', 'lng', 'zip_code').to_a.detect { |a| !a[1].blank? }[0]\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end", "def has_city?(city_name)\n\t\tcity(city_name).present?\n\tend", "def create\n @city = City.new(:name => city_params[:name].strip, :state_id => city_params[:state_id])\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render action: 'show', status: :created, location: @city }\n else\n format.html { render action: 'new' }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @country = Country.find_by_id(params[:city][:country_id])\n if !@country.nil?\n @region = @country.regions.find_by_id(params[:city][:region_id])\n if !@region.nil?\n @city = City.new(params[:city])\n else\n flash[:notice] = \"Region not found\"\n return redirect_to country_path(@country)\n end\n else\n flash[:notice] = \"Country not found\"\n return redirect_to countries_path\n end\n\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render json: @city, status: :created, location: @city }\n else\n format.html { render action: \"new\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_to_db(str, data)\n Country.create(query: str.upcase, country_name: data)\n end", "def set_City(value)\n set_input(\"City\", value)\n end", "def set_City(value)\n set_input(\"City\", value)\n end", "def set_City(value)\n set_input(\"City\", value)\n end", "def add_city(city_name='Toronto')\n city = City.find_by(name: city_name)\n self.cities << city\n end", "def create\n @city = City.new(params[:city])\n @country = Country.find(params[:country_id])\n\n @city.country_id,@city.lang=@country.id,@country.lang\n @city.assign_idents\n managing_photos\n\n respond_to do |format|\n if @city.save\n flash[:notice] = 'Город добавлен.'\n format.html { redirect_to countries_path }\n format.xml { render :xml => @city, :status => :created, :location => @city }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end", "def enter_city_pair\n\n end", "def city_name\n\t\treturn \"Mysore\"\n\tend", "def city_params\n params.require(:city).permit(:country_id, :name, :description, :latitude, :longitude)\n end", "def has_city?\n self.errors.add :base, \"Ad must have at least one city.\" if self.cities.blank?\n end", "def set_City(value)\n set_input(\"City\", value)\n end", "def set_City(value)\n set_input(\"City\", value)\n end", "def set_City(value)\n set_input(\"City\", value)\n end", "def set_City(value)\n set_input(\"City\", value)\n end", "def set_City(value)\n set_input(\"City\", value)\n end", "def set_City(value)\n set_input(\"City\", value)\n end" ]
[ "0.64925826", "0.6492329", "0.6460233", "0.6402264", "0.62617785", "0.6249138", "0.6213983", "0.61953133", "0.6180432", "0.6175494", "0.6132899", "0.6120531", "0.6089509", "0.60081226", "0.59451073", "0.5918122", "0.5918122", "0.5918122", "0.5895548", "0.5880662", "0.58754593", "0.5867095", "0.5864948", "0.5792973", "0.5791814", "0.5791814", "0.5791814", "0.5791814", "0.5791814", "0.5791814" ]
0.6672219
1
Branches this environment and puts some additional explicit definitions. This method is provided for (with ...) expressions and should not be overriden by subclasses.
def branch(defs) Explicit.new(defs, self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_environment (initial_vars=nil)\n\n @environment_id = @fei.dup\n @environment_id.expression_name = EN_ENVIRONMENT\n\n parent_fei = nil\n parent = nil\n\n parent, _fei = get_expression_pool.fetch(@parent_id) \\\n if @parent_id\n\n parent_fei = parent.environment_id if parent\n\n env = Environment.new_env(\n @environment_id, parent_fei, nil, @application_context, nil)\n\n env.variables.merge!(initial_vars) if initial_vars\n\n env[@fei.wfname] = self.raw_representation \\\n if (not @parent_id) and (self.is_a?(RawExpression))\n #\n # keeping track of the raw representation\n # of the top expression (for top recursion)\n\n env.store_itself\n\n env\n end", "def environment(environment); end", "def apply_environment_overrides\n @format = env(:format, @format)\n @autopath = env(:autopath, @autopath)\n @files = env(:files, @files)\n @match = env(:match, @match)\n @tags = env(:tags, @tags)\n @units = env(:units, @units)\n @requires = env(:requires, @requires)\n @loadpath = env(:loadpath, @loadpath)\n end", "def body= exp\n expect :defn, :defs, :class, :module\n @my_hash_value = nil\n\n case self.node_type\n when :defn, :class\n index = 3\n when :defs\n index = 4\n when :module\n index = 2\n end\n\n self.slice!(index..-1) # Remove old body\n\n if exp.first == :rlist\n exp = exp[1..-1]\n end\n\n # Insert new body\n exp.each do |e|\n self[index] = e\n index += 1\n end\n end", "def __branch(arg)\n case arg\n when ::Hash then TupleScope.new(arg, [], self)\n else\n Kernel::raise NotImplementedError, \"Unable to branch with `#{arg}`\"\n end\n end", "def env=(environment); end", "def env=(environment); end", "def to_upper_space!\n # First recurse.\n # On the sub scopes.\n self.each_scope(&:to_upper_space!)\n # On the behaviors.\n self.each_behavior(&:to_upper_space!)\n \n # Then extract the declarations from the sub scope.\n decls = self.each_scope.map(&:extract_declares!)\n # And do the same with the behaviors'.\n decls << self.each_behavior.map(&:extract_declares!)\n\n # Reinsert the extracted declares to self.\n decls.flatten.each do |decl|\n if decl.is_a?(Type) then\n self.add_type(decl)\n elsif decl.is_a?(SystemT) then\n self.add_systemT(decl)\n elsif decl.is_a?(SignalI) then\n self.add_inner(decl)\n elsif decl.is_a?(SystemI) then\n self.add_systemI(decl)\n else\n raise AnyError, \"Internal error: invalid class for a declaration: #{decl.class}\"\n end\n end\n\n # Extract the behaviors of the sub scopes.\n behs = self.each_scope.map(&:extract_behaviors!).flatten\n # Reinsert them to self.\n behs.each { |beh| self.add_behavior(beh) }\n\n # Extract the connections of the sub scopes.\n cnxs = self.each_scope.map(&:extract_connections!).flatten\n # Reinsert them to self.\n cnxs.each { |beh| self.add_connection(beh) }\n\n # Now can delete the sub scopes since they are empty.\n self.each_scope.to_a.each { |scope| self.delete_scope!(scope) }\n end", "def apply_environment!(hook_context, env); end", "def define_dep!\n @context = template.context_class.new self, &@block\n context.define!\n @dep_defined = true\n end", "def base_environment\n environment[:all] || (next_library.nil? ? {} : next_library.base_environment)\n end", "def branch; end", "def initial_definitions\n definitions = Definition::RubyObject.new(\n :name => 'root',\n :type => :root,\n :parents => [RubyLint::VirtualMachine.global_constant('Kernel')],\n :instance_type => :instance\n )\n\n definitions.merge(RubyLint::VirtualMachine.global_scope)\n\n definitions.add(:keyword, 'self', definitions)\n\n return definitions\n end", "def environment; end", "def env\n super.merge(hacked_env)\n end", "def scope\n @env.unshift({})\n begin\n yield\n ensure\n @env.shift\n raise \"You went too far unextending env\" if @env.empty?\n end\n end", "def on_defined(node)\n pushing(\n [@redo_stack, nil],\n [@break_stack, nil],\n [@retry_stack, nil]\n ) { super }\n end", "def _post_eval\n @environments << @env if @env_used\n @env = nil\n @options = nil\n end", "def all\n @env.reverse.inject { |env, scope| env.merge scope }\n end", "def define\n description <<~str\n The branches your build will be run on.\n str\n\n # examples <<~str,\n # branch: master\n # str\n # <<~str,\n # branch:\n # only: master\n # except: unstable\n # str\n # <<~str,\n # branch:\n # only:\n # - master\n # - development\n # except:\n # - unstable\n # - experiment\n # str\n\n normal\n prefix :only\n\n map :only, to: :seq\n map :except, to: :seq, alias: :exclude\n\n export\n end", "def precedences &blk\n PrecedenceBuilder.new(self).instance_eval(&blk)\n end", "def make_base_env(klass)\n TypeEnv::BaseTypeEnv.new(klass)\n end", "def definitions; end", "def definitions; end", "def expand_elses(branch); end", "def expand_elses(branch); end", "def build_everything\n @defs.keys.each { |k| self[k] }\n end", "def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n }\n end", "def apply_environment_defaults\n @format = env(:format, @format) if @format.nil?\n @autopath = env(:autopath, @autopath) if @autopath.nil?\n @files = env(:files, @files) if @files.empty?\n @match = env(:match, @match) if @match.empty?\n @tags = env(:tags, @tags) if @tags.empty?\n @units = env(:units, @units) if @units.empty?\n @requires = env(:requires, @requires) if @requires.empty?\n @loadpath = env(:loadpath, @loadpath) if @loadpath.empty?\n end", "def to_upper_space!\n # Recurse on the statements.\n self.each_statement(&:to_upper_space!)\n\n # Extract the declares from the statements.\n decls = self.each_statement.map(&:extract_declares!)\n\n # Reinsert the extracted declares to self.\n decls.flatten.each { |decl| self.add_inner(decl) }\n end" ]
[ "0.52933764", "0.5286487", "0.528187", "0.51998067", "0.51785547", "0.5163257", "0.5163257", "0.5088034", "0.5083556", "0.4988153", "0.49532187", "0.49175993", "0.49129614", "0.49030185", "0.48869172", "0.4878474", "0.48570415", "0.48296884", "0.48217487", "0.4812493", "0.4803672", "0.48025933", "0.47968316", "0.47968316", "0.47827423", "0.47827423", "0.47724032", "0.47720286", "0.4771998", "0.47347593" ]
0.55452096
0
update the state of this object, and then delegate to the update on the wrapped object if that is a necessary part of the contract. NOTE: Most of the time, you want to read the state transition callbacks and ignore the complexity of this method.
def update(*args) # args only necessary for delegation load_wrapped_object() # => @wrapped_object # delegate to wrapped object if :update is part of the contract if !@wrapped_object.nil? and @contract.include? :update # TODO: maybe memoize the invariant? could get bad if @contact is long protect_runtime_errors do @wrapped_object.update *args end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @state_lock.synchronize do\n @state = yield @state\n end\n end", "def update_state\n raise \"Nothing to do\"\n end", "def perform_state_update\n return unless state_changed?\n\n return if @ignore_state_changes\n\n case state_change\n when %w(mill_build buyer_unclaimed)\n transition_mill_build_to_buyer_unclaimed\n when %w(buyer_unclaimed buyer_build)\n transition_buyer_unclaimed_buyer_build\n when %w(buyer_build pending)\n transition_buyer_build_to_pending\n when %w(pending ordered)\n transition_pending_to_ordered\n when %w(ordered closed)\n transition_ordered_to_closed\n end\n end", "def update\n raise NotImplemented\n end", "def update\n \t@currentState.update\n\tend", "def call_needs_update(next_params, next_state)\n component = self\n next_params.define_singleton_method(:changed?) do\n component.props_changed?(self)\n end\n next_state.define_singleton_method(:changed?) do\n component.native_state_changed?(next_state)\n end\n needs_update?(next_params, next_state)\n end", "def mirror_state\n super\n end", "def method_missing(method, *args, &block)\n # ensure the state is initialized before calling any methods\n init unless initialized?\n if @state.respond_to?(method)\n @state.send(method, *args, &block)\n else\n super\n end\n end", "def update!(**args)\n @state_sync_method = args[:state_sync_method] if args.key?(:state_sync_method)\n end", "def _update(*)\n fail NotImplementedError\n end", "def update!\n update_totals\n update_payment_state\n # update_adjustments\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n \n update_attributes_without_callbacks({\n :state => \"complete\"\n }) \n \n logger.info 'UPDATED ORDER'\n # update_hooks.each { |hook| self.send hook }\n end", "def method_missing(method_symbol, *args, &block)\n if block.nil? && args.length == 1 && !method_symbol.match(/^to_/)\n self.class.attribute method_symbol, kind_of: args[0].class\n add_state_attr(method_symbol)\n send(method_symbol, args[0]) unless args[0].nil?\n else\n super\n end\n end", "def update!\n return if locked? || originator.nil?\n originator.update_adjustment(self, source)\n end", "def update(peer, proxy)\n\t\tsuper\n\t\tif happened && !proxy.happened?\n\t\t proxy.instance_eval { @happened = true }\n\t\tend\n\t end", "def update_state!\n case @state\n when STARTING_TRANSACTION_STATE\n @state = TRANSACTION_IN_PROGRESS_STATE\n when TRANSACTION_COMMITTED_STATE, TRANSACTION_ABORTED_STATE\n @state = NO_TRANSACTION_STATE\n end\n end", "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "def update!\n return if locked?\n set_eligibility\n if originator.present?\n originator.update_adjustment(self, source)\n end\n end", "def update\n raise NotImplementedError\n end", "def update\n raise NotImplementedError\n end", "def update(instance)\n raise NotImplementedError, 'Expected adapter to override `update`'\n end", "def update\n super\n @ucActStates.update()\n end", "def voice_state_update(attributes = {}, &block)\n register_event(VoiceStateUpdateEvent, attributes, block)\n end", "def chain_state\n super\n end", "def update\n raise NotImplementedError\n end" ]
[ "0.6230203", "0.6148862", "0.6096569", "0.5843052", "0.5705288", "0.5662664", "0.5637792", "0.5616954", "0.5577694", "0.5562994", "0.55574477", "0.55291516", "0.5527059", "0.55223966", "0.55134934", "0.55049336", "0.55049336", "0.55049336", "0.55049336", "0.55049336", "0.55049336", "0.55049336", "0.5492326", "0.5470842", "0.5470842", "0.5433958", "0.5428515", "0.541703", "0.5410033", "0.54066706" ]
0.6467465
0
Replace running Snippet classes with updated versions (binds should always happen before loads) NOTE: Reload should NOT be implemented with a combination of load / unload. (1) you need different debug information. (2) reloading involves transplanting data from the old instance, to the new one.
def reload(obj) # (each time a Snippet is reloaded, the class ID will change) # NOTE: Sometimes this replaces working code with broken code. # That's fine. Always want what's current, even if it's broken. # ASSUME: Only one class definition per file. # ^ This check is enforced above, after loading new files. puts "Reloading Snippet defined in: #{@file}" print " " unload(kill:false) print " " load(obj) # Snippets need to be anonymous, because that allows all contained # constants to easily be thrown away (GCed) when new versions are loaded. # The Object.new -> metaclass style allows both contained constants, # and contaned Class declarations to be completely swept away on reload. # (TODO: source the sinatra live reload article, and my personal experiments with constant binding) # NOTE: Now that @file and @save_directory are being saved on the DynamicObject wrapper class, instead of on the callback instance, you likely don't have to copy the value of @save_directory from the old instance. This means that #reload and #load are exactly the same. # TODO: document that methods like #bind, which are not part of the method contract passed to the wrapper object, are nontheless still a part of the required interface for the wrapped object. # (the method #bind in particular may not longer be relevant, but this general idea still applies) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload!\n unload!\n versions\n get_json\n get_map\n last_updated\n third_party_links\n mappings\n end", "def reload!\n new_instance = instance(_id)\n update_instance_variables!(\n :public_addresses => new_instance.public_addresses,\n :private_addresses => new_instance.private_addresses,\n :state => new_instance.state\n )\n end", "def reload_classes_only_on_change=(_arg0); end", "def reload_classes_only_on_change=(_arg0); end", "def reload!\n Merb::BootLoader::ReloadClasses.reload\n end", "def reload!\n Merb::BootLoader::ReloadClasses.reload\n end", "def reload!\n reload_lock.write_sync do\n self.class.erase_dependencies!\n\n if File.extname(self.class.source_file) != \".ru\"\n self.class.erase! [self.class.source_file],\n [self.class.name.split(\"::\").last],\n self.class.namespace\n require self.class.source_file\n end\n\n @app = self.class.source_class.new @rack_app, @override_options\n end\n end", "def reload\n Merb::BootLoader::ReloadClasses.reload\n end", "def reload_classes_only_on_change; end", "def reload_classes_only_on_change; end", "def reload\n raise 'not implemented'\n end", "def reload_classes\n klasses = [:Inject]\n\n # unload classes\n Object.class_eval do\n klasses.each do |klass|\n remove_const klass.to_s if const_defined? klass.to_s\n end\n end\n\n # reload classes\n klasses.each do |klass|\n load \"#{klass.to_s.underscore}.rb\"\n end\n end", "def reload\n Config.object.inject_shortcuts self\n @trees.each(&:reload)\n end", "def reload(instance)\n raise NotImplementedError, 'Expected adapter to override `reload`'\n end", "def reload(filename = nil)\n warn = $VERBOSE\n $VERBOSE = nil\n files = Dir.glob('lib/seamless_cloning/**/*.rb')\n if filename\n file = files.find do |f|\n filename == File.basename(f)\n end\n load(file)\n else\n files.each { |f| load(f) }\n end\n nil\nensure\n $VERBOSE = warn\n true\nend", "def reload!\n @data = reload.raw\n self\n end", "def reload\n self.data = self.class.load_data\n self\n end", "def reloadModified(component_class=nil,only_if_singular=nil,import_call=false)\n unless @templateRTimes[component_class.to_s] > Time.now\n @templateRTimes[component_class.to_s] = Time.now + reload_interval\n pathlist = nil\n classname = component_class.to_s.split(ClassSeparator).last.to_s\n if (reload_scan_mode == Csingular and !classname.nil?)\n pathlist = [pathForName(component_class)].compact\n elsif (reload_scan_mode != Csingular and !only_if_singular)\n pathlist = search_proc(@docroot)\n end\n \n if pathlist\n if import_call\n reloadLoop(pathlist)\n else\n reloadLoop(pathlist)\n end\n end\n end\n end", "def reload!; end", "def reload!; end", "def reload!; end", "def reload!; end", "def reload_source_and_set_module\n raise LoaderError, \"Reload not implemented\"\n end", "def reload!\n load './lib/try-new-beers/beer_review.rb'\nend", "def reload!\n load force: true\n end", "def with_reloading &block\n Cove::Ext.use_reload\n block.call\n ensure\n Cove::Ext.use_require\n end", "def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end", "def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end", "def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end", "def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end" ]
[ "0.6332332", "0.62747407", "0.6272521", "0.6272521", "0.6235362", "0.6235362", "0.6232977", "0.6226022", "0.62136847", "0.62136847", "0.620844", "0.6189222", "0.6161927", "0.6157085", "0.6146739", "0.61433035", "0.60363024", "0.6024652", "0.5990847", "0.5990847", "0.5990847", "0.5990847", "0.59891933", "0.59852505", "0.5963526", "0.59443265", "0.5939288", "0.5939288", "0.5939288", "0.5939288" ]
0.7416939
0
Get current currency (for use in event cond. branch)
def get_current_currency $game_party.current_currency[:sym] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curr\n Currency.where('client_id = ? and default_currency = ?', current_user.client_id, \"t\").first.try(:currency_symbol)\n end", "def current_currency(checkout_obj)\n symbol = ExchangeRateService.currency_symbol_mappings[checkout_obj.currency.downcase.to_sym]\n { code: checkout_obj.currency, symbol: symbol }\n end", "def current_company_curr\n Currency.where('client_id = ? and default_currency = ?', current_subdomain, \"t\").first.try(:currency_symbol)\n end", "def currency\n 'usd'\n end", "def get_Currency()\n \t return @outputs[\"Currency\"]\n \tend", "def currency\n money.currency\n end", "def currency\n \"USD\"\n end", "def currency\n order.currency\n end", "def currency\n \"EUR\"\n end", "def currency\n\t\t\"USD\"\n\tend", "def currency\n if currency_id.blank?\n self.company.currency_code\n else\n Currency.find(currency_id).currency_code\n end\n end", "def currency_code\n h.e_system_currency\n end", "def currency\n nil\n end", "def currency\n nil\n end", "def currency\n @currency ||= 'AUD'\n end", "def currency\n @ipn['mc_currency']\n end", "def currency; end", "def currency; end", "def currency_code\n @currency_code\n end", "def currency_code\n data.currency_code\n end", "def preferred_currency\n Reji.configuration.currency\n end", "def currency\n params[\"Currency\"]\n end", "def currency\n return nil unless (extended_currency = read_attribute(:currency))\n encrypt_remove_pre_and_postfix(extended_currency, 'currency', 10)\n end", "def currency\n return nil unless (extended_currency = read_attribute(:currency))\n encrypt_remove_pre_and_postfix(extended_currency, 'currency', 10)\n end", "def currency\n params['currency']\n end", "def currency\n 'INR'\n end", "def currency\n 'INR'\n end", "def acc_currency\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.currency.to_s\n end", "def get_currency_name\n \"euro\"\n end", "def currency_unit\n @currency_unit\n end" ]
[ "0.7785002", "0.7755168", "0.77353585", "0.7626988", "0.76184523", "0.75700045", "0.74717844", "0.74617755", "0.7388218", "0.7387024", "0.7383762", "0.7307661", "0.7307138", "0.7307138", "0.7289657", "0.728093", "0.7278962", "0.7278962", "0.72668135", "0.7235496", "0.721979", "0.71725065", "0.70960194", "0.70960194", "0.7088047", "0.70633227", "0.7052511", "0.705098", "0.7044096", "0.70367247" ]
0.8154682
0
Overwrite Method; Draw Total Price
def draw_total_price width = contents_width - 8 draw_currency_value(@price * @number, @currency_unit, 4, price_y, width, @currency) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_price\n puts \"O PRECO TOTAL DE ORDER FOI CHAMADO\"\n self.line_items.to_a.sum{ |item| item.total_price}\n end", "def sub_total_price\n line_items.inject(0) {|sum, item| sum += item.price * item.qty }\n end", "def total_price\n self.line_items.each.sum {|li| li.total_price}\n end", "def get_total_price\n self.line_items.sum { |item| item.get_subtotal }\n end", "def total_price\n\t\tline_items.to_a.sum { |item| item.total_price }\n\tend", "def total_price\n\t\tline_items.to_a.sum{|item| item.total_price}\n\tend", "def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end", "def define_total_price\n self.total_price = self.quantity.to_f * (self.price.to_f + self.vat_amount.to_f )\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price}\n end", "def sub_total\n return ApplicationHelper.round_currency(self.line_items.inject(BigDecimal('0.0')) { |sum, li| sum + li.price })\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n # convert to array so it doesn't try to do sum on database directly\n @total = 0\n line_items.each do |item|\n @total = item.price\n end\n line_items.to_a.sum {|item| (item.quantity * item.price) }\n end", "def price\n total\n end", "def total\n sum = self.line_items.inject(BigDecimal('0.0')) { |sum, li| sum + li.price } +\n self.price_modifiers.inject(BigDecimal('0.0')) { |sum, pm| sum + pm.amount }\n return ApplicationHelper.round_currency(sum)\n end", "def total_price\n line_items.to_a.sum {|item| item.total_price}\n end", "def total\n total = 0\n @products.values.each do |price|\n total += price\n end\n total += (0.075 * total).round(2)\n end", "def total\n\t\tprices = line_items.map {|li| li.price}\n\t\tprices.reduce(0) {|it0, it1| it0+it1}\n\tend", "def total\n total_price = 0.0\n cart.line_items.each do |line_item|\n if !line_item.unit_price.blank?\n total_price += line_item.unit_price.to_f\n if line_item.line_item_options\n line_item.line_item_options.each do |line_item_option|\n total_price += line_item_option.price.to_f\n end\n end\n elsif line_item.menu_section_item\n total_price += line_item.menu_section_item.price.to_f\n if line_item.menu_item_options\n line_item.menu_item_options.each do |menu_item_option|\n total_price += menu_item_option.price.to_f\n end\n end\n else\n total_price += 0\n end\n end\n tax = total_price.to_f * 0.0825\n total_price = total_price + tax\n if tip\n total_price = total_price.to_f + tip.to_f\n end\n return total_price\n end", "def total\n conv_price_single * conv_quantity\n end", "def total_order\n total = 0.00 #initializing total\n @selected_prices.each do |cost| #for each selected item add the total cost\n total += cost\n end\n total\n end", "def line_total\n (@quantity * @price + line_item_sales_tax_total).round(2)\n end", "def total_price\n line_items.map { |line_item| line_item.item.price * line_item.quantity }.sum\n end", "def total_price\r\n\t\t@items.inject(0.0) { |sum, i| sum + i.total_unit_price * i.quantity }\r\n\tend", "def total\n total = 0\n line_items.each do |line_item|\n total += line_item.item.price * line_item.quantity\n end\n total\n end", "def total\n total = 0\n self.menu_items.each do |item|\n total += item.price\n end\n \"$#{total}\"\n end", "def total_price\n\t\tproduct.price * quantity\n\tend", "def total\n return @total_price \n end" ]
[ "0.7498781", "0.7433152", "0.740586", "0.73571366", "0.73524135", "0.7317448", "0.7297184", "0.72935206", "0.72562724", "0.7255841", "0.7200599", "0.7200599", "0.7200599", "0.7200599", "0.71997726", "0.7189589", "0.7145178", "0.7131362", "0.71303993", "0.71294355", "0.7116583", "0.7081433", "0.7079745", "0.70303077", "0.70243895", "0.70063365", "0.70030975", "0.6991032", "0.69892216", "0.6987378" ]
0.864281
0
Resets left or right generator based on internal state.
def reset_main_generator @main_generator = if @right_generator.length > @left_generator.length @right_generator else @left_generator end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @left_generator.reset\n @right_generator.reset\n\n nil\n end", "def reset\n\t\tself.rs \t= 0\n\t\tself.ps \t= 0\n\t\tself.ss \t= 0\n\t\tself.gen\t= Random.new(SEED)\n\tend", "def reset()\n @rand_count = 0\n @sideup = nil\n end", "def reset\n\t\tself.gen = Random.new(SEED)\n\tend", "def reset\n\t\tself.gen = Random.new(SEED)\n\tend", "def reset\n @perms = []\n @depends = []\n @next_blocks = []\n @clobbers = []\n @offset = nil\n @state = nil\n @once = false\n @references = 0\n @used_references = 0\n @generated = false\n end", "def reset\n @current = nil\n @pos = 0\n end", "def reset\n @blocks = @original_blocks\n end", "def reset_state\n @state = nil\n end", "def reset\n\t\t@r = 0\n\t\t@p = 0\n\t\t@t = 0\n\t\t@l = 0\n\t\t@s = 0\n\tend", "def reset\n @source.each_value(&:reset)\n nil\n end", "def reset\n @position = 0\n @rotor_array = @reset_rotor.dup\n end", "def reset!\n @blocks = []\n @single_block = []\n end", "def initialize(left_generator_or_options, right_generator_or_options) # rubocop:disable Lint/MissingSuper\n @left_generator = OCG.prepare_generator left_generator_or_options\n @right_generator = OCG.prepare_generator right_generator_or_options\n\n reset\n end", "def reset\n @pointer = 0\n self\n end", "def reset\n each(&:reset)\n self\n end", "def reset\r\n @v_n_1 = @v_n_2 = 0\r\n end", "def reset\n self.x, self.y, self.o = self.sequence.first\n end", "def reset\n @rotor_array = @reset_rotor.dup\n end", "def internal_reset(initial_value); end", "def do_reset\n\t\t\n\t\t\t# Mark state as reset\n\t\t\t@reset = true\n\t\t\t\n\t\t\t# Revert text and palette\n\t\t\tself.text = nil \n\t\t\tself.palette = @palette_normal\t\t\t\n\t\tend", "def reset\n dup.reset!\n end", "def reset\n @cursor = Point.new(0, 0)\n @delta = Point.new(0, 1)\n @stores = Code::FINAL_CONSONANTS.times.map do |consonant|\n case consonant\n when 21 then Queue.new # ㅇ\n when 27 then Port.new # ㅎ\n else Stack.new\n end\n end\n @selected_store = @stores[0]\n @finished = false\n end", "def reset\n clear\n @position = 0\n @current_index = 0\n end", "def reset() end", "def reset\n @assigned = false\n end", "def reset\n clear\n CONNECTION_TYPES.map { |ct| connections.send(ct) }.each do |conn_group|\n conn_group.each_value { |conn| conn.weight = rand * 0.2 - 0.1 }\n end\n\n @bias = rand * 0.2 - 0.1\n @old = @state = @activation = 0\n end", "def clearState()\n\t\t\t@_previous_state = @_state\n\t\t\t@_state = nil\n\t\tend", "def reset()\n #This is a stub, used for indexing\n end", "def reset()\n #This is a stub, used for indexing\n end" ]
[ "0.8471291", "0.68176115", "0.66692066", "0.6434911", "0.6434911", "0.6430289", "0.63532746", "0.63394326", "0.6302699", "0.62748617", "0.6183007", "0.6127471", "0.6112817", "0.61115694", "0.6096389", "0.6049628", "0.6047095", "0.6025806", "0.6020039", "0.60028344", "0.597796", "0.5934994", "0.59326", "0.59024197", "0.586263", "0.5862468", "0.58608437", "0.5854583", "0.582636", "0.582636" ]
0.770566
1